You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to understand how I can use an array populated with dates on the xAxis, but I haven't figured it out yet.
Below is my code for the setChart function. On the last row I use the dataPoints provided on the function bt they cannot be casted as IAxisValueFormatter.
If I remove this line the app works but returns the bar chart with 0 - 6 enumeration based on the for clause.
func setChart(dataPoints: [String], values: [Int]) {
barChartView.noDataText = "You need to run some tests first to use the charts"
var dataEntries: [BarChartDataEntry] = []
for i in 0..<dataPoints.count {
let dataEntry = BarChartDataEntry(x: Double(i), y: Double(values[i]))
dataEntries.append(dataEntry)
}
let chartDataSet = BarChartDataSet(values: dataEntries, label: "Hyper")
let chartData = BarChartData(dataSet: chartDataSet)
let xAxis = barChartView.xAxis
xAxis.labelWidth = 5
barChartView.data = chartData
barChartView.xAxis.labelPosition = .bottom
barChartView.chartDescription?.text = "Hyper Diagram"
barChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
barChartView.xAxis.valueFormatter = dataPoints as! IAxisValueFormatter //This returns error
}
Thank you!
The text was updated successfully, but these errors were encountered:
I am trying to understand how I can use an array populated with dates on the xAxis, but I haven't figured it out yet.
Below is my code for the setChart function. On the last row I use the dataPoints provided on the function bt they cannot be casted as IAxisValueFormatter.
If I remove this line the app works but returns the bar chart with 0 - 6 enumeration based on the for clause.
Thank you!
The text was updated successfully, but these errors were encountered: