List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.kurento.test.latency.ChartWriter.java
public ChartWriter(Map<Long, LatencyRegistry> latencyMap, String seriesTitle, String chartTitle, String xAxisLabel, String yAxisLabel) { // Convert latencyMap to XYDataset XYSeries series = new XYSeries(seriesTitle); for (long time : latencyMap.keySet()) { series.add(time, Math.abs(latencyMap.get(time).getLatency())); }/*from w ww.j a v a2 s .c o m*/ dataset = new XYSeriesCollection(); ((XYSeriesCollection) dataset).addSeries(series); this.xAxisLabel = xAxisLabel; this.yAxisLabel = yAxisLabel; this.chartTitle = chartTitle; }
From source file:phat.audio.listeners.XYRMSAudioChart.java
/** * Creates a new demo./*from w w w .j a va2 s .c om*/ * * @param title the frame title. */ public XYRMSAudioChart(final String title) { super(title); //Object[][][] data = new Object[3][50][2]; values = new XYSeries("data"); dataset = new XYSeriesCollection(); dataset.addSeries(values); chart = ChartFactory.createXYLineChart(title, // chart title "Time (m)", // domain axis label "RMS (dB)", // range axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); plot = chart.getXYPlot(); /*final NumberAxis domainAxis = new NumberAxis("x"); final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis);*/ chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:SystemAnomalies.bouncedLogInRate.java
public static final XYSeriesCollection getDataSet() { XYSeries series = new XYSeries("Sign-in Bounce off Rate"); series.add(0, 0);//from w w w . j ava2 s .c o m series.add(1, 100); series.add(2, 100); series.add(3, 100); series.add(4, 120); series.add(5, 120); series.add(6, 1040); series.add(7, 1040); series.add(8, 1040); series.add(9, 2000); series.add(10, 2000); // Add the series to your data set XYSeriesCollection dataset = new XYSeriesCollection(); return dataset; }
From source file:turtlekit.murmuration.SpeedChecker.java
@Override public void setupFrame(JFrame frame) { XYSeriesCollection dataset = new XYSeriesCollection(); final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Moyenne", null, null); chartPanel.setPreferredSize(new java.awt.Dimension(550, 250)); speed = new XYSeries("Speed"); dataset.addSeries(speed);//from w w w . jav a 2s . c o m frame.setContentPane(chartPanel); frame.setLocation(50, 0); // XYSeries s = dataset.getSeries("Total"); }
From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.Classes.FindMaxpoint.java
private XYDataset createDummyGatingData() { final XYSeries s1 = new XYSeries("DummyGating"); s1.add(0, 0);// w ww . j a va 2 s . c o m s1.add(1000, 0); s1.add(2000, 0); s1.add(3000, 0); s1.add(4000, 0); s1.add(5000, 0); final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); return dataset; }
From source file:statistics.distribution.ExponentialDistribution.java
private XYDataset getDataset() { XYSeriesCollection dataSet = new XYSeriesCollection(); XYSeries xySeries = new XYSeries("CDF"); double x = 0.0; for (int i = 0; i < 50; i++) { xySeries.add(x, CDF(x));/*from ww w .j a v a2s . c om*/ x += 0.2; } dataSet.addSeries(xySeries); return dataSet; }
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);/*from 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:audio.cords.old.RegressionDemo.java
private static XYDataset regress(XYSeriesCollection data) { // Determine bounds double xMin = Double.MAX_VALUE, xMax = 0; for (int i = 0; i < data.getSeriesCount(); i++) { XYSeries ser = data.getSeries(i); for (int j = 0; j < ser.getItemCount(); j++) { double x = ser.getX(j).doubleValue(); if (x < xMin) { xMin = x;//from www . j av a 2 s.c o m } if (x > xMax) { xMax = x; } } } // Create 2-point series for each of the original series XYSeriesCollection coll = new XYSeriesCollection(); for (int i = 0; i < data.getSeriesCount(); i++) { XYSeries ser = data.getSeries(i); int n = ser.getItemCount(); double sx = 0, sy = 0, sxx = 0, sxy = 0, syy = 0; for (int j = 0; j < n; j++) { double x = ser.getX(j).doubleValue(); double y = ser.getY(j).doubleValue(); sx += x; sy += y; sxx += x * x; sxy += x * y; syy += y * y; } double b = (n * sxy - sx * sy) / (n * sxx - sx * sx); double a = sy / n - b * sx / n; XYSeries regr = new XYSeries(ser.getKey()); regr.add(xMin, a + b * xMin); regr.add(xMax, a + b * xMax); coll.addSeries(regr); } return coll; }
From source file:ejemplo.Ejemplo.java
private XYDataset createDataset() { final XYSeries series1 = new XYSeries("First"); series1.add(1.0, 1.0);/* w w w .j av a 2 s .co m*/ 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:org.ow2.clif.jenkins.chart.CallChart.java
@Override protected JFreeChart createChart() { XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(this.eventSerie); JFreeChart chart;/*from w w w . j av a 2 s . c o m*/ if (this.scatterPlot) { chart = ChartFactory.createScatterPlot(getBasicTitle(), // chart title Messages.CallChart_Time(), // x axis label Messages.CallChart_ResponseTime(), // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); } else { chart = ChartFactory.createXYLineChart(getBasicTitle(), // chart title Messages.CallChart_Time(), // x axis label this.chartId.getEvent(), // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); } chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); Shape cross = ShapeUtilities.createDiamond(3); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShape(cross); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShape(0, cross); plot.setRenderer(renderer); // Force the 0 on vertical axis NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(true); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // Force the 0 on horizontal axis NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(true); return chart; }