List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:br.com.una.apa.p02e01.Graph.java
/** * Creates a sample dataset./*from w ww. j a v a 2 s. c o m*/ * * @return a sample dataset. */ private XYDataset createDataset(ArrayList<Grafico> lista) { final XYSeriesCollection dataset = new XYSeriesCollection(); for (int i = 0; i < lista.size(); i++) { XYSeries series = new XYSeries(lista.get(i).getNome()); series.add(0, lista.get(i).getY()); series.add(lista.get(i).getX(), lista.get(i).getY()); dataset.addSeries(series); } return dataset; }
From source file:edu.ucla.stat.SOCR.chart.demo.PolarChartDemo1.java
/** * Returns a sample dataset./*from w ww .j a va2s . com*/ * * @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:com.seniorproject.augmentedreality.chart.ChartCreator.java
protected XYDataset createDataset() { // System.out.println("Create Dataset of" + textX); final XYSeries seriesR = new XYSeries(title[1]); final XYSeries seriesG = new XYSeries(title[2]); final XYSeries seriesB = new XYSeries(title[3]); Integer countPixel[] = new Integer[256]; for (int i = 0; i < 256; i++) { countPixel[i] = 0;//from w ww . ja va 2 s. c o m for (int j = 0; j < this.pixelR.length; j++) { if (this.pixelR[j] == i) { countPixel[i]++; } } seriesR.add(i, countPixel[i] / (this.pixelR.length * 1.0d)); } for (int i = 0; i < 256; i++) { countPixel[i] = 0; for (int j = 0; j < this.pixelG.length; j++) { if (this.pixelG[j] == i) { countPixel[i]++; } } seriesG.add(i, countPixel[i] / (this.pixelG.length * 1.0d)); } for (int i = 0; i < 256; i++) { countPixel[i] = 0; for (int j = 0; j < this.pixelB.length; j++) { if (this.pixelB[j] == i) { countPixel[i]++; } } seriesB.add(i, countPixel[i] / (this.pixelB.length * 1.0d)); } final XYSeriesCollection dataSeries = new XYSeriesCollection(); dataSeries.addSeries(seriesR); dataSeries.addSeries(seriesB); dataSeries.addSeries(seriesG); return dataSeries; }
From source file:tl.lib.dataCollection.gui.TimeSeriesChart.java
public TimeSeriesChart(_CollectionGUIScenario scenario, String label, String description, String labelAxisY) { super(null);// www. j a v a 2 s . co m this.sourceDescriptor = scenario.getSourceDescriptor(); this.collection = new XYSeriesCollection(); // ChartTheme currentTheme = new StandardChartTheme("JFree"); ValueAxis timeAxis = new DateAxis("Time"); timeAxis.setLowerMargin(0.02); // reduce the default margins timeAxis.setUpperMargin(0.02); NumberAxis valueAxis = new NumberAxis(labelAxisY); valueAxis.setAutoRangeIncludesZero(false); // override default XYToolTipGenerator toolTipGenerator = null; toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); // XYURLGenerator urlGenerator = new StandardXYURLGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); // renderer.setURLGenerator(urlGenerator); this.plot = new XYPlot(collection, timeAxis, valueAxis, renderer); this.chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true); // currentTheme.apply(chart); renderingInfo = new ChartRenderingInfo(); this.scenario = scenario; this.description = description; this.label = label; this.selected = new Vector<SourceId>(); default_all = true; super.setChart(chart); }
From source file:MSUmpire.DIA.RTMappingExtLib.java
public void GenerateModel() throws IOException { XYPointCollection points = new XYPointCollection(); XYSeries series = new XYSeries("Peptide ions"); XYSeriesCollection xySeriesCollection = new XYSeriesCollection(); FileWriter writer = new FileWriter(FilenameUtils.getFullPath(TargetLCMS.mzXMLFileName) + "/" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "_" + libManager.LibID + "_RTMapPoints.txt"); for (String pepkey : libManager.PeptideFragmentLib.keySet()) { if (TargetLCMS.GetPepIonList().containsKey(pepkey)) { PepFragmentLib peplib = libManager.GetFragmentLib(pepkey); for (float rt : peplib.RetentionTime) { float y = TargetLCMS.GetPepIonList().get(pepkey).GetRT(); points.AddPoint(rt, y);//w w w .j a v a 2 s. c om series.add(new XYDataItem(rt, y)); writer.write(rt + "\t" + y + "\n"); } } } writer.close(); regression = new PiecewiseRegression(parameter.MaxCurveRTRange, parameter.MaxCurveRTRange); regression.SetData(points); float R2 = regression.GetR2(); Logger.getRootLogger() .info("Retention time prediction model:(" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "..R2=" + R2 + "(No. of commonly identified peptide ions=" + points.PointCount() + ")"); GenerateRTMapPNG(xySeriesCollection, series, R2); }
From source file:org.squale.squaleweb.util.graph.ScatterMaker.java
/** * Constructeur par dfaut/* w ww .j a v a2 s. co m*/ */ public ScatterMaker() { mDataSet = new XYSeriesCollection(); // Etiquete figurant sur l'axe horizontal (peut etre null) Par dfaut : "v(g)" mXLabel = WebMessages.getString("scatter.default.axis.domain"); // Etiquete figurant sur l'axe des valeurs (peut etre null) Par dfaut : "ev(g)" mYLabel = WebMessages.getString("scatter.default.axis.value"); }
From source file:de.cebitec.readXplorer.plotting.CreatePlots.java
public synchronized static ChartPanel createInfPlot(Map<PersistentFeature, Pair<Double, Double>> data, String xName, String yName, XYToolTipGenerator toolTip) { XYSeriesCollection normal = new XYSeriesCollection(); XYSeriesCollection posInf = new XYSeriesCollection(); XYSeriesCollection negInf = new XYSeriesCollection(); XYSeries nor = new XYSeries("Normal"); XYSeries pos = new XYSeries("Positive Infinite"); XYSeries neg = new XYSeries("Negative Infinite"); for (Iterator<PersistentFeature> it = data.keySet().iterator(); it.hasNext();) { PersistentFeature key = it.next(); Pair<Double, Double> pair = data.get(key); Double X = pair.getFirst(); Double Y = pair.getSecond(); if (Y == Double.POSITIVE_INFINITY) { Y = 0d;//from w ww .jav a 2 s .c om pos.add(new PlotDataItem(key, X, Y)); } if (Y == Double.NEGATIVE_INFINITY) { Y = 0d; neg.add(new PlotDataItem(key, X, Y)); } if (!Y.isInfinite() && !X.isInfinite()) { nor.add(new PlotDataItem(key, X, Y)); } } normal.addSeries(nor); posInf.addSeries(pos); negInf.addSeries(neg); JFreeChart chart = createCombinedChart(normal, posInf, negInf, xName, yName, toolTip); chart.removeLegend(); ChartPanel panel = new ChartPanel(chart, true, false, true, true, true); panel.setInitialDelay(0); panel.setMaximumDrawHeight(1080); panel.setMaximumDrawWidth(1920); panel.setMouseWheelEnabled(true); panel.setMouseZoomable(true); MouseActions mouseAction = new MouseActions(); panel.addChartMouseListener(mouseAction); ChartPanelOverlay overlay = new ChartPanelOverlay(mouseAction); panel.addOverlay(overlay); return panel; }
From source file:wm.edu.cs420.Data.ChartBuilder.java
public JFreeChart createChart() { final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series);/* w w w .j a v a 2 s. co m*/ series = null; return generateChart(dataset); }
From source file:org.matsim.contrib.socnetsim.usage.analysis.CourtesyHistogramListener.java
static JFreeChart getGraphic(final CourtesyHistogram.DataFrame dataFrame, int iteration, String actType) { final XYSeriesCollection xyData = new XYSeriesCollection(); final XYSeries helloSeries = new XYSeries("hello", false, true); final XYSeries goodbyeSerie = new XYSeries("goodbye", false, true); final XYSeries togetherSerie = new XYSeries("pairs together", false, true); int together = 0; for (int i = 0; i < dataFrame.countsHello.length; i++) { together = together + dataFrame.countsHello[i] - dataFrame.countsGoodbye[i]; double hour = i * dataFrame.binSize / 60.0 / 60.0; helloSeries.add(hour, dataFrame.countsHello[i]); goodbyeSerie.add(hour, dataFrame.countsGoodbye[i]); togetherSerie.add(hour, together); }/*w ww . ja va2 s .c o m*/ xyData.addSeries(helloSeries); xyData.addSeries(goodbyeSerie); xyData.addSeries(togetherSerie); final JFreeChart chart = ChartFactory.createXYStepChart( "Courtesy Statistics," + "actType " + actType + " it." + iteration, "time", "# persons", xyData, PlotOrientation.VERTICAL, true, // legend false, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); final CategoryAxis axis1 = new CategoryAxis("hour"); axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7)); plot.setDomainAxis(new NumberAxis("time")); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f)); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.gray); plot.setDomainGridlinePaint(Color.gray); return chart; }
From source file:ihm.mainActivity.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w w w .ja v a 2 s . c o m */ 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)); } 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; }