Handling Duplicate Datapoints (Android Chart)


Is there a suggested way to handle (ignore) datapoint values?  Sometimes our data has the same X value, and we’re happy to just ignore it, but ShinobiControls throws an exception.  We could add a variable to store the last X value and not add it if it matches the new value, but I was wondering if there was a better way?

Here’s the stack trace:

07:59 E/com.coherent: java.lang.IllegalStateException: Ordinates of stacked series must increase at each point
07:59 E/com.coherent:     at com.shinobicontrols.charts.dc.a(SourceFile:145)
07:59 E/com.coherent:     at com.shinobicontrols.charts.bh.b(SourceFile:213)
07:59 E/com.coherent:     at com.shinobicontrols.charts.bh.a(SourceFile:35)
07:59 E/com.coherent:     at com.shinobicontrols.charts.cr.a(SourceFile:69)
07:59 E/com.coherent:     at com.shinobicontrols.charts.x.onDrawFrame(SourceFile:95)
07:59 E/com.coherent:     at com.shinobicontrols.charts.GLTextureView$f.l(SourceFile:896)
07:59 E/com.coherent:     at com.shinobicontrols.charts.GLTextureView$f.run(SourceFile:620)


Hi. Thanks for getting in touch.

As you have seen, duplicate ordinals in DataPoints are not permitted when one sets a stackId on a series. Whilst we generally make no restrictions on duplicate DataPoint values, it is necessary for the principle of stacked series. We have not exposed any way in which we can filter any duplicate data values, we have placed that responsibility on to the user. To overcome this issue a suggestion would be to strip out duplicate data values at the earliest opportunity. This might be at the point of generating the data itself but of course you may have no control over your data, especially if it is coming from an external source. In this case you might like to implement your own DataAdapter, and add some custom logic which filters out duplicate data values before the creation and addition of DataPoints.

I hope this helps, thanks,



Thanks, Kai.  That was it.  I tried to mark your answer as the solution but I’m not sure that worked.


Glad to hear you got it sorted!

Kind regards,