Pre loader

Real-time Averaging When Zooming-In

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

Answered
1
0

Hi,

We want to implement averaging of data points when you zoom into a graph.
We have implemented pre-processed average plotting – and this works for certain cases.
Basically, you see less point markers when you zoom out a certain level (point marker will show averaged points), and when you zoom in, point markers show increased sample points – in real time.

  1. Is there a an API that enables this capability and determining when the averaging happens (at what zoom level) and the averaging period (to average values over)?
  2. If there isn’t an API, can you point us in the right direction to implement such feature?
Version
4.4.0.4739
  • Eyram Dornor
    Hi @Andrew, thanks for those directions. Now deep diving into this. A quick look at the custom series API and the DataSeries wrapper options,- these classes don’t provide access to the current zoom level or enable monitoring of the zoom level changes – correct me if i’m wrong. What accessible object (if any) provides access to the chart zoom level, plus monitoring of changes?
  • You must to post comments
Best Answer
1
0

Hi Eyram

There isn’t an API to do this out of the box with SciChart Android. The best suggestion we have is to use the Custom Series API and create something similar to a spline series – performing your own interpolation or aggregation on data that is sent to the series to draw.

Take a look at the documentation page above. It gives some hints how to get started with this API.

Another way – would be to create a wrapper around your DataSeries and somehow filter the data or downsample it as you zoom in and out – depending on zoom level you would have to change the data. Also possible with SciChart (and much simpler than the above)

Best regards
Andrew

  • You must to post comments
1
0

Hi Andrew,

Sorry, now diving deeper into this.
With the Custom series (and same for the DataSeries wrapper) – from a quick look, these don’t provide access to the zoom level or the change in the zoom level – correct me if I’m wrong.
What object primarily provides access to the current zoom level and track changes to the zoom level?

  • You must to post comments
0
0

Hi Eyram,

The class that reports on zoom level is the Axis itself. We have an article in our SciChart Android Documentation about listening to VisibleRange changes.

Please subscribe to the VisibleRangeChangedListener to be informed when the chart has zoomed (note you will need to do this for each axis, however if you are interested in over or under sampling only, then X-axis should be sufficient)

// Java
final NumericAxis axis = new NumericAxis(getContext());
axis.setVisibleRangeChangeListener(new VisibleRangeChangeListener() {
    @Override
    public void onVisibleRangeChanged(IAxisCore axis, IRange oldRange, IRange newRange, boolean isAnimating) {
        // TODO handle range changes here
    }
});

// Kotlin 
val axis = NumericAxis(context)
      axis.setVisibleRangeChangeListener { axis, oldRange, newRange, isAnimating ->
// TODO handle range changes here
} 

Best regards
Andrew

  • 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