首页 > 学院 > 开发设计 > 正文

JavaFx开发的图表

2019-11-14 21:56:34
字体:
来源:转载
供稿:网友
javaFx开发的图表

效果图<ignore_js_op>

代码如下:

  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. public class PieChartSample extends Application {
  9. @Override public void start(Stage stage) {
  10. Scene scene = new Scene(new Group());
  11. stage.setTitle("Imported Fruits");
  12. stage.setWidth(500);
  13. stage.setHeight(500);
  14. ObservableList<PieChart.Data> pieChartData =
  15. FXCollections.observableArrayList(
  16. new PieChart.Data("Grapefruit", 13),
  17. new PieChart.Data("Oranges", 25),
  18. new PieChart.Data("Plums", 10),
  19. new PieChart.Data("Pears", 22),
  20. new PieChart.Data("Apples", 30));
  21. final PieChart chart = new PieChart(pieChartData);
  22. chart.setTitle("水果");
  23. .......

详细说明:http://java.662p.com/thread-3725-1-1.html


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表