We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What I got:
The x-axis is not displaying all the labels in the chart. It should display all the month labels. Here is my code:
let chart = LineChartView(frame: .zero) chart.setExtraOffsets(left: 20, top: 15, right: 20, bottom: 15) chart.drawGridBackgroundEnabled = true chart.gridBackgroundColor = .clear chart.backgroundColor = .clear chart.chartDescription = nil chart.highlightPerTapEnabled = false chart.isUserInteractionEnabled = false chart.rightAxis.enabled = false chart.legend.enabled = false let yAxis = chart.leftAxis yAxis.gridColor = UIColor(hexString: "C7C7C7")! yAxis.drawAxisLineEnabled = false yAxis.drawLabelsEnabled = false yAxis.axisMaximum = 6000 yAxis.gridLineWidth = 1 yAxis.enabled = true let xAxisLabels = ["Jan", "Feb", "Mar", "April", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] chart.xAxis.valueFormatter = IndexAxisValueFormatter(values: xAxisLabels) chart.xAxis.labelFont = UIFont.sourceSansProSemibold(withSize: 15.5) chart.xAxis.labelTextColor = UIColor(hexString: "808080")! chart.xAxis.drawGridLinesEnabled = false chart.xAxis.drawAxisLineEnabled = false chart.xAxis.drawLabelsEnabled = true chart.xAxis.labelPosition = .bottom chart.xAxis.enabled = true chart.xAxis.granularityEnabled = true chart.xAxis.granularity = 1 chart.xAxis.wordWrapEnabled = true
Can somebody point out what I'm doing wrong? Thanks!
The text was updated successfully, but these errors were encountered:
Solved it by adding this line:
chart.xAxis.setLabelCount(xAxisLabels.count, force: true)
Sorry, something went wrong.
No branches or pull requests
What I got:
The x-axis is not displaying all the labels in the chart. It should display all the month labels. Here is my code:
Can somebody point out what I'm doing wrong? Thanks!
The text was updated successfully, but these errors were encountered: