List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.schreibubi.JCombinations.logic.visitors.ChartNodesVisitor.java
public void visit(Shmoo s) throws Exception { if (s.componentSelected(this.treePaths, OurTreeNode.MYSELF | OurTreeNode.PARENTS | OurTreeNode.CHILDS)) { NumberAxis xAxis = new NumberAxis(s.getTrim() + " [" + s.getXdataDefault().getUnit() + "]"); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis( s.getMeasure() + " [" + ((Ydata) s.getYdata().get(0)).getUnit() + "]"); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRendererExtended(true, true); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); this.dutData = new ArrayList<ArrayList<Double>>(); this.dutName = new ArrayList<String>(); for (int i = 0; i < s.getChildCount(); i++) (s.getChildAt(i)).accept(this); XYSeriesCollection xyseries = new XYSeriesCollection(); ArrayList<Double> x = s.getXdataDefault().getXPositions(); for (int j = 0; j < this.dutData.size(); j++) { ArrayList<Double> y = this.dutData.get(j); XYSeries xy = new XYSeries(this.dutName.get(j)); for (int i = 0; i < y.size(); i++) xy.add(x.get(i), y.get(i)); xyseries.addSeries(xy);// www . ja v a2 s . c o m } XYPlot plot = new XYPlot(xyseries, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); Marker marker = s.getMarker(); if (marker != null) plot.addRangeMarker(marker, Layer.BACKGROUND); ExtendedJFreeChart chart = new ExtendedJFreeChart(s.getDescription(), JFreeChart.DEFAULT_TITLE_FONT, plot, false); if (marker == null) chart.addSubtitle(new TextTitle(s.getSubtitle())); else chart.addSubtitle(new TextTitle( s.getSubtitle() + " " + s.getValueAt(3) + "/" + s.getValueAt(4) + "/" + s.getValueAt(5))); chart.setTreePath(s.getTreePath()); this.charts.add(chart); } }
From source file:course_generator.param.frmEditCurve.java
/** * Creates new form frmSettings//from w ww . ja va 2s . c o m */ public frmEditCurve() { super(); bEditMode = false; bundle = java.util.ResourceBundle.getBundle("course_generator/Bundle"); dataset = new XYSeriesCollection(); chart = CreateChartProfil(dataset); param = new ParamData(); tablemodel = new ParamPointsModel(param); initComponents(); setModal(true); }
From source file:edu.psu.citeseerx.misc.charts.CiteChartBuilderJFree.java
private XYDataset collectData(java.util.List<ThinDoc> docs) { Calendar now = Calendar.getInstance(); int currentYear = now.get(Calendar.YEAR); HashMap<Integer, DataPoint> data = new HashMap<Integer, DataPoint>(); for (ThinDoc doc : docs) { try {//from ww w . j a v a 2 s. c o m Integer year = new Integer(doc.getYear()); if (year.intValue() < 1930 || year.intValue() > currentYear + 2) { continue; } DataPoint point; if (data.containsKey(year)) { point = data.get(year); } else { point = new DataPoint(year.intValue()); data.put(year, point); } point.ncites++; } catch (Exception e) { } } XYSeries series = new XYSeries("Years"); for (DataPoint point : data.values()) { System.out.println(point.year); System.out.println(point.ncites); series.add(point.year, point.ncites); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); return dataset; }
From source file:ubic.gemma.visualization.ExpressionDataMatrixVisualizationServiceImpl.java
@Override @Deprecated/*from w w w. j a v a2 s . co m*/ public JFreeChart createXYLineChart(String title, Collection<double[]> dataCol, int numProfiles) { if (dataCol == null) throw new RuntimeException("dataCol cannot be " + null); if (dataCol.size() < numProfiles) { log.info("Collection smaller than number of elements. Will display first " + NUM_PROFILES_TO_DISPLAY + " profiles."); numProfiles = NUM_PROFILES_TO_DISPLAY; } XYSeriesCollection xySeriesCollection = new XYSeriesCollection(); Iterator<double[]> iter = dataCol.iterator(); for (int j = 0; j < numProfiles; j++) { double[] data = iter.next(); XYSeries series = new XYSeries(j, true, true); for (int i = 0; i < data.length; i++) { series.add(i, data[i]); } xySeriesCollection.addSeries(series); } JFreeChart chart = ChartFactory.createXYLineChart(title, "Platform", "Expression Value", xySeriesCollection, PlotOrientation.VERTICAL, false, false, false); chart.addSubtitle(new TextTitle("(Raw data values)", new Font("SansSerif", Font.BOLD, 14))); return chart; }
From source file:Utils.GeneradorDeGraficas.java
private XYDataset createDatasetCosto(DeterministaGeneral general, String unidad) { XYSeries TCq = new XYSeries("Costo total en " + unidad); XYSeries costoOrden = new XYSeries("Costo de Orden"); XYSeries mantener = new XYSeries("Costo de Mantenimiento"); XYSeries EOQx = new XYSeries("Punto Optimo (x)"); XYSeries EOQy = new XYSeries("Punto Optimo (y)"); for (int i = 1; i < general.calcularCantidadOptimaOrdenar() * 2; i++) { TCq.add(i, general.calcularCostoGrafica(i)); costoOrden.add(i, general.calcularCostoOrdenGrafica(i)); mantener.add(i, general.calcularMantenimientoGrafica(i)); }//w ww . j av a2 s . c o m EOQx.add(general.calcularCantidadOptimaOrdenar(), 0); EOQx.add(general.calcularCantidadOptimaOrdenar(), general.calcularCostoGrafica(general.calcularCantidadOptimaOrdenar())); EOQy.add(0, general.calcularCostoGrafica(general.calcularCantidadOptimaOrdenar())); EOQy.add(general.calcularCantidadOptimaOrdenar(), general.calcularCostoGrafica(general.calcularCantidadOptimaOrdenar())); final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(TCq); dataset.addSeries(mantener); dataset.addSeries(costoOrden); dataset.addSeries(EOQx); dataset.addSeries(EOQy); return dataset; }