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.   
  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. .......

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

posted on 2014-11-18 09:44  wangniuzen  阅读(1730)  评论(0编辑  收藏  举报

导航