Package org.jfree.data.xy

Examples of org.jfree.data.xy.XYSeriesCollection


        }
    }

    private void addDataToLineChart(ChartEvent event, Wink lastSimTime, ParCollection params) {
        // Line Chart.
        XYSeriesCollection dataset = this.lineDataSet.get(event.getChartName());
        XYItemRenderer renderer;
        XYPlot plot;
       
        if (dataset == null) {
            NumberAxis domain = new NumberAxis(event.getxAxisLabel());
            NumberAxis range = new NumberAxis(event.getyAxisLabel());
           
            if (event.isDrawSmoothSplinesInLineCharts()) {
                renderer = new XYSplineRenderer();
            } else {
                renderer = new XYLineAndShapeRenderer(event.isDrawLinesInLineCharts(), event.isDrawSymbolsInLineCharts());
            }
           
            dataset = new XYSeriesCollection();
            plot = new XYPlot(dataset, domain, range, renderer);
            domain.setAutoRange(true);
            domain.setLowerBound(lastSimTime.getCurrentTime());
            domain.setTickLabelsVisible(true);
            range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
            JFreeChart chart = new JFreeChart(
                    event.getChartName(),
                    new Font("SansSerif", Font.BOLD, 24),
                    plot,
                    true);
           
            createFrame(event.getChartName(), event.getChartType(), params, chart);
           
            this.lineDataSet.put(event.getChartName(), dataset);
            this.chartList.put(event.getChartName(), chart);
        } else {
            plot = chartList.get(event.getChartName()).getXYPlot();
        }
       
        XYSeries series;
        int foundSeriesNum = this.containsSeriesLinechart(dataset.getSeries(), event.getSeriesName());
       
        if (foundSeriesNum < 0) {
            dataset.addSeries(new XYSeries(event.getSeriesName()));
            foundSeriesNum = this.containsSeriesLinechart(dataset.getSeries(), event.getSeriesName());
        }
       
        if (event.getLineStroke() != null) {
            plot.getRenderer().setSeriesStroke(foundSeriesNum, event.getLineStroke());
        }
        if (event.getLineColor() != null) {
            plot.getRenderer().setSeriesPaint(foundSeriesNum, event.getLineColor());
        }

        plot.getDomainAxis().setUpperBound(lastSimTime.getCurrentTime());
        series = dataset.getSeries(event.getSeriesName());

        if (event.getXValue() == ChartEvent.X_VALUE_NOT_SPECIFIED) {
            series.add(new XYDataItem(lastSimTime.getCurrentTime(), event.getValue()));
        } else {
            series.add(new XYDataItem(event.getXValue(), event.getValue()));
View Full Code Here


    double[] ys = new double[algoAggregates.size()];
    double[] starty = new double[algoAggregates.size()];
    double[] endy = new double[algoAggregates.size()];

    XYSeries series1 = new XYSeries("CostBenefit");
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    DefaultIntervalXYDataset datasetxy = new DefaultIntervalXYDataset();
   
    if (connectionModel.getSchema() != null) {
   
      Map<Parameter, Object> algorithmParams = ArgumentUtils.validateParameters(algorithm, algorithmUiExtension.getAlgorithmParameters());
View Full Code Here

  /**
   * Construct the pane.
   */
  public ChartPane() {
    this.series1 = new XYSeries("Current Error");
    this.dataset1 = new XYSeriesCollection();
    this.dataset1.addSeries(this.series1);
    this.series1.setMaximumItemCount(50);

    this.series2 = new XYSeries("Error Improvement");
    this.dataset2 = new XYSeriesCollection();
    this.dataset2.addSeries(this.series2);
    this.series2.setMaximumItemCount(50);

    // addData(1,1,0.01);

View Full Code Here

        return chart;
    }
   
    public XYDataset createDataset() {
      String title = rbf.getClass().getSimpleName();
        XYSeriesCollection dataset = new XYSeriesCollection();

        Function2D n1 = new RBFFunction2D(this.rbf);// //new NormalDistributionFunction2D(0.0, 1.0);
        XYSeries s1 = DatasetUtilities.sampleFunction2DToSeries(n1, -5.1, 5.1,
                121, title);
        dataset.addSeries(s1);

        return dataset;
    }
View Full Code Here

      XYSeries cSeries = computation.get(i);
      JFreeChart chart = charts.get(i);
      ChartPanel chartPanel = chartPanels.get(i);

      XYPlot plot = chart.getXYPlot();
      plot.setDataset(0, new XYSeriesCollection(vSeries));
      final XYItemRenderer renderer1 = new StandardXYItemRenderer();
      renderer1.setSeriesPaint(0, Color.blue);
      plot.setRenderer(0, renderer1);

      plot.setDataset(1, new XYSeriesCollection(cSeries));
      final XYItemRenderer renderer2 = new StandardXYItemRenderer();
      renderer2.setSeriesPaint(0, Color.red);
      plot.setRenderer(1, renderer2);

      ChartUtilities.applyCurrentTheme(chart);
View Full Code Here

     * function.
     *
     * @return A dataset.
     */
    public static XYDataset createDataset(ActivationFunction activation, boolean normal) {
        XYSeriesCollection dataset = new XYSeriesCollection();

        if( normal )
        {
        Function2D n1 = new ActivationFunction2D(activation);// //new NormalDistributionFunction2D(0.0, 1.0);
        XYSeries s1 = DatasetUtilities.sampleFunction2DToSeries(n1, -5.1, 5.1,
                121, "Activation Function");
        dataset.addSeries(s1);
        }
        else
        {
          if( activation.hasDerivative())
          {
        Function2D n2 = new DerivativeFunction2D(activation);
        XYSeries s2 = DatasetUtilities.sampleFunction2DToSeries(n2, -5.1, 5.1,
                121, "Derivative Function");
        dataset.addSeries(s2);
          }
        }

        return dataset;
    }
View Full Code Here

  /**
   *
   */
  private void addChart() {
    series = new XYSeries("Temperature");
    XYDataset xyDataset=new XYSeriesCollection(series);   
    JFreeChart chart=ChartFactory.createTimeSeriesChart("History","Time","Temperature",
        xyDataset,false,false,false);
    //chart.getXYPlot()
    jPanelChart=new ChartPanel(chart);
    jPanelChart.setOpaque(false);
View Full Code Here

   */
  public static void ulozGrafPodleVerzi(Hashtable<Long, Long> data, String soubor,
      boolean png) throws SVNstatistikaChybaVystupu {

    /* vytvoříme dataset, který bude zadáním pro vytvoření grafu */
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries rada = new XYSeries("Řada");
    dataSet.addSeries(rada);

    for (Long verze : data.keySet()) {
      rada.add(verze, data.get(verze));
    }

View Full Code Here

      dtm.addColumn("DPSe");
      dtm.addColumn("Activity");
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      if(c==null) return;
      int marked=3;
      XYSeriesCollection dps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        ((DefaultListModel)cParticipants.getModel()).addElement(cp.getName());
        dtm.addRow(new Object[]{(marked>0),cp.getName(),cp.getDpsRealTimeStats().getDamage(),cp.getDpsRealTimeStats().getDPS(c.getCombatDuration()),cp.getDpsRealTimeStats().getDPSe(),cp.getDpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          dps_dataset.addSeries(createDPSSeries(c,cp));
        marked--;
      }
      dpsoChart=ChartFactory.createXYLineChart("Real time DPS", "Seconds of combat", "DPS", dps_dataset, PlotOrientation.VERTICAL, true, true, false);
      dpsoChart.getXYPlot().setRenderer(new XYSplineRenderer());
      dpsoChartPanel=new ChartPanel(dpsoChart);
      dpsoChartPanel.setLayout(new BorderLayout());
      dpsoPanel.removeAll();
      dpsoPanel.add(dpsoChartPanel);
      dpsoChartPanel.revalidate();
      dpsoChartPanel.repaint();
      dpso.getColumnModel().getColumn(0).setMaxWidth(30);
      dpso.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      dpso.getColumnModel().getColumn(0).setCellEditor(new DPSCheckBoxCellEditor(c.getName(),this));
      dtm.fireTableDataChanged();
      dpso.revalidate();
      dpso.repaint();
     
      combatName.setText(c.getName());
      SimpleDateFormat sdf=new SimpleDateFormat("HH:mm:ss");
      combatStart.setText(sdf.format(c.getCombatStart()));
      combatEnd.setText(sdf.format(c.getCombatEnd()));
      combatDuration.setText(Long.toString(c.getCombatDuration()));
     
      ((DefaultListModel)cParticipants.getModel()).removeAllElements();
      for(Iterator<CombatParticipant> it=c.getSortedParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        ((DefaultListModel)cParticipants.getModel()).addElement(cp.getName());
      }
      x1_dps1Stats.setModel(new DefaultTableModel());
      x1_dps1Stats.revalidate();
      x1_dps1Stats.repaint();
      x1_dps2Stats.setModel(new DefaultTableModel());
      x1_dps2Stats.revalidate();
      x1_dps2Stats.repaint();
      x1_dtps1Stats.setModel(new DefaultTableModel());
      x1_dtps1Stats.revalidate();
      x1_dtps1Stats.repaint();
      x1_dtps2Stats.setModel(new DefaultTableModel());
      x1_dtps2Stats.revalidate();
      x1_dtps2Stats.repaint();
      x1_hps1Stats.setModel(new DefaultTableModel());
      x1_hps1Stats.revalidate();
      x1_hps1Stats.repaint();
      x1_hps2Stats.setModel(new DefaultTableModel());
      x1_hps2Stats.revalidate();
      x1_hps2Stats.repaint();
      x1_hps3Stats.setModel(new DefaultTableModel());
      x1_hps3Stats.revalidate();
      x1_hps3Stats.repaint();
      x1_dtpsTypes.setModel(new DefaultTableModel());
      x1_dtpsTypes.revalidate();
      x1_dtpsTypes.repaint();
      interrupts.setModel(new DefaultTableModel());
      interrupts.revalidate();
      interrupts.repaint();
      deaths.setModel(new DefaultTableModel());
      deaths.revalidate();
      deaths.repaint();
      cParticipants.revalidate();
      cParticipants.repaint();     

      DefaultTableModel htm=new DefaultTableModel();
      hps.setModel(htm);
      htm.addColumn("");
      htm.addColumn("Combat participant");
      htm.addColumn("Healing done");
      htm.addColumn("Overhealing");
      htm.addColumn("HPS");
      htm.addColumn("HPSe");
      htm.addColumn("Activity");
      marked=3;
      XYSeriesCollection hps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedHPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        htm.addRow(new Object[]{(marked>0),cp.getName(),cp.getHpsRealTimeStats().getHealingDone(),cp.getHpsRealTimeStats().getOverhealingDone(),cp.getHpsRealTimeStats().getHPS(c.getCombatDuration()),cp.getHpsRealTimeStats().getHPSe(),cp.getHpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          hps_dataset.addSeries(createHPSSeries(c,cp));
        marked--;
      }
      hpsChart=ChartFactory.createXYLineChart("Real time HPS", "Seconds of combat", "HPS", hps_dataset, PlotOrientation.VERTICAL, true, true, false);
      hpsChart.getXYPlot().setRenderer(new XYSplineRenderer());
      hpsChartPanel=new ChartPanel(hpsChart);
      hpsChartPanel.setLayout(new BorderLayout());
      hpsPanel.removeAll();
      hpsPanel.add(hpsChartPanel);
      hpsChartPanel.revalidate();
      hpsChartPanel.repaint();
      hps.getColumnModel().getColumn(0).setMaxWidth(30);
      hps.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      hps.getColumnModel().getColumn(0).setCellEditor(new HPSCheckBoxCellEditor(c.getName(),this));
      htm.fireTableDataChanged();
      hps.revalidate();
      hps.repaint();
     
      DefaultTableModel dttm=new DefaultTableModel();
      dpst.setModel(dttm);
      dttm.addColumn("");
      dttm.addColumn("Combat participant");
      dttm.addColumn("Damage taken");
      dttm.addColumn("DTPS");
      dttm.addColumn("DTPSe");
      dttm.addColumn("Activity");
      marked=3;
      XYSeriesCollection dtps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedDTPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        dttm.addRow(new Object[]{(marked>0),cp.getName(),cp.getDtpsRealTimeStats().getDamage(),cp.getDtpsRealTimeStats().getDPS(c.getCombatDuration()),cp.getDtpsRealTimeStats().getDPSe(),cp.getDtpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          dtps_dataset.addSeries(createDTPSSeries(c,cp));
        marked--;
      }
      dpstChart=ChartFactory.createXYLineChart("Real time damage taken", "Seconds of combat", "DTPS", dtps_dataset, PlotOrientation.VERTICAL, true, true, false);
      dpstChart.getXYPlot().setRenderer(new XYSplineRenderer());
      dpstChartPanel=new ChartPanel(dpstChart);
      dpstChartPanel.setLayout(new BorderLayout());
      dpstPanel.removeAll();
      dpstPanel.add(dpstChartPanel);
      dpstChartPanel.revalidate();
      dpstChartPanel.repaint();
      dpst.getColumnModel().getColumn(0).setMaxWidth(30);
      dpst.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      dpst.getColumnModel().getColumn(0).setCellEditor(new DTPSCheckBoxCellEditor(c.getName(),this));
      dttm.fireTableDataChanged();
      dpst.revalidate();
      dpst.repaint();
    }
    if(eventType==RRAMediator.EventDPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)dpsoChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createDPSSeries(c,cp));
          }
        }
      }
      dpsoChart.fireChartChanged();
      dpsoChartPanel.revalidate();
      dpsoChartPanel.repaint();
    }
    if(eventType==RRAMediator.EventHPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedHPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)hpsChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createHPSSeries(c,cp));
          }
        }
      }
      hpsChart.fireChartChanged();
      hpsChartPanel.revalidate();
      hpsChartPanel.repaint();
    }
    if(eventType==RRAMediator.EventDTPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedDTPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)dpstChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createDTPSSeries(c,cp));
          }
        }
      }
      dpstChart.fireChartChanged();
      dpstChartPanel.revalidate();
View Full Code Here

    int numberOfPoints = values.length;
    double xx = min;
    double step = (max - min) / ((double) numberOfPoints);
    for( int i = 0; i < numberOfPoints; i++, xx += step )
      series.add(xx, values[i]);
    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

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.