Pre loader

"MipMapping" or Virtualization of Data (reload dataseries on zoom)

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
1

Hi,

I would like to achieve dynamic loading finely sampled data from db when user zooms in.

For example I would like to display 1 month of data sampled by day (one sample per each day). As user zooms in to day-level, I would like to load data only for visible day but sampled in finer resolution (for example one sample per minute). User could zoom in further to seconds or milliseconds details.

I could probable detect displayed time range and load data with corresponding sampling and switch the dataset bound to the control.

But after that the control will be bound only to visible portion of time interval and user will not be able to zoom out back to coarser level of detail (ie whole month).

Is there a way how to do this?

Thanks,
Petr

  • You must to post comments
1
0

Hi Andrew,

thanks for quick response. I tried to implement simple version of virtualizing sample. I’m just loading data for visible range + some surroundings before and after the interval, so user could move within data without reloading after each pixel. I’m resampling the range if zoom changes to twice or half.

I’m attaching my quick sample, so anybody could use it as a reference. Sample contains simple data generator of “fractal” sine function.

I could imagine that sample could be easily extended by many ways – for example async loading of data.

I had found SciChart library few days ago and I must say it looks very impressive.

Thanks,
Petr

Attachments
  • Andrew Burnett-Thompson
    Hi Petr, Thanks a lot for contributing that, I'm sure anyone else who wants to implement virtualization in SciChart will be grateful for this! Some comments for other users / suggestions for yourself - I ran your app and it wasn't immediately apparent what it did. I noticed that when zooming/panning the dataset was not changed, but when dragging the XAxis to scale, the DataSeries was being cleared/recreated with new data at a finer granularity. Ok nice - I would suggest using RubberBandXyZoomModifier with IsAnimated=false to do the granularity / DataSeries changes. E.g. when user zooms in, you get one Axis.VisibleRangeChanged event, get new data and reload series - I noticed that double click using ZoomExtentsModifier didn't really work, as SciChart is only zooming to extents on the data that it already has. I would suggest subscribing to SciChartSurface.MouseDoubleClick (remov the ZoomExtentsModifier) and manually reload the DataSeries with the original low-detail data, then call SciChartSurface.ZoomExtents(). This should achieve the effect you want. Ok good stuff! Feel free to post if you have any questions Andrew
  • pal
    • pal
    • 11 years ago
    Hi Andrew, I like that data resampling is transparent to user, in fact he did not notice when dataset is regenerated. In real world usage reloading dataset takes some time, but I think that async loading could work good here. Do I understand correctly, that data could be changed from non-UI thread? I'll try RubberBandXyZoomModifier with IsAnimated=fall as you suggested. Yes double click is not handled, but this could be done easily. I'll try to rewrite the sample with MVVM approach, but I'm not sure how to hook viewmodel to VisibleRangeChanged event? Regards, Petr
  • Andrew Burnett-Thompson
    Hi Petr, Yes, you can load data on a background thread. Drawing operations are throttled and queued internally and decoupled from the DataSeries.Append so no need to call this method on the UI Thread. I would recommend performing block updates inside a SciChartSurface.SuspendUpdates() call. If you want you can pass the SciChartSurface as ISuspendable to your viewmodel to achieve this in MVVM, or, use the similar API DataSeriesSet.SuspendUpdates(). Async loading is definitely the way to go - you may also be able to achieve something like putting a loading animation over the screen using the CustomAnnotation type, with CoordinateMode=Relative, X1,Y1=0.5 and HorizontalAnchorPoint / VerticalAnchorPoint = Center (will place annotation in centre of screen), Best regards, Andrew
  • You must to post comments
0
0

Hi, to further clarify, we noticed that Scichart automatically scales as per the values and the height of the smartphone screen. We would like to control it a bit more like “traditional” EEG charts which can show amplitude at 7Uv/mm or 20Uv/mm or 200Uv/mm or even 1000Uv/mm. Can Scichart help us with this? dr sturm ophthalmologist

  • You must to post comments
Showing 2 results
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