在 Swing 中使用 JavaFX,我为场景创建了 JFXPAnel 和 ScatterChart。
但是从图表来看,数据并不完全正确。看起来好像是在数据点而不是形状的中心绘制了左上角的图标。
这是我正在使用的示例数据。您会注意到所有 Y 值都是整数。但是当显示图表时,图标位于该值的线下方。这是一个 JavaFX 错误,还是我做错了什么?
XYChart.Series series1 = new XYChart.Series();
series1.setName("Effects");
series1.getData().add(new XYChart.Data(4.2, 2));
series1.getData().add(new XYChart.Data(2.8, 2));
series1.getData().add(new XYChart.Data(6.2, 2));
series1.getData().add(new XYChart.Data(1, 1));
series1.getData().add(new XYChart.Data(1.2, 1));
series1.getData().add(new XYChart.Data(4.4, 1));
series1.getData().add(new XYChart.Data(8.5, 1));
series1.getData().add(new XYChart.Data(6.9, 1));
series1.getData().add(new XYChart.Data(9.9, 1));
series1.getData().add(new XYChart.Data(0.9, 1));
series1.getData().add(new XYChart.Data(3.2, 3));
series1.getData().add(new XYChart.Data(4.8, 3));
series1.getData().add(new XYChart.Data(7.3, 3));
series1.getData().add(new XYChart.Data(1.8, 3));
series1.getData().add(new XYChart.Data(7.3, 3));
series1.getData().add(new XYChart.Data(2.7, 3));
XYChart.Series series2 = new XYChart.Series();
series2.setName("Cause");
series2.getData().add(new XYChart.Data(2.4, -1));
series2.getData().add(new XYChart.Data(3.2, -1));
series2.getData().add(new XYChart.Data(1.8, -1));
series2.getData().add(new XYChart.Data(3.2, -1));
series2.getData().add(new XYChart.Data(7.4, -1));
series2.getData().add(new XYChart.Data(3.5, -2));
series2.getData().add(new XYChart.Data(9.3, -2));
series2.getData().add(new XYChart.Data(8.1, -2));
XYChart.Series series3 = new XYChart.Series();
series3.setName("Events");
series3.getData().add(new XYChart.Data(5.2, 0));
series3.getData().add(new XYChart.Data(2.9, 0));
series3.getData().add(new XYChart.Data(3.3, 0));