List of usage examples for org.jfree.chart.renderer.xy XYSplineRenderer setSeriesPaint
public void setSeriesPaint(int series, Paint paint)
From source file:logica.LGraficaAltura.java
public static void logicaBtnGraficar(JRadioButton jRLinea) { ChartPanel panel;// w w w . j a v a 2 s .c om JFreeChart chart = null; if (jRLinea.isSelected()) { // ejecuto linea XYSplineRenderer graficoLinea = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Datos"); XYPlot plot; graficoLinea.setSeriesPaint(0, Color.YELLOW); VGraficaAltura.getPanelLinea().removeAll(); for (int i = 0; i < VGraficaAltura.getjTable1().getRowCount(); i++) { float valor1 = Float.parseFloat(String.valueOf(VGraficaAltura.getjTable1().getValueAt(i, 0))); float valor2 = Float.parseFloat(String.valueOf(VGraficaAltura.getjTable1().getValueAt(i, 1))); System.out.println("valores " + valor1 + " " + valor2); serie.add(valor1, valor2); } dataset.addSeries(serie); x.setLabel("MES"); y.setLabel("ALTURA"); plot = new XYPlot(dataset, x, y, graficoLinea); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(15, 30); chart = new JFreeChart(plot); chart.setTitle("grafico"); panel = new ChartPanel(chart); panel.setBounds(5, 10, 410, 350); VGraficaAltura.getPanelLinea().add(panel); VGraficaAltura.getPanelLinea().repaint(); } }
From source file:logica.LGraficapeso.java
public static void logicaBtnGraficar(JRadioButton jRLinea) { ChartPanel panel;/*from w w w. ja va 2 s .c om*/ JFreeChart chart = null; if (jRLinea.isSelected()) { // ejecuto linea XYSplineRenderer graficoLinea = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Datos"); XYPlot plot; graficoLinea.setSeriesPaint(0, Color.YELLOW); VGraficaPeso.getPanelLinea().removeAll(); for (int i = 0; i < VGraficaPeso.getjTable1().getRowCount(); i++) { float valor1 = Float.parseFloat(String.valueOf(VGraficaPeso.getjTable1().getValueAt(i, 0))); float valor2 = Float.parseFloat(String.valueOf(VGraficaPeso.getjTable1().getValueAt(i, 1))); System.out.println("valores " + valor1 + " " + valor2); serie.add(valor1, valor2); } dataset.addSeries(serie); x.setLabel("MES"); y.setLabel("peso"); plot = new XYPlot(dataset, x, y, graficoLinea); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(10, 15); chart = new JFreeChart(plot); chart.setTitle("grafico"); panel = new ChartPanel(chart); panel.setBounds(5, 10, 410, 350); VGraficaPeso.getPanelLinea().add(panel); VGraficaPeso.getPanelLinea().repaint(); } }
From source file:org.ala.spatial.web.services.GDMWSController.java
public static void generateCharts123(String outputdir) { try {/*from ww w . ja va2s.c o m*/ IniReader ir = new IniReader(outputdir + "/gdm_params.txt"); double intercept = ir.getDoubleValue("GDMODEL", "Intercept"); // 1. read the ObservedVsPredicted.csv file System.out.println("Loading csv data"); CSVReader csv = new CSVReader(new FileReader(outputdir + "ObservedVsPredicted.csv")); List<String[]> rawdata = csv.readAll(); double[][] dataCht1 = new double[2][rawdata.size() - 1]; double[][] dataCht2 = new double[2][rawdata.size() - 1]; // for Chart 1: obs count int[] obscount = new int[11]; for (int i = 0; i < obscount.length; i++) { obscount[i] = 0; } System.out.println("populating data"); for (int i = 1; i < rawdata.size(); i++) { String[] row = rawdata.get(i); double obs = Double.parseDouble(row[4]); dataCht1[0][i - 1] = Double.parseDouble(row[6]); dataCht1[1][i - 1] = obs; dataCht2[0][i - 1] = Double.parseDouble(row[5]) - intercept; dataCht2[1][i - 1] = obs; int obc = (int) Math.round(obs * 10); obscount[obc]++; } DefaultXYDataset dataset1 = new DefaultXYDataset(); dataset1.addSeries("", dataCht1); DefaultXYDataset dataset2 = new DefaultXYDataset(); dataset2.addSeries("", dataCht2); DefaultCategoryDataset dataset3 = new DefaultCategoryDataset(); for (int i = 0; i < obscount.length; i++) { String col = "0." + i + "-0." + (i + 1); if (i == 10) { col = "0.9-1.0"; } dataset3.addValue(obscount[i] + 100, "col", col); } generateChartByType("Response Histogram", "Observed Dissimilarity Class", "Number of Site Pairs", dataset3, outputdir, "bar", "resphist"); XYDotRenderer renderer = new XYDotRenderer(); //Shape cross = ShapeUtilities.createDiagonalCross(3, 1); //renderer.setSeriesShape(0, cross); renderer.setDotWidth(3); renderer.setDotHeight(3); renderer.setSeriesPaint(0, Color.BLACK); JFreeChart jChart1 = ChartFactory.createScatterPlot( "Observed versus predicted compositional dissimilarity", "Predicted Compositional Dissimilarity", "Observed Compositional Dissimilarity", dataset1, PlotOrientation.VERTICAL, false, false, false); jChart1.getTitle().setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); XYPlot plot = (XYPlot) jChart1.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRenderer(0, renderer); NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setAutoRangeIncludesZero(false); domain.setAxisLineVisible(false); domain.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setAutoRangeIncludesZero(false); range.setAxisLineVisible(false); range.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); double dMinPred = domain.getRange().getLowerBound(); double dMaxPred = domain.getRange().getUpperBound(); double dMinObs = range.getRange().getLowerBound(); double dMaxObs = range.getRange().getUpperBound(); System.out.println("1..pred.min.max: " + dMinPred + ", " + dMaxPred); int regressionLineSegs = 10; double dInc = (dMaxPred - dMinPred) / regressionLineSegs; double[][] dataReg1 = new double[2][regressionLineSegs + 1]; DefaultXYDataset dsReg1 = new DefaultXYDataset(); int i = 0; for (double d = dMinPred; d <= dMaxPred; d += dInc, i++) { dataReg1[0][i] = d; dataReg1[1][i] = d; } dsReg1.addSeries("", dataReg1); XYSplineRenderer regressionRenderer = new XYSplineRenderer(); regressionRenderer.setBaseSeriesVisibleInLegend(true); regressionRenderer.setSeriesPaint(0, Color.RED); regressionRenderer.setSeriesStroke(0, new BasicStroke(1.5f)); regressionRenderer.setBaseShapesVisible(false); plot.setDataset(1, dsReg1); plot.setRenderer(1, regressionRenderer); System.out.println("Writing image...."); ChartUtilities.saveChartAsPNG(new File(outputdir + "plots/obspredissim.png"), jChart1, 600, 400); // For chart 3 JFreeChart jChart2 = ChartFactory.createScatterPlot( "Observed compositional dissimilarity vs predicted ecological distance", "Predicted ecological distance", "Observed Compositional Dissimilarity", dataset2, PlotOrientation.VERTICAL, false, false, false); jChart2.getTitle().setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); plot = (XYPlot) jChart2.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlineStroke(new BasicStroke(0.5F, 0, 1)); plot.setRenderer(0, renderer); domain = (NumberAxis) plot.getDomainAxis(); domain.setAutoRangeIncludesZero(false); domain.setAxisLineVisible(false); domain.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); range = (NumberAxis) plot.getRangeAxis(); range.setAutoRangeIncludesZero(false); range.setAxisLineVisible(false); range.setLabelFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); dMinPred = domain.getRange().getLowerBound(); dMaxPred = domain.getRange().getUpperBound(); dMinObs = range.getRange().getLowerBound(); dMaxObs = range.getRange().getUpperBound(); System.out.println("2.pred.min.max: " + dMinPred + ", " + dMaxPred); regressionLineSegs = 10; dInc = (dMaxPred - dMinPred) / regressionLineSegs; dataReg1 = new double[2][regressionLineSegs + 1]; dsReg1 = new DefaultXYDataset(); i = 0; for (double d = dMinPred; d <= dMaxPred; d += dInc, i++) { dataReg1[0][i] = d; dataReg1[1][i] = (1.0 - Math.exp(-d)); } dsReg1.addSeries("", dataReg1); regressionRenderer.setBaseSeriesVisibleInLegend(true); regressionRenderer.setSeriesPaint(0, Color.RED); regressionRenderer.setSeriesStroke(0, new BasicStroke(1.5f)); regressionRenderer.setBaseShapesVisible(false); plot.setDataset(1, dsReg1); plot.setRenderer(1, regressionRenderer); System.out.println("Writing image...."); ChartUtilities.saveChartAsPNG(new File(outputdir + "plots/dissimdist.png"), jChart2, 600, 400); } catch (Exception e) { System.out.println("Unable to generate charts 2 and 3:"); e.printStackTrace(System.out); } }
From source file:charts.Chart.java
public static JFreeChart MultipleStepChartOverlayed(XYDataset[] datasets1, XYDataset[] datasets2, String title, String x_axis_label, String y_axis_label, boolean showlegend, float maxvalue, float minvalue, boolean showchart) { ValueAxis domainAxis = new NumberAxis(x_axis_label); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ValueAxis rangeAxis = new NumberAxis(y_axis_label); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (minvalue == 0 && maxvalue == 0) { rangeAxis.setAutoRange(true);//from www . j ava2s . c o m } else { rangeAxis.setRange(minvalue, maxvalue); } //define o grafo combinado, determinando o label do eixo x. CombinedDomainXYPlot parent = new CombinedDomainXYPlot(domainAxis); for (int i = 0; i < datasets1.length; i++) { XYItemRenderer renderer1 = new XYStepRenderer(); renderer1.setBaseStroke(new BasicStroke(2.0f)); renderer1.setBaseSeriesVisibleInLegend(showlegend); XYPlot subplot = new XYPlot(datasets1[i], domainAxis, rangeAxis, renderer1); subplot.setBackgroundPaint(Color.white); subplot.setRangeGridlinePaint(Color.black); subplot.setDomainGridlinesVisible(true); XYSplineRenderer renderer2 = new XYSplineRenderer(); renderer2.setSeriesPaint(0, Color.LIGHT_GRAY); renderer2.setBaseStroke(new BasicStroke(2.0f)); renderer2.setShapesVisible(true); renderer2.setBaseSeriesVisibleInLegend(false); subplot.setDataset(1, datasets2[i]); subplot.setRenderer(1, renderer2); parent.add(subplot, 1); } JFreeChart jfreechart = new JFreeChart(title, parent); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); if (showchart) { JFrame chartwindow = new JFrame(title); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); } return jfreechart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart.// w ww . j a v a2 s . com * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createXYLineSplineChart(String title, String categoryAxisLabel, String valueAxisLabel, XYDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundAlpha(0.4f); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); plot.setRenderer(new XYSplineRenderer(100)); XYSplineRenderer renderer = (XYSplineRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:loci.slim.ui.ExcitationGraph.java
/** * Creates the chart//from ww w . jav a2 s . c o m * * @param bins number of bins * @param timeInc time increment per bin * @param data fitted data * @return the chart */ JFreeChart createChart(final int bins, final double timeInc, final double[] values) { // create chart data createDataset(bins, timeInc, values); // make a horizontal axis final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL); timeAxis.setLabel(UNITS_LABEL); timeAxis.setRange(0.0, (bins - 1) * timeInc); // make a vertical axis NumberAxis photonAxis; if (_logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } // make an excitation plot final XYSplineRenderer excitationRenderer = new XYSplineRenderer(); excitationRenderer.setSeriesShapesVisible(0, false); excitationRenderer.setSeriesPaint(0, EXCITATION_COLOR); _excitationPlot = new XYPlot(_excitationDataset, timeAxis, photonAxis, excitationRenderer); _excitationPlot.setDomainCrosshairVisible(true); _excitationPlot.setRangeCrosshairVisible(true); // now make the top level JFreeChart final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, _excitationPlot, true); chart.removeLegend(); return chart; }
From source file:loci.slim2.process.interactive.ui.DefaultExcitationGraph.java
/** * Creates the chart//from w w w .ja va 2s. co m * * @param bins number of bins * @param timeInc time increment per bin * @param data fitted data * @return the chart */ JFreeChart createChart(final int bins, final double timeInc, final double[] values) { // create chart data createDataset(bins, timeInc, values); // make a horizontal axis final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL); timeAxis.setLabel(UNITS_LABEL); timeAxis.setRange(0.0, (bins - 1) * timeInc); // make a vertical axis NumberAxis photonAxis; if (logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } // make an excitation plot final XYSplineRenderer excitationRenderer = new XYSplineRenderer(); excitationRenderer.setSeriesShapesVisible(0, false); excitationRenderer.setSeriesPaint(0, EXCITATION_COLOR); excitationPlot = new XYPlot(excitationDataset, timeAxis, photonAxis, excitationRenderer); excitationPlot.setDomainCrosshairVisible(true); excitationPlot.setRangeCrosshairVisible(true); // now make the top level JFreeChart final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, excitationPlot, true); chart.removeLegend(); return chart; }
From source file:edu.cudenver.bios.chartsvc.resource.LegendResource.java
private XYPlot buildScatterPlot(Chart chart) throws ResourceException { // the first series is treated as the x values if (chart.getSeries() == null || chart.getSeries().size() <= 0) throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "No data series specified"); // create the jfree chart series XYSeriesCollection chartData = new XYSeriesCollection(); // use a spline renderer to make the connecting lines smooth XYSplineRenderer rend = new XYSplineRenderer(); int seriesIdx = 0; for (Series series : chart.getSeries()) { XYSeries xySeries = new XYSeries(series.getLabel()); List<Double> xList = series.getXCoordinates(); List<Double> yList = series.getYCoordinates(); if (xList != null && yList != null && xList.size() == yList.size()) { for (int i = 0; i < xList.size(); i++) { xySeries.add(xList.get(i), yList.get(i)); }/* www . ja v a 2s . c om*/ } // set the line style rend.setSeriesPaint(seriesIdx, Color.BLACK); if (seriesIdx > 0) { rend.setSeriesStroke(seriesIdx, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { (float) seriesIdx, (float) 2 * seriesIdx }, 0.0f)); } // add the series to the data set chartData.addSeries(xySeries); seriesIdx++; } // turn off shapes displayed at each data point to make a smooth curve rend.setBaseShapesVisible(false); // Create the line chart NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); if (chart.getXAxis() != null) { Axis xAxisSpec = chart.getXAxis(); xAxis.setLabel(xAxisSpec.getLabel()); if (!Double.isNaN(xAxisSpec.getRangeMin()) && !Double.isNaN(xAxisSpec.getRangeMax())) { xAxis.setRange(xAxisSpec.getRangeMin(), xAxisSpec.getRangeMax()); } } NumberAxis yAxis = new NumberAxis(); if (chart.getYAxis() != null) { Axis yAxisSpec = chart.getYAxis(); yAxis.setLabel(chart.getYAxis().getLabel()); if (!Double.isNaN(yAxisSpec.getRangeMin()) && !Double.isNaN(yAxisSpec.getRangeMax())) { xAxis.setRange(yAxisSpec.getRangeMin(), yAxisSpec.getRangeMax()); } } XYPlot plot = new XYPlot((XYDataset) chartData, xAxis, yAxis, rend); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); return plot; }
From source file:loci.slim2.process.interactive.ui.DefaultDecayGraph.java
/** * Creates the chart/* w w w . j a va2s .c o m*/ * * @param bins number of bins * @param timeInc time increment per bin * @return the chart */ JFreeChart createCombinedChart(final int bins, final double timeInc) { // create empty chart data sets decayDataset = new XYSeriesCollection(); residualDataset = new XYSeriesCollection(); // make a common horizontal axis for both sub-plots final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL); timeAxis.setLabel(UNITS_LABEL); timeAxis.setRange(0.0, (bins - 1) * timeInc); // make a vertically combined plot final CombinedDomainXYPlot parent = new CombinedDomainXYPlot(timeAxis); // create decay sub-plot NumberAxis photonAxis; if (logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } final XYSplineRenderer decayRenderer = new XYSplineRenderer(); decayRenderer.setSeriesShapesVisible(0, false); decayRenderer.setSeriesShapesVisible(1, false); decayRenderer.setSeriesLinesVisible(2, false); decayRenderer.setSeriesShape(2, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); decayRenderer.setSeriesPaint(0, PROMPT_COLOR); decayRenderer.setSeriesPaint(1, FITTED_COLOR); decayRenderer.setSeriesPaint(2, DECAY_COLOR); decaySubPlot = new XYPlot(decayDataset, null, photonAxis, decayRenderer); decaySubPlot.setDomainCrosshairVisible(true); decaySubPlot.setRangeCrosshairVisible(true); // add decay sub-plot to parent parent.add(decaySubPlot, DECAY_WEIGHT); // create residual sub-plot final NumberAxis residualAxis = new NumberAxis(RESIDUAL_AXIS_LABEL); final XYSplineRenderer residualRenderer = new XYSplineRenderer(); residualRenderer.setSeriesPaint(0, RESIDUAL_COLOR); residualRenderer.setSeriesLinesVisible(0, false); residualRenderer.setSeriesShape(0, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); final XYPlot residualSubPlot = new XYPlot(residualDataset, null, residualAxis, residualRenderer); residualSubPlot.setDomainCrosshairVisible(true); residualSubPlot.setRangeCrosshairVisible(true); residualSubPlot.setFixedLegendItems(null); // add residual sub-plot to parent parent.add(residualSubPlot, RESIDUAL_WEIGHT); // now make the top level JFreeChart final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, parent, true); chart.removeLegend(); return chart; }
From source file:loci.slim.ui.DecayGraph.java
/** * Creates the chart//from ww w . j a v a 2 s .c o m * * @param bins number of bins * @param timeInc time increment per bin * @return the chart */ JFreeChart createCombinedChart(final int bins, final double timeInc) { // create empty chart data sets _decayDataset = new XYSeriesCollection(); _residualDataset = new XYSeriesCollection(); // make a common horizontal axis for both sub-plots final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL); timeAxis.setLabel(UNITS_LABEL); timeAxis.setRange(0.0, (bins - 1) * timeInc); // make a vertically combined plot final CombinedDomainXYPlot parent = new CombinedDomainXYPlot(timeAxis); // create decay sub-plot NumberAxis photonAxis; if (_logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } final XYSplineRenderer decayRenderer = new XYSplineRenderer(); decayRenderer.setSeriesShapesVisible(0, false); decayRenderer.setSeriesShapesVisible(1, false); decayRenderer.setSeriesLinesVisible(2, false); decayRenderer.setSeriesShape(2, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); decayRenderer.setSeriesPaint(0, PROMPT_COLOR); decayRenderer.setSeriesPaint(1, FITTED_COLOR); decayRenderer.setSeriesPaint(2, DECAY_COLOR); _decaySubPlot = new XYPlot(_decayDataset, null, photonAxis, decayRenderer); _decaySubPlot.setDomainCrosshairVisible(true); _decaySubPlot.setRangeCrosshairVisible(true); // add decay sub-plot to parent parent.add(_decaySubPlot, DECAY_WEIGHT); // create residual sub-plot final NumberAxis residualAxis = new NumberAxis(RESIDUAL_AXIS_LABEL); final XYSplineRenderer residualRenderer = new XYSplineRenderer(); residualRenderer.setSeriesPaint(0, RESIDUAL_COLOR); residualRenderer.setSeriesLinesVisible(0, false); residualRenderer.setSeriesShape(0, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); final XYPlot residualSubPlot = new XYPlot(_residualDataset, null, residualAxis, residualRenderer); residualSubPlot.setDomainCrosshairVisible(true); residualSubPlot.setRangeCrosshairVisible(true); residualSubPlot.setFixedLegendItems(null); // add residual sub-plot to parent parent.add(residualSubPlot, RESIDUAL_WEIGHT); // now make the top level JFreeChart final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, parent, true); chart.removeLegend(); return chart; }