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

guoyutaog picture guoyutaog  Â·  3Comments

sjdevlin picture sjdevlin  Â·  3Comments

brytnvmg picture brytnvmg  Â·  4Comments

coop44483 picture coop44483  Â·  3Comments

newbiebie picture newbiebie  Â·  3Comments