Java Code Examples for org.jfree.chart.plot.CombinedDomainXYPlot#setGap()
The following examples show how to use
org.jfree.chart.plot.CombinedDomainXYPlot#setGap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwingCombinedChartGestureDemo.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 2
Source File: FXCombinedChartGestureDemo.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 3
Source File: SwingCombinedChartGestureDemo.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 4
Source File: FXCombinedChartGestureDemo.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 5
Source File: SwingCombinedChartGestureDemo.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 6
Source File: FXCombinedChartGestureDemo.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 7
Source File: GUIUtils.java From egads with GNU General Public License v3.0 | 5 votes |
/** * Creates a combined chart. * * @return The combined chart. */ private JFreeChart createCombinedChart(DataSequence tsOne, DataSequence tsTwo, ArrayList<Anomaly> anomalyList) { // create subplot 1. final XYDataset data1 = createDataset(tsOne, "Original"); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Original Value"); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // plot anomalies on subplot 1. addAnomalies(subplot1, anomalyList); // create subplot 2. final XYDataset data2 = createDataset(tsTwo, "Forecast"); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Forecast Value"); rangeAxis2.setAutoRangeIncludesZero(false); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot. final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time")); plot.setGap(10.0); // add the subplots. plot.add(subplot1, 1); plot.add(subplot2, 1); // Add anomaly score time-series. addAnomalyTS(plot, tsOne, tsTwo); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot. return new JFreeChart("EGADS GUI", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 8
Source File: CombinedDomainXYPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainXYPlot createPlot() { // create subplot 1... XYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Range 1"); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... XYDataset data2 = createDataset2(); XYItemRenderer renderer2 = new StandardXYItemRenderer(); NumberAxis rangeAxis2 = new NumberAxis("Range 2"); rangeAxis2.setAutoRangeIncludesZero(false); XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
Example 9
Source File: CombinedDomainXYPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainXYPlot createPlot() { // create subplot 1... XYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Range 1"); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... XYDataset data2 = createDataset2(); XYItemRenderer renderer2 = new StandardXYItemRenderer(); NumberAxis rangeAxis2 = new NumberAxis("Range 2"); rangeAxis2.setAutoRangeIncludesZero(false); XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
Example 10
Source File: MirrorChartFactory.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
private static JFreeChart createMirrorChart(String labelA, double precursorMZA, double rtA, DataPoint[] dpsA, String labelB, double precursorMZB, double rtB, DataPoint[] dpsB, boolean showTitle, boolean showLegend) { PseudoSpectrumDataSet data = dpsA == null ? null : createMSMSDataSet(precursorMZA, rtA, dpsA, labelA); PseudoSpectrumDataSet dataMirror = dpsB == null ? null : createMSMSDataSet(precursorMZB, rtB, dpsB, labelB); NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = new DecimalFormat("0.#"); // set the X axis (retention time) properties NumberAxis xAxis = new NumberAxis("m/z"); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(false); xAxis.setMinorTickCount(5); PseudoSpectraRenderer renderer1 = new PseudoSpectraRenderer(Color.BLACK, false); PseudoSpectraRenderer renderer2 = new PseudoSpectraRenderer(Color.BLACK, false); // create subplot 1... final NumberAxis rangeAxis1 = new NumberAxis("rel. intensity [%]"); final XYPlot subplot1 = new XYPlot(data, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); rangeAxis1.setNumberFormatOverride(intensityFormat); rangeAxis1.setAutoRangeIncludesZero(true); rangeAxis1.setAutoRangeStickyZero(true); // create subplot 2... final NumberAxis rangeAxis2 = new NumberAxis("rel. intensity [%]"); rangeAxis2.setNumberFormatOverride(intensityFormat); rangeAxis2.setAutoRangeIncludesZero(true); rangeAxis2.setAutoRangeStickyZero(true); rangeAxis2.setInverted(true); final XYPlot subplot2 = new XYPlot(dataMirror, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(xAxis); plot.setGap(0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // set the plot properties plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); chart.getXYPlot().setRangeZeroBaselineVisible(true); chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); return chart; }
Example 11
Source File: StlPlotter.java From stl-java with Apache License 2.0 | 4 votes |
private JFreeChart createChart() { final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer(); final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black); final TimeSeries seriests = new TimeSeries("Series"); final TimeSeries seasonalts = new TimeSeries("Seasonal"); final TimeSeries trendts = new TimeSeries("Trend"); final TimeSeries remainderts = new TimeSeries("Remainder"); final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts}; final String[] labels = new String[]{"Series", "Seasonal", "Trend"}; for (int i = 0; i < series.length; i++) { final Date d = new Date((long) times[i]); RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault()); seriests.addOrUpdate(rtp, series[i]); seasonalts.addOrUpdate(rtp, seasonal[i]); trendts.addOrUpdate(rtp, trend[i]); remainderts.addOrUpdate(rtp, remainder[i]); } plot.setGap(10.0); renderer.setSeriesPaint(0, black); barRenderer.setSeriesPaint(0, black); plot.setOrientation(PlotOrientation.VERTICAL); for (int i = 0; i < tsArray.length; i++) { final XYDataset ts = new TimeSeriesCollection(tsArray[i]); final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer); plot.add(p); } final XYDataset rts = new TimeSeriesCollection(remainderts); final XYDataset sts = new TimeSeriesCollection(seriests); final XYDataset tts = new TimeSeriesCollection(trendts); final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer); final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer); seriesAndTrend.setDataset(1, tts); seriesAndTrend.setRenderer(1, renderer); plot.add(rplot); plot.add(seriesAndTrend); return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
Example 12
Source File: SpectrumChartFactory.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static EChartPanel createMirrorChartPanel(String labelA, double precursorMZA, double rtA, DataPoint[] dpsA, String labelB, double precursorMZB, double rtB, DataPoint[] dpsB, boolean showTitle, boolean showLegend) { PseudoSpectrumDataSet data = dpsA == null ? null : createMSMSDataSet(precursorMZA, rtA, dpsA, labelA); PseudoSpectrumDataSet dataMirror = dpsB == null ? null : createMSMSDataSet(precursorMZB, rtB, dpsB, labelB); NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = new DecimalFormat("0.#"); // set the X axis (retention time) properties NumberAxis xAxis = new NumberAxis("m/z"); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(false); xAxis.setMinorTickCount(5); PseudoSpectraRenderer renderer1 = new PseudoSpectraRenderer(Color.BLACK, false); PseudoSpectraRenderer renderer2 = new PseudoSpectraRenderer(Color.BLACK, false); // create subplot 1... final NumberAxis rangeAxis1 = new NumberAxis("rel. intensity [%]"); final XYPlot subplot1 = new XYPlot(data, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); rangeAxis1.setNumberFormatOverride(intensityFormat); rangeAxis1.setAutoRangeIncludesZero(true); rangeAxis1.setAutoRangeStickyZero(true); // create subplot 2... final NumberAxis rangeAxis2 = new NumberAxis("rel. intensity [%]"); rangeAxis2.setNumberFormatOverride(intensityFormat); rangeAxis2.setAutoRangeIncludesZero(true); rangeAxis2.setAutoRangeStickyZero(true); rangeAxis2.setInverted(true); final XYPlot subplot2 = new XYPlot(dataMirror, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // set the plot properties plot.setBackgroundPaint(Color.white); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // chart.getXYPlot().setRangeZeroBaselineVisible(true); chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); return new EChartPanel(chart); }