XChart
XChart copied to clipboard
Incorrect Y-Axis for Category Chart when using Line Render Style
The y-axis is incorrect for category chart when using line rendering style. The chart becomes correct if the y-axis min is explicitly set to 0 i.e. x chart.getStyler().setYAxisMin(0.0). If the y-axis min is set to something other than 0, the axes are again incorrect. This bug does not occur when using bar rendering style.
Example:
double[] xData = new double[] { 0.0, 1.0, 2.0, 3.0, 4.0 };
double[] yData = new double[] { 2.0, 1.5, 4.0, 3.77, 2.5 };
// Create Chart
CategoryChartBuilder builder = new CategoryChartBuilder();
builder.title("Sample Chart")
.xAxisTitle("X")
.yAxisTitle("Y")
.theme(ChartTheme.Matlab);
CategoryChart chart = builder.build();
chart.getStyler().setDefaultSeriesRenderStyle(CategorySeries.CategorySeriesRenderStyle.Line);
// .setYAxisMin(0.0);
chart.addSeries("y(x)", xData, yData);
// Show it
new SwingWrapper(chart).displayChart();
Identified the same issue today. Thanks Daniel.
Thanks. I'm looking at it now.
Fixed. I'll push a release soon.
Thanks Tim!
On Sun, Sep 18, 2022 at 2:50 PM Tim Molter @.***> wrote:
Closed #653 https://github.com/knowm/XChart/issues/653 as completed.
— Reply to this email directly, view it on GitHub https://github.com/knowm/XChart/issues/653#event-7409307732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF6VAPMBYZSWBQLJ5JHJKOLV65P73ANCNFSM5LUL3MBA . You are receiving this because you authored the thread.Message ID: @.***>