+ JDiagram.setColoredBackgrounds(...)

master
Harald Christian Joachim Wolff 2018-05-18 11:35:34 +02:00
parent b6b1770ce5
commit 41992950fb
1 changed files with 12 additions and 2 deletions

View File

@ -486,8 +486,14 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
Point2D pmin = mapDiagramToMouse(new Point2D.Double(0, bg.getMin()));
Point2D pmax = mapDiagramToMouse(new Point2D.Double(0, bg.getMax()));
int x,y,width,height;
width = this.plotWidth;
height = (int)(pmin.getY() - pmax.getY());
x = getWidth() - this.plotWidth - this.bRight;
y = (int)(pmax.getY());
g.setColor(bg.getColor());
g.fillRect(0, (int)pmax.getY(), getWidth(), (int)(pmax.getY() - pmin.getX()));
g.fillRect(0,y,getWidth(),height);
}
paintOrdinates ((Graphics2D) g);
@ -852,7 +858,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
this.num = num;
this.colDraw = Color.BLACK;
this.colGrid = Color.LIGHT_GRAY;
this.colGrid = Color.GRAY;
this.scaler = new LinearScaler();
}
@ -942,4 +948,8 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
public List<ColoredBackground> getColoredBackgrounds() {
return coloredBackgrounds;
}
public void setColoredBackgrounds(List<ColoredBackground> backgrounds){
this.coloredBackgrounds.clear();
this.coloredBackgrounds.addAll(backgrounds);
}
}