Example usage for org.jfree.chart.plot SpiderWebPlot SpiderWebPlot

List of usage examples for org.jfree.chart.plot SpiderWebPlot SpiderWebPlot

Introduction

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

Prototype

public SpiderWebPlot(CategoryDataset dataset) 

Source Link

Document

Creates a new spider web plot with the given dataset, with each row representing a series.

Usage

From source file:org.jfree.chart.demo.SpiderWebChartDemo1.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    SpiderWebPlot plot = new SpiderWebPlot(categorydataset);
    plot.setStartAngle(54D);//from   w  ww.j av a  2  s .co  m
    plot.setInteriorGap(0.40000000000000002D);
    plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    JFreeChart chart = new JFreeChart("Spider Web Chart Demo 1", TextTitle.DEFAULT_FONT, plot, false);
    LegendTitle legendtitle = new LegendTitle(plot);
    legendtitle.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendtitle);
    return chart;
}

From source file:org.operamasks.faces.render.graph.RadarChartRenderer.java

protected JFreeChart createChart(UIChart comp) {
    Dataset dataset = createDataset(comp);
    JFreeChart chart = null;// w  w  w  . j  av a2 s .c o  m

    if (dataset instanceof CategoryDataset) {
        SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) dataset);
        plot.setWebFilled(false);

        Object startAngle = comp.getAttributes().get("startAngle");
        if (startAngle != null) {
            plot.setStartAngle(Coercion.coerceToDouble(startAngle));
        }

        if (comp.isShowItemTips()) {
            plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
        }

        chart = new JFreeChart(null, null, plot, false);
    }

    return chart;
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputRadar.java

@Override
public void createChart(final IScope scope) {
    super.createChart(scope);
    final SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) createDataset(scope));
    chart = new JFreeChart(getName(), null, plot, true);

}

From source file:org.sonar.plugins.core.charts.XradarChart.java

@Override
protected Plot getPlot(ChartParameters params) {
    SpiderWebPlot plot = new SpiderWebPlot(createDataset(params));
    plot.setStartAngle(0D);//from w w  w  .  j ava 2  s .  c  om
    plot.setOutlineVisible(false);
    plot.setAxisLinePaint(Color.decode("0xCCCCCC"));
    plot.setSeriesOutlineStroke(new BasicStroke(2f));

    if (params.getValue(PARAM_INTERIOR_GAP) != null) {
        plot.setInteriorGap(Double.parseDouble(params.getValue(PARAM_INTERIOR_GAP, "0.4", false)));
    }
    if (params.getValue(PARAM_MAX_VALUE) != null) {
        plot.setMaxValue(Double.parseDouble(params.getValue(PARAM_MAX_VALUE, "100", false)));
    }
    configureColors(plot, params);
    return plot;
}

From source file:moviedatas.View.SpiderWebChart.java

/**
 * Creates a sample chart.//  ww w .j a  v a  2  s  .  co  m
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    SpiderWebPlot plot = new SpiderWebPlot(dataset);
    plot.setStartAngle(54);
    plot.setInteriorGap(0.40);
    //plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    JFreeChart chart = new JFreeChart("", TextTitle.DEFAULT_FONT, plot, false);
    LegendTitle legend = new LegendTitle(plot);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legend);
    //ChartUtilities.applyCurrentTheme(chart);
    return chart;
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.MaturitySpiderChart.java

protected JFreeChart createSpiderChart(Object dataset) {
    SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) dataset);
    plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());

    plot.setSeriesPaint(0, new Color(0.0f, 1f, 0f, 1f)); // green
    plot.setSeriesPaint(1, new Color(1f, 1f, 0f, 1f)); // yellow
    plot.setSeriesPaint(2, new Color(1f, 0f, 0f, 1f)); // red
    plot.setSeriesPaint(3, new Color(0f, 0f, 0f, 1f)); // grey

    plot.setWebFilled(true);//from  w  w  w  .j  a  v a  2 s. c  o  m
    JFreeChart chart = new JFreeChart(Messages.MaturitySpiderChart_0, TextTitle.DEFAULT_FONT, plot, false);

    LegendTitle legend = new LegendTitle(plot);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legend);

    return chart;
}

From source file:net.sf.jasperreports.components.spiderchart.SpiderChartDesignEvaluator.java

/**
 * /*from   w  ww.  jav a  2  s  .c  o m*/
 */
public static JRRenderable evaluateRenderer(ReportConverter reportConverter, JRComponentElement element) {
    SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent();
    ChartSettings chartSettings = chartComponent.getChartSettings();
    SpiderPlot plot = chartComponent.getPlot();

    SpiderWebPlot spiderWebPlot = new SpiderWebPlot(getSampleDataset());

    if (plot.getAxisLineColor() != null) {
        spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor());
    }
    if (plot.getAxisLineWidth() != null) {
        spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth()));
    }
    if (plot.getBackcolor() != null) {
        spiderWebPlot.setBackgroundPaint(plot.getBackcolor());
    }
    if (plot.getBackgroundAlpha() != null) {
        spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha());
    }
    if (plot.getForegroundAlpha() != null) {
        spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha());
    }
    if (plot.getHeadPercent() != null) {
        spiderWebPlot.setHeadPercent(plot.getHeadPercent());
    }
    if (plot.getInteriorGap() != null) {
        spiderWebPlot.setInteriorGap(plot.getInteriorGap());
    }
    if (plot.getLabelColor() != null) {
        spiderWebPlot.setLabelPaint(plot.getLabelColor());
    }
    if (plot.getLabelFont() != null) {
        spiderWebPlot.setLabelFont(JRFontUtil.getAwtFont(plot.getLabelFont(), Locale.getDefault()));
    }
    if (plot.getLabelGap() != null) {
        spiderWebPlot.setAxisLabelGap(plot.getLabelGap());
    }

    spiderWebPlot.setMaxValue(MAX_VALUE);

    if (plot.getRotation() != null) {
        spiderWebPlot.setDirection(plot.getRotation().getRotation());
    }
    if (plot.getStartAngle() != null) {
        spiderWebPlot.setStartAngle(plot.getStartAngle());
    }
    if (plot.getTableOrder() != null) {
        spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder());
    }
    if (plot.getWebFilled() != null) {
        spiderWebPlot.setWebFilled(plot.getWebFilled());
    }

    spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    spiderWebPlot.setLabelGenerator(new StandardCategoryItemLabelGenerator());

    String titleText = JRExpressionUtil.getExpressionText(chartSettings.getTitleExpression());

    Font titleFont = chartSettings.getTitleFont() != null
            ? JRFontUtil.getAwtFont(chartSettings.getTitleFont(), Locale.getDefault())
            : TextTitle.DEFAULT_FONT;

    JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true);

    if (chartSettings.getBackcolor() != null) {
        jfreechart.setBackgroundPaint(chartSettings.getBackcolor());
    }

    RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP);

    if (titleText != null) {
        TextTitle title = jfreechart.getTitle();
        title.setText(titleText);
        if (chartSettings.getTitleColor() != null) {
            title.setPaint(chartSettings.getTitleColor());
        }

        title.setFont(titleFont);
        title.setPosition(titleEdge);
        jfreechart.setTitle(title);
    }

    String subtitleText = JRExpressionUtil.getExpressionText(chartSettings.getSubtitleExpression());
    if (subtitleText != null) {
        TextTitle subtitle = new TextTitle(subtitleText);
        subtitle.setText(subtitleText);
        if (chartSettings.getSubtitleColor() != null) {
            subtitle.setPaint(chartSettings.getSubtitleColor());
        }

        if (chartSettings.getSubtitleColor() != null) {
            Font subtitleFont = chartSettings.getSubtitleFont() != null
                    ? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault())
                    : TextTitle.DEFAULT_FONT;
            subtitle.setFont(subtitleFont);
        }

        subtitle.setPosition(titleEdge);

        jfreechart.addSubtitle(subtitle);
    }

    // Apply all of the legend formatting options
    LegendTitle legend = jfreechart.getLegend();
    if (legend != null) {
        legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend()));
        if (legend.isVisible()) {
            if (chartSettings.getLegendColor() != null) {
                legend.setItemPaint(chartSettings.getLegendColor());
            }
            if (chartSettings.getLegendBackgroundColor() != null) {
                legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor());
            }

            if (chartSettings.getLegendFont() != null) {
                legend.setItemFont(JRFontUtil.getAwtFont(chartSettings.getLegendFont(), Locale.getDefault()));
            }
            legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM));
        }
    }

    Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight());

    String renderType = chartSettings.getRenderType();
    if (renderType == null) {
        renderType = JRProperties.getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_RENDER_TYPE);
    }

    return ChartUtil.getChartRendererFactory(renderType).getRenderer(jfreechart, null, rectangle);
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.LebenszyklusBarChart.java

protected JFreeChart createSpiderChart(Object dataset) {
    final int startAngle = 54;
    final double interiorGap = 0.4d;
    SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) dataset);
    plot.setStartAngle(startAngle);/*from w  w  w  .  j a  v  a2s. c  o m*/
    plot.setInteriorGap(interiorGap);
    plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    JFreeChart chart = new JFreeChart(Messages.LebenszyklusBarChart_1, TextTitle.DEFAULT_FONT, plot, false);
    LegendTitle legend = new LegendTitle(plot);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legend);
    return chart;
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.ISRSpiderChart.java

protected JFreeChart createSpiderChart(Object dataset) {
    SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) dataset);
    plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());

    plot.setSeriesPaint(0, new Color(0.0f, 1f, 0f, 1f)); // green
    plot.setSeriesPaint(1, new Color(1f, 1f, 0f, 1f)); // yellow
    plot.setSeriesPaint(2, new Color(1f, 0f, 0f, 1f)); // red
    plot.setSeriesPaint(3, new Color(0f, 0f, 0f, 1f)); // grey

    plot.setWebFilled(true);/*from  w  ww.j a  v  a 2  s.com*/
    JFreeChart chart = new JFreeChart(Messages.ISRSpiderChart_0, TextTitle.DEFAULT_FONT, plot, false);

    LegendTitle legend = new LegendTitle(plot);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legend);

    return chart;
}

From source file:biz.ixnay.pivot.charts.skin.jfree.SpiderWebViewSkin.java

@Override
protected JFreeChart createChart() {
    ChartView chartView = (ChartView) getComponent();

    String title = chartView.getTitle();
    boolean showLegend = chartView.getShowLegend();
    String seriesNameKey = chartView.getSeriesNameKey();

    List<?> chartData = chartView.getChartData();

    JFreeChart chart;/*  w w w.  j a v  a  2 s  .co  m*/
    ChartView.CategorySequence categories = chartView.getCategories();

    CategorySeriesDataset dataset = new CategorySeriesDataset(categories, seriesNameKey, chartData);

    // JFree ChartFactory is missing factory method for SpiderWebPlot
    SpiderWebPlot plot = new SpiderWebPlot(dataset);
    chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, showLegend);

    STANDARD_THEME.apply(chart);

    return chart;
}