Nil y-values


I have a SChartLineseries chart with SChartDateTimeAxis as x-axis - and SChartNumberAxis as y-axis.

I would like to show holes/gaps in the series - if there are missing y values. So the x-axis should be a regular linear time axis - but y values for certain dates might be missing. Those points should not be connected by lines. They should leave gaps in the plot.

I looked at setting the datapoint y value to nil/NULL - but that did not work. And I could not find a way to hide the datapoint either.

What am I missing?


Hi 925dk, 

Line series always join up their points., so to create the effect you are talking about you would need to use multiple line series with the same style. This would create the effect of a single discontinuous series.

You could then set all but one series’ showInLegend property to NO, so that you don’t have multiple legend entries for your pseudo-single series.


EDIT: Added a bit more information
EDIT: This feature is now available in version 2.7.0. See the following blog post for more information:


Any update on this feature?


Any updates?


I have come across a need for this feature also for both iOS and Android. I am displaying a line series that shows data from external sensors. These sensors tend to be unreliable at times and will have drop outs in the data.

Over say a 6 to 10 hour period of time there could be a 100s of these dropouts so using multiple line series with the same style mentioned above doesn’t seem reasonable. It also makes the code more complex when handling user interaction events with the chart. 

So, add my vote for implementing this feature. Thanks…


Upvoting for Android as well. I guess this is what we’re after, and doing it with three line series is just wastefull. 


Now implemented for iOS in v. 2.7.



I followed the tutorial

I followed the exact steps to create a discontinuous line, but even though the datapoint.yValue logs the proper values inside the

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

it doesn’t plot it in the graph. I am using 2.7.0-5 in iOS.

The data points are (x=0,y=5),(x=2,y=nil), (x=3,y=5),(x=4,y=nil) …
Series is SChartLineSeries

Any help would be really appreciated.



Hi theranji,

Can I verify your issue is that a line doesn’t draw when you add the datapoints you described?

If so, this is due to needing atleast two points without nil Y-values to render a line. Due to having datapoint’s with nil Y-values between your datapoints the first point has no second point to draw too as nil valued datapoints get ignored.

If this is not the case, could you please clarify your issue?

Perhaps adding images of what your chart is currently drawing and what you want it draw.

This would really help me identify the source of your issue.

Kind regards,
Andrew Polkinghorn


Hi Andrew,

Thanks for the reply. Yes those were the data points I used.

Ok so the data points needs to be like { (1,5), (2,5), (3,nil), (4,5), (5,5), (6,nil)}

I thought if data points were given as in my previous post the nil Y values are skipped, but the rest of the points get drawn. If I needed that then the graoh type should not have been a line graph I guess. My bad for getting things mixed up.

Thanks again this resolved my issue.


Hi TheRanji,

The reason you’re not seeing a line is because you’re only supplying a single datapoint between each discontinuation. For a line to draw you must supply at least two points for each segmented of the line.

Jan Akerman


Hi, I didnt quite understand the examples. I checked the sampel link where the value is set to nil but in my code I am unable to set the yValue to nil . Please let me know if there is a way to ignore the 0 values in a line series keeping the x-axis dates in tact


Still no news for Android? even with the “parity” achieved between the platforms?


Looks like it is also supported, but

  • Android: requires to use a Float.NaN, null value causing crash
  • iOS: requires to use a null for iOS, NaN causing a crash

Cross platform developement is not so easy ^^


Hi Guillaume,

At present  shinobicharts for Android doesn’t support DiscontinuousLineSeries. The current way to achieve this is to use separate LineSeries for each segment of the line.

I wasn’t aware that Float.NaN would achieve a similar effect to DiscontinuousLineSeries but did just try it and while it did break up the line it didn’t seem consistent and this certainly wasn’t by design!

We are still very much aiming to include this functionality in the library and will make a note of your interest in it. The more a feature is requested the higher we will prioritise it. Unfortunately though I can’t give you any specific timescale for its release.

Kind regards,



Looks like points with nil y-values are impacking the DataRange returned by an axis.
Tested with an SChartNumberAxis and a data source containing data point with either 7.65f as Y value or null:

  • axis.DataRange is returning [0 … 7.65] where Y values are mixed between 7.65f and null
  • axis.DataRange is returning [7.15 … 8.15] when there is no null Y value and only 7.65f as Y value.


Hi ggirard,

I’m afraid I don’t quite understand - I assume you are referring to iOS charts using Xamarin?

Would you mind copying your datasource method where you are returning these data points?