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

abort when really small chart for legend and line chart

parent a2450bae
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,9 @@ public class Legend implements ChartPart {
if (!chartPainter.getStyleManager().isLegendVisible()) {
return new double[] { 0, 0 };
}
if (chartPainter.getPlot().getBounds().getWidth() < 30) {
return new double[] { 0, 0 };
}
StyleManager styleManager = getChartPainter().getStyleManager();
boolean isBar = styleManager.getChartType() == ChartType.Bar;
......@@ -114,6 +117,11 @@ public class Legend implements ChartPart {
@Override
public void paint(Graphics2D g) {
// if the area to draw a chart on is so small, don't even bother
if (chartPainter.getPlot().getBounds().getWidth() < 30) {
return;
}
bounds = new Rectangle2D.Double();
// g.setFont(chartPainter.getStyleManager().getLegendFont());
......
......@@ -54,6 +54,11 @@ public class PlotContentLineChart extends PlotContent {
// g.setColor(Color.red);
// g.draw(bounds);
// if the area to draw a chart on is so small, don't even bother
if (bounds.getWidth() < 30) {
return;
}
StyleManager styleManager = plot.getChartPainter().getStyleManager();
// this is for preventing the series to be drawn outside the plot area if min and max is overridden to fall inside the data range
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment