Vision chart: Resampling on zoom

Hello,

I want to display 100 000 points of data in a chart. With easy chart is very simple to parameter the number of points I want to display (for exemple 2 000) and if I zoom in the chart resample the data in the zoom range: So if I zoom enought, I can see the raw data on the chart.
THat's exactly what I want :slight_smile:

My question is: If I want to do that kind of behavior with regular Chart module, is it possible and how can I do that please?
I've found some info about resampling on zoom with Jchartfree API but maybe there is a better way to do that?

Thanks for your help

How are you getting the data for the chart component?

I'm using Tag Historian :slight_smile:

Just supply the 100000 points to the chart in a dataset. No need to resample.

I said 100 000 points just to give the main idea. In fact it's more like 3 000 000 points per plot (up to 20 plots on the chart).

Been there, done that. Just give the chart the whole thing. Allow your client more RAM (in project properties) if necessary.

(You might find my Time Series Database Cache module helpful to get such large history datasets into Vision without query timeouts.)

I've tryed the sample size "On change" on the chart dataset: My client crashes.
I really need to resample the data on zoom. To implement the same resampling mode like Easy Chart, it seems difficult to you?

Do you mean per pen? How many datasets are being updated?

Yes sorry it's per pen. I got only 1 dataset filled by Tag Historian.

If I try to display raw data the client freezes.

I'd like to catch the zoom event but as far as I can see, I only can catch the mouse events (it's a start but maybe not the best way....) and capture the new bounds during this event and use
system.tag.queryTagHistory | Ignition User Manual (inductiveautomation.com) to resample the data.

I suppose it would be simple enough to store the visible start and end domain somewhere, and check to see if it's changed on the mouse released event.

dateAxis = event.source.chart.plot.domainAxis
startDate = event.source.chart.plot.domainAxis.lowerBound
endDate = event.source.chart.plot.domainAxis.upperBound
print startDate, endDate

...and the unzooming behavior could probably mimicked using the mouse dragged event if its right to left, but perhaps it would be simpler to just use a date range component to set the visible area?