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

dtogias picture dtogias  路  23Comments

zxy198717 picture zxy198717  路  33Comments

klanderson picture klanderson  路  35Comments

steprescott picture steprescott  路  51Comments

ajimenezjulio picture ajimenezjulio  路  33Comments