Retain nil values for the y-axis


I have a requirement , where the x-axis needs to display the days of the week , and the y-axis display steps covered during each day . My issue is currently when  I use the below code , the x-axis customizes itself . For eg , suppose I did not have any steps value on Jan 12th , then the x-axis does not display Jan 12th as the date at all . It basically skips the x and y axis values for any day where the reading is not present

The correct behavior would however be that , even though the y axis does not have value for a particular day the x-axis should still show the day. So in the above case the x-axis should display the day corresponding to Jan 12th on the x-axis and the y axis will not have any value. Also since I am using line series , whenever a value on the y-axis is missing it should include that inside the line 

I referred to the below post link : , but setting nil values on the y-axis was returning error :


My code is as follows :


    SChartCategoryAxis *xAxis = [[SChartCategoryAxisalloc] init];

    xAxis.rangePaddingHigh = @(0.5);

    xAxis.rangePaddingLow = @(0.5); = YES;

    _shinobiChart.xAxis = xAxis;


    SChartAxis *yAxis = [[SChartNumberAxisalloc] init];

    yAxis.rangePaddingHigh = @1.0;

    _shinobiChart.yAxis = yAxis;


    SChartNumberRange *rangeY=[[SChartNumberRangealloc]initWithMinimum:minY.intValue<=19 ? @(0) : [NSNumbernumberWithInt:minY.intValue-20] andMaximum:[NSNumbernumberWithInt:maxY.intValue+20]];

    SChartNumberAxis *YAxis = [[SChartNumberAxisalloc] initWithRange:rangeY];

    _shinobiChart.yAxis = YAxis;;

   Under a specific condition I populate the datapoint value 0 

    SChartDataPoint* datapoint = [selfdataPointForValue:[NSNumbernumberWithInt:dayNumber] andValue: [NSNumber     numberWithFloat:day.weightAppType.floatValue]];

datapoint.xValue = weekday;


if (specific condition)

datapoint.yValue = nil //So that the x-axis is present but y-axis is nil . however this steps fails. Is there a working solution for me to plot nil values on the y-axis to enable a proper line series 


The DiscontinousDateTimeAxis does exactly what you need. Unless you specifically exclude the dates for you nil y values, the xAxis will show those dates as well.

[ShinobiChartalloc] initWithFrame:frame withPrimaryXAxisType:SChartAxisTypeDiscontinuousDateTimewithPrimaryYAxisType:SChartAxisTypeNumber];
 Take a look at the TimeSeriesChart demo project included in the ShinobiCharts package.


Thank you for your response. If I use "SChartAxisTypeDiscontinuousDateTime" my app crashes saying continuos date time is supported only for premium account. If with my current subscription I need to get this concept working is there any other XaxisType that will work ?

I tried using the below initialization , but it didnt work. For the days that I did not have any reading , the y-axis value is taken as 0 and the line graph is connected to that 0

-[[ShinobiChartalloc] initWithFrame:CGRectInset(scrollView_graph.bounds, margin, margin) withPrimaryXAxisType:SChartAxisTypeDateTimewithPrimaryYAxisType:SChartAxisTypeNumber];


Another observation , if I use the bar chat then a y-axis value of 0 is not plotted and the date is retained in the x-axis. Is there anyway to do this using a line chart ?.

 I also tried following the example here - but  I still get the nil point exception 

  • (id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex


    SChartDataPoint *dataPoint= _arr_weight[dataIndex];

    if ([dataPoint.yValueintValue] == 0 ) { //criteria to set the nil value

       dataPoint.yValue = nil;


    return dataPoint;