How to plot large data vectors accurately at all zoom levels in real time?

前端 未结 3 1007
一向
一向 2021-02-04 18:04

I have large data sets (10 Hz data, so 864k points per 24 Hours) which I need to plot in real time. The idea is the user can zoom and pan into highly detailed scatter plots.

3条回答
  •  走了就别回头了
    2021-02-04 18:18

    10Hz data means that you only have to plot 10 frames per second. It should be easy, since many games achieve >100 fps with much more complex graphics.

    If you plot 10 pixels per second for each possible data point you can display a minute worth of data using a 600 pixel wide widget. If you save the index of the 600th to last sample it should be easy to draw only the latest data.

    If you don't have a new data-point every 10th of a second you have to come up with a way to insert an interpolated data-point. Three choices come to mind:

    1. Repeat the last data-point.
    2. Insert an "empty" data-point. This will cause gaps in the graph.
    3. Don't update the graph until the next data-point arrives. Then insert all the pixels you didn't draw at once, with linear interpolation between the data-points.

    To make the animation smooth use double-buffering. If your target language supports a canvas widget it probably supports double-buffering.

    When zooming you have the same three choices as above, as the zoomed data-points are not continuous even if the original data-points were.

    This might help for implementing it in Java.

提交回复
热议问题