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 {
Series series = chart.addSeries("Model 77", xData, yData);
series.setLineColor(SeriesColor.RED);
chart.getStyleManager().setPlotGridLinesVisible(false);
chart.getStyleManager().setBarFilled(false);
return chart;
}
......
......@@ -136,6 +136,7 @@ public class StyleManager {
// Bar Charts ///////////////////////////////
private double barWidthPercentage;
private boolean isBarsOverlapped;
private boolean isBarFilled;
// Line, Scatter, Area Charts ///////////////////////////////
private int markerSize;
......@@ -222,6 +223,7 @@ public class StyleManager {
// Bar Charts ///////////////////////////////
barWidthPercentage = theme.getBarWidthPercentage();
isBarsOverlapped = theme.isBarsOverlapped();
isBarFilled = theme.isBarFilled();
// Line, Scatter, Area Charts ///////////////////////////////
......@@ -1041,6 +1043,21 @@ public class StyleManager {
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 ///////////////////////////////
/**
......
......@@ -32,7 +32,7 @@ public class PlotContentBarChart extends PlotContent {
/**
* Constructor
*
*
* @param plot
*/
protected PlotContentBarChart(Plot plot) {
......@@ -190,7 +190,13 @@ public class PlotContentBarChart extends PlotContent {
path.lineTo(xOffset + barWidth, zeroOffset);
path.lineTo(xOffset, zeroOffset);
path.closePath();
g.fill(path);
g.setStroke(series.getStroke());
if (getChartPainter().getStyleManager().isBarFilled()) {
g.fill(path);
}
else {
g.draw(path);
}
}
seriesCounter++;
......
......@@ -293,6 +293,12 @@ public class GGPlot2Theme implements Theme {
return false;
}
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts ///////////////////////////////
@Override
......
......@@ -294,6 +294,12 @@ public class MatlabTheme implements Theme {
return false;
}
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts ///////////////////////////////
@Override
......
......@@ -122,6 +122,8 @@ public interface Theme {
public boolean isBarsOverlapped();
public boolean isBarFilled();
// Line, Scatter, Area Charts ///////////////////////////////
public int getMarkerSize();
......
......@@ -293,6 +293,12 @@ public class XChartTheme implements Theme {
return false;
}
@Override
public boolean isBarFilled() {
return true;
}
// Line, Scatter, Area Charts ///////////////////////////////
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment