0
在Swing中使用JavaFX,我創建了一個JFXPAnel和一個ScatterChart到場景中。JavaFX ScatterChart Data不會出現在正確的位置
然而,看着圖表的數據是不是很正確。看起來好像左上角的圖標正在數據點繪製,而不是形狀的中心。
這是我使用的示例數據。你會注意到所有的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));