List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.drugis.addis.gui.ConvergencePlotsDialog.java
private JPanel createPanel() { FormLayout layout = new FormLayout("pref:grow:fill", "p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();//from w ww .j a va 2s.co m CellConstraints cc = new CellConstraints(); final XYSeriesCollection datasetRhat = new XYSeriesCollection(); final XYSeriesCollection datasetVhatVsW = new XYSeriesCollection(); datasetRhat.addSeries(d_rHatSeries); datasetVhatVsW.addSeries(d_vHatSeries); datasetVhatVsW.addSeries(d_wSeries); final JFreeChart rHatChart = createRhatChart(datasetRhat); final JFreeChart vHatvsWChart = createVhatVsWChart(datasetVhatVsW); final ChartPanel chartPanelRhat = new ChartPanel(rHatChart); final ChartPanel chartPanelVhatVsW = new ChartPanel(vHatvsWChart); chartPanelRhat.setVisible(true); chartPanelVhatVsW.setVisible(true); JProgressBar bar = new TaskProgressBar(d_task); builder.add(bar, cc.xy(1, 1)); builder.add(chartPanelRhat, cc.xy(1, 3)); builder.add(chartPanelVhatVsW, cc.xy(1, 5)); return builder.getPanel(); }
From source file:org.drools.planner.benchmark.core.statistic.memoryuse.MemoryUseProblemStatistic.java
protected void writeGraphStatistic() { XYSeriesCollection seriesCollection = new XYSeriesCollection(); for (SingleBenchmark singleBenchmark : problemBenchmark.getSingleBenchmarkList()) { MemoryUseSingleStatistic singleStatistic = (MemoryUseSingleStatistic) singleBenchmark .getSingleStatistic(problemStatisticType); XYSeries usedSeries = new XYSeries(singleBenchmark.getSolverBenchmark().getName() + " used"); XYSeries maxSeries = new XYSeries(singleBenchmark.getSolverBenchmark().getName() + " max"); for (MemoryUseSingleStatisticPoint point : singleStatistic.getPointList()) { long timeMillisSpend = point.getTimeMillisSpend(); MemoryUseMeasurement memoryUseMeasurement = point.getMemoryUseMeasurement(); usedSeries.add(timeMillisSpend, memoryUseMeasurement.getUsedMemory()); maxSeries.add(timeMillisSpend, memoryUseMeasurement.getMaxMemory()); }//w w w . jav a2 s. com seriesCollection.addSeries(usedSeries); seriesCollection.addSeries(maxSeries); } NumberAxis xAxis = new NumberAxis("Time spend"); xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat()); NumberAxis yAxis = new NumberAxis("Memory"); yAxis.setAutoRangeIncludesZero(false); XYItemRenderer renderer = new XYAreaRenderer2(); XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(problemBenchmark.getName() + " memory use statistic", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); graphStatisticFile = new File(problemBenchmark.getProblemReportDirectory(), problemBenchmark.getName() + "MemoryUseStatistic.png"); OutputStream out = null; try { out = new FileOutputStream(graphStatisticFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException("Problem writing graphStatisticFile: " + graphStatisticFile, e); } finally { IOUtils.closeQuietly(out); } }
From source file:org.jfree.data.xy.IntervalXYDelegateTest.java
/** * Serialize an instance, restore it, and check for equality. *//*from www .ja v a 2 s. c o m*/ @Test public void testSerialization() { XYSeries s1 = new XYSeries("Series"); s1.add(1.2, 3.4); XYSeriesCollection c1 = new XYSeriesCollection(); c1.addSeries(s1); IntervalXYDelegate d1 = new IntervalXYDelegate(c1); IntervalXYDelegate d2 = (IntervalXYDelegate) TestUtilities.serialised(d1); assertEquals(d1, d2); }
From source file:org.squale.squaleweb.util.graph.ScatterMaker.java
/** * Constructeur avec le titre du diagramme et les titres des axes * /* ww w .j a v a2s . c om*/ * @param pTitle titre du diagramme (peut etre <code>null</code>) * @param pDomainAxisLabel titre de l'axe horizontal (peut etre <code>null</code>) * @param pValueAxisLabel titre de l'axe des valeurs (peut etre <code>null</code>) */ public ScatterMaker(String pTitle, String pDomainAxisLabel, String pValueAxisLabel) { mDataSet = new XYSeriesCollection(); mTitle = pTitle; mXLabel = pDomainAxisLabel; mYLabel = pValueAxisLabel; }
From source file:rework.MainFrame.java
private XYDataset createDataset() { final XYSeries sheet = new XYSeries("Serie"); if (datalist == null) { //dataList = new DataList(); //dataList.addObserver(this); datalist.add(new Point(new Date(1970, 1, 1), 5, 7.2)); }/*from w ww .j a v a 2s . c o m*/ int i = 0; data = new Object[datalist.size()][3]; while (i != datalist.size()) { Point currentPoint = datalist.getPointAt(i); sheet.add(currentPoint.getX(), currentPoint.getValue()); data[i][0] = currentPoint.getDate(); data[i][1] = currentPoint.getX(); data[i][2] = currentPoint.getValue(); i++; } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(sheet); return dataset; }
From source file:eremeykin.pete.plotter.PlotterTopComponent.java
void init(TopComponent tc) { final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dataSeries);/* w w w . j a v a2s .c o m*/ dataset.addSeries(toleranceSeries); final JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart); tc.setLayout(new java.awt.BorderLayout()); tc.add(chartPanel, BorderLayout.CENTER); tc.validate(); }
From source file:LineChartDemo6.java
/** * Creates a sample dataset.// w w w . j av a2s. co m * * @return a sample dataset. */ private XYDataset createDataset() { final XYSeries series1 = new XYSeries("First"); series1.add(1.0, 1.0); series1.add(2.0, 4.0); series1.add(3.0, 3.0); series1.add(4.0, 5.0); series1.add(5.0, 5.0); series1.add(6.0, 7.0); series1.add(7.0, 7.0); series1.add(8.0, 8.0); final XYSeries series2 = new XYSeries("Second"); series2.add(1.0, 5.0); series2.add(2.0, 7.0); series2.add(3.0, 6.0); series2.add(4.0, 8.0); series2.add(5.0, 4.0); series2.add(6.0, 4.0); series2.add(7.0, 2.0); series2.add(8.0, 1.0); final XYSeries series3 = new XYSeries("Third"); series3.add(3.0, 4.0); series3.add(4.0, 3.0); series3.add(5.0, 2.0); series3.add(6.0, 3.0); series3.add(7.0, 6.0); series3.add(8.0, 3.0); series3.add(9.0, 4.0); series3.add(10.0, 3.0); final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2); dataset.addSeries(series3); return dataset; }
From source file:edu.ucla.stat.SOCR.chart.demo.XYAreaChartDemo1.java
protected XYDataset createDataset(boolean isDemo) { if (isDemo) { XYSeries series1 = new XYSeries("Random 1"); series1.add(new Integer(1), new Double(500.2)); series1.add(new Integer(2), new Double(694.1)); series1.add(new Integer(3), new Double(-734.4)); series1.add(new Integer(4), new Double(453.2)); series1.add(new Integer(5), new Double(500.2)); series1.add(new Integer(6), new Double(300.7)); series1.add(new Integer(7), new Double(734.4)); series1.add(new Integer(8), new Double(453.2)); XYSeries series2 = new XYSeries("Random 2"); series2.add(new Integer(1), new Double(700.2)); series2.add(new Integer(2), new Double(534.1)); series2.add(new Integer(3), new Double(323.4)); series2.add(new Integer(4), new Double(125.2)); series2.add(new Integer(5), new Double(653.2)); series2.add(new Integer(6), new Double(432.7)); series2.add(new Integer(7), new Double(564.4)); series2.add(new Integer(8), new Double(322.2)); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1);//from ww w . ja v a 2 s .c o m dataset.addSeries(series2); dataset.setIntervalWidth(0.0); return dataset; } else return super.createDataset(false); }
From source file:techtonic.WellBoreListenerOnView.java
public void superImposGraph(List<WitsmlTrajectory> trajectorys) { int ct = 0;/*from www . j a v a2s. c om*/ XYSeriesCollection data = new XYSeriesCollection(); for (WitsmlTrajectory trajectory : trajectorys) { List<WitsmlTrajectoryStation> stationsAsList = Arrays .asList(new WitsmlTrajectoryStation[trajectory.getStations().size()]); for (WitsmlTrajectoryStation s : trajectory.getStations()) { stationsAsList.set(s.getStationNo(), s); } XYSeries series = new XYSeries(trajectory.getName()); // add data to Dataset (here assume data is in ArrayLists x and y for (WitsmlTrajectoryStation station : stationsAsList) { Value tvd = station.getTvd(); if (tvd == null) { continue; } Value md = station.getNorth(); if (md == null) { continue; } // System.out.println(count + " : ===>> tvd : "+tvd.getValue()+ "; md "+md.getValue()); series.add(md.getValue(), tvd.getValue()); } data.addSeries(series); ct++; } // create a chart using the createYLineChart method... JFreeChart chart = ChartFactory.createXYLineChart("Trajectory: True Vertical Depth Against North", // chart title "North", "Depth", // x and y axis labels data); // data ChartPanel cp = new ChartPanel(chart); // JFrame fr = new JFrame(); // fr.add(cp); // fr.pack(); // fr.setVisible(true); cp.setMouseZoomable(true, true); Techtonic.setFreeChart(chart); Techtonic.setDisplayArea(cp); }
From source file:com.che.software.testato.business.SelectiveChartManager.java
/** * Creates a selective chart from a set of scripts related to 2 criterions. * Excluded values are optionals and will be created as a different set of * points. This allow to colored them in red in following steps. * /*from www.ja v a 2 s . c o m*/ * @author Clement HELIOU (clement.heliou@che-software.com). * @param xValues the x axis values list. * @param yValues the y axis values list. * @param title the title to give to the line chart. * @param xLabel the criterion label to display on the x axis. * @param yLabel the criterion label to display on the y axis. * @param xExcludedValues the x axis excluded values. * @param yExcludedValues the y axis excluded values. * @return the resulting chart. * @since August, 2011. */ public JFreeChart createSelectiveChart(List<MatrixResult> xValues, List<MatrixResult> yValues, String title, String xLabel, String yLabel, List<MatrixResult> xExcludedValues, List<MatrixResult> yExcludedValues) { LOGGER.debug("createSelectiveChart(" + xLabel + "," + yLabel + "," + xValues.size() + "," + yValues.size() + ")."); XYSeries notExcludedData = new XYSeries("1"), excludedData = new XYSeries("2"), lowMediumLine = new XYSeries("3"), mediumHighLine = new XYSeries("4"); for (int i = 0; i < xValues.size(); i++) { notExcludedData.add(yValues.get(i).getPercentage() * 100, xValues.get(i).getPercentage() * 100); } if (null != xExcludedValues) { for (int j = 0; j < xExcludedValues.size(); j++) { excludedData.add(yExcludedValues.get(j).getPercentage() * 100, xExcludedValues.get(j).getPercentage() * 100); } } double maxAbscissaValue = LineChartGraphistUtil.getMaxAbscissaValue(xValues, xExcludedValues) + 2; lowMediumLine.add(0, 0); lowMediumLine.add(0.5 * maxAbscissaValue, maxAbscissaValue); mediumHighLine.add(0, 0); mediumHighLine.add(1.5 * maxAbscissaValue, maxAbscissaValue); XYSeriesCollection dataSet = new XYSeriesCollection(); dataSet.addSeries(notExcludedData); dataSet.addSeries(excludedData); dataSet.addSeries(lowMediumLine); dataSet.addSeries(mediumHighLine); return ChartFactory.createXYLineChart(title, xLabel, yLabel, dataSet, PlotOrientation.HORIZONTAL, false, true, false); }