Example usage for org.jfree.chart ChartPanel setEnabled

List of usage examples for org.jfree.chart ChartPanel setEnabled

Introduction

In this page you can find the example usage for org.jfree.chart ChartPanel setEnabled.

Prototype

@BeanProperty(expert = true, preferred = true, visualUpdate = true, description = "The enabled state of the component.")
public void setEnabled(boolean enabled) 

Source Link

Document

Sets whether or not this component is enabled.

Usage

From source file:Visuals.PieChart.java

public ChartPanel drawPieChart() {
    DefaultPieDataset piedataset = new DefaultPieDataset();
    if (riskCount == 0) {
        title = "";
        piedataset.setValue(noVulnerabilities, new Integer(1));
    } else {//from  w  w w  .  ja  v  a  2 s. c o m
        piedataset.setValue(lowValue, new Integer(low));
        piedataset.setValue(mediumValue, new Integer(medium));
        piedataset.setValue(highValue, new Integer(high));
        piedataset.setValue(criticalValue, new Integer(critical));
    }

    JFreeChart piechart = ChartFactory.createPieChart(title, // Title  
            piedataset, // Dataset  
            true, // Show legend  
            true, // Use tooltips  
            false // Generate URLs  
    );

    PiePlot plot = (PiePlot) piechart.getPlot();
    //plot.setSimpleLabels(true); 
    if (riskCount == 0) {
        plot.setSectionPaint(noVulnerabilities, new Color(47, 196, 6));
        plot.setLabelLinksVisible(false);
        plot.setLabelGenerator(null);
        piechart.removeLegend();
    } else {
        plot.setSectionPaint(criticalValue, new Color(230, 27, 27));
        plot.setSectionPaint(highValue, new Color(230, 90, 27));
        plot.setSectionPaint(mediumValue, new Color(85, 144, 176));
        plot.setSectionPaint(lowValue, new Color(230, 219, 27));
    }

    if (isMain) {
        piechart.removeLegend();
    }
    plot.setBackgroundPaint(new Color(210, 234, 243));
    ChartPanel chartPanel = new ChartPanel(piechart);
    chartPanel.setEnabled(false);
    return chartPanel;
}