1.import javafx.application.Application;2.import javafx.collections.FXCollections;3.import javafx.collections.ObservableList;4.import javafx.scene.Scene;5.import javafx.stage.Stage;6.import javafx.scene.chart.*;7.import javafx.scene.Group;8. 9.public class PieChartSample extends Application {10. 11. @Override public void start(Stage stage) {12. Scene scene = new Scene(new Group());13. stage.setTitle("Imported Fruits");14. stage.setWidth(500);15. stage.setHeight(500);16. 17. ObservableList<PieChart.Data> pieChartData =18. FXCollections.observableArrayList(19. new PieChart.Data("Grapefruit", 13),20. new PieChart.Data("Oranges", 25),21. new PieChart.Data("Plums", 10),22. new PieChart.Data("Pears", 22),23. new PieChart.Data("Apples", 30));24. final PieChart chart = new PieChart(pieChartData);25. chart.setTitle("水果");26........
原标题:JavaFx开发的图表实例
关键词:JAVA