Pre loader

Virtualizing (dynamic loading) as you zoom using Overview Control

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

0
0

I have a number of modifiers on my chart, and I would like to react to the change of visible range that comes about as a result of the RubberBandXyZoomModifier, ZoomPanModifier, ZoomExtentModifier and XAxisDragModifier. I specifically need to differentiate whether the visible range was changed by one of these modifiers vs. the case where the visible range is changed in code.

Is there an event that I can hook on the modifiers, or on the surface, or the DataSeriesSet, or something else, that will tell me when the visible range has changed?

My ultimate goal is to know when the user has tried to scroll back in time so that I can read data from a historical database to back-fill the chart as necessary. I would be very happy with a slider-based alternative like the mini-history charts in Google finance, but I don’t see a modifier for that.

  • You must to post comments
0
0

Hi there,

Hmmm, Axis.VisibleRange event fires for any visible-range change operation. There is no differentiation between programmatic and user-initiated range changes for this event. Would it not be possible to subscribe to Axis.VisibleRangeChanged and find out if the new range is outside the current known data-range, loading new data only if required?

We did have a user-posted solution of virtualizing a DataSeries, its just a proof of concept but should demonstrate how to achieve it in code. Please see here: http://http://www.scichart.com/questions/question/mipmapping/

If you really need Modifier interactivity notifications, the best I can suggest is to subclass the modifiers, e.g. RubberBandXyZoomModifier, ZoomPanModifier, ZoomExtentsModifier, XAxisDragModifier and override the methods OnModifierMouseMove, OnModifierMouseDown, OnModifierMouseUp, OnModifierDoubleClick and in there detect a combination of modifier interaction + visible range changed.

For example:

XAxisDragModifier works on mouse-down, move and up. If between the down-move-up events there has been one or more VisibleRange changes, you can fire an event to signal that the user has dragged the XAxis.

Finally, regarding the mini-history in Google Finance, we have a control called the Overview control. Please see here for a demo: http://http://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/ZoomAndPanAChart/ScrollChartUsingOverviewControl.xaml

Thanks!
Andrew

  • asthomas
    Thanks. Axis.VisibleRangeChanged is what I was looking for. I think I can distinguish between a data change and a user-initiated change using guard variables. Regarding the Overview control - that looks really nice. Is it possible to have the Overview use a different data set from the main surface? I work with data sets of potentially millions of data points. I can sample the whole data set to produce a low-fidelity trace for the overview, but I want to be able to display all of the data within the VisibleRange on the main surface. This means that the overview must use a different data set from the main surface. For example, the overview needs to show 1 sample per day for two years. The main chart needs to show every data value at 10 milliseconds for 2 hours (or whatever time range is selected). Obviously I don't want to load all two years of 10 millisecond data, as that would break all kinds of things, so I need to decouple the overview data from the main surface data. My first thought was that I could have an extra data series in the DataSeriesSet that is not associated with a renderer, but that looks like a book-keeping headache. I want to be able to dynamically add and remove series (and therefore renderers) from the chart at run-time. It looks like series and renderers are associated only by index, which means that the index of the extra series associated with the overview will always be changing. So that brings up a couple of questions: - Am I even allowed to have a different number of series vs. renderers, or is the chart expecting a one-to-one association? - Is there a way to permanently associate a particular series with a particular renderer, regardless of the order of renderers and series?
  • asthomas
    Thinking about this further, it doesn't make sense to store another series in the series set, even without connecting it to a renderer. This will cause the series set MIN and MAX to compute to the bounds of the sampled full-range series, which is not what I want at all. I don't want the series that populates the Overview to be part of the SeriesSet at all.
  • Andrew Burnett-Thompson
    That's a good point. The Overview Control needs to bind to the ParentSurface in order to share XAxis type (e.g. DateTimeAxis, NumericAxis) and XAxis.VisibleRange and for that to happen, the data must be in the ParentSurface's DataSet. I can't think of a way of decoupling the source DataSeries from the parent chart's dataset, unless ... you make the Overview control bind to a hidden SciChartSurface, e.g. your XAML might look something like this. I must stress I've not tried this, just suggesting it as an extreme workaround.
    <!-- Note, not tested or compiled, just for illustration purposes -->
    <s:SciChartSurface x:Name="realChart" DataSet="{Binding RealData}">
      <s:SciChartSurface.XAxis>
          <s:DateTimeAxis x:Name="realXAxis"/>
      </s:SciChartSurface.XAxis>
    </s:SciChartSurface>
    
    <s:SciChartSurface x:Name="fakeChart" DataSet="{Binding OverviewData}" Visibility="Collapsed">
      <s:SciChartSurface.XAxis>
          <!-- Must be bound to real-chart's XAxis.VisibleRange -->
          <s:DateTimeAxis VisibleRange="{Binding ElementName=realXAxis, Path=VisibleRange, Mode=TwoWay}"/>
      </s:SciChartSurface.XAxis>
    </s:SciChartSurface>
    
    <s:SciChartOverview ParentSurface="{Binding ElementName=fakeChart}"/>
    
    Bit of a hack I know, but we never considered people would want to use the Overview in this way. I'm definitely going to log it as a feature request. - Andrew
  • asthomas
    This actually works, with some modification. For whatever reason binding the VisibleRange in the hidden X axis to the VisibleRange in the real X axis throws a null object error while rendering. I can hook the VisibleRangeChanged events on the two axes, then manually set the VisibleRange on the other through code and it works fine.
  • You must to post comments
0
0

Wow, that’s cool. It was a long-shot. We have been discussing today changing the API for SciChartOverview, since a lot of people have requested the ability to data-virtualize. We need to create a tutorial on this topic but also requires a few changes to make it easier for the end-user. Watch this space!

  • Andrew
  • You must to post comments
0
0

Hi Andrew, just wondering has there been any progress with Data Virtualization on Sci Charts?

  • Andrew Burnett-Thompson
    We still don't support it natively, but people have had good success with the above workarounds to dynamically load on zoom. It's still on our wish-list of TODO items but we've been very busy with some other big-ticket items!
  • You must to post comments
Showing 3 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