Example usage for org.jfree.chart.plot PiePlot3D setIgnoreZeroValues

List of usage examples for org.jfree.chart.plot PiePlot3D setIgnoreZeroValues

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot3D setIgnoreZeroValues.

Prototype

public void setIgnoreZeroValues(boolean flag) 

Source Link

Document

Sets a flag that controls whether zero values are ignored, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:net.nosleep.superanalyzer.analysis.views.RatingView.java

private void refreshDataset() {
    _dataset.clear();//from  w w  w.j  av  a 2s. c o m

    Stat itemStats = null;

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector<Double> counts = new Vector<Double>(6);
    double[] ratings = itemStats.getRatings();
    for (int i = 0; i < ratings.length; i++)
        counts.addElement(new Double(ratings[i]));

    Vector<String> labels = new Vector<String>(6);
    labels.add(new String(Misc.getString("NOT_RATED")));
    labels.add(new String("1 " + Misc.getString("STAR")));
    labels.add(new String("2 " + Misc.getString("STARS")));
    labels.add(new String("3 " + Misc.getString("STARS")));
    labels.add(new String("4 " + Misc.getString("STARS")));
    labels.add(new String("5 " + Misc.getString("STARS")));

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    Color[] colors = Theme.getColorSet();
    plot.setIgnoreZeroValues(true);

    for (int i = 0; i < counts.size(); i++) {
        // if((Double)counts.elementAt(i) > 0)
        {
            _dataset.setValue((String) labels.elementAt(i), (Double) counts.elementAt(i));
            plot.setSectionPaint((String) labels.elementAt(i), colors[5 - i]);
        }
    }

}

From source file:org.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java

protected Plot getOutlinePlot() {
    if (outlinePlot == null) {
        PiePlot3D myMapPlot = new PiePlot3D();

        myMapPlot.setLabelGap(0);/*from   www. j  a  va  2 s  . c om*/
        myMapPlot.setIgnoreZeroValues(ignoreZeroValues);

        updateDataset();

        myMapPlot.setDataset(new DefaultPieDataset(dataset));
        myMapPlot.setDirection(clockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE);
        myMapPlot.setDepthFactor(depthFactor);
        myMapPlot.setMinimumArcAngleToDraw(minimumAngleToDraw);
        myMapPlot.setCircular(circular);
        myMapPlot.setStartAngle(getRotation());
        /*
         * myMapPlot.setDarkerSides(false); // requires jfreechart 1.0.10
         * myMapPlot.setForegroundAlpha(foregroundAlpha); // requires
         * jfreechart 1.0.10
         */
        outlinePlot = myMapPlot;
    }
    return outlinePlot;
}

From source file:net.nosleep.superanalyzer.analysis.views.QualityView.java

private void refreshDataset() {

    Stat itemStats = null;// w  w w  .  j av  a 2s .  c o  m

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector counts = new Vector(5);
    int[] rates = itemStats.getBitRates();
    for (int i = 0; i < rates.length; i++)
        counts.addElement(new Double(rates[i]));

    Vector labels = new Vector(5);
    labels.add(new String(Misc.getString("POOR") + "\n(0-63 kbps)\n"));
    labels.add(new String(Misc.getString("LOW") + "\n(64-127 kbps)\n"));
    labels.add(new String(Misc.getString("GOOD") + "\n(128-191 kbps)\n"));
    labels.add(new String(Misc.getString("HIGH") + "\n(192-255 kbps)\n"));
    labels.add(new String(Misc.getString("EXCELLENT") + "\n(256-320 kbps)\n"));

    _dataset.clear();

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    Color[] colors = Theme.getColorSet();
    plot.setIgnoreZeroValues(true);

    for (int i = 0; i < counts.size(); i++) {
        // if((Double)counts.elementAt(i) > 0)
        {
            _dataset.setValue((String) labels.elementAt(i), (Double) counts.elementAt(i));
            plot.setSectionPaint((String) labels.elementAt(i), colors[5 - i]);
        }

    }

}

From source file:net.nosleep.superanalyzer.analysis.views.EncodingKindView.java

private void createChart() {

    _chart = ChartFactory.createPieChart3D(Misc.getString("KINDS_OF_MUSIC_FILES"), _dataset, false, true,
            false);/*w  ww. ja va 2s.c  om*/

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    plot.setDarkerSides(true);
    plot.setStartAngle(PieRotator.angle);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setInsets(new RectangleInsets(10, 10, 10, 10));
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));

    _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("KINDS_OF_MUSIC_FILES_SUBTITLE")));

    ChartUtilities.applyCurrentTheme(_chart);
    plot.setBackgroundPaint(Color.white);
    _chart.setBorderVisible(false);

    plot.setIgnoreZeroValues(true);

    // plot.setAutoPopulateSectionPaint(false);

    // Misc.formatChart(plot);
}

From source file:org.sonar.plugins.abacus.chart.PieChart3D.java

@Override
protected Plot getPlot(ChartParameters params) {
    PiePlot3D plot = new PiePlot3D();

    String[] colorsHex = params.getValues(PARAM_COLORS, ",", true);
    String[] serie = params.getValues(PARAM_VALUES, ";", true);

    DefaultPieDataset set = new DefaultPieDataset();

    Color[] colors = COLORS;/*w w w.  ja va 2s . c o  m*/
    if (colorsHex != null && colorsHex.length > 0) {
        colors = new Color[colorsHex.length];
        for (int i = 0; i < colorsHex.length; i++) {
            colors[i] = Color.decode("#" + colorsHex[i]);
        }
    }

    String[] keyValue = null;
    for (int i = 0; i < serie.length; i++) {
        if (!StringUtils.isEmpty(serie[i])) {
            keyValue = StringUtils.split(serie[i], "=");
            set.setValue(keyValue[0], Double.parseDouble(keyValue[1]));
            plot.setSectionPaint(keyValue[0], colors[i]);
        }
    }
    plot.setDataset(set);

    plot.setStartAngle(360);
    plot.setCircular(true);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setForegroundAlpha(1.0f);
    plot.setBackgroundAlpha(0.0f);
    plot.setIgnoreNullValues(true);
    plot.setIgnoreZeroValues(true);
    plot.setOutlinePaint(Color.WHITE);
    plot.setShadowPaint(Color.WHITE);
    plot.setDarkerSides(false);
    plot.setLabelFont(DEFAULT_FONT);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(Color.WHITE);
    plot.setLabelOutlinePaint(Color.WHITE);
    plot.setLabelShadowPaint(Color.WHITE);
    plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1));
    plot.setInteriorGap(0.02);
    plot.setMaximumLabelWidth(0.15);

    return plot;
}

From source file:org.sonar.plugins.scmstats.charts.PieChart3D.java

@Override
protected Plot getPlot(ChartParameters params) {
    PiePlot3D plot = new PiePlot3D();

    String[] colorsHex = params.getValues(PARAM_COLORS, ",", true);
    String[] serie = params.getValues(PARAM_VALUES, ";", true);

    DefaultPieDataset set = new DefaultPieDataset();

    Color[] colors = COLORS;/*from www  .  ja v  a  2 s . c o  m*/
    if (colorsHex != null && colorsHex.length > 0) {
        colors = new Color[colorsHex.length];
        for (int i = 0; i < colorsHex.length; i++) {
            colors[i] = Color.decode("#" + colorsHex[i]);
        }
    }

    String[] keyValue = null;
    for (int i = 0; i < serie.length; i++) {
        if (!StringUtils.isEmpty(serie[i])) {
            keyValue = StringUtils.split(serie[i], "=");
            set.setValue(keyValue[0], Double.parseDouble(keyValue[1]));
            plot.setSectionPaint(keyValue[0], colors[i]);
        }
    }
    plot.setDataset(set);

    plot.setStartAngle(180);
    plot.setCircular(true);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setForegroundAlpha(1.0f);
    plot.setBackgroundAlpha(0.0f);
    plot.setIgnoreNullValues(true);
    plot.setIgnoreZeroValues(true);
    plot.setOutlinePaint(Color.WHITE);
    plot.setShadowPaint(Color.GREEN);
    plot.setDarkerSides(true);
    plot.setLabelFont(DEFAULT_FONT);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(Color.WHITE);
    plot.setLabelOutlinePaint(Color.WHITE);
    plot.setLabelShadowPaint(Color.GRAY);
    plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1));
    plot.setInteriorGap(0.01);
    plot.setMaximumLabelWidth(0.25);

    return plot;
}