Java Code Examples for javafx.scene.chart.PieChart#setTitle()
The following examples show how to use
javafx.scene.chart.PieChart#setTitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetailPCController.java From FlyingAgent with Apache License 2.0 | 7 votes |
private void addDiskBox(Disk disk) { try { Parent parentDisk = FXMLLoader.load(getClass().getResource("/resources/views/models/DiskInfo.fxml")); //Label lblName = (Label) parentDisk.lookup("#lblName"); Label lblTotalSpace = (Label) parentDisk.lookup("#lblTotalSpace"); PieChart pieData = (PieChart) parentDisk.lookup("#pieData"); pieData.setTitle(disk.getName()); lblTotalSpace.setText(Utils.humanReadableByteCount(disk.getTotalSpace())); // Data of pie chart ObservableList<PieChart.Data> data = FXCollections.observableArrayList(); data.add(new PieChart.Data("Usable", Utils.humanReadableByteCountNumber(disk.getUsableSpace()))); data.add(new PieChart.Data("Free", Utils.humanReadableByteCountNumber(disk.getFreeSpace()))); pieData.setData(data); pieData.getData().forEach(d -> d.nameProperty().bind(Bindings.concat(d.getName(), " ", d.pieValueProperty(), " GB")) ); boxContainerDisks.getChildren().add(parentDisk); } catch (IOException ioe) { ioe.printStackTrace(); } }
Example 2
Source File: ScanAllController.java From FlyingAgent with Apache License 2.0 | 6 votes |
private void addDiskBox(Disk disk) { try { Parent parentDisk = FXMLLoader.load(getClass().getResource("/resources/views/models/DiskInfo.fxml")); //Label lblName = (Label) parentDisk.lookup("#lblName"); Label lblTotalSpace = (Label) parentDisk.lookup("#lblTotalSpace"); PieChart pieData = (PieChart) parentDisk.lookup("#pieData"); pieData.setTitle(disk.getName()); lblTotalSpace.setText(Utils.humanReadableByteCount(disk.getTotalSpace())); // Data of pie chart ObservableList<PieChart.Data> data = FXCollections.observableArrayList(); data.add(new PieChart.Data("Usable", Utils.humanReadableByteCountNumber(disk.getUsableSpace()))); data.add(new PieChart.Data("Free", Utils.humanReadableByteCountNumber(disk.getFreeSpace()))); pieData.setData(data); pieData.getData().forEach(d -> d.nameProperty().bind(Bindings.concat(d.getName(), " ", d.pieValueProperty(), " GB")) ); boxContainerDisks.getChildren().add(parentDisk); } catch (IOException ioe) { ioe.printStackTrace(); } }
Example 3
Source File: PieChart - MainApp.java From Java-for-Data-Science with MIT License | 6 votes |
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Europian Country Population"); stage.setWidth(500); stage.setHeight(500); ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( new PieChart.Data("Belgium", 3), new PieChart.Data("France", 26), new PieChart.Data("Germany", 35), new PieChart.Data("Netherlands", 7), new PieChart.Data("Sweden", 4), new PieChart.Data("United Kingdom", 25)); final PieChart pieChart = new PieChart(pieChartData); pieChart.setTitle("Country Population"); ((Group) scene.getRoot()).getChildren().add(pieChart); stage.setScene(scene); stage.show(); }
Example 4
Source File: ChartGenerator.java From testgrid with Apache License 2.0 | 6 votes |
/** * Generates a pie chart with the summary test results of the current build. * * @param passedCount passed test count * @param failedCount failed test count * @param skippedCount skipped test count * @param summaryChartFileName file name of the summary chart */ public void generateSummaryChart(int passedCount, int failedCount, int skippedCount, String summaryChartFileName) { List<PieChart.Data> data = new ArrayList<>(); data.add(new PieChart.Data(StringUtil.concatStrings("Test Failures (", Integer.toString(failedCount), ")"), failedCount)); data.add(new PieChart.Data(StringUtil.concatStrings("Deployment Errors (", Integer.toString (skippedCount), ")"), skippedCount)); data.add(new PieChart.Data(StringUtil.concatStrings("Passed (", Integer.toString(passedCount), ")"), passedCount)); ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(data); final PieChart chart = new PieChart(pieChartData); chart.setAnimated(false); chart.setLabelsVisible(true); chart.setTitle("Build Summary of Infrastructure Combinations (" + (failedCount + skippedCount + passedCount) + ")"); genChart(chart, 600, 600, summaryChartFileName, "styles/summary.css"); }
Example 5
Source File: CloudSettingsController.java From ariADDna with Apache License 2.0 | 6 votes |
/** * 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"); }
Example 6
Source File: StatisticsView.java From Maus with GNU General Public License v3.0 | 6 votes |
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)); }
Example 7
Source File: AdvancedPieChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
protected PieChart createChart() { final PieChart pc = new PieChart(FXCollections.observableArrayList( new PieChart.Data("Sun", 20), new PieChart.Data("IBM", 12), new PieChart.Data("HP", 25), new PieChart.Data("Dell", 22), new PieChart.Data("Apple", 30) )); // setup chart pc.setId("BasicPie"); pc.setTitle("Pie Chart Example"); return pc; }
Example 8
Source File: AdvancedPieChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
protected PieChart createChart() { final PieChart pc = new PieChart(FXCollections.observableArrayList( new PieChart.Data("Sun", 20), new PieChart.Data("IBM", 12), new PieChart.Data("HP", 25), new PieChart.Data("Dell", 22), new PieChart.Data("Apple", 30) )); // setup chart pc.setId("BasicPie"); pc.setTitle("Pie Chart Example"); return pc; }
Example 9
Source File: ChartAdvancedPie.java From netbeans with Apache License 2.0 | 5 votes |
protected PieChart createChart() { final PieChart pc = new PieChart(FXCollections.observableArrayList( new PieChart.Data("Sun", 20), new PieChart.Data("IBM", 12), new PieChart.Data("HP", 25), new PieChart.Data("Dell", 22), new PieChart.Data("Apple", 30) )); // setup chart pc.setId("BasicPie"); pc.setTitle("Pie Chart Example"); return pc; }