Pre loader

How to change the startX on a UniformHeatmapDataSeries?

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
0

I have a large data set that I can’t really load into memory at once so instead I am paging the data, grabbing only what I require plus a little buffer either side so that the graph always has something in it.

To implement paging I need to change the position at which the graph starts rendering, unfortunately it seems that it is not possible to change UniformHeatmapDataSeries.xStart as set in the constructor.

Is the only way around this to recreate the heatmap from scratch every time a new page is loaded or am I missing another trick?

Version
2.1.2294
  • You must to post comments
1
0

Hi Paul

The UniformHeatmapDataSeries doesn’t have a way to modify or change the xStart, xStep, yStart, yStep properties after construction. However, the heatmap simply wraps a 2d array so the overhead to create a new UniformHeatmapDataSeries and assign it to the RenderableSeries is quite low.

This is how you might update the heatmap series position dynamically:

    const zValues: number[][] = ...

    const heatmapData = new UniformHeatmapDataSeries(webAssemblyContext, { 
        xStart: 0,
        xStep: 1,
        yStart: 0,
        yStep: 1,
        zValues
    });

    const heatmapRenderSeries = new UniformHeatmapRenderableSeries(webAssemblyContext, { dataSeries: heatmapData });

    // Later, you want to update data but not recreate the chart
    heatmapRenderSeries.dataSeries = new UniformHeatmapDataSeries(webAssemblyContext, {
        xStart: 100,
        xStep: 1,
        yStart: 100,
        yStep: 1,
        zValues
    }); 

Any time you assign a new UniformHeatmapDataSeries to the RenderableSeries.DataSeries property the chart will redraw.

Note: you can have multiple heatmap series on a single SciChartSurface (tiling is possible). I would suggest as well as paging to tile and create new heatmap RenderableSeries/DataSeries pairs and add them on to the chart, removing when the chart zooms them out of scope. The memory is held in the zValues[][] array passed into UniformHeatmapDataSeries constructor so if you want to be memory efficient, re-use that array.

Lastly, don’t forget if you do remove and discard any RenderableSeries/DataSeries from a SciChartSurface to call .delete() on them to ensure any native memory is freed.

Let me know if this helps

Best regards,
Andrew

  • You must to post comments
0
0

Thanks Andrew, this is pretty much the approach I’ve taken now although the tiling idea could be a useful optimisation.

Regards
Paul

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.