Hi HuiminQi,
Passing the entire data array to ChartDirector by itself should not have any performance impact. The majority of the CPU is used in makeImage (updating the chart and the screen), which is required when the chart changes. In a typical chart, the update may require around 20 to 100ms. Note that if you have a lot of points, we suggest you do not enable image maps (that is, do not use getHTMLImageMap). It is because for large number of points, the image map may consume significant more CPU than the chart itself.
In any case, I think updating the chart should not affect your interrupts. The suggested code structure is like the followings:
(1) In your interrupt handler, please read your new data, and append them to the data array. Do not draw or update the chart in the interrupt handler.
(2) In your main GUI thread, please set a timer to update the chart. For example, the timer may "attempt" to update the chart once per second. In other words, every one second, your timer can check if there is new data. If there is new data, update the chart.
Because the timer runs in the GUI thread, and the chart is generated in the main GUI thread, it should not affect the interrupts for collecting data. (I assume the interrupts you use for collecting data should have higher priority than the GUI thread.) In general, the data collection code and the chart update code should run separately, and not in the same routine.
Hope this can help.
Regards
Peter Kwan |