Search code examples
iosswiftios-charts

Y-axis is repeating values - iOS Charts


In the iOS Chart Framework the y-values in the chart are repeating. As shown in the picture below there are multiple 0's and 1's in the chart.enter image description here Is there anyway I can customize this chart so there aren't any repeating y-values. So in this scenario ideally the y-values should be 1,2,3,4,5. I just don't want the y-values to repeat itself.


Solution

  • you could also try:

    /// When true, axis labels are controlled by the `granularity` property.
    /// When false, axis values could possibly be repeated.
    /// This could happen if two adjacent axis values are rounded to same value.
    /// If using granularity this could be avoided by having fewer axis values visible.
    public var granularityEnabled = false
    

    and set yAxis.granularity = some value