Example usage for org.jfree.data.xy MatrixSeriesCollection getSeriesCount

List of usage examples for org.jfree.data.xy MatrixSeriesCollection getSeriesCount

Introduction

In this page you can find the example usage for org.jfree.data.xy MatrixSeriesCollection getSeriesCount.

Prototype

@Override
public int getSeriesCount() 

Source Link

Document

Returns the number of series in the collection.

Usage

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

@Override
protected void createNewSerie(final IScope scope, final String serieid) {

    final ChartDataSeries dataserie = chartdataset.getDataSeries(scope, serieid);
    final MatrixSeries serie = new MatrixSeries((String) dataserie.getSerieLegend(scope),
            Math.max(1, this.getChartdataset().getYSeriesValues().size()),
            Math.max(1, this.getChartdataset().getXSeriesValues().size()));
    final XYPlot plot = (XYPlot) this.chart.getPlot();

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

    if (!IdPosition.containsKey(serieid)) {

        if (firstdataset.getSeriesCount() == 0) {
            firstdataset.addSeries(serie);
            plot.setDataset(0, firstdataset);

        } else {/*from  w ww.j av a  2s .  co m*/

            final MatrixSeriesCollection newdataset = new MatrixSeriesCollection();
            newdataset.addSeries(serie);
            jfreedataset.add(newdataset);
            plot.setDataset(jfreedataset.size() - 1, newdataset);

        }
        plot.setRenderer(jfreedataset.size() - 1, (XYItemRenderer) getOrCreateRenderer(scope, serieid));
        IdPosition.put(serieid, jfreedataset.size() - 1);
        // DEBUG.LOG("new serie"+serieid+" at
        // "+IdPosition.get(serieid)+" fdsize "+plot.getSeriesCount()+" jfds
        // "+jfreedataset.size()+" datasc "+plot.getDatasetCount());
        // TODO Auto-generated method stub

    }
}