0
@Override public void start(Stage stage) throws Exception { PieChart pie = new PieChart(); pie.setData(getChart()); StackPane pane = new StackPane(); Scene scene = new Scene(pane); stage.setScene(scene); pane.getChildren().addAll(pie); stage.show(); } private ObservableList<PieChart.Data> getChart() { ObservableList<PieChart.Data> list = FXCollections.observableArrayList(); list.addAll(new PieChart.Data("java",20), new PieChart.Data("c",20), new PieChart.Data("C++",20)); return list; } 

i want this chart to be displayed on scene builder. how is it possible..??

1 Answer 1

1

pie

In SceneBuilder, from the menu:

  1. Select File | Open
  2. Choose pie.fxml
  3. Select View | Show Sample Data

pie.fxml

<?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.chart.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.paint.*?> <StackPane id="StackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="250.0" prefWidth="300.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2"> <children> <PieChart id="PieChart" prefHeight="-1.0" prefWidth="-1.0" /> </children> </StackPane> 
Sign up to request clarification or add additional context in comments.

1 Comment

i am sorry to ask this. could u help me with a step by step process for the solved answer. i m a basic to javaFX n scene builder. if u can provide me ur mail_id it wud b better. i can clarify my doubts when ur available. my id [email protected]

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.