1

I want the dates on the X-axis to follow without missing dates (i.e. 1, 2, 3, 4, and so on). When I know exactly how many columns there will be in the chart, I can solve the problem by calling setScaleMinima(_:scaleY:):

But when I have a large number of dates, with the same scale minima, the dates start to be grouped:

How can I make do that, regardless of the number of dates, all numbers without grouping are displayed on the X axis?

RareScrap
  • 541
  • 1
  • 7
  • 17

1 Answers1

-1

You can use setVisibleXRangeMinimum(minXRange:) and setVisibleXRangeMaximum(maxXRange:) to set the minimum and maximum number of chart columns. But these methods will only take effect if there is data in the chart (thx to this answer), so for convenience I call them every time the data changes:

public class MyChartView: BarChartView {
    
    override public var data: ChartData? {
        didSet {
            self.setVisibleXRangeMinimum(2.0)
            self.setVisibleXRangeMaximum(8.0)
        }
    }
}
RareScrap
  • 541
  • 1
  • 7
  • 17