Tips for improving performance of redrawing charts


I have 6-7 charts with 3 series each on the screen at one time. I need to update them by adding data to the series. Unfortunately, since they’re linked (they’re displaying the data on the same y axis (they’re time-based data points) I don’t really have the option of refreshing the charts separately.

I was wondering if there are any tips for improving performance of updates. I’m already using series.addAll, but I was thinking I could disable redraw while I update all three series and then only call it once? 

Any other tips for improving performance? Should I roll my own adapter to fireUpdateHandler once? 

Anything else I could do for this scenario of only performing additions to the series? My series have hundreds to thousands of data points, but I’m adding only a few extra points on every update…




Performance improved a bit when using a plain DataAdapter like this:

new DataAdapter<Double, Date>(){}

This will not fire any updates, so doing a manual redrawChart instead after updating all three series for a chart.

Still interested in more ideas on how to improve performance. A chart redraw seems to hog the main event dispatching thread. I tried running it on a separate thread but that crashes. 


Scratch my previous comment about using a plain DataAdapter. Unless fireUpdateHandler is called, the chart will not refresh that series.


Hi Radu,

Here are a few tips we’ve come across:

  1. Profile with DDMS and find out where the bottlenecks are. Point 6 below is a case in point, to avoid un-necessary meaasure passes.
  2. Don’t accumulate large amounts of data in the DataAdapters, just what you want to display - the chart has to process what you give it.
  3. DateTimeAxis is slower than NumberAxis. Not much you can do about that, but we’ve optimised for frequencies smaller than a month (units of fixed length).
  4. Avoid minor tick marks if you can - it’s more calculation and drawing, so a performance tradeoff.
  5. Avoid stacked series if you can - there’s obviously more calculation involved, so a performance tradeoff.
  6. If you can put the chart in a LinearLayout rather than a RelativeLayout, do so. Relative layout will measure it at least twice for each frame, and the measure pass is expensive, as it has to work out the tick frequencies and axis space requirements.
  7. This may not be so applicable if you’re using Xamarin, but is worth a read anyway:

Best regards,