List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.jfree.chart.demo.PlotOrientationDemo1.java
private static XYDataset createDataset(int i) { XYSeries xyseries = new XYSeries("Series " + (i + 1)); xyseries.add(-10D, -5D);//from w w w . ja v a 2 s. c o m xyseries.add(10D, 5D); XYSeriesCollection xyseriescollection = new XYSeriesCollection(); xyseriescollection.addSeries(xyseries); return xyseriescollection; }
From source file:eu.hydrologis.jgrass.charting.impl.JGrassXYLineChart.java
/** * A line chart creator basing on series made up two values per row. More series, independing * one from the other are supported./*w w w. j av a 2s. c o m*/ * * @param chartValues - a hashmap containing as keys the name of the series and as values the * double[][] representing the data. Important: the data matrix has to be passed as two * rows (not two columns) */ public JGrassXYLineChart(LinkedHashMap<String, double[][]> chartValues) { chartSeries = new XYSeries[chartValues.size()]; // extrapolate the data from the Hashmap and convert it to a XYSeries // Collection final Iterator<String> it = chartValues.keySet().iterator(); int count = 0; while (it.hasNext()) { final String key = it.next(); final double[][] values = chartValues.get(key); chartSeries[count] = new XYSeries(key); for (int i = 0; i < values[0].length; i++) { // important: the data matrix has to be passed as two rows (not // two columns) double val = values[1][i]; if (isNovalue(val)) continue; chartSeries[count].add(values[0][i], val); } count++; } lineDataset = new XYSeriesCollection(); for (int i = 0; i < chartSeries.length; i++) { lineDataset.addSeries(chartSeries[i]); } }
From source file:eremeykin.pete.plotter.PolarPlotterTopComponent.java
public PolarPlotterTopComponent() { initComponents();// ww w . ja v a 2 s. c om setName(Bundle.CTL_PolarPlotterTopComponent()); setToolTipText(Bundle.HINT_PolarPlotterTopComponent()); final XYSeriesCollection dataset = new XYSeriesCollection(); final XYSeries toleranceSeries = new XYSeries("Tolerance"); final XYSeries dataSeries = new XYSeries("U"); dataset.addSeries(dataSeries); dataset.addSeries(toleranceSeries); final JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart); jPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.add(chartPanel, BorderLayout.CENTER); validate(); }
From source file:org.jfree.chart.demo.XYBarChartDemo4.java
/** * Creates a sample dataset.// w ww . j a v a2 s. c om * * @return A sample dataset. */ private IntervalXYDataset createDataset() { final XYSeries series = new XYSeries("Series 1"); series.add(1.0, 5.0); series.add(2.0, 7.8); series.add(3.0, 9.3); final XYSeriesCollection collection = new XYSeriesCollection(); collection.addSeries(series); return new XYBarDataset(collection, 0.9); }
From source file:iad_2_gg.gui.ChartDialog.java
private XYDataset createDataset(List<Double> values1, String sName1, List<Double> values2, String sName2, int interval) { XYSeriesCollection data = new XYSeriesCollection(); XYSeries serie1 = new XYSeries(sName1); int i = 1;/*from w ww . jav a2 s . co m*/ for (double v : values1) { serie1.add((i * interval), v); i++; } data.addSeries(serie1); XYSeries serie2 = new XYSeries(sName2); i = 1; for (double v : values2) { serie2.add((i * interval), v); i++; } data.addSeries(serie2); return data; }
From source file:playground.dgrether.signalsystems.analysis.DgGreenSplitPerIterationGraph.java
private void createDataSet() { this.dataset = new XYSeriesCollection(); Map<Id, XYSeries> signalGroupGreenXYSeries = new HashMap<Id, XYSeries>(); // Map<Id, XYSeries> signalGroupRedXYSeries = new HashMap<Id, XYSeries>(); for (Integer it : this.iterationSystemDataMap.keySet()) { DgSignalSystemAnalysisData sd = this.iterationSystemDataMap.get(it); for (Id groupId : sd.getSystemGroupAnalysisDataMap().keySet()) { XYSeries series = signalGroupGreenXYSeries.get(groupId); if (series == null) { series = new XYSeries("group id green" + groupId, false, true); signalGroupGreenXYSeries.put(groupId, series); this.dataset.addSeries(series); }// w w w.ja v a 2s . c o m Map<SignalGroupState, Double> stateTimeMap = sd.getSystemGroupAnalysisDataMap().get(groupId) .getStateTimeMap(); Double green = stateTimeMap.get(SignalGroupState.GREEN); Double red = stateTimeMap.get(SignalGroupState.RED); Double greenSplit = null; if (green == null) { greenSplit = 0.0; } if (red == null) { greenSplit = 100.0; } if (greenSplit == null) { greenSplit = green / (red + green) * 100.0; } series.add(it, greenSplit); // XYSeries redSeries = signalGroupRedXYSeries.get(groupId); // if (redSeries == null) { // redSeries = new XYSeries("group id red" + groupId, false, true); // signalGroupRedXYSeries.put(groupId, redSeries); // this.dataset.addSeries(redSeries); // } // redSeries.add(it, sd.getSystemGroupDataMap().get(groupId).getStateTimeMap().get(SignalGroupState.RED)); } } }
From source file:eu.hydrologis.jgrass.charting.impl.JGrassXYBarChart.java
/** * A line chart creator basing on series made up two values per row. More series, independing * one from the other are supported./*from w ww . j a v a 2 s .c om*/ * * @param chartValues - a hashmap containing as keys the name of the series and as values the * double[][] representing the data. Important: the data matrix has to be passed as two * rows (not two columns) * @param barwidth */ public JGrassXYBarChart(LinkedHashMap<String, double[][]> chartValues, double barwidth) { chartSeries = new XYSeries[chartValues.size()]; // extrapolate the data from the Hashmap and convert it to a XYSeries // Collection Iterator<String> it = chartValues.keySet().iterator(); int count = 0; while (it.hasNext()) { String key = it.next(); double[][] values = chartValues.get(key); chartSeries[count] = new XYSeries(key); for (int i = 0; i < values[0].length; i++) { // important: the data matrix has to be passed as two rows (not // two columns) double val = values[1][i]; if (isNovalue(val)) continue; chartSeries[count].add(values[0][i], val); } count++; } barDataset = new XYSeriesCollection(); for (int i = 0; i < chartSeries.length; i++) { barDataset.addSeries(chartSeries[i]); } dataset = new XYBarDataset(barDataset, barwidth); }
From source file:org.jfree.data.xy.junit.XYSeriesCollectionTest.java
/** * Some checks for the constructor./*from w ww .java 2 s. c o m*/ */ public void testConstructor() { XYSeriesCollection xysc = new XYSeriesCollection(); assertEquals(0, xysc.getSeriesCount()); assertEquals(1.0, xysc.getIntervalWidth(), EPSILON); assertEquals(0.5, xysc.getIntervalPositionFactor(), EPSILON); }
From source file:com.ivli.roim.controls.VOILUTPanel.java
public VOILUTPanel(LUTControl aP) { iCurveName = java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle").getString("VOILUTPANEL.VOI_LUT"); iLUT = LUTControl.create(aP);/* ww w . java2s . c o m*/ aP.addWindowChangeListener(this); initComponents(); XYPlot plot = new XYPlot(); plot.setDataset(0, makeLUTCurve()); plot.setRenderer(0, new XYSplineRenderer()); ((XYSplineRenderer) plot.getRenderer()).setShapesVisible(false); plot.setRangeAxis(0, new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_VOI_CURVE"))); XYSeriesCollection col2 = new XYSeriesCollection(); col2.addSeries(makeHistogram()); plot.setDataset(1, col2); plot.setRenderer(1, new XYBarRenderer()); plot.setRangeAxis(1, new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_IMAGE_SPACE"))); plot.mapDatasetToRangeAxis(1, 1); plot.setDomainAxis(new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_IMAGE_HISTOGRAM"))); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); // change the rendering order so the primary dataset appears "behind" the // other datasets... plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); JFreeChart jfc = new JFreeChart(plot); jfc.setBorderVisible(true); jfc.removeLegend(); iPanel = new ChartPanel(jfc); iPanel.setSize(jPanel1.getPreferredSize()); jPanel1.add(iPanel);//, java.awt.BorderLayout.CENTER); iLUT.setSize(jPanel2.getPreferredSize()); jPanel2.add(iLUT); iLabelMin.setText(String.format("%.0f", iLUT.getView().getMin())); iLabelMax.setText(String.format("%.0f", iLUT.getView().getMax())); validate(); }
From source file:eremeykin.pete.plotter.CartesianPlotterTopComponent.java
public CartesianPlotterTopComponent() { initComponents();/*from w w w . j a v a2 s .com*/ setName(Bundle.CTL_CartesianPlotterTopComponent()); setToolTipText(Bundle.HINT_CartesianPlotterTopComponent()); final XYSeriesCollection dataset = new XYSeriesCollection(); final XYSeries toleranceSeries = new XYSeries("Tolerance"); final XYSeries dataSeries = new XYSeries("U"); dataset.addSeries(dataSeries); dataset.addSeries(toleranceSeries); final JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart); setLayout(new java.awt.BorderLayout()); add(chartPanel, BorderLayout.CENTER); validate(); }