import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.chart.PieChart;
import
javafx.scene.layout.*;
import
javafx.event.ActionEvent;
import
javafx.scene.AmbientLight;
import
javafx.scene.shape.Sphere;
import
javafx.scene.control.*;
import
javafx.stage.Stage;
import
javafx.scene.Group;
import
javafx.scene.PerspectiveCamera;
import
javafx.scene.paint.Color;
import
javafx.event.ActionEvent;
import
javafx.event.EventHandler;
import
javafx.collections.FXCollections;
public
class
pie_chart_2
extends
Application {
public
void
start(Stage stage)
{
stage.setTitle("Creating Pie Chart");
PieChart.Data data[] =
new
PieChart.Data[
5
];
String status[] = {"Correct Answer", "Wrong Answer",
"Compilation Error", "Runtime Error",
"Others"};
int
values[] = {
20
,
30
,
10
,
4
,
2
};
for
(
int
i =
0
; i <
5
; i++) {
data[i] =
new
PieChart.Data(status[i], values[i]);
}
PieChart pie_chart =
new
PieChart(FXCollections.observableArrayList(data));
pie_chart.setLabelLineLength(
10
.0f);
pie_chart.setLabelsVisible(
true
);
pie_chart.setStartAngle(
20
.0f);
pie_chart.setClockwise(
false
);
Group group =
new
Group(pie_chart);
Scene scene =
new
Scene(group,
500
,
500
);
stage.setScene(scene);
stage.show();
}
public
static
void
main(String args[])
{
launch(args);
}
}