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

fix for issue #56 - drawing out of bounds when min or max manually set

parent 7b0e2a1a
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
* <li>Customizing the series style properties
* <li>Scatter and Line overlay
* <li>Logarithmic Y-Axis
* <li>An X-Axis min value clipping off the series
*/
public class LineChart05 implements ExampleChart {
......@@ -74,8 +75,8 @@ public class LineChart05 implements ExampleChart {
chart.getStyleManager().setYAxisMin(0.01);
chart.getStyleManager().setYAxisMax(1000);
chart.getStyleManager().setXAxisMin(-2);
chart.getStyleManager().setXAxisMax(8);
chart.getStyleManager().setXAxisMin(2);
chart.getStyleManager().setXAxisMax(7);
return chart;
}
......
......@@ -49,6 +49,9 @@ public class PlotContentLineChart extends PlotContent {
Rectangle2D bounds = plot.getBounds();
// 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
g.setClip(bounds);
// X-Axis
int xTickSpace = Utils.getTickSpace((int) bounds.getWidth());
int xLeftMargin = Utils.getTickStartOffset((int) bounds.getWidth(), xTickSpace);
......@@ -113,11 +116,6 @@ public class PlotContentLineChart extends PlotContent {
// System.out.println(x);
}
// break out of out of over-ridden min and max values
if (x < getChartPainter().getStyleManager().getXAxisMin() || x > getChartPainter().getStyleManager().getXAxisMax()) {
continue;
}
if (getChartPainter().getStyleManager().isXAxisLogarithmic()) {
x = Math.log10(x);
}
......@@ -136,10 +134,6 @@ public class PlotContentLineChart extends PlotContent {
double yOrig = next.doubleValue();
// break out of out of over-ridden min and max values
if (yOrig < getChartPainter().getStyleManager().getYAxisMin() || yOrig > getChartPainter().getStyleManager().getYAxisMax()) {
continue;
}
double y = 0.0;
// System.out.println(y);
......
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