Skip to content
Snippets Groups Projects
Commit 9d8a2780 authored by Tim Molter's avatar Tim Molter
Browse files

issue #82 - barchart bar style outline or filled

parent adfacadd
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,7 @@ public class BarChart02 implements ExampleChart { ...@@ -78,6 +78,7 @@ public class BarChart02 implements ExampleChart {
Series series = chart.addSeries("Model 77", xData, yData); Series series = chart.addSeries("Model 77", xData, yData);
series.setLineColor(SeriesColor.RED); series.setLineColor(SeriesColor.RED);
chart.getStyleManager().setPlotGridLinesVisible(false); chart.getStyleManager().setPlotGridLinesVisible(false);
chart.getStyleManager().setBarFilled(false);
return chart; return chart;
} }
......
...@@ -136,6 +136,7 @@ public class StyleManager { ...@@ -136,6 +136,7 @@ public class StyleManager {
// Bar Charts /////////////////////////////// // Bar Charts ///////////////////////////////
private double barWidthPercentage; private double barWidthPercentage;
private boolean isBarsOverlapped; private boolean isBarsOverlapped;
private boolean isBarFilled;
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
private int markerSize; private int markerSize;
...@@ -222,6 +223,7 @@ public class StyleManager { ...@@ -222,6 +223,7 @@ public class StyleManager {
// Bar Charts /////////////////////////////// // Bar Charts ///////////////////////////////
barWidthPercentage = theme.getBarWidthPercentage(); barWidthPercentage = theme.getBarWidthPercentage();
isBarsOverlapped = theme.isBarsOverlapped(); isBarsOverlapped = theme.isBarsOverlapped();
isBarFilled = theme.isBarFilled();
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
...@@ -1041,6 +1043,21 @@ public class StyleManager { ...@@ -1041,6 +1043,21 @@ public class StyleManager {
return isBarsOverlapped; return isBarsOverlapped;
} }
/**
* set whether or no bars are filled with a solid color or empty.
*
* @param isBarFilled
*/
public void setBarFilled(boolean isBarFilled) {
this.isBarFilled = isBarFilled;
}
public boolean isBarFilled() {
return isBarFilled;
}
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
/** /**
......
...@@ -190,7 +190,13 @@ public class PlotContentBarChart extends PlotContent { ...@@ -190,7 +190,13 @@ public class PlotContentBarChart extends PlotContent {
path.lineTo(xOffset + barWidth, zeroOffset); path.lineTo(xOffset + barWidth, zeroOffset);
path.lineTo(xOffset, zeroOffset); path.lineTo(xOffset, zeroOffset);
path.closePath(); path.closePath();
g.setStroke(series.getStroke());
if (getChartPainter().getStyleManager().isBarFilled()) {
g.fill(path); g.fill(path);
}
else {
g.draw(path);
}
} }
seriesCounter++; seriesCounter++;
......
...@@ -293,6 +293,12 @@ public class GGPlot2Theme implements Theme { ...@@ -293,6 +293,12 @@ public class GGPlot2Theme implements Theme {
return false; return false;
} }
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
@Override @Override
......
...@@ -294,6 +294,12 @@ public class MatlabTheme implements Theme { ...@@ -294,6 +294,12 @@ public class MatlabTheme implements Theme {
return false; return false;
} }
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
@Override @Override
......
...@@ -122,6 +122,8 @@ public interface Theme { ...@@ -122,6 +122,8 @@ public interface Theme {
public boolean isBarsOverlapped(); public boolean isBarsOverlapped();
public boolean isBarFilled();
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
public int getMarkerSize(); public int getMarkerSize();
......
...@@ -293,6 +293,12 @@ public class XChartTheme implements Theme { ...@@ -293,6 +293,12 @@ public class XChartTheme implements Theme {
return false; return false;
} }
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts /////////////////////////////// // Line, Scatter, Area Charts ///////////////////////////////
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment