当前位置: 首页>>代码示例>>Java>>正文


Java PieChart.setData方法代码示例

本文整理汇总了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;
}
 
开发者ID:kwilliams3,项目名称:Recordian,代码行数:7,代码来源:PieChartFactory.java

示例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;
	  
}
 
开发者ID:naeemkhan12,项目名称:IOTproject,代码行数:46,代码来源:ChartControls.java

示例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;
    }
 
开发者ID:scalalab,项目名称:scalalab,代码行数:17,代码来源:javaFXPlotPie.java


注:本文中的javafx.scene.chart.PieChart.setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。