Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates x-axis labels are plotted separately in graph? #2549

Closed
SamSundar1 opened this issue Jun 22, 2017 · 5 comments
Closed

Duplicates x-axis labels are plotted separately in graph? #2549

SamSundar1 opened this issue Jun 22, 2017 · 5 comments

Comments

@SamSundar1
Copy link

SamSundar1 commented Jun 22, 2017

screen shot 2017-06-22 at 1 37 18 pm

I have a issue while plotting the graph.The Xaxis values are plotted separately for same date. How can i merge same date into one so that values for same dates are plotted in same line in graph. I can i overcome the problem as shown in the figure above. I using chart version 2. Can i solve this issue in this version rather than updating to version 3???
@liuxuan30
Copy link
Member

you just check where the label starts repeat and take a look at how granularity is implemented.

@SamSundar1
Copy link
Author

can you provide some demo?please

@liuxuan30
Copy link
Member

it's in ChartsDemo, you can try zoom and change granularity

@SamSundar1
Copy link
Author

SamSundar1 commented Jul 6, 2017

@liuxuan30
Please tell me.
What can i do beside this??

func setChart(dataPoints: [String], values: [Double])
{
    lineChartView.noDataText = "You need to provide a dataFor linechart"
    lineChartView.legend.enabled = true
    lineChartView.descriptionText = ""
    lineChartView.leftAxis.granularity = 1
    lineChartView.leftAxis.axisMinValue =  0
    lineChartView.rightAxis.axisMinValue = 0
    lineChartView.doubleTapToZoomEnabled = false
    var dataEntries : [ChartDataEntry] = [ChartDataEntry]()
    for i in 0..<dataPoints.count{
        dataEntries.append(ChartDataEntry(value: values[i], xIndex: i))
        
    }
    let set1: LineChartDataSet = LineChartDataSet(yVals: dataEntries, label: "Done Dates")
    
    var dataSets : [LineChartDataSet] = [LineChartDataSet]()
    dataSets.append(set1)
    let data: LineChartData = LineChartData(xVals: dataPoints, dataSets: dataSets)
    data.setValueTextColor(UIColor.whiteColor())
    //5 - finally set our data
    set1.circleRadius = 6.0
    set1.fillColor = UIColor.redColor()
    lineChartView.data = data
    lineChartView.xAxis.labelPosition = .Bottom
    lineChartView.setVisibleXRangeMaximum(2)
}

@thierryH91200
Copy link
Contributor

update to v3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants