SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Answered
0
0

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.

Edit:

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.

Version
2.0.0.1654
Attachments
  • 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
0
0

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 = surface.renderableSeries.map { it.dataSeries }.toList()
    for (item in dsList) {
        Log.d("DataSeries", item.hashCode().toString() + ": "+item.getCount().toString())
    }
    Log.d("DataSeries", "End chart state")

    surface.zoomExtents()
}

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,
Yura

  • 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.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more
+