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

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

Introduction

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

Prototype

public void setSeriesOutlineStroke(int series, Stroke stroke) 

Source Link

Document

Sets the stroke used to fill a series of the radar and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.pentaho.plugin.jfreereport.reportcharts.RadarChartExpression.java

protected void configureChart(final JFreeChart chart) {
    super.configureChart(chart);

    //Create the stroke for the primary (= real) data series...
    final Stroke thick = new BasicStroke(thicknessprimaryseries);

    //...and apply that stroke to the series
    final SpiderWebPlot webPlot = (SpiderWebPlot) chart.getPlot();
    webPlot.setLabelFont(Font.decode(getLabelFont()));

    if (StringUtils.isEmpty(getTooltipFormula()) == false) {
        webPlot.setToolTipGenerator(new FormulaCategoryTooltipGenerator(getRuntime(), getTooltipFormula()));
    }//from   ww  w.j av  a  2 s. com
    if (StringUtils.isEmpty(getUrlFormula()) == false) {
        webPlot.setURLGenerator(new FormulaCategoryURLGenerator(getRuntime(), getUrlFormula()));
    }

    final CategoryDataset categoryDataset = webPlot.getDataset();
    final int count = categoryDataset.getRowCount();

    for (int t = 0; t < count; t++) {
        if (categoryDataset.getRowKey(t) instanceof GridCategoryItem) {
            continue;
        }
        webPlot.setSeriesOutlineStroke(t, thick);
    }

    //Set the spiderweb filled (or not)
    webPlot.setWebFilled(radarwebfilled);
    //Set the size of the datapoints on the axis
    webPlot.setHeadPercent(headsize);

    //Set the color of the fake datasets (gridlines) to grey
    for (int t = 0; t < count; t++) {
        if (categoryDataset.getRowKey(t) instanceof GridCategoryItem) {
            webPlot.setSeriesPaint(t, Color.GRAY);
        }
    }

}

From source file:org.squale.squaleweb.util.graph.KiviatMaker.java

/**
 * Create the JreeChart object/*from  w w  w .j  a v  a2  s . c o  m*/
 * 
 * @param showLegend indicate if it should display the legend or not
 * @param showBackground indicate if we want showBackground
 * @return The JreeChart object
 */
public JFreeChart getChart(boolean showLegend, boolean showBackground) {
    JFreeChart retChart = super.getChart();

    // Creation of the graph if it not already exist
    if (null == retChart) {

        // Creation of the plot
        SpiderWebPlot plot = new SpiderWebPlot(mDataset);

        // Creation of the picture. The plot is inside the picture
        retChart = new JFreeChart(mTitle, TextTitle.DEFAULT_FONT, plot, false);

        // Display of the legend
        if (showLegend) {
            LegendTitle legendtitle = new LegendTitle(plot);
            legendtitle.setPosition(RectangleEdge.BOTTOM);
            retChart.addSubtitle(legendtitle);
        }

        // Definition of the style of the three first draw in the spiderWEbPlot.
        // This three first draw represent the scale for the mark 1.0, 2.0 and 3.0 in the plot
        // First we define the style
        final float miterLimit = 10.0f;
        final float[] dashPattern = { 5.0f, 3.0f };
        BasicStroke dash = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, // End cap
                BasicStroke.JOIN_MITER, // Join style
                miterLimit, // Miter limit
                dashPattern, // Dash pattern
                0.0f);
        // We associate this style to the draw
        plot.setSeriesPaint(0, new Color(WebMessages.getInt("kiviat.color.1")));
        plot.setSeriesOutlineStroke(0, dash);
        plot.setSeriesPaint(1, new Color(WebMessages.getInt("kiviat.color.2")));
        plot.setSeriesOutlineStroke(1, dash);
        plot.setSeriesPaint(2, new Color(WebMessages.getInt("kiviat.color.3")));
        plot.setSeriesOutlineStroke(2, dash);

        // Define the gap what is draw and the border of the plot
        plot.setInteriorGap(DEFAULT_GAP);

        // Define the style of the line stroke
        plot.setBaseSeriesOutlineStroke(new BasicStroke(2.0f));

        // The max value put in the plot (for the scale)
        plot.setMaxValue(SCALE_MAX_VALUE);

        // Indicate if we want fill the inner of the draw
        plot.setWebFilled(FILL_RADAR);

        if (!showBackground) {
            // Set the background of the picture to white
            retChart.setBackgroundPaint(Color.WHITE);

            // Set the border of the plot to white
            plot.setOutlinePaint(Color.WHITE);
        }
        super.setChart(retChart);
    }
    return retChart;
}