altosuilib: Disable graph element notifies for each add()
authorKeith Packard <keithp@keithp.com>
Fri, 1 Mar 2013 20:34:04 +0000 (12:34 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 1 Mar 2013 20:34:04 +0000 (12:34 -0800)
This reduces the number of notify calls made and dramatically speeds
up graph creation.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosuilib/AltosUIGraph.java

index 5c589c02555070637c7d3055cb9c91087f70c848..5f3a2eef30a8064936f4abc763160cd4298124e6 100644 (file)
@@ -91,13 +91,19 @@ public class AltosUIGraph implements AltosUnitsListener {
        }
 
        public void resetData() {
-               for (AltosUIGrapher g : graphers)
+               for (AltosUIGrapher g : graphers) {
                        g.clear();
+                       g.setNotify(false);
+               }
                if (dataSet != null) {
                        for (AltosUIDataPoint dataPoint : dataSet.dataPoints())
                                for (AltosUIGrapher g : graphers)
                                        g.add(dataPoint);
                }
+               for (AltosUIGrapher g : graphers) {
+                       g.setNotify(true);
+                       g.fireSeriesChanged();
+               }
        }
 
        public void units_changed(boolean imperial_units) {