Honoring plot backgroung on LinePlot

This commit is contained in:
2014-11-12 17:02:21 +01:00
parent 9ec66825e2
commit ac7ef97ca3
2 changed files with 20 additions and 1 deletions

View File

@@ -71,6 +71,15 @@ public class LinePlot extends LinePlotBase {
public LinePlot() {
super();
}
@Override
public void setBackground(Color c){
super.setBackground(c);
if (chartPanel!=null){
chartPanel.setBackground(c);
}
}
@Override
public void onAppendData(LinePlotSeries series, double x, double y) {
@@ -192,6 +201,8 @@ public class LinePlot extends LinePlotBase {
// Set size of chart
chartPanel.setPreferredSize(new java.awt.Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT));
chartPanel.setBackground(getBackground());
//Activate (arrow) keys
addKeyBindings();

View File

@@ -32,6 +32,14 @@ public class LinePlot extends LinePlotBase {
setRequireUpdateOnAppend(false);
}
@Override
public void setBackground(Color c){
super.setBackground(c);
if (plot!=null){
plot.setBackground(c);
}
}
static final Color[] defaultColors = new Color[]{Color.RED,Color.BLUE,Color.GREEN,Color.ORANGE,Color.MAGENTA,Color.CYAN,Color.YELLOW,Color.PINK,Color.LIGHT_GRAY,Color.GRAY};
Random random;
@@ -171,7 +179,7 @@ public class LinePlot extends LinePlotBase {
plot.getXAxis().setMaximum(10);
*/
plot.setLabelVisible(false);
plot.setBackground(new Color(240, 240, 240));
plot.setBackground(getBackground());
setLayout(new BorderLayout());
add(plot);