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.
- 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)?
- If there isn’t an API, can you point us in the right direction to implement such feature?
- Eyram Dornor asked 1 year ago
- last edited 1 year ago
- 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 login to post comments
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
- Andrew Burnett-Thompson answered 1 year ago
- You must login to post comments
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?
- Eyram Dornor answered 1 year ago
- last edited 1 year ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 1 year ago
- You must login to post comments
Please login first to submit.