Package org.jfree.data.xy

Examples of org.jfree.data.xy.XYSeriesCollection


    for( Iterator it = iterator(); it.hasNext(); ) {
      double xx = (Double) it.next();
      double yy = getDiscreteValue(xx);
      series.add(xx, yy);
    }
    XYDataset xyDataset = new XYSeriesCollection(series);

    // Create plot and show it
    JFreeChart chart = ChartFactory.createScatterPlot(title, "x", "Membership", xyDataset, PlotOrientation.VERTICAL, false, true, false);
    if( showIt ) PlotWindow.showIt(title, chart);
View Full Code Here


    if( Double.isNaN(universeMin) || Double.isInfinite(universeMax) ) estimateUniverse();
    int numberOfPoints = PlotWindow.DEFAULT_CHART_NUMBER_OF_POINTS;
    double step = (universeMax - universeMin) / ((double) numberOfPoints);

    // Create a dataset
    XYSeriesCollection xyDataset = new XYSeriesCollection();

    // For each linguistic term...
    int j = 0;
    for( Iterator it = iteratorLinguisticTermNames(); it.hasNext(); j++ ) {
      // Add this linguistic term to dataset
      String termName = (String) it.next();
      MembershipFunction membershipFunction = getLinguisticTerm(termName).getMembershipFunction();
      discrete &= membershipFunction.isDiscrete();

      // Create a series and add points
      XYSeries series = new XYSeries(termName);
      if( membershipFunction.isDiscrete() ) {
        // Discrete case: Evaluate membership function and add points to dataset
        MembershipFunctionDiscrete membershipFunctionDiscrete = (MembershipFunctionDiscrete) membershipFunction;
        numberOfPoints = membershipFunctionDiscrete.size();
        for( int i = 0; i < numberOfPoints; i++ )
          series.add(membershipFunctionDiscrete.valueX(i), membershipFunctionDiscrete.membership(i));
      } else {
        // Continuous case: Add every membershipfunction's point
        numberOfPoints = PlotWindow.DEFAULT_CHART_NUMBER_OF_POINTS;
        double xx = universeMin;
        for( int i = 0; i < numberOfPoints; i++, xx += step )
          series.add(xx, membershipFunction.membership(xx));
      }

      // Add series to dataSet
      xyDataset.addSeries(series);
    }

    // Create chart and show it
    JFreeChart chart;
    if( !discrete ) chart = ChartFactory.createXYLineChart(name, "x", "Membership", xyDataset, PlotOrientation.VERTICAL, true, true, false);
View Full Code Here

  private XYSeriesCollection xyDataset;

  public PerformanceChart(int stepSize, String chartTitle) {
    super();
    this.stepSize = stepSize;
    xyDataset = new XYSeriesCollection();
    this.chartTitle = chartTitle;
  }
View Full Code Here

    // Evaluate membership function and add points to dataset
    XYSeries series = new XYSeries(title);
    for( int i = 0; i < numberOfPoints; i++ )
      series.add(valueX(i), membership(i));
    XYDataset xyDataset = new XYSeriesCollection(series);

    // Create plot and show it
    JFreeChart chart = ChartFactory.createScatterPlot(title, "x", "Membership", xyDataset, PlotOrientation.VERTICAL, false, true, false);
    if( showIt ) PlotWindow.showIt(title, chart);
View Full Code Here

    double xx = universeMin;
    double step = (universeMax - universeMin) / ((double) numberOfPoints);
    for( int i = 0; i < numberOfPoints; i++, xx += step ) {
      series.add(xx, membership(xx));
    }
    XYDataset xyDataset = new XYSeriesCollection(series);

    // Create plot and show it
    JFreeChart chart = ChartFactory.createXYLineChart(title, "x", "Membership", xyDataset, PlotOrientation.VERTICAL, false, true, false );
    if( showIt ) PlotWindow.showIt(title, chart);
   
View Full Code Here

*/
public class XYChart {

    public static ChartPanel createChart(List data, String title, List<String> seriesTitle, String fileName, boolean shapeRenderer) {
        final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
        XYSeriesCollection dataset = new XYSeriesCollection();
        for (int i = 0; i < data.size(); i++) {
            XYSeries series = new XYSeries(seriesTitle.get(i));
            ArrayList list = (ArrayList) data.get(i);
            for (int j = 0; j < list.size(); j++) {
                series.add(j, (Double) list.get(j));
            }
            dataset.addSeries(series);

        }

        JFreeChart chart = ChartFactory.createXYLineChart(
                title,
View Full Code Here

 
  @Override
  public void init() {
    reward = new XYSeries("Reward", false, false);
   
    XYSeriesCollection xyDataset = new XYSeriesCollection(reward);
   
    JFreeChart chart = ChartFactory.createXYLineChart("Reward", "Episode", "Reward", xyDataset, PlotOrientation.VERTICAL, true, false, false);
   
    ChartPanel chartArea = new ChartPanel(chart, true);
   
View Full Code Here

        //series.add(toInt + (lastLength / length), dataset.getInterval(toInt).getMeanValue(v));
      }
    }

    // --- collect all series into one collection/chart
    XYSeriesCollection data = new XYSeriesCollection();

    for (XYSeries serie : serien) {
      data.addSeries(serie);
    }

    JFreeChart chart = ChartFactory.createXYLineChart("Averaged, per edge data", // chart-title
        "Simulation Step", // x axis label
        "Value", // y axis label
        data, // data
        PlotOrientation.VERTICAL, true, // include legend
        true, // tooltips
        false // urls
        );
   
    chart.addSubtitle(new TextTitle("Only values > 0 are taken into account"));
    //configure domain axis (interval numbers and simulation steps
    final XYPlot plot = chart.getXYPlot();
    NumberAxis stepAxis = (NumberAxis) plot.getDomainAxis();
    stepAxis.setAutoTickUnitSelection(false);
    stepAxis.setTickUnit(new NumberTickUnit(
            dataset.getInterval(fromInt).getEndTime() + 1 -
            dataset.getInterval(fromInt).getBeginTime()));
    stepAxis.setRange(data.getDomainLowerBound(false),
        dataset.getInterval(toInt).getBeginTime() + length);
   
    NumberAxis intervalAxis = new NumberAxis("Interval Number");
        intervalAxis.setAutoRangeIncludesZero(false);
        intervalAxis.setLowerMargin((0.5 / (toInt - fromInt)));
View Full Code Here

        if (firstVal >= SCHWELL_VAL && secondVal >= SCHWELL_VAL) {
          serie.add(firstVal, secondVal);
        }
      }
    }
    XYSeriesCollection dataCol = new XYSeriesCollection(serie);

    JFreeChart chart = ChartFactory.createScatterPlot(
        "Dependency Scatter Plot", firstValue.text() + "  " + firstValue.unit(),
        secondValue.text() + "  " + secondValue.unit(), dataCol,
        PlotOrientation.HORIZONTAL, true, true, false);
View Full Code Here

     * @param flag to determine frequency or time domain
     * @return A dataset.
     */
    private XYDataset createDataset(SpectrumArray sp, int flag) {

        XYSeriesCollection dataset = new XYSeriesCollection();
        if (flag == 1) {
            for (int i = 0; i < sp.getNumberOfTraces(); i++) {
                double[] fdabs = sp.getFrequencyAxisValuesHz();

                ComplexArray spec = sp.getSpec(i);

                XYSeries series = new XYSeries("Frequency Domain Abscissa");
                for (int j = 0; j < fdabs.length; j++) {
                    series.add(fdabs[j] + this.xoffset * i, spec.getElement(j).abs() + this.yoffset * i);
                }
                dataset.addSeries(series);

                XYSeries realseries = new XYSeries("Real Plot");
                for (int j = 0; j < fdabs.length; j++) {
                    realseries.add(fdabs[j] + this.xoffset * i, spec.getElement(j).real() + this.yoffset * i);
                }
                dataset.addSeries(realseries);

                XYSeries imagseries = new XYSeries("Imaginary Plot");
                for (int j = 0; j < fdabs.length; j++) {
                    imagseries.add(fdabs[j] + this.xoffset * i, spec.getElement(j).imag() + this.yoffset * i);
                }
                dataset.addSeries(imagseries);
            }
        } else if (flag == 0) {
            for (int i = 0; i < sp.getNumberOfTraces(); i++) {
                double[] tdabs = sp.getTimeAxisValues();

                ComplexArray spec = sp.getFid(i);

                XYSeries series = new XYSeries("Time Domain Abscissa");
                for (int j = 0; j < tdabs.length; j++) {
                    series.add(tdabs[j], spec.getElement(j).abs());
                }
                dataset.addSeries(series);

                XYSeries realseries = new XYSeries("Real Plot");
                for (int j = 0; j < tdabs.length; j++) {
                    realseries.add(tdabs[j], spec.getElement(j).real());
                }
                dataset.addSeries(realseries);

                XYSeries imagseries = new XYSeries("Imaginary Plot");
                for (int j = 0; j < tdabs.length; j++) {
                    imagseries.add(tdabs[j], spec.getElement(j).imag());
                }
                dataset.addSeries(imagseries);
            }

        } else if (flag == 2) {

            for (int i = 0; i < sp.getNumberOfTraces(); i++) {
                double[] fdabs = sp.getFrequencyAxisValuesPPM();

                ComplexArray spec = sp.getSpec(i);

                XYSeries series = new XYSeries("Frequency Domain Abscissa");
                for (int j = 0; j < fdabs.length; j++) {
                    series.add(fdabs[j] + this.xoffset * i, spec.getElement(j).abs() + this.yoffset * i);
                }
                dataset.addSeries(series);

                XYSeries realseries = new XYSeries("Real Plot");
                for (int j = 0; j < fdabs.length; j++) {
                    realseries.add(fdabs[j] + this.xoffset * i, spec.getElement(j).real() + this.yoffset * i);
                }
                dataset.addSeries(realseries);

                XYSeries imagseries = new XYSeries("Imaginary Plot");
                for (int j = 0; j < fdabs.length; j++) {
                    imagseries.add(fdabs[j] + this.xoffset * i, spec.getElement(j).imag() + this.yoffset * i);
                }
                dataset.addSeries(imagseries);
            }
        } else if (flag == 3) {
            for (int i = 0; i < sp.getNumberOfTraces(); i++) {
                double[] tdabs = sp.getTimeAxisValues();

                ComplexArray spec = sp.getFid(i);

                XYSeries series = new XYSeries("Time Domain Abscissa");
                for (int j = 0; j < tdabs.length; j++) {
                    series.add(tdabs[j] * 1000, spec.getElement(j).abs());
                }
                dataset.addSeries(series);

                XYSeries realseries = new XYSeries("Real Plot");
                for (int j = 0; j < tdabs.length; j++) {
                    realseries.add(tdabs[j] * 1000, spec.getElement(j).real());
                }
                dataset.addSeries(realseries);

                XYSeries imagseries = new XYSeries("Imaginary Plot");
                for (int j = 0; j < tdabs.length; j++) {
                    imagseries.add(tdabs[j] * 1000, spec.getElement(j).imag());
                }
                dataset.addSeries(imagseries);
            }

        }
        return dataset;
    }
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.