Java PieChart.setStartAngle(double value)

Syntax

PieChart.setStartAngle(double value) has the following syntax.

public final void setStartAngle(double value)

Example

In the following code shows how to use PieChart.setStartAngle(double value) method.


import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Side;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.chart.PieChart.Data;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
//w w  w  . j  a v  a  2 s .com
public class Main extends Application {
  public static void main(String[] args) {
    launch(args);
  }
  
  @Override
  public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());
    

    
    pieChart.setTitle("Title");
    pieChart.setLegendSide(Side.LEFT);
    pieChart.setClockwise(false);
    pieChart.setLabelsVisible(false);
    
    StackPane root = new StackPane();
    root.getChildren().add(pieChart);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
    
    pieChart.setStartAngle(5);
  }

  private ObservableList<Data> getChartData() {
    ObservableList<Data> answer = FXCollections.observableArrayList();
    answer.addAll(new PieChart.Data("java", 17.56),
            new PieChart.Data("JavaFx",31.37 )
            );
    return answer;
  }
  
  
}




















Home »
  Java Tutorial »
    javafx.scene.chart »




AreaChart
BarChart
BubbleChart
CategoryAxis
PieChart