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

BarChart bottom space when having a small value #4198

Closed
nastasiupta opened this issue Oct 28, 2019 · 1 comment
Closed

BarChart bottom space when having a small value #4198

nastasiupta opened this issue Oct 28, 2019 · 1 comment

Comments

@nastasiupta
Copy link

[*] I've read, understood, and done my best to follow the *CONTRIBUTING guidelines.

What did you do?

I just configured BarChartView with basic data as following:

` var dataEntries: [BarChartDataEntry] = []

    let values: [Double] = [50.0, 100.0, 123.0, 313.0, 104.0, 180.0]
    for i in 0 ..< values.count {
        let dataEntry = BarChartDataEntry(x: Double(i), y: Double(values[i]))
        dataEntries.append(dataEntry)
    }
    
    let chartDataSet = BarChartDataSet(entries: dataEntries)
    chartDataSet.colors = [UIColor(red: 55.0/255.0, green: 148.0/255.0, blue: 252.0/255.0, alpha: 1.0)]
    let chartData = BarChartData(dataSet: chartDataSet)
    barChartView?.xAxis.labelPosition = .bottom
    barChartView?.xAxis.valueFormatter = axisFormatDelegate
    barChartView?.xAxis.labelTextColor = Color.main.color
    barChartView?.xAxis.labelFont = AppFonts.regular.font.withSize(7)
    barChartView?.xAxis.gridColor = UIColor(red: 224.0/255.0, green: 231.0/255.0, blue: 255.0/255.0, alpha: 1.0)
    barChartView?.leftAxis.labelTextColor = Color.main.color
    barChartView?.leftAxis.labelFont = AppFonts.regular.font.withSize(9)
    barChartView?.leftAxis.gridColor = UIColor(red: 224.0/255.0, green: 231.0/255.0, blue: 255.0/255.0, alpha: 1.0)
    barChartView?.rightAxis.enabled = false
    barChartView?.legend.enabled = false
    barChartView?.data = chartData
    barChartView?.isUserInteractionEnabled = false`

What did you expect to happen?

To see the chart but having the BarChart starting from XAxis

What happened instead?

I have a some space on the bottom
Screenshot 2019-10-28 at 16 20 27

But if I try with bigger values, it works properly:
Screenshot 2019-10-28 at 16 24 05

Charts Environment

Charts version/Branch/Commit Number: 3.4.0
Xcode version: 11.1 (11A1027)
Swift version: 5.0
Platform(s) running Charts: iPhone X iOS 13.1
macOS version running Xcode: macOS Catalina 10.15

@liuxuan30
Copy link
Member

set axis min.

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

2 participants