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

improved Area Chart error conditions

parent 2883eec0
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,10 @@ public class AreaChart02 implements ExampleChart {
}
xData.add(10);
yData.add(null);
xData.add(11);
yData.add(100);
xData.add(12);
yData.add(90);
chart.addSeries("a", xData, yData);
......
......@@ -31,6 +31,9 @@ import com.xeiam.xchart.internal.style.XChartTheme;
*/
public class StyleManager {
/**
* Note: For Area Charts, the X-Axis data must be in ascending order.
*/
public enum ChartType {
Line, Scatter, Area, Bar
......
......@@ -194,9 +194,11 @@ public class PlotContentLineChart extends PlotContent {
path.moveTo(previousX, yBottomOfArea);
path.lineTo(previousX, previousY);
}
path.lineTo(xOffset, yOffset);
}
if (xOffset < previousX) {
throw new RuntimeException("X-Data must be in ascending order for Area Charts!!!");
}
}
previousX = xOffset;
......
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