Skip to content
Snippets Groups Projects
Commit 8dc0dfae authored by Tim Molter's avatar Tim Molter Committed by Niklas Polke
Browse files

misc cleanup

parent 28d125df
Branches
Tags
No related merge requests found
...@@ -53,6 +53,7 @@ public class LineChart04 implements ExampleChart { ...@@ -53,6 +53,7 @@ public class LineChart04 implements ExampleChart {
series.setLineStyle(SeriesLineStyle.SOLID); series.setLineStyle(SeriesLineStyle.SOLID);
series.setMarker(SeriesMarker.CIRCLE); series.setMarker(SeriesMarker.CIRCLE);
series.setMarkerColor(SeriesColor.BLUE); series.setMarkerColor(SeriesColor.BLUE);
} }
return chart; return chart;
......
...@@ -88,7 +88,9 @@ public class XChartPanel extends JPanel { ...@@ -88,7 +88,9 @@ public class XChartPanel extends JPanel {
super.paintComponent(g); super.paintComponent(g);
chart.paint((Graphics2D) g, getWidth(), getHeight()); Graphics2D g2d = (Graphics2D) g.create();
chart.paint(g2d, getWidth(), getHeight());
g2d.dispose();
} }
@Override @Override
......
...@@ -122,7 +122,8 @@ public class AxisTickLabels implements ChartPart { ...@@ -122,7 +122,8 @@ public class AxisTickLabels implements ChartPart {
// g.draw(bounds); // g.draw(bounds);
} }
else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis // X-Axis
else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) {
double xOffset = axisTick.getAxis().getPaintZone().getX(); double xOffset = axisTick.getAxis().getPaintZone().getX();
double yOffset = axisTick.getAxis().getAxisTitle().getBounds().getY(); double yOffset = axisTick.getAxis().getAxisTitle().getBounds().getY();
......
...@@ -89,7 +89,8 @@ public class AxisTickMarks implements ChartPart { ...@@ -89,7 +89,8 @@ public class AxisTickMarks implements ChartPart {
} }
} }
else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis // X-Axis
else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) {
double xOffset = axisTick.getAxis().getPaintZone().getX(); double xOffset = axisTick.getAxis().getPaintZone().getX();
double yOffset = axisTick.getAxisTickLabels().getBounds().getY() - getChartPainter().getStyleManager().getAxisTickPadding(); double yOffset = axisTick.getAxisTickLabels().getBounds().getY() - getChartPainter().getStyleManager().getAxisTickPadding();
...@@ -120,10 +121,9 @@ public class AxisTickMarks implements ChartPart { ...@@ -120,10 +121,9 @@ public class AxisTickMarks implements ChartPart {
// Line // Line
if (getChartPainter().getStyleManager().isAxisTicksLineVisible()) { if (getChartPainter().getStyleManager().isAxisTicksLineVisible()) {
Shape line = g.setStroke(getChartPainter().getStyleManager().getAxisTickMarksStroke());
new Line2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength(), xOffset + axisTick.getAxis().getPaintZone().getWidth(), yOffset g.drawLine((int) xOffset, (int) (yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength()), (int) (xOffset + axisTick.getAxis().getPaintZone().getWidth()),
- getChartPainter().getStyleManager().getAxisTickMarkLength()); (int) (yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength()));
g.draw(line);
} }
} }
......
...@@ -109,7 +109,7 @@ public class ChartPainter { ...@@ -109,7 +109,7 @@ public class ChartPainter {
axisPair.paint(g); axisPair.paint(g);
plot.paint(g); plot.paint(g);
// TODO why not just paint them first and skip the size hinting? // TODO why not just paint the title first and skip the size hinting?
chartTitle.paint(g); chartTitle.paint(g);
chartLegend.paint(g); chartLegend.paint(g);
......
...@@ -280,6 +280,7 @@ public class PlotContentLineChart extends PlotContent { ...@@ -280,6 +280,7 @@ public class PlotContentLineChart extends PlotContent {
} }
g.setClip(null); g.setClip(null);
} }
/** /**
......
...@@ -62,6 +62,7 @@ public class PlotSurface implements ChartPart { ...@@ -62,6 +62,7 @@ public class PlotSurface implements ChartPart {
// paint plot border // paint plot border
if (getChartPainter().getStyleManager().isPlotBorderVisible()) { if (getChartPainter().getStyleManager().isPlotBorderVisible()) {
g.setColor(getChartPainter().getStyleManager().getPlotBorderColor()); g.setColor(getChartPainter().getStyleManager().getPlotBorderColor());
// g.setStroke(getChartPainter().getStyleManager().getAxisTickMarksStroke());
g.draw(rect); g.draw(rect);
} }
...@@ -84,6 +85,7 @@ public class PlotSurface implements ChartPart { ...@@ -84,6 +85,7 @@ public class PlotSurface implements ChartPart {
Shape line = new Line2D.Double(bounds.getX(), yOffset, bounds.getX() + bounds.getWidth(), yOffset); Shape line = new Line2D.Double(bounds.getX(), yOffset, bounds.getX() + bounds.getWidth(), yOffset);
g.draw(line); g.draw(line);
} }
// tick marks // tick marks
if (getChartPainter().getStyleManager().isPlotTicksMarksVisible()) { if (getChartPainter().getStyleManager().isPlotTicksMarksVisible()) {
...@@ -100,11 +102,11 @@ public class PlotSurface implements ChartPart { ...@@ -100,11 +102,11 @@ public class PlotSurface implements ChartPart {
// vertical // vertical
if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar
&& (getChartPainter().getStyleManager().isPlotGridLinesVisible() && (getChartPainter().getStyleManager().isPlotGridLinesVisible()
|| getChartPainter().getStyleManager().isPlotTicksMarksVisible()) || getChartPainter().getStyleManager().isPlotTicksMarksVisible())
) { ) {
List<Double> xAxisTickLocations = getChartPainter().getAxisPair().getXAxis().getAxisTick().getTickLocations(); List<Double> xAxisTickLocations = getChartPainter().getAxisPair().getXAxis().getAxisTick().getTickLocations();
for (int i = 0; i < xAxisTickLocations.size(); i++) { for (int i = 0; i < xAxisTickLocations.size(); i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment