-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloController.java
More file actions
37 lines (27 loc) · 831 Bytes
/
Copy pathHelloController.java
File metadata and controls
37 lines (27 loc) · 831 Bytes
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
package com.example.javafxproject1;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.TextField;
import java.net.URL;
import java.util.ResourceBundle;
public class HelloController implements Initializable {
@FXML
private LineChart<?, ?> chart;
@FXML
private TextField xPara;
@FXML
private TextField yPara;
@Override
public void initialize(URL Url, ResourceBundle resourceBundle) {
}
XYChart.Series seriesReal = new XYChart.Series();
@FXML
public void onAddDataClick() {
String x = xPara.getText();
int y = Integer.parseInt(yPara.getText());
seriesReal.getData().add(new XYChart.Data(x, y));
chart.getData().add(seriesReal);
}
}