Charts: What is the replacement for xVals for BarChartData? in swift 3.0

Created on 10 Nov 2016  路  4Comments  路  Source: danielgindi/Charts

BarChartData(xVals: dataPoints, dataSet: chartDataSet)

Most helpful comment

let labels = ["Label 1", "Label 2"]
chartView.xAxis.valueFormatter = DefaultAxisValueFormatter {
    return labels[Int($0)]
}

All 4 comments

found the way thanks

@Aungbandlab what is the way?

let labels = ["Label 1", "Label 2"]
chartView.xAxis.valueFormatter = DefaultAxisValueFormatter {
    return labels[Int($0)]
}

@fnk0

// MARK: axisFormatDelegate
extension StackBarChartCell: IValueFormatter {

func stringForValue(_ value: Double,
                    entry: ChartDataEntry,
                    dataSetIndex: Int,
                    viewPortHandler: ViewPortHandler?) -> String {
    return String(format: "%.0f", value)
}

}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

valeIT picture valeIT  路  3Comments

kirti0525 picture kirti0525  路  3Comments

Shunshine07 picture Shunshine07  路  3Comments

brytnvmg picture brytnvmg  路  4Comments

sjdevlin picture sjdevlin  路  3Comments