Package org.jfree.data.xy

Examples of org.jfree.data.xy.XYSeriesCollection


    else
    {
      final PlotOrientation orientation = computePlotOrientation();
      if (isStacked() && xyDataset instanceof XYSeriesCollection)
      {
        final XYSeriesCollection xySeriesCollection = (XYSeriesCollection) xyDataset;
        chart = createStackedXYBarChart(computeTitle(), getDomainTitle(), false, getRangeTitle(),
            convertToTable(xySeriesCollection), orientation, isShowLegend(), false, false);
      }
      else if (isStacked() && xyDataset instanceof TableXYDataset)
      {
View Full Code Here


  }

  protected void buildDataset()
  {

    final XYSeriesCollection xySeriesDataset = (XYSeriesCollection) getDatasourceValue();
    final List seriesList = xySeriesDataset.getSeries();
    final HashMap seriesMap = new HashMap();
    for (int i = 0; i < seriesList.size(); i++)
    {
      final XYSeries series = (XYSeries) seriesList.get(i);
      seriesMap.put(series.getKey(), series);
    }

    final String[] seriesNames = getSeriesName();
    final int maxIndex = Math.min(seriesNames.length, Math.min (this.xValueColumns.size(), this.yValueColumns.size()));
    for (int i = 0; i < maxIndex; i++)
    {
      String seriesName = seriesNames[i];
      final String xColumn = (String) xValueColumns.get(i);
      final String yColumn = (String) yValueColumns.get(i);
      final Object xValueObject = getDataRow().get(xColumn);
      final Object yValueObject = getDataRow().get(yColumn);

      if (isSeriesColumn())
      {
        final Object tmp = getDataRow().get(seriesName);
        if (tmp != null)
        {
          seriesName = tmp.toString();
        }
      }

      if (xValueObject instanceof Number == false)
      {
        continue;
      }
      final Number xValue = (Number) xValueObject;
      final Number yValue = (yValueObject instanceof Number) ? (Number) yValueObject : null;

      XYSeries series = (XYSeries) seriesMap.get(seriesName);
      if (series == null)
      {
        series = new XYSeries(seriesName);
        xySeriesDataset.addSeries(series);
        seriesMap.put (seriesName, series);
      }
      series.add(xValue, yValue);
    }
  }
View Full Code Here

    }
  }

  public Dataset createNewDataset()
  {
    return new XYSeriesCollection();
  }
View Full Code Here

  }

  protected Dataset createNewDataset()
  {
    seriesMap = new HashMap();
    return new XYSeriesCollection();
  }
View Full Code Here

  }


  protected void buildDataset()
  {
    final XYSeriesCollection xySeriesDataset = (XYSeriesCollection) getDataSet();
    final List seriesList = xySeriesDataset.getSeries();
    if (seriesMap == null)
    {
      final HashMap seriesMap = new HashMap();
      for (int i = 0; i < seriesList.size(); i++)
      {
        final XYSeries series = (XYSeries) seriesList.get(i);
        seriesMap.put(series.getKey(), series);
      }
      this.seriesMap = seriesMap;
    }

    final int maxIndex = Math.min (this.xValueColumns.size(), this.yValueColumns.size());
    for (int i = 0; i < maxIndex; i++)
    {
      final Comparable seriesName = querySeriesValue(i);
      final Object xValueObject = getDataRow().get((String) xValueColumns.get(i));
      final Object yValueObject = getDataRow().get((String) yValueColumns.get(i));

      if (xValueObject instanceof Number == false)
      {
        continue;
      }
      final Number xValue = (Number) xValueObject;
      final Number yValue = (yValueObject instanceof Number) ? (Number) yValueObject : null;
     
      XYSeries series = (XYSeries) seriesMap.get(seriesName);
      if (series == null)
      {
        series = new XYSeries(seriesName);
        xySeriesDataset.addSeries(series);
        seriesMap.put(seriesName, series);
      }

      series.add(xValue, yValue, false);
    }
View Full Code Here

  public XYDataSetCollectorFunction()
  {
    this.seriesNames = new ArrayList();
    series = new HashMap();

    xyDataset = new XYSeriesCollection();
  }
View Full Code Here

      {
        if (LOG.isDebugEnabled())
        {
          LOG.debug("XYDataSetCollectorFunction.groupStarted ");//NON-NLS
        }
        XYSeriesCollection xyDataset = new XYSeriesCollection();
        for (int i = 0; i < getSeriesName().length; i++)
        {
          String s = getSeriesName()[i];
          XYSeries series = new XYSeries(s, true, true);
          xyDataset.addSeries(series);
          this.series.put(s, series);

        }
        this.xyDataset = xyDataset;
        //results.add(categoryDataset);
      }
      else
      {
        if (FunctionUtilities.isLayoutLevel(event))
        {
          // Activate the current group, which was filled in the prepare run.
          //currentIndex += 1;
          //categoryDataset = results.get(currentIndex);
        }
      }
    }
    else
    {
      // reset ...
      if (FunctionUtilities.isDefinedPrepareRunLevel(this, event))
      {
        if (LOG.isDebugEnabled())
        {
          LOG.debug("XYDataSetCollectorFunction.groupStarted ");//NON-NLS
        }
        XYSeriesCollection xyDataset = new XYSeriesCollection();
        for (int i = 0; i < getSeriesName().length; i++)
        {
          String s = getSeriesName()[i];
          XYSeries series = new XYSeries(s, true, true);
          xyDataset.addSeries(series);
          this.series.put(s, series);
        }
        this.xyDataset = xyDataset;
        //results.add(categoryDataset);
      }
View Full Code Here

  /**
   *
   */
  public Dataset getCustomDataset()
  {
    XYSeriesCollection dataset = new XYSeriesCollection();
    if (seriesNames != null)
    {
      for(int i = 0; i < seriesNames.size(); i++)
      {
        Comparable seriesName = (Comparable)seriesNames.get(i);
        dataset.addSeries((XYSeries)seriesMap.get(seriesName));
      }
    }
    return dataset;
  }
View Full Code Here

 
  private XYDataset createXyDataset()
  {
    if (sampleXyDataset == null)
    {
      XYSeriesCollection dataset = new XYSeriesCollection();

      XYSeries series = new XYSeries("First");
      series.add(1.0, 500.2);
      series.add(5.0, 694.1);
      series.add(4.0, 100.0);
      series.add(12.5, 734.4);
      series.add(17.3, 453.2);
      series.add(21.2, 500.2);
      series.add(21.9, null);
      series.add(25.6, 734.4);
      series.add(30.0, 453.2);
      dataset.addSeries(series);

      series = new XYSeries("Second");
      series.add(2.0, 400.2);
      series.add(6.0, 594.1);
      series.add(5.0, 90.0);
      series.add(13.5, 634.4);
      series.add(18.3, 353.2);
      series.add(22.2, 400.2);
      series.add(22.9, null);
      series.add(26.6, 634.4);
      series.add(31.0, 353.2);
      dataset.addSeries(series);

      series = new XYSeries("Third");
      series.add(0.0, 600.2);
      series.add(4.0, 794.1);
      series.add(3.0, 200.0);
      series.add(11.5, 834.4);
      series.add(16.3, 553.2);
      series.add(20.2, 600.2);
      series.add(20.9, null);
      series.add(24.6, 834.4);
      series.add(29.0, 553.2);
      dataset.addSeries(series);
     
      sampleXyDataset = dataset;
    }

    return sampleXyDataset;
View Full Code Here

        }

        //Distribution series
        XYSeries dSeries = ChartUtils.createXYSeries(dist, pName);

        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(dSeries);

        JFreeChart chart = ChartFactory.createXYLineChart(
                pName,
                pX,
                pY,
View Full Code Here

TOP

Related Classes of org.jfree.data.xy.XYSeriesCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.