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

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

Introduction

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

Prototype

public CategoryDataset getDataset() 

Source Link

Document

Returns the dataset.

Usage

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

@Override
protected void clearDataSet(final IScope scope) {
    // TODO Auto-generated method stub
    super.clearDataSet(scope);
    final SpiderWebPlot plot = (SpiderWebPlot) this.chart.getPlot();
    for (int i = plot.getDataset().getRowCount() - 1; i >= 1; i--) {
        // plot.setDataset(i, null);
        // plot.setRenderer(i, null);
    }//w w w  . ja v  a 2 s.co  m
    if (jfreedataset.size() > 0)
        ((DefaultCategoryDataset) jfreedataset.get(0)).clear();
    jfreedataset.clear();
    jfreedataset.add(0, new DefaultCategoryDataset());
    plot.setDataset((DefaultCategoryDataset) jfreedataset.get(0));
    IdPosition.clear();
    nbseries = 0;
}

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

@Override
protected void createNewSerie(final IScope scope, final String serieid) {
    // final ChartDataSeries dataserie = chartdataset.getDataSeries(scope,
    // serieid);//from   w  ww.  ja v a2s. co m
    // final XYIntervalSeries serie = new
    // XYIntervalSeries(dataserie.getSerieLegend(scope), false, true);
    final SpiderWebPlot plot = (SpiderWebPlot) this.chart.getPlot();

    final DefaultCategoryDataset firstdataset = (DefaultCategoryDataset) plot.getDataset();

    if (nbseries == 0) {
        plot.setDataset(firstdataset);

    } else {

        // DefaultCategoryDataset newdataset=new DefaultCategoryDataset();
        // jfreedataset.add(newdataset);
        // plot.setDataset(jfreedataset.size()-1, newdataset);
        // plot.setDataset(nbseries, firstdataset);

    }
    nbseries++;
    // plot.setRenderer(nbseries-1,
    // (CategoryItemRenderer)getOrCreateRenderer(scope,serieid));
    IdPosition.put(serieid, nbseries - 1);

    // DEBUG.LOG("new serie"+serieid+" at
    // "+IdPosition.get(serieid)+" fdsize "+plot.getCategories().size()+"
    // jfds "+jfreedataset.size()+" datasc "+plot.getDatasetCount()+" nbse
    // "+nbseries);
    // TODO Auto-generated method stub
}

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  w  w  w .ja  v a 2s.  c om
    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);
        }
    }

}