本文整理匯總了Java中javafx.scene.chart.PieChart.setData方法的典型用法代碼示例。如果您正苦於以下問題:Java PieChart.setData方法的具體用法?Java PieChart.setData怎麽用?Java PieChart.setData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.PieChart
的用法示例。
在下文中一共展示了PieChart.setData方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getChartInfos
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
public String getChartInfos(PieChart chart,char Phase) {
actualPhase = Phase;
stopTime(Phase);
elapsedTimed=System.currentTimeMillis()-(StartTime+trackerTime);
RedTimeInPreCent = Math.round(((double) RedTime/elapsedTimed)*100);
GreenTimeInPreCent = Math.round(((double) GreenTime/elapsedTimed)*100);
RefactorTimeInPreCent = Math.round(((double) RefactorTime/elapsedTimed)*100);
ExtraInfo=setExtraInfo();
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("RED-Time", RedTimeInPreCent),
new PieChart.Data("GREEN-Time", GreenTimeInPreCent),
new PieChart.Data("REFACTOR-Time", RefactorTimeInPreCent));
chart.setData(pieChartData);
chart.setTitle("Phase Duration");
return getTrackingStats();
}
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代碼行數:18,代碼來源:TrackingUnit.java
示例2: getPieChart
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
public PieChart getPieChart() {
PieChart pieChart = new PieChart();
pieChart.setTitle(chartTitle());
pieChart.setData(pieChartData());
return pieChart;
}
示例3: getPane
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
public BorderPane getPane() {
TableView<Details> table = new TableView<Details>();
PieChart chart =new PieChart() ;
ObservableList<Details> list = FXCollections.observableArrayList();
TableColumn<Details, String> name = new TableColumn<>("Name");
name.setPrefWidth(100);
TableColumn<Details, String> todayExpense = new TableColumn<>("Today Expense");
todayExpense.setPrefWidth(105);
TableColumn<Details, String> todayUnits = new TableColumn<>("Today Units");
todayUnits.setPrefWidth(100);
TableColumn<Details, String> totalExpense = new TableColumn<>("Total Expense");
totalExpense.setPrefWidth(100);
TableColumn<Details, String> totalUnits = new TableColumn<>("Total Units");
totalUnits.setPrefWidth(100);
name.setCellValueFactory(new PropertyValueFactory<Details,String>("name"));
todayExpense.setCellValueFactory(new PropertyValueFactory<Details,String>("todayExpense"));
todayUnits.setCellValueFactory(new PropertyValueFactory<Details,String>("todayUnits"));
totalExpense.setCellValueFactory(new PropertyValueFactory<Details,String>("totalExpense"));
totalUnits.setCellValueFactory(new PropertyValueFactory<Details,String>("totalUnits"));
table.getColumns().addAll(name,todayExpense,todayUnits,totalExpense,totalUnits);
Details detail1 = new Details("Lights", "3400", "40", "6000", "67");
list.addAll(detail1, new Details("Refrigerator", "40000", "40", "8000", "67"),new Details("Television", "3000", "40", "5000", "67"),new Details("Fans", "300", "20", "600", "47"),new Details("A.C", "7000", "80", "10000", "100"),new Details("Oven", "3400", "50", "6500", "70"),new Details("Washing Machine", "3700", "60", "6500", "80"));
table.setItems(list);
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(
new PieChart.Data("Device 1", 200),
new PieChart.Data("Device 2", 130),
new PieChart.Data("Device 3", 100),
new PieChart.Data("Device 4", 200)
);
chart.setLabelsVisible(false);
chart.setLegendVisible(true);
chart.setMaxSize(400, 400);
chart.setLegendSide(Side.RIGHT);
chart.setLabelLineLength(3);
chart.setLegendSide(Side.BOTTOM);
chart.setData(pieChartData);
BorderPane pane = new BorderPane();
pane.setStyle("-fx-background-color: #1d1d1d");
pane.setLeft(table);
pane.setRight(chart);
return pane;
}
示例4: createScene
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private static Scene createScene() {
javafx.scene.chart.NumberAxis myaxis1 = new javafx.scene.chart.NumberAxis();
javafx.scene.chart.NumberAxis myaxis2 = new javafx.scene.chart.NumberAxis();
PieChart pieChart = new PieChart();
pieChart.setData(getChartData());
BorderPane pane = new BorderPane();
pane.setCenter(pieChart);
Scene myScene = new Scene(pane, Color.ALICEBLUE);
return myScene;
}