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

Blank space should not exist in BarChartView #4157

Closed
1 task done
anchar opened this issue Sep 25, 2019 · 1 comment
Closed
1 task done

Blank space should not exist in BarChartView #4157

anchar opened this issue Sep 25, 2019 · 1 comment

Comments

@anchar
Copy link

anchar commented Sep 25, 2019

What did you do?

I create two BarChartView in a storyboard with configure them. But will a blank appear at the bottom of the chart.

        barChartView.drawGridBackgroundEnabled = false 
        barChartView.drawBordersEnabled = false 
        barChartView.drawMarkers = false
        
        
        //barChartView.legend.form = .none
        barChartView.legend.horizontalAlignment = .center
        barChartView.legend.font = UIFont(name: "PingFangSC-Regular", size: 12) ?? UIFont.systemFont(ofSize: 12)
        barChartView.legend.textColor = UIColor("#6C6C6C")
        barChartView.legend.formSize = 0
        barChartView.legend.formToTextSpace = 0
        
        barChartView.xAxis.labelPosition = .bottom
        barChartView.xAxis.drawGridLinesEnabled = false
        //barChartView.xAxis.enabled = false
        
        barChartView.leftAxis.enabled = false
        barChartView.rightAxis.enabled = false
        
        if let noDataFont = UIFont(name: "PingFangSC-Regular", size: 15) {
            barChartView.noDataFont = noDataFont
        }
        barChartView.noDataTextColor = UIColor("#6C6C6C")
        barChartView.noDataTextAlignment = .center
        var dataEntries = [BarChartDataEntry]()
        for i in 0..<3 {
            let entry = BarChartDataEntry(x: Double(i), y: Double(i))
            dataEntries.append(entry)}
        barChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: [])
       
        let chartDataSet = BarChartDataSet(entries: dataEntries, label: text)
        chartDataSet.colors = [.red, . blue, .green]
        chartDataSet.valueColors = chartDataSet.colors
        chartDataSet.valueFont = UIFont(name: "PingFangSC-Regular", size: 10) ?? UIFont.systemFont(ofSize: 10)
        
        let chartData = BarChartData(dataSets: [chartDataSet])
        chartData.barWidth = 0.5
        
        barChartView.data = chartData

What did you expect to happen?

1569388127478

What happened instead?

If y of BarChartDataEntry is 0
WX20190925-115340

Charts Environment

**Charts version/Branch/Commit Number: iOS-Charts 3.3.0
**Xcode version: Xcode 10.3
**Swift version: Swift 4.3
**Platform(s) running Charts: iOS 12.4.6
**macOS version running Xcode: macOS Mojave 10.14.6

Demo Project

@anchar
Copy link
Author

anchar commented Sep 25, 2019

This question need set barChartView.leftAxis.axisMinimum and barChartView.leftAxis.axisMaximum.

barChartView.leftAxis.axisMinimum = 0
barChartView.leftAxis.axisMaximum = 100

Please read issue#3650.

@anchar anchar closed this as completed Sep 25, 2019
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