List of usage examples for org.jfree.data.xy XYSeriesCollection addSeries
public void addSeries(XYSeries series)
From source file:edu.ucla.stat.SOCR.chart.demo.PolarChartDemo1.java
/** * Returns a sample dataset./* w w w . j a va 2 s .c o m*/ * * @return The dataset. */ protected XYDataset createDataset(boolean isDemo) { if (isDemo) { XYSeriesCollection result = new XYSeriesCollection(); XYSeries s1 = new XYSeries("Series 1"); s1.add(0.0, 2.0); s1.add(90.0, 13.0); s1.add(180.0, 9.0); s1.add(270.0, 8.0); result.addSeries(s1); XYSeries s2 = new XYSeries("Series 2"); s2.add(90.0, -11.2); s2.add(180.0, 21.4); s2.add(250.0, 17.3); s2.add(355.0, 10.9); result.addSeries(s2); return result; } else return super.createDataset(false); }
From source file:org.jfree.chart.demo.PolarChartDemo.java
/** * Creates a sample dataset./*ww w . j a v a2s . c o m*/ * * @return A sample dataset. */ private XYDataset createDataset() { final XYSeriesCollection data = new XYSeriesCollection(); final XYSeries series1 = createRandomData("Series 1", 75.0, 10.0); final XYSeries series2 = createRandomData("Series 2", 50.0, 5.0); final XYSeries series3 = createRandomData("Series 3", 25.0, 1.0); data.addSeries(series1); data.addSeries(series2); data.addSeries(series3); return data; }
From source file:turtlekit.murmuration.HeadingChecker.java
@Override public void setupFrame(JFrame frame) { XYSeriesCollection dataset = new XYSeriesCollection(); final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Average heading", null, null); chartPanel.setPreferredSize(new java.awt.Dimension(550, 250)); heading = new XYSeries("Average heading"); dataset.addSeries(heading); frame.setContentPane(chartPanel);/*from w ww .j a v a 2 s . c o m*/ frame.setLocation(50, 0); // XYSeries s = dataset.getSeries("Total"); }
From source file:metodosnumericos.VentanaPuntoFijo.java
private void butCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCalcularActionPerformed if (txtGx.getText().isEmpty() || txtIteraciones.getText().isEmpty() || txtTolerancia.getText().isEmpty() || txtXa.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Verifique que los campos no esten vacios", "Mensaje", JOptionPane.INFORMATION_MESSAGE); } else {/* w ww . j av a 2 s .co m*/ try { Graficador t = new Graficador(); double tolerancia = Double.parseDouble(txtTolerancia.getText()); int iteraciones = Integer.parseInt(txtIteraciones.getText()); double xi = Double.parseDouble(txtXa.getText()); String gx = txtGx.getText(); Metodos m = new Metodos(); JOptionPane.showMessageDialog(null, m.PuntoFijo(tolerancia, xi, iteraciones, funcion, gx, true), "Resultado", JOptionPane.INFORMATION_MESSAGE); GeneradorTablas g = new GeneradorTablas(); JTable tabla = g.tablaPuntoFijo(m.getPuntoFijoXn(), m.getPuntoFijoFxn(), m.getPuntoFijoEa(), m.getPuntoFijoEr()); double xs; //Si Xi < Xv if (xi < m.getPuntoFijoXn().get(m.getPuntoFijoXn().size() - 1).doubleValue()) { xs = m.getPuntoFijoXn().get(m.getPuntoFijoXn().size() - 1).doubleValue() + 5; } else { xs = xi; xi = m.getPuntoFijoXn().get(m.getPuntoFijoXn().size() - 1).doubleValue() - 5; } XYSeries series = t.series2(gx, "gx", xi, xs); XYSeries seriesx = t.series2("x", "X", xi, xs); XYSeriesCollection collection = new XYSeriesCollection(series); collection.addSeries(seriesx); JFreeChart chart = ChartFactory.createXYLineChart("Grafica", "X", "Y", collection); ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new java.awt.Dimension(400, 300)); panelGrafica.removeAll(); panelGrafica.add(panel); panelGrafica.updateUI(); panelTabla.removeAll(); panelTabla.add(new JScrollPane(tabla)); panelTabla.updateUI(); VentanaUnaVariable vuv = new VentanaUnaVariable(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Verifique que los campos sean Numeros", "Mensaje", JOptionPane.INFORMATION_MESSAGE); } } }
From source file:com.signalcollect.sna.gephiconnectors.SignalCollectGephiConnector.java
/** * Creates the Chart of the Clustering Distribution according to the * calculated distribution/*from w w w.j a va 2 s .c om*/ * * @param clusterDistribution * @return a {@link JFreeChart} containing the distribution of local cluster * coefficients in the graph * @throws IOException */ public JFreeChart createClusterDistributionChart(Map<Double, Integer> clusterDistribution) throws IOException { XYSeries dSeries = new XYSeries("number of occurences"); for (Iterator it = clusterDistribution.entrySet().iterator(); it.hasNext();) { Map.Entry d = (Map.Entry) it.next(); Number x = (Number) d.getKey(); Number y = (Number) d.getValue(); dSeries.add(x, y); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); dataset.setAutoWidth(true); JFreeChart chart = ChartFactory.createHistogram("Local Cluster Coefficient Distribution", "Local Cluster Coefficient value", "number of occurences", dataset, PlotOrientation.VERTICAL, true, true, true); XYPlot plot = chart.getXYPlot(); XYBarRenderer renderer0 = new XYBarRenderer(); Font font = new Font("Font", 0, 14); renderer0.setMargin(0.2); renderer0.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); renderer0.setBaseItemLabelsVisible(true); renderer0.setBaseItemLabelFont(font); plot.setDataset(0, dataset); plot.setRenderer(0, renderer0); plot.getRendererForDataset(plot.getDataset(0)).setSeriesPaint(0, Color.BLUE); return chart; }
From source file:turtlekit.pvequalsnrt.PhysicsChecker.java
@Override public void setupFrame(JFrame frame) { XYSeriesCollection dataset = new XYSeriesCollection(); final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "PV = nRT", null, null); chartPanel.setPreferredSize(new java.awt.Dimension(550, 250)); rightSide = new XYSeries("Gas on the right side"); dataset.addSeries(rightSide); total = new XYSeries("Total"); dataset.addSeries(total);/* w w w . j ava 2 s . c o m*/ frame.setContentPane(chartPanel); frame.setLocation(50, 0); XYSeries s = dataset.getSeries("Total"); }
From source file:org.ensor.robots.apps.pidcallibrator.MainPanel.java
/** * Creates new form MainPanel/* w w w .ja v a 2 s . c o m*/ */ public MainPanel() { initComponents(); XYSeriesCollection collection = new XYSeriesCollection(); XYSeries setPoints = new XYSeries("Set Points"); setPoints.add(10, 0); setPoints.add(20, 10); setPoints.add(30, 5); setPoints.add(40, 20); collection.addSeries(setPoints); XYSeries actualPoints = new XYSeries("Actual Points"); actualPoints.add(5, 0); actualPoints.add(15, 5); actualPoints.add(40, 50); collection.addSeries(actualPoints); JFreeChart scatterPlot = ChartFactory.createScatterPlot("Angle PID tracking", "Time", "Angle", collection); ChartPanel cp = new ChartPanel(scatterPlot); mChart.setLayout(new BorderLayout()); mChart.add(cp, BorderLayout.CENTER); mChart.validate(); cp.setSize(mChart.getSize()); }
From source file:playground.dgrether.analysis.charts.DgAvgDeltaMoneyGroupChart.java
protected XYSeriesCollection createDatasets(String runId1, String runId2) { XYSeriesCollection ds = new XYSeriesCollection(); Tuple<XYSeries, List<String>> seriesLabels = this.createXYSeries("Mean " + '\u0394' + "Delta Money", this.ana, runId1, runId2); ds.addSeries(seriesLabels.getFirst()); this.labelGenerator.setLabels(0, seriesLabels.getSecond()); return ds;/*from ww w . j av a2 s.c om*/ }
From source file:carfuzzy.Operations.java
public JFreeChart drawAggregation(FIS[] fis) { XYSeriesCollection aggregationDataset = new XYSeriesCollection(); for (int i = 0; i < 4; i++) { aggregationDataset.addSeries(fis[i].getImplication()); }/*from ww w . j a v a 2 s .c o m*/ //aggregationDataset.getSeries(0).setKey("Agjujugregation"); JFreeChart chart = setToChart(aggregationDataset, "Aggregation"); XYPlot plot = chart.getXYPlot(); XYAreaRenderer renderer = new XYAreaRenderer(); renderer.setSeriesVisibleInLegend(false, true); renderer.setSeriesItemLabelsVisible(0, false, true); renderer.setSeriesItemLabelsVisible(3, true); renderer.setPaint(Color.RED.darker(), true); plot.setRenderer(renderer); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setRange(0, 10); return chart; }
From source file:org.jfree.chart.demo.LineChartDemo3.java
/** * Creates a new demo./*from w w w. j a v a 2s .c o m*/ * * @param title the frame title. */ public LineChartDemo3(final String title) { super(title); // create a dataset... final XYSeriesCollection dataset = new XYSeriesCollection(); for (int i = 0; i < 10; i++) { final XYSeries series = new XYSeries("S" + i); for (int j = 0; j < 10; j++) { series.add(j, Math.random() * 100); } dataset.addSeries(series); } final JFreeChart chart = createChart(dataset); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }