-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathChartLesson.java
More file actions
35 lines (31 loc) · 1.04 KB
/
Copy pathChartLesson.java
File metadata and controls
35 lines (31 loc) · 1.04 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
package fx;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.stage.Stage;
/**
* Created by max on 3/3/17.
*/
public class ChartLesson extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
ObservableList<PieChart.Data> data = FXCollections.observableArrayList(
new PieChart.Data("Grapefruit", 13),
new PieChart.Data("Oranges", 25),
new PieChart.Data("Plums", 10),
new PieChart.Data("Pears", 22),
new PieChart.Data("Apples", 30));
PieChart chart = new PieChart(data);
chart.setTitle("products");
Group root = new Group();
root.getChildren().addAll(chart);
primaryStage.setScene(new Scene(root, 400, 300));
primaryStage.show();
}
}