/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package piechartsample; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.chart.PieChart; import javafx.stage.Stage; /** * * @author kitsunesaki */ public class PieChartSample extends Application { @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(500); stage.setHeight(500); ObservableList pieChartData = FXCollections.observableArrayList( new PieChart.Data("Grapefruit", 13), new PieChart.Data("Oranges", 25), new PieChart.Data("Plums", 10), new PieChart.Data("Pears", 22), new PieChart.Data("Apples", 30)); final PieChart chart = new PieChart(pieChartData); //chart.setStyle("-fx-pie-label-visible: false"); chart.setLabelsVisible(false); ((Group) scene.getRoot()).getChildren().add(chart); stage.setScene(scene); stage.show(); } /** * The main() method is ignored in correctly deployed JavaFX application. * main() serves only as fallback in case the application can not be * launched through deployment artifacts, e.g., in IDEs with limited FX * support. NetBeans ignores main(). * * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }