How to set max point in axisX SChartTickMark


#1

Hey there!

I want to fix max point for axisX’s shinobichart.

axisX is auto show SChartTickMark title label when i fill data: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13

But i want to fix number axisX max point always is 6 point: 1, 3, 5, 7, 9, 10 or 3, 5, 8, 10, 11, 13

How to fix it? Please help me resolve this issue. Thanks all!

And then, this is my screenshot and my sourecode:

shinobichart

SChartDataPoint *dataPointMin = [self.timeSeries objectAtIndex:0];
    SChartDataPoint *dataPointMax = [self.timeSeries objectAtIndex:self.timeSeries.count-1];
    SChartDateRange *range = [[SChartDateRange alloc] initWithDateMinimum:dataPointMin.xValue andDateMaximum:dataPointMax.xValue];
    SChartDateTimeAxis *xAxis = [[SChartDateTimeAxis alloc] initWithRange:range];
    NSDateFormatter *dayFormatter = [[NSDateFormatter alloc] init];
    if (self.optionDataChartType == ChartAWeekButtonTag) {
        [dayFormatter setDateFormat:@"d"];
    } else {
        [dayFormatter setDateFormat:@"d/M"];
    }
    SChartTickLabelFormatter *formatter = [SChartTickLabelFormatter dateFormatter];
    [formatter setFormatter:dayFormatter];
    xAxis.labelFormatter = formatter;
    
    xAxis.rangePaddingLow = [SChartDateFrequency dateFrequencyWithDay:1];
    xAxis.rangePaddingHigh = [SChartDateFrequency dateFrequencyWithDay:1];
    self.chart.xAxis = xAxis;

#2

Hi - you should be able to do this by setting the majorTickFrequency to 6, which will cause a tick label to be shown every 6 values along the axis. To adjust the start point, you can set the anchorPoint property to offset this - let us know if this does the trick!