Skip to content

Box chart gets stuck when only one yData value is provided #890

@hogan-deng

Description

@hogan-deng

Describe the bug
If the box chart is given only one yData value, rendering gets stuck. When displaying the chart, the window appears blank, and the close button becomes unresponsive. Attempting to save the chart results in a broken or unreadable image file.

To Reproduce
The following sample can reproduce the bug:

public class TestForIssue834 {

public static void main(String[] args) throws ParseException {
    BoxChart chart = getBoxChart();
    new SwingWrapper(chart).displayChart();
  }

  public static BoxChart getBoxChart() {
    BoxChart chart = new BoxChartBuilder()
      .title("box plot demo")
      .xAxisTitle("X")
      .yAxisTitle("Y")
      .build();

    chart.addSeries("test", Arrays.asList(1));

    return chart;
  }
}

Screenshots
Image

Expected behavior
An appropriate warning (e.g., illegal argument) should be shown, or the program should complete without crashing, even if the result is a blank image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions