micropeak: Fix chart colors
authorKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 00:57:31 +0000 (16:57 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 00:57:31 +0000 (16:57 -0800)
Need to apply custom colors after setting the theme

Signed-off-by: Keith Packard <keithp@keithp.com>
micropeak/MicroGraph.java

index b9b084f855880539fb7fc422b002920a41e7ce9c..c55806348463f8a72b7c52b35abab9307911f6e4 100644 (file)
@@ -72,9 +72,12 @@ public class MicroGraph implements AltosUnitsListener {
         MicroSeries    speedSeries;
        MicroSeries     accelSeries;
 
-       static final private Color red = new Color(194,31,31);
-       static final private Color green = new Color(31,194,31);
-       static final private Color blue = new Color(31,31,194);
+       static final private Color height_color = new Color(194,31,31);
+       static final private Color speed_color = new Color(31,194,31);
+       static final private Color accel_color = new Color(31,31,194);
+       static final private Color gridline_color = new Color(0, 0, 0);
+       static final private Color border_color = new Color(255, 255, 255);
+       static final private Color background_color = new Color(255, 255, 255);
 
        MicroData       data;
 
@@ -142,14 +145,22 @@ public class MicroGraph implements AltosUnitsListener {
                plot.setDomainPannable(true);
                plot.setRangePannable(true);
 
-               heightSeries = addSeries(0, "Height", AltosConvert.height.show_units(), red);
-               speedSeries = addSeries(1, "Speed", AltosConvert.speed.show_units(), green);
-               accelSeries = addSeries(2, "Acceleration", AltosConvert.accel.show_units(), blue);
-
                chart = new JFreeChart("Flight", JFreeChart.DEFAULT_TITLE_FONT,
                                       plot, true);
 
                ChartUtilities.applyCurrentTheme(chart);
+
+               heightSeries = addSeries(0, "Height", AltosConvert.height.show_units(), height_color);
+               speedSeries = addSeries(1, "Speed", AltosConvert.speed.show_units(), speed_color);
+               accelSeries = addSeries(2, "Acceleration", AltosConvert.accel.show_units(), accel_color);
+
+               plot.setDomainGridlinePaint(gridline_color);
+               plot.setRangeGridlinePaint(gridline_color);
+               plot.setBackgroundPaint(background_color);
+               plot.setBackgroundAlpha((float) 1);
+
+               chart.setBackgroundPaint(background_color);
+               chart.setBorderPaint(border_color);
                panel = new ChartPanel(chart);
                panel.setMouseWheelEnabled(true);
                panel.setPreferredSize(new java.awt.Dimension(800, 500));