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 have created one IAxisValueFormatter which returns xAxis label value as string.
Chart is being displayed and xAxis labels are also being displayed using the formatter which i have created. Once chart is displayed, when I am zooming in the line chart and stack bar chart till all xAxsis labels are visible and change device orientation from portrait to landscape app crashes and gives me error index out of range
My XAxisValueFormatter
// Stores xAxis labels
var xAxisLabels = [String]()
public class XAxisValueFormatter: NSObject, IAxisValueFormatter {
private let dateFormatter = DateFormatter()
public func stringForValue(_ value: Double, axis: AxisBase?) -> String {
return xAxisLabels[Int(value)] // error
}
}
What did you expect to happen?
After zooming in line and stack bar chart till all its xAxis labels are visible and change device orientation from portrait to landscape chart should be displayed in landscape mode.
What happened instead?
App is crashing and gives me error on the below line
" return xAxisLabels[Int(value)] "
Solution
Need help or suggest me other IAxisValueFormatter which can be used to display xAxis label value as string
The text was updated successfully, but these errors were encountered:
What did you do?
I have created one IAxisValueFormatter which returns xAxis label value as string.
Chart is being displayed and xAxis labels are also being displayed using the formatter which i have created. Once chart is displayed, when I am zooming in the line chart and stack bar chart till all xAxsis labels are visible and change device orientation from portrait to landscape app crashes and gives me error index out of range
My XAxisValueFormatter
What did you expect to happen?
After zooming in line and stack bar chart till all its xAxis labels are visible and change device orientation from portrait to landscape chart should be displayed in landscape mode.
What happened instead?
App is crashing and gives me error on the below line
" return xAxisLabels[Int(value)] "
Solution
Need help or suggest me other IAxisValueFormatter which can be used to display xAxis label value as string
The text was updated successfully, but these errors were encountered: