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

In BarChartView leftAxis labels cutdown, does-not fit on screen. #2086

Closed
ghost opened this issue Jan 17, 2017 · 1 comment
Closed

In BarChartView leftAxis labels cutdown, does-not fit on screen. #2086

ghost opened this issue Jan 17, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 17, 2017

In below Bar-Chart my left-axis values are cutdown. How do I resolve this issue.

In X-axis I want to show values like this. i.e 1,3,5,7,9,11...

SetChart function :-

func setChart(dataPoints: [String], values: [Float])
{
barChartView.noDataText = "You need to provide data for the chart."

    for i in 0..<dataPoints.count
    {
        let dataEntry = BarChartDataEntry(x: Double(i), yValues: [Double(Float(values[i]).round(decimalPlace: 2))])
        dataEntries.append(dataEntry)
    }
    
    let chartDataSet = BarChartDataSet(values: dataEntries, label: "INR Rates(₹)/$")
    let chartData = BarChartData(dataSet: chartDataSet)
    
    barChartView.data = chartData
    barChartView.leftAxis.axisMinimum = 67
    barChartView.leftAxis.axisMaximum = 70
    barChartView.xAxis.labelPosition = .bottom
    barChartView.rightAxis.enabled = false
    barChartView.data?.setDrawValues(false)
    barChartView.leftAxis.granularityEnabled = true
    barChartView.leftAxis.granularity = 1.0
    barChartView.chartDescription?.text = ""
    chartDataSet.colors = [UIColor(red: 0/255, green: 76/255, blue: 153/255, alpha: 1)]
}

img_4208

@ghost ghost closed this as completed Jan 17, 2017
@ghost ghost reopened this Jan 17, 2017
@liuxuan30
Copy link
Member

put barChartView.data = chartData at last line.

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