Example usage for javafx.scene.chart PieChart setLegendVisible

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

Introduction

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

Prototype

public final void setLegendVisible(boolean value) 

Source Link

Usage

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

/**
 * Generates a pie chart.//from   www .  j a va 2  s  .com
 *
 * @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;
}