當前位置: 首頁>>代碼示例>>Java>>正文


Java PieChart.setLegendVisible方法代碼示例

本文整理匯總了Java中javafx.scene.chart.PieChart.setLegendVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java PieChart.setLegendVisible方法的具體用法?Java PieChart.setLegendVisible怎麽用?Java PieChart.setLegendVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.chart.PieChart的用法示例。


在下文中一共展示了PieChart.setLegendVisible方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPieChart

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/** 
 * Creates a pie chart
 * 
 * @return {@link PieChart}
 */
private PieChart createPieChart() {
	PieChart chart = new PieChart();
	chart.setMinHeight(chartHeight);
	chart.setTitle("Time needed in mode");
	chart.setLegendVisible(false);
	chart.getStyleClass().add("statistic-chart");
	chart.getStyleClass().add("statistic-chart-pie");
	
	long[] durations = trackingSession.getDuration();
	
	PieChart.Data redData = new PieChart.Data("RED", durations[0]/1000.0);
	PieChart.Data greenData = new PieChart.Data("GREEN", durations[1]/1000.0);
	PieChart.Data blueData = new PieChart.Data("BLUE", durations[2]/1000.0);
	
	if(durations[0] != 0) {
		chart.getData().addAll(redData, greenData, blueData);
	}
	
	return chart;
}
 
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-null,代碼行數:26,代碼來源:TrackingStatistic.java

示例2: initChart

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
 * Generate pipe chart
 */
private void initChart() {
    PieChart.Data available = new PieChart.Data("Available", 13);
    PieChart.Data used = new PieChart.Data("Used", 25);
    PieChart.Data empty = new PieChart.Data("Empty", 10);


    ObservableList<PieChart.Data> pieChartData =
            FXCollections.observableArrayList(available, used, empty);
    final PieChart chart = new PieChart(pieChartData);
    chart.setTitle("");
    chart.setPrefSize(350, 350);
    chart.setLegendVisible(false);
    chart.setStyle("-fx-background-color: none");
    pieChartPane.getChildren().add(chart);

    available.getNode().setStyle("-fx-background-color: #55c4fe");
    used.getNode().setStyle("-fx-background-color: #008287");
    empty.getNode().setStyle("-fx-background-color: #219297");

}
 
開發者ID:StnetixDevTeam,項目名稱:ariADDna,代碼行數:24,代碼來源:CloudSettingsController.java

示例3: getSystemPanel

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private HBox getSystemPanel() {
    ObservableList<PieChart.Data> pieChartData =
            FXCollections.observableArrayList();
    CONNECTIONS.forEach((string, clientObject) -> {
        if (clientObject.getSYSTEM_OS() != null) {
            if (operatingSystems.containsKey(clientObject.getSYSTEM_OS())) {
                operatingSystems.put(clientObject.getSYSTEM_OS(), operatingSystems.get(clientObject.getSYSTEM_OS()) + 1);
            } else {
                operatingSystems.put(clientObject.getSYSTEM_OS(), 1);
            }
        }
    });
    operatingSystems.forEach((string, integer) -> {
        pieChartData.add(new PieChart.Data(string, CONNECTIONS.size() / integer));
    });
    final PieChart chart = new PieChart(pieChartData);
    chart.setLegendVisible(false);
    chart.setTitle("Operating Systems");
    chart.setMaxSize(300, 300);
    return Styler.hContainer(Styler.vContainer(10, chart));
}
 
開發者ID:Ghosts,項目名稱:Maus,代碼行數:22,代碼來源:StatisticsView.java

示例4: makeGenotypePie

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private PieChart makeGenotypePie(final VariantContext ctx) {
    final Counter<GenotypeType> countTypes= new Counter<>();
    if(ctx!=null) {
    	for(final Genotype g:ctx.getGenotypes())
{
    		// ignore genotype if not displayed
    		final SampleDef sampleDef= this.name2sampledef.get(g.getSampleName());
    		if(sampleDef==null || !sampleDef.isDisplayed()) continue;

    		countTypes.incr(g.getType());
}
    	}
	final ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
	for(final GenotypeType t:GenotypeType.values())
		{
		
		int c= (int)countTypes.count(t);
		if(c==0) continue;
		pieChartData.add(new PieChart.Data(
				t.name()+" = "+c,
				c));
		}
    final PieChart chart = new PieChart(pieChartData);
    chart.setLegendVisible(false);
    return chart;
	}
 
開發者ID:lindenb,項目名稱:jvarkit,代碼行數:27,代碼來源:VcfStage.java

示例5: getPieChart

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
static PieChart getPieChart(String title) {

        PieChart pie = new PieChart();
        pie.setTitle(title);
        pie.setLegendVisible(false);
        pie.setBackground(Background.EMPTY);
        pie.setLegendVisible(true);
        pie.setLegendSide(Side.RIGHT);
        return pie;
    }
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:11,代碼來源:FxBuilder.java

示例6: build

import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
@Override
public Chart build() {	
       final ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
       for(int i=0;i< categories.length;++i)
		{
       	if(counts[i]==0) continue;
       	pieChartData.add( new PieChart.Data(categories[i].getName() +" "+counts[i], counts[i]));
		}
       final PieChart chart = new PieChart(pieChartData);
       chart.setTitle(this.getName());
       chart.setLegendVisible(false);
       return chart;
	}
 
開發者ID:lindenb,項目名稱:jvarkit,代碼行數:14,代碼來源:VariantTypeChartFactory.java

示例7: 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


注:本文中的javafx.scene.chart.PieChart.setLegendVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。