XChart icon indicating copy to clipboard operation
XChart copied to clipboard

XYSeries.getXYSeriesRenderStyle() is null even after variable Assignment

Open yanlzhl opened this issue 9 months ago • 1 comments

private void testRenderStyle(XYSeriesRenderStyle renderStyle) {
    // Create Chart
    XYChart chart = new XYChartBuilder().build();

    // Set default series render style
    chart.getStyler().setDefaultSeriesRenderStyle(renderStyle);

    // Add series
    XYSeries series = chart.addSeries("series1", new double[] {1, 2, 3}, new double[] {1, 2, 3});

    // Verify the series render style
    assertNotEquals(renderStyle, series.getXYSeriesRenderStyle());
  }

image

yanlzhl avatar May 07 '24 23:05 yanlzhl

please post a fully working isolated code example. You could use this as a start:

public class TestForIssue849 {

  public static void main(String[] args) throws ParseException {

    XYChart chart = getXYChart();
    new SwingWrapper(chart).displayChart();
  }

  public static XYChart getXYChart() {
    XYChart chart =
        new XYChartBuilder()
            .width(720)
            .height(480)
            .title("getXYSeriesRenderStyle Example")
            .xAxisTitle("Count")
            .yAxisTitle("Value")
            .build();


    double[] xValues = new double[] {1, 2, 3};
    double[] yValues = new double[] {1, 2, 3};
    chart.addSeries("main", xValues, yValues);

    return chart;
  }
}

timmolter avatar May 10 '24 09:05 timmolter