Repository navigation
Expand file tree
/
Copy pathFXMLDocumentController.java
More file actions
54 lines (39 loc) · 1.55 KB
/
Copy pathFXMLDocumentController.java
File metadata and controls
54 lines (39 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package barchartexample;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
public class FXMLDocumentController implements Initializable {
@FXML
private BarChart barChart;
@FXML
private CategoryAxis xAxis;
@FXML
private NumberAxis yAxis;
@Override
public void initialize(URL url, ResourceBundle rb) {
loadBarChar();
}
private void loadBarChar() {
XYChart.Series xyJava = new XYChart.Series();
XYChart.Series xyC = new XYChart.Series();
XYChart.Series xyJS = new XYChart.Series();
xyJava.setName("Java");
xyC.setName("C");
xyJS.setName("JS");
xyJava.getData().add(new XYChart.Data<>("September", 20));
xyC.getData().add(new XYChart.Data<>("September", 50));
xyJS.getData().add(new XYChart.Data<>("September", 30));
xyJava.getData().add(new XYChart.Data<>("October", 20));
xyC.getData().add(new XYChart.Data<>("October", 10));
xyJS.getData().add(new XYChart.Data<>("October", 80));
xyJava.getData().add(new XYChart.Data<>("November", 15));
xyC.getData().add(new XYChart.Data<>("November", 10));
xyJS.getData().add(new XYChart.Data<>("November", 20));
barChart.getData().addAll(xyJava, xyC, xyJS);
}
}