Example usage for javafx.scene.chart PieChart setTitle

List of usage examples for javafx.scene.chart PieChart setTitle

Introduction

In this page you can find the example usage for javafx.scene.chart PieChart setTitle.

Prototype

public final void setTitle(String value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*w  ww  .j a  v a  2  s .  co  m*/

    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.requestLayout();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*  ww w .j a  va2s.co  m*/

    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();

    System.out.println(pieChart.isClockwise());
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*  ww  w .j  av  a  2s. co m*/

    System.out.println(pieChart.getData());

    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();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*from w  w  w .  jav a  2  s.c o m*/

    System.out.println(pieChart.dataProperty());

    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();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());//from   w  ww .  j  a  v a 2  s. c  o  m

    System.out.println(pieChart.getLabelsVisible());

    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();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*  w  ww . j  a  va 2 s .  c om*/

    System.out.println(pieChart.clockwiseProperty());

    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();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());//from w w w  . j  a v  a 2s  .c o m

    System.out.println(pieChart.getLabelLineLength());

    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();
}

From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java

/**
 * This method is invoked when the "by category" button has been toggled
 *
 * @param actionEvent//from  w w  w . ja  v a 2  s . co m
 */
public void byCategoryToggled(ActionEvent actionEvent) {
    final PieChart pieChart = new PieChart();
    pieChart.setTitle("Transaction balance by categories");
    pieChart.setLegendSide(LEFT);
    chartFrame.setCenter(pieChart);
    ToggleButton toggle = (ToggleButton) actionEvent.getTarget();
    if (toggle.isSelected()) {
        Service<Void> service = new Service<Void>() {
            @Override
            protected Task<Void> createTask() {
                return new Task<Void>() {
                    @Override
                    protected Void call() throws Exception {
                        ValueRange<LocalDate> period = getTransactionOpRange(accountCombo.getValue(),
                                yearCombo.getValue());
                        if (period.isEmpty()) {
                            return null;
                        }
                        Platform.runLater(() -> pieChart.setTitle(format("%s for transactions from %s until %s",
                                pieChart.getTitle(), period.from().format(DATE_FORMATTER),
                                period.to().format(DATE_FORMATTER))));

                        categoryRepository.findAll().stream()
                                .sorted((c1, c2) -> c1.getName().compareTo(c2.getName())).forEach(category -> {
                                    List<Transaction> found = (accountCombo.getValue() == ALL_ACCOUNTS)
                                            ? transactionRepository.findByCategory(category)
                                            : transactionRepository.findByAccountAndCategory(
                                                    accountCombo.getValue(), category);
                                    if (INTEGER_ZERO.compareTo(yearCombo.getValue()) < 0) {
                                        found = found.stream().filter(
                                                trx -> yearCombo.getValue().equals(trx.getDtOp().getYear()))
                                                .sorted((t1, t2) -> t1.getDtOp().compareTo(t2.getDtOp()))
                                                .collect(toList());
                                    }
                                    List<Transaction> transactions = new ArrayList<>(found.size());
                                    transactions.addAll(found);
                                    Platform.runLater(() -> {
                                        double value = getSum(transactions);
                                        String name = format("%s [%s]", category.getName(),
                                                CurrencyFormat.getInstance().format(value));
                                        PieChart.Data data = new PieChart.Data(name, value);
                                        pieChart.getData().add(data);
                                        data.getNode().addEventHandler(MOUSE_CLICKED,
                                                event -> handleCategoryChartMouseClickEvent(
                                                        (accountCombo.getValue() == ALL_ACCOUNTS) ? null
                                                                : accountCombo.getValue(),
                                                        category, yearCombo.getValue(), event));
                                    });
                                });
                        return null;
                    }
                };
            }
        };
        service.start();
    }
}

From source file:de.ifsr.adam.ImageGenerator.java

/**
 * Generates a pie chart.//from   w  w  w  . jav a  2s.co m
 *
 * @param question A question JSONObject of a report
 * @return
 */
private PieChart generatePieChart(JSONObject question) {
    ObservableList<PieChart.Data> data;
    PieChart chart;

    JSONObject surveyQuestion;
    JSONObject answerType;
    JSONObject result;

    try {
        surveyQuestion = getSurveyQuestion(question.getString("question"));
        try {
            answerType = getAnswerType(surveyQuestion.getString("type"));
        } catch (NullPointerException e) {
            log.error("The answerType of " + question + " wasnt generated due to a NullPointer");
            log.debug("", e);
            return null;
        }

        result = question.getJSONObject("result");
        data = generateDataPieChart(result, answerType);

        chart = new PieChart(data);
        chart.setTitle(surveyQuestion.getString("text"));
        chart.setLegendVisible(false);
    } catch (JSONException e) {
        log.error(e);
        return null;
    }

    return chart;
}