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

HorizontalBarChart - Right axis label starts with the highest value up to the same value #3235

Closed
jojonarte opened this issue Feb 2, 2018 · 1 comment

Comments

@jojonarte
Copy link

jojonarte commented Feb 2, 2018

As you could see on the screenshot below the rightaxis labels start with 6 then up to 6.
screen shot 2018-02-02 at 5 53 53 pm

Code used:

func prepareHorizontalBarChart() {
       horizontalBarChart.drawBarShadowEnabled = false
       horizontalBarChart.drawValueAboveBarEnabled = true
       
       var entries = [BarChartDataEntry]()
       
       let bar1 = BarChartDataEntry(x: Double(0), y: Double(4))
       entries.append(bar1)
       
       let bar2 = BarChartDataEntry(x: Double(1), y: Double(6))
       entries.append(bar2)
       
       let bar3 = BarChartDataEntry(x: Double(2), y: Double(2))
       entries.append(bar3)
       
       let set1 = BarChartDataSet(values: entries, label: "test")
       set1.drawIconsEnabled = false
       
       
       set1.colors = [UIColor.purple, UIColor.magenta, UIColor.red ]
       
       let data = BarChartData(dataSet: set1)
       data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 10))
       data.barWidth = 0.2
       
       horizontalBarChart.zoomOut()
       horizontalBarChart.fitBars = true
       horizontalBarChart.data = data
       
       horizontalBarChart.xAxis.drawGridLinesEnabled = false // disable horizontal grid lines
       horizontalBarChart.xAxis.enabled = false
       horizontalBarChart.chartDescription?.enabled = false
       
       
       horizontalBarChart.leftAxis.enabled = true
       horizontalBarChart.xAxis.drawAxisLineEnabled = true
       horizontalBarChart.xAxis.drawLabelsEnabled = true
       
       horizontalBarChart.minOffset = 0
       horizontalBarChart.legend.enabled = true
       horizontalBarChart.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
       
   }
@jojonarte jojonarte changed the title Right axis label starts with the highest value up to the same value HorizontalBarChart - Right axis label starts with the highest value up to the same value Feb 2, 2018
@jojonarte
Copy link
Author

Fixed with horizontalBarChart.leftAxis.axisMinimum = 0

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

1 participant