Search in sources :

Example 1 with PiePlot3D

use of org.jfree.chart.plot.PiePlot3D in project cubrid-manager by CUBRID.

the class VolumeInformationEditor method createChart.

/**
	 *
	 * Create jfreechart
	 *
	 * @param dataset DefaultPieDataset
	 * @return JFreeChart
	 */
private static JFreeChart createChart(DefaultPieDataset dataset) {
    JFreeChart chart = // chart
    ChartFactory.createPieChart3D(// chart
    "", // data
    dataset, // include legend
    true, true, false);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 12));
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setCircular(false);
    plot.setLabelLinkMargin(0.0);
    plot.setLabelGap(0.0);
    plot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    plot.setOutlinePaint(ChartColor.VERY_DARK_BLUE);
    plot.setLabelGenerator(null);
    plot.setLabelLinksVisible(false);
    plot.setLegendLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0}:{1} Mbyte", new DecimalFormat("0.00"), new DecimalFormat("0.00")));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0}={1}Mbyte {2}", new DecimalFormat("0.00"), new DecimalFormat("0.00%")));
    // plot.setSectionPaint("", SWTResourceManager.getColor(230, 230, 230));
    Color[] colors = { new Color(235, 139, 82), new Color(119, 119, 253) };
    PieRenderer renderer = new PieRenderer(colors);
    renderer.setColor(plot, dataset);
    return chart;
}
Also used : PiePlot3D(org.jfree.chart.plot.PiePlot3D) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) DecimalFormat(java.text.DecimalFormat) Color(java.awt.Color) ChartColor(org.jfree.chart.ChartColor) PieRenderer(com.cubrid.cubridmanager.ui.cubrid.database.control.PieRenderer) JFreeChart(org.jfree.chart.JFreeChart)

Example 2 with PiePlot3D

use of org.jfree.chart.plot.PiePlot3D in project cubrid-manager by CUBRID.

the class VolumeFolderInfoEditor method createChart.

/**
	 *
	 * Creates a chart.
	 *
	 * @param dataset DefaultPieDataset
	 * @param dbSpaceInfo DbSpaceInfo
	 * @return jFreeChart
	 */
private static JFreeChart createChart(DefaultPieDataset dataset, DbSpaceInfo dbSpaceInfo) {
    JFreeChart chart = ChartFactory.createPieChart3D(// chart
    dbSpaceInfo.getSpacename() + " Chart", // data
    dataset, // include legend
    true, true, false);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 12));
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setCircular(false);
    plot.setLabelLinkMargin(0.0);
    plot.setLabelGap(0.0);
    plot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    plot.setOutlinePaint(ChartColor.VERY_DARK_BLUE);
    plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0}={1} pages {2}", new DecimalFormat("00.0"), new DecimalFormat("0.00%")));
    // plot.setSectionPaint("", SWTResourceManager.getColor(230, 230, 230));
    Color[] colors = { new Color(235, 139, 82), new Color(119, 119, 253) };
    PieRenderer renderer = new PieRenderer(colors);
    renderer.setColor(plot, dataset);
    return chart;
}
Also used : PiePlot3D(org.jfree.chart.plot.PiePlot3D) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) DecimalFormat(java.text.DecimalFormat) Color(java.awt.Color) ChartColor(org.jfree.chart.ChartColor) PieRenderer(com.cubrid.cubridmanager.ui.cubrid.database.control.PieRenderer) JFreeChart(org.jfree.chart.JFreeChart)

Example 3 with PiePlot3D

use of org.jfree.chart.plot.PiePlot3D in project pentaho-platform by pentaho.

the class JFreeChartEngine method createPieDatasetChart.

private static JFreeChart createPieDatasetChart(final PieDatasetChartDefinition chartDefinition) {
    // TODO Make the following accessible from the chartDefinition
    boolean tooltips = true;
    boolean urls = true;
    // -----------------------------------------------------------
    String title = chartDefinition.getTitle();
    boolean legend = chartDefinition.isLegendIncluded();
    PiePlot plot = null;
    plot = chartDefinition.isThreeD() ? new PiePlot3D(chartDefinition) : new PiePlot(chartDefinition);
    JFreeChartEngine.updatePlot(plot, chartDefinition);
    JFreeChart pieChart = new JFreeChart(title, chartDefinition.getTitleFont(), plot, legend);
    // $NON-NLS-1$ //$NON-NLS-2$
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(title);
    pieChart.setBackgroundPaint(chartDefinition.getChartBackgroundPaint());
    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        plot.setToolTipGenerator(tooltipGenerator);
    }
    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        plot.setURLGenerator(urlGenerator);
    }
    return pieChart;
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieURLGenerator(org.jfree.chart.urls.PieURLGenerator) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PiePlot3D(org.jfree.chart.plot.PiePlot3D) PieToolTipGenerator(org.jfree.chart.labels.PieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) JFreeChart(org.jfree.chart.JFreeChart) Font(java.awt.Font)

Example 4 with PiePlot3D

use of org.jfree.chart.plot.PiePlot3D in project watchdog by TestRoots.

the class WatchDogView method createPieChart.

private JFreeChart createPieChart(final PieDataset dataset, String title) {
    JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(FOREGROUND_TRANSPARENCY);
    return chart;
}
Also used : PiePlot3D(org.jfree.chart.plot.PiePlot3D) JFreeChart(org.jfree.chart.JFreeChart)

Example 5 with PiePlot3D

use of org.jfree.chart.plot.PiePlot3D in project sonar-scanner-jenkins by SonarSource.

the class PieChart3D method getPlot.

@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;
    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;
}
Also used : DefaultPieDataset(org.jfree.data.general.DefaultPieDataset) PiePlot3D(org.jfree.chart.plot.PiePlot3D) Color(java.awt.Color) RectangleInsets(org.jfree.ui.RectangleInsets)

Aggregations

PiePlot3D (org.jfree.chart.plot.PiePlot3D)10 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)7 JFreeChart (org.jfree.chart.JFreeChart)6 PieRenderer (com.cubrid.cubridmanager.ui.cubrid.database.control.PieRenderer)3 Color (java.awt.Color)3 DecimalFormat (java.text.DecimalFormat)3 ChartColor (org.jfree.chart.ChartColor)3 StandardPieURLGenerator (org.jfree.chart.urls.StandardPieURLGenerator)3 RectangleInsets (org.jfree.ui.RectangleInsets)3 Font (java.awt.Font)2 PieToolTipGenerator (org.jfree.chart.labels.PieToolTipGenerator)2 MultiplePiePlot (org.jfree.chart.plot.MultiplePiePlot)2 PiePlot (org.jfree.chart.plot.PiePlot)2 TextTitle (org.jfree.chart.title.TextTitle)2 PieURLGenerator (org.jfree.chart.urls.PieURLGenerator)2 Color (org.eclipse.swt.graphics.Color)1 DefaultPieDataset (org.jfree.data.general.DefaultPieDataset)1