Pre loader

Unable to remove data points from line chart


Hey everyone,

Im using scichart in a data intensive application and have hit a problem that I haven’t been able to find a solution to.

The scope for feature is that the chart must be able to render a real time list of data points (double & timestamp) as they come in from a web service. However the chart must also be able to filter to show points that ocurred in a configurable window eg. all points within the last 5 minutes or 15 minutes or no filter.

I have business logic which generates the list of points the chart should show for the desired window. I also have an adapter that generates a diff of the old data aginst the new data to dispatch commands to the XyDataSeries.

The diff generates add, remove and update patches which the adapter applies to the XyDataSeries in the following form:
Add -> append() if data is at end of series, insertAt otherwise
Remove -> removeAt()
Update -> updateAt()

This is where I hit a problem. The removes do not happen, the only command that I can see modifying the chart is the append. I’ve tried using removeRange as well since removes often occur together but still no success.

The only way I’ve managed to get it to work is to clear all the rendered lines and redrew them which I imagine is hugely inefficient.

I’m using the UpdateSuspender to ensure that all operations complete as one.

At the moment I’m seeing no messages in Logcat and haven’t experienced any crashes and debugging with breakpoints show that the methods are being called.

Does it sound like I’m doing something wrong?

Also just to check my understanding of modifying the XyDataSeries, does it only apply updates at the end? I’ve been modifying my indices as I go so if I remove at index 1 I then assume that the series has shrunk by 1, is this the case?

Thanks for any assistance you can provide.


A sample project that demonstrates this is attached. The provided ReadMe briefly covers the expected behaviour for the app and a run down of the classes included.

  • Yura Khariton
    Hi Keith. Can you provide project which reproduce this bug? I’ve tried to reproduce this issue in one of examples from our demo application and everything seems to be working as it should.
  • Keith Kirk
    Hi Yura, Thank you for getting back to me so quickly. I can’t post the code for the app directly but I could try and make a sample app using portions of the code that relate to the graph. It will take me a bit of time though, I’ll reply back when I have the source of the test app available.
  • Keith Kirk
    Hey Yura, I’ve pdated my question with a sample project that demonstrates what I’m seeing. The ReadMe file explains what the components are expected to do and the intended behaviour. I did record a video but sadly it’s just over the 1MB file limit.
  • You must to post comments
Best Answer

Hi Keith,

I took a look on you project and I don’t think that the issue with points removing which you described is caused by SciChart. I’ve noticed that in readme file you wrote that you expect 3 lines but after last step I’ve seen 6 series in chart’s RenderableSeries collection. So I believe that at some point your code creates new series, then removes points from one data series but leaves points in another. You can check how amount of points changes in processUpdate() call by modifying it and adding logging count value from data series:

    private fun processUpdate(series: List<DataSeries>) {
    map = map
        .let { remover.removeAbsentSeries(it, series) }
        .let { updater.updateSeries(it, series) }
        .let { inserter.insertSeries(it, series) }

    Log.d("DataSeries", "Begin chart state")
    val dsList = { it.dataSeries }.toList()
    for (item in dsList) {
        Log.d("DataSeries", item.hashCode().toString() + ": "+item.getCount().toString())
    Log.d("DataSeries", "End chart state")


With this code I’ve seen that at some point there are 3 data series with more than 1000 points but then you remove 1000 points from only one of them and other 2 remain intact. So would suggest you to recheck your code and ensure that you remove points from correct series.

Best regards,

  • Keith Kirk
    Hey Yura, Thanks for spotting that, I missed a line in the Inserter so it was only outputting the lines that had been adding rather than combining them with the ones that had been updated.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies