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

shayneptorres picture shayneptorres  ·  4Comments

sjdevlin picture sjdevlin  ·  3Comments

newbiebie picture newbiebie  ·  3Comments