org.jfree.chart.plot.DatasetRenderingOrder Java Examples
The following examples show how to use
org.jfree.chart.plot.DatasetRenderingOrder.
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: DefaultChartService.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns a CategoryPlot. */ private CategoryPlot getCategoryPlot( CategoryDataset dataSet, CategoryItemRenderer renderer, PlotOrientation orientation, CategoryLabelPositions labelPositions ) { CategoryPlot plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), renderer ); plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD ); plot.setOrientation( orientation ); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions( labelPositions ); return plot; }
Example #2
Source File: JPanelAnalysisTimeTemperature.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
private JFreeChart CreateChart(XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createXYLineChart("", // x axis label bundle.getString("JPanelAnalysisTimeDist.labelX"), // "Distance" // y axis label bundle.getString("JPanelAnalysisTimeDist.labelY1"), // "Elevation" dataset1, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); // -- Background color chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); XYAreaRenderer renderer = new XYAreaRenderer(); renderer.setSeriesPaint(0, new Color(0x99, 0xff, 0x00)); renderer.setOutline(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); plot.setRenderer(0, renderer); NumberAxis rangeAxis2 = new NumberAxis(bundle.getString("JPanelAnalysisTimeTemperature.labelY2")); // "Time" plot.setRangeAxis(1, rangeAxis2); plot.setDataset(1, dataset2); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // -- Select the display order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #3
Source File: CandlestickChart.java From ta4j-origins with MIT License | 4 votes |
public static void main(String[] args) { /** * Getting time series */ TimeSeries series = CsvTradesLoader.loadBitstampSeries(); /** * Creating the OHLC dataset */ OHLCDataset ohlcDataset = createOHLCDataset(series); /** * Creating the additional dataset */ TimeSeriesCollection xyDataset = createAdditionalDataset(series); /** * Creating the chart */ JFreeChart chart = ChartFactory.createCandlestickChart( "Bitstamp BTC price", "Time", "USD", ohlcDataset, true); // Candlestick rendering CandlestickRenderer renderer = new CandlestickRenderer(); renderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST); XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer); // Additional dataset int index = 1; plot.setDataset(index, xyDataset); plot.mapDatasetToRangeAxis(index, 0); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); renderer2.setSeriesPaint(index, Color.blue); plot.setRenderer(index, renderer2); // Misc plot.setRangeGridlinePaint(Color.lightGray); plot.setBackgroundPaint(Color.white); NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); numberAxis.setAutoRangeIncludesZero(false); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); /** * Displaying the chart */ displayChart(chart); }
Example #4
Source File: ScatterPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
ScatterPlotPanel(TopComponent parentDialog, String helpId) { super(parentDialog, helpId, CHART_TITLE, false); userSettingsMap = new HashMap<>(); productRemovedListener = new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { } @Override public void productRemoved(ProductManager.Event event) { final UserSettings userSettings = userSettingsMap.remove(event.getProduct()); if (userSettings != null) { userSettings.dispose(); } } }; xAxisRangeControl = new AxisRangeControl("X-Axis"); yAxisRangeControl = new AxisRangeControl("Y-Axis"); scatterPlotModel = new ScatterPlotModel(); bindingContext = new BindingContext(PropertyContainer.createObjectBacked(scatterPlotModel)); scatterpointsDataset = new XYIntervalSeriesCollection(); acceptableDeviationDataset = new XYIntervalSeriesCollection(); regressionDataset = new XYIntervalSeriesCollection(); r2Annotation = new XYTitleAnnotation(0, 0, new TextTitle("")); chart = ChartFactory.createScatterPlot(CHART_TITLE, "", "", scatterpointsDataset, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); createDomainAxisChangeListener(); final PropertyChangeListener userSettingsUpdateListener = evt -> { if (getRaster() != null) { final VectorDataNode pointDataSourceValue = scatterPlotModel.pointDataSource; final AttributeDescriptor dataFieldValue = scatterPlotModel.dataField; final UserSettings userSettings = getUserSettings(getRaster().getProduct()); userSettings.set(getRaster().getName(), pointDataSourceValue, dataFieldValue); } }; bindingContext.addPropertyChangeListener(PROPERTY_NAME_DATA_FIELD, userSettingsUpdateListener); bindingContext.addPropertyChangeListener(PROPERTY_NAME_POINT_DATA_SOURCE, userSettingsUpdateListener); }
Example #5
Source File: ScaleBuilder.java From libreveris with GNU Lesser General Public License v3.0 | 4 votes |
public void plot (Point upperLeft) { // All values, quorum line & spread line plotValues(); plotQuorumLine(); plotSpreadLine("", peak); // Second peak spread line? if (secondPeak != null) { plotSpreadLine("Second", secondPeak); } // Chart // JFreeChart chartLines = ChartFactory.createXYLineChart( // sheet.getId() + " (" + name + " runs)", // Title // "Lengths " + ((scale != null) ? scale : "*no scale*"), // X-Axis label // "Counts", // Y-Axis label // dataset, // Dataset // PlotOrientation.VERTICAL, // orientation, // true, // Show legend // false, // Show tool tips // false // urls // ); // use a histogram so we can see the actual buckets values // rather than being left to interpolate for any given length JFreeChart chart = ChartFactory.createHistogram( sheet.getId() + " (" + name + " runs)", // Title "", // X-Axis label - already labeled in chartLines "", // Y-Axis label - already labeled in chartLines dataset, // Dataset PlotOrientation.VERTICAL, // orientation, true, // Show legend false, // Show tool tips false // urls ); // have the quorum and spread be lines rather than bars XYPlot xyPlot = (XYPlot) chart.getPlot(); xyPlot.setDataset(1, datasetLines); XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(); renderer1.setSeriesPaint(0, Color.GREEN); xyPlot.setRenderer(1, renderer1); // "FORWARD" causes the added dataset of // lines to be overlayed on histogram bars xyPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // Hosting frame ChartFrame frame = new ChartFrame( sheet.getId() + " - " + name + " runs", chart, true); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setLocation(upperLeft); frame.setVisible(true); }
Example #6
Source File: TwoDPlot.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
TwoDPlot(RawDataFile rawDataFile, TwoDVisualizerWindow visualizer, TwoDDataSet dataset, Range<Double> rtRange, Range<Double> mzRange, String whichPlotTypeStr) { super(null, true); this.rawDataFile = rawDataFile; this.rtRange = rtRange; this.mzRange = mzRange; setBackground(Color.white); setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); // set the X axis (retention time) properties xAxis = new NumberAxis("Retention time"); xAxis.setAutoRangeIncludesZero(false); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); // set the Y axis (intensity) properties yAxis = new NumberAxis("m/z"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); // set the plot properties if (whichPlotTypeStr == "default") { plot = new TwoDXYPlot(dataset, rtRange, mzRange, xAxis, yAxis); } else if (whichPlotTypeStr == "point2D") { plot = new PointTwoDXYPlot(dataset, rtRange, mzRange, xAxis, yAxis); } plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); // chart properties chart = new JFreeChart("", titleFont, plot, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set crosshair (selection) properties plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); peakDataRenderer = new PeakDataRenderer(); JMenuItem plotTypeMenuItem = new JMenuItem("Toggle centroid/continuous mode"); plotTypeMenuItem.addActionListener(visualizer); plotTypeMenuItem.setActionCommand("SWITCH_PLOTMODE"); add(plotTypeMenuItem); JPopupMenu popupMenu = getPopupMenu(); popupMenu.addSeparator(); popupMenu.add(plotTypeMenuItem); // Add EMF and EPS options to the save as menu JMenuItem saveAsMenu = (JMenuItem) popupMenu.getComponent(3); GUIUtils.addMenuItem(saveAsMenu, "EMF...", this, "SAVE_EMF"); GUIUtils.addMenuItem(saveAsMenu, "EPS...", this, "SAVE_EPS"); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #7
Source File: ScatterPlotChart.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public ScatterPlotChart(ScatterPlotWindow window, ScatterPlotTopPanel topPanel, PeakList peakList) { super(null, true); this.window = window; this.peakList = peakList; this.topPanel = topPanel; // initialize the chart by default time series chart from factory chart = ChartFactory.createXYLineChart("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation false, // create legend false, // generate tooltips false // generate URLs ); chart.setBackgroundPaint(Color.white); setChart(chart); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // Set the domain log axis LogAxis logAxisDomain = new LogAxis(); logAxisDomain.setMinorTickCount(1); logAxisDomain.setNumberFormatOverride(MZmineCore.getConfiguration().getIntensityFormat()); logAxisDomain.setAutoRange(true); plot.setDomainAxis(logAxisDomain); // Set the range log axis LogAxis logAxisRange = new LogAxis(); logAxisRange.setMinorTickCount(1); logAxisRange.setNumberFormatOverride(MZmineCore.getConfiguration().getIntensityFormat()); logAxisRange.setAutoRange(true); plot.setRangeAxis(logAxisRange); // Set crosshair properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // Create data sets; mainDataSet = new ScatterPlotDataSet(peakList); plot.setDataset(0, mainDataSet); diagonalLineDataset = new DiagonalLineDataset(); plot.setDataset(1, diagonalLineDataset); // Create renderers mainRenderer = new ScatterPlotRenderer(); plot.setRenderer(0, mainRenderer); diagonalLineRenderer = new DiagonalLineRenderer(); plot.setRenderer(1, diagonalLineRenderer); // Set tooltip properties ttm = new ComponentToolTipManager(); ttm.registerComponent(this); setDismissDelay(Integer.MAX_VALUE); setInitialDelay(0); // add items to popup menu TODO: add other Show... items JPopupMenu popupMenu = getPopupMenu(); popupMenu.addSeparator(); GUIUtils.addMenuItem(popupMenu, "Show Chromatogram", this, "TIC"); // Add EMF and EPS options to the save as menu JMenuItem saveAsMenu = (JMenuItem) popupMenu.getComponent(3); GUIUtils.addMenuItem(saveAsMenu, "EMF...", this, "SAVE_EMF"); GUIUtils.addMenuItem(saveAsMenu, "EPS...", this, "SAVE_EPS"); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #8
Source File: HistogramChart.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public HistogramChart() { super(null, true); // initialize the chart by default time series chart from factory chart = ChartFactory.createHistogram("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // create legend false, // generate tooltips false // generate URLs ); // title chartTitle = chart.getTitle(); chartTitle.setFont(titleFont); chartTitle.setMargin(5, 0, 0, 0); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // legend constructed by ChartFactory LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); chart.setBackgroundPaint(Color.white); setChart(chart); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(true); // set the logarithmic axis NumberAxis axisDomain = new HistogramDomainAxis(); axisDomain.setMinorTickCount(1); axisDomain.setAutoRange(true); NumberAxis axisRange = new NumberAxis(); axisRange.setMinorTickCount(1); axisRange.setAutoRange(true); plot.setDomainAxis(axisDomain); plot.setRangeAxis(axisRange); ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer(); renderer.setMargin(marginSize); renderer.setShadowVisible(false); plot.setRenderer(renderer); this.setMinimumSize(new Dimension(400, 400)); this.setDismissDelay(Integer.MAX_VALUE); this.setInitialDelay(0); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #9
Source File: PseudoSpectrum.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, RawDataFile raw, boolean sum, String title) { // JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); 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); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzFormat); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // return chart; }
Example #10
Source File: SpectrumChartFactory.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public static JFreeChart createChart(PseudoSpectrumDataSet dataset, boolean showTitle, boolean showLegend, double rt, double precursorMZ) { // if (dataset == null) return null; // NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat(); NumberFormat rtForm = MZmineCore.getConfiguration().getRTFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); String title = ""; if (precursorMZ == 0) title = "RT=" + mzForm.format(precursorMZ); else title = MessageFormat.format("MSMS for m/z={0} RT={1}", mzForm.format(precursorMZ), rtForm.format(rt)); JFreeChart chart = ChartFactory.createXYLineChart(title, // title "m/z", // x-axis label "Intensity", // y-axis label dataset, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); chart.getTitle().setVisible(false); // set the plot properties XYPlot plot = chart.getXYPlot(); 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); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzForm); xAxis.setUpperMargin(0.08); xAxis.setLowerMargin(0.00); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); xAxis.setAutoRangeIncludesZero(true); xAxis.setMinorTickCount(5); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); yAxis.setUpperMargin(0.20); PseudoSpectraRenderer renderer = new PseudoSpectraRenderer(Color.BLACK, false); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer); plot.setRenderer(2, renderer); renderer.setSeriesVisibleInLegend(1, false); renderer.setSeriesPaint(2, Color.ORANGE); // chart.getTitle().setVisible(showTitle); chart.getLegend().setVisible(showLegend); // if (precursorMZ != 0) addPrecursorMarker(chart, precursorMZ); return chart; }
Example #11
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); }
Example #12
Source File: MsMsPlot.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
MsMsPlot(final ActionListener listener, RawDataFile rawDataFile, MsMsVisualizerWindow visualizer, MsMsDataSet dataset, Range<Double> rtRange, Range<Double> mzRange) { super(null, true); this.visualizer = visualizer; this.rawDataFile = rawDataFile; this.rtRange = rtRange; this.mzRange = mzRange; // initialize the chart by default time series chart from factory chart = ChartFactory.createXYLineChart("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // create legend false, // generate tooltips false // generate URLs ); chart.setBackgroundPaint(Color.white); setChart(chart); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // Set the domain log axis xAxis = new NumberAxis("Retention time (min)"); xAxis.setAutoRangeIncludesZero(false); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0.01); xAxis.setLowerMargin(0.01); plot.setDomainAxis(xAxis); // Set the range log axis yAxis = new NumberAxis("Precursor m/z"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0.1); yAxis.setLowerMargin(0.1); plot.setRangeAxis(yAxis); // Set crosshair properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // Create renderers mainRenderer = new MsMsPlotRenderer(); plot.setRenderer(0, mainRenderer); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // Add data sets; plot.setDataset(0, dataset); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); peakDataRenderer = new PeakDataRenderer(); // Add EMF and EPS options to the save as menu JPopupMenu popupMenu = getPopupMenu(); JMenuItem saveAsMenu = (JMenuItem) popupMenu.getComponent(3); GUIUtils.addMenuItem(saveAsMenu, "EMF...", this, "SAVE_EMF"); GUIUtils.addMenuItem(saveAsMenu, "EPS...", this, "SAVE_EPS"); // Register for mouse-wheel events addMouseWheelListener(this); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #13
Source File: AlignmentRansacPlot.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public AlignmentRansacPlot() { super(null, true); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // legend constructed by ChartFactory legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // set default renderer properties XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setDefaultLinesVisible(false); renderer.setDefaultShapesVisible(true); renderer.setSeriesShape(0, dataPointsShape); renderer.setSeriesShape(1, dataPointsShape); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GRAY); renderer.setSeriesPaint(2, Color.BLUE); renderer.setDefaultItemLabelPaint(labelsColor); renderer.setDrawSeriesLineAsPath(true); plot.setRenderer(renderer); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #14
Source File: ChromatogramPlotWindowController.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
@FXML public void initialize() { final JFreeChart chart = chartNode.getChart(); final XYPlot plot = chart.getXYPlot(); // Do not set colors and strokes dynamically. They are instead provided // by the dataset and configured in configureRenderer() plot.setDrawingSupplier(null); plot.setDomainGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setRangeGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setRangeCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // chart properties chart.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); // legend properties LegendTitle legend = chart.getLegend(); // legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setLabel("Retention time (min)"); xAxis.setUpperMargin(0.03); xAxis.setLowerMargin(0.03); xAxis.setRangeType(RangeType.POSITIVE); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel("Intensity"); yAxis.setRangeType(RangeType.POSITIVE); yAxis.setAutoRangeIncludesZero(true); // set the fixed number formats, because otherwise JFreeChart sometimes // shows exponent, sometimes it doesn't DecimalFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); xAxis.setNumberFormatOverride(mzFormat); DecimalFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); yAxis.setNumberFormatOverride(intensityFormat); chartTitle = chartNode.getChart().getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartTitle.setText("Chromatogram"); chartNode.setCursor(Cursor.CROSSHAIR); // Remove the dataset if it is removed from the list datasets.addListener((Change<? extends ChromatogramPlotDataSet> c) -> { while (c.next()) { if (c.wasRemoved()) { for (ChromatogramPlotDataSet ds : c.getRemoved()) { int index = plot.indexOf(ds); plot.setDataset(index, null); } } } }); itemLabelsVisible.addListener((prop, oldVal, newVal) -> { for (ChromatogramPlotDataSet dataset : datasets) { int datasetIndex = plot.indexOf(dataset); XYItemRenderer renderer = plot.getRenderer(datasetIndex); renderer.setBaseItemLabelsVisible(newVal); } }); legendVisible.addListener((prop, oldVal, newVal) -> { legend.setVisible(newVal); }); }
Example #15
Source File: MsSpectrumPlotWindowController.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
public void initialize() { final JFreeChart chart = chartNode.getChart(); final XYPlot plot = chart.getXYPlot(); // Do not set colors and strokes dynamically. They are instead provided // by the dataset and configured in configureRenderer() plot.setDrawingSupplier(null); plot.setDomainGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setRangeGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // chart properties chart.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); // legend properties LegendTitle legend = chart.getLegend(); // legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the X axis (m/z) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setLabel("m/z"); xAxis.setUpperMargin(0.03); xAxis.setLowerMargin(0.03); xAxis.setRangeType(RangeType.POSITIVE); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel("Intensity"); yAxis.setRangeType(RangeType.POSITIVE); yAxis.setAutoRangeIncludesZero(true); // set the fixed number formats, because otherwise JFreeChart sometimes // shows exponent, sometimes it doesn't DecimalFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); xAxis.setNumberFormatOverride(mzFormat); DecimalFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); yAxis.setNumberFormatOverride(intensityFormat); chartTitle = chartNode.getChart().getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartNode.setCursor(Cursor.CROSSHAIR); // Remove the dataset if it is removed from the list datasets.addListener((Change<? extends MsSpectrumDataSet> c) -> { while (c.next()) { if (c.wasRemoved()) { for (MsSpectrumDataSet ds : c.getRemoved()) { int index = plot.indexOf(ds); plot.setDataset(index, null); } } } }); itemLabelsVisible.addListener((prop, oldVal, newVal) -> { for (MsSpectrumDataSet dataset : datasets) { int datasetIndex = plot.indexOf(dataset); XYItemRenderer renderer = plot.getRenderer(datasetIndex); renderer.setBaseItemLabelsVisible(newVal); } }); legendVisible.addListener((prop, oldVal, newVal) -> { legend.setVisible(newVal); }); }
Example #16
Source File: ParetoChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private JFreeChart createChart() { if (data.getItemCount() > 0) { // get cumulative percentages KeyedValues cumulative = DataUtilities.getCumulativePercentages(data); CategoryDataset categoryDataset = DatasetUtilities.createCategoryDataset( "Count for " + this.dataTable.getColumnName(this.countColumn) + " = " + countValue, data); // create the chart... final JFreeChart chart = ChartFactory.createBarChart(null, // chart title this.dataTable.getColumnName(this.groupByColumn), // domain axis label "Count", // range axis label categoryDataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); // get a reference to the plot for further customization... CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.02); domainAxis.setUpperMargin(0.02); domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US)); rangeAxis.setLabelFont(LABEL_FONT_BOLD); rangeAxis.setTickLabelFont(LABEL_FONT); // second data set (cumulative percentages) CategoryDataset dataset2 = DatasetUtilities.createCategoryDataset("Cumulative (Percent)", cumulative); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); renderer2.setSeriesPaint(0, SwingTools.VERY_DARK_BLUE.darker()); NumberAxis axis2 = new NumberAxis("Percent of " + countValue); axis2.setNumberFormatOverride(NumberFormat.getPercentInstance()); axis2.setLabelFont(LABEL_FONT_BOLD); axis2.setTickLabelFont(LABEL_FONT); plot.setRangeAxis(1, axis2); plot.setDataset(1, dataset2); plot.setRenderer(1, renderer2); plot.mapDatasetToRangeAxis(1, 1); axis2.setTickUnit(new NumberTickUnit(0.1)); // show grid lines plot.setRangeGridlinesVisible(true); // bring cumulative line to front plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); if (isLabelRotating()) { domainAxis.setTickLabelsVisible(true); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } return chart; } else { return null; } }
Example #17
Source File: AlignmentRansacPlot.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public AlignmentRansacPlot() { super(ChartFactory.createXYLineChart("", null, null, new XYSeriesCollection(), PlotOrientation.VERTICAL, true, true, false)); chart = this.getChart(); chart.setBackgroundPaint(Color.white); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // legend constructed by ChartFactory legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); dataset = (XYSeriesCollection) plot.getDataset(); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // set default renderer properties XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setDefaultLinesVisible(false); renderer.setDefaultShapesVisible(true); renderer.setSeriesShape(0, dataPointsShape); renderer.setSeriesShape(1, dataPointsShape); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GRAY); renderer.setSeriesPaint(2, Color.BLUE); renderer.setDefaultItemLabelPaint(labelsColor); renderer.setDrawSeriesLineAsPath(true); plot.setRenderer(renderer); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #18
Source File: JPanelAnalysisTimeDist.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
private JFreeChart CreateChart(XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createXYAreaChart("", // x axis label bundle.getString("JPanelAnalysisTimeDist.labelX"), // "Distance" // y axis label bundle.getString("JPanelAnalysisTimeDist.labelY1"), // "Elevation" dataset1, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); // -- Background color chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); XYAreaRenderer renderer = new XYAreaRenderer(); renderer.setSeriesPaint(0, new Color(0x99, 0xff, 0x00)); renderer.setOutline(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); plot.setRenderer(0, renderer); NumberAxis rangeAxis2 = new NumberAxis(bundle.getString("JPanelAnalysisTimeDist.labelY2")); // "Time" plot.setRangeAxis(1, rangeAxis2); plot.setDataset(1, dataset2); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // -- Select the display order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #19
Source File: JPanelAnalysisSpeedSlope.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
private JFreeChart CreateChart(XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createScatterPlot("", // x axis label bundle.getString("JPanelAnalysisSpeedSlope.labelX"), // "Slope", // y axis label bundle.getString("JPanelAnalysisSpeedSlope.labelY"), // "Speed", // data dataset1, PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // Panel background color chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setRangeCrosshairLockedOnData(false); XYDotRenderer renderer = new XYDotRenderer(); renderer.setSeriesPaint(0, new Color(0x6B, 0xB2, 0x00)); renderer.setDotWidth(2); renderer.setDotHeight(2); plot.setRenderer(renderer); NumberAxis rangeAxis2 = new NumberAxis(); plot.setRangeAxis(1, rangeAxis2); plot.setDataset(1, dataset2); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); XYAreaRenderer renderer2 = new XYAreaRenderer(); renderer2.setSeriesPaint(0, new Color(0x99, 0xff, 0x00, 0x80)); renderer2.setOutline(true); renderer2.setSeriesOutlinePaint(0, new Color(0x80, 0x80, 0x80, 0x80)); renderer2.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); plot.setRenderer(1, renderer2); /* * StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); * renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); */ // -- Select the display order plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); return chart; }
Example #20
Source File: JPanelAnalysisSpeed.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
private JFreeChart CreateChart(XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createXYAreaChart("", // x axis label bundle.getString("JPanelAnalysisSpeed.labelX"), // "Distance", // y axis label bundle.getString("JPanelAnalysisSpeed.labelY"), // "Speed" dataset1, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // Panel background color chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); XYAreaRenderer renderer = new XYAreaRenderer(); renderer.setSeriesPaint(0, new Color(0x99, 0xff, 0x00)); renderer.setOutline(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); plot.setRenderer(0, renderer); NumberAxis rangeAxis2 = new NumberAxis(); plot.setRangeAxis(1, rangeAxis2); plot.setDataset(1, dataset2); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // -- Select the display order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #21
Source File: FrmElevationFilter.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
/** * Update the chart * * @param dataset1 * @param dataset2 * @return */ private JFreeChart CreateChart(XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createXYAreaChart("", // x axis label bundle.getString("frmElevationFilter.labelX"), // "Distance" // y axis label bundle.getString("frmElevationFilter.labelY1"), // "Elevation" dataset1, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); // -- Background color chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); XYAreaRenderer renderer = new XYAreaRenderer(); renderer.setSeriesPaint(0, new Color(0x99, 0xff, 0x00)); renderer.setOutline(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f)); plot.setRenderer(0, renderer); NumberAxis rangeAxis2 = new NumberAxis("");// bundle.getString("JPanelAnalysisTimeDist.labelY2")); // "Time" // plot.setRangeAxis(1, rangeAxis2); plot.setDataset(1, dataset2); plot.setRangeAxis(1, rangeAxis2); // plot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); renderer2.setSeriesStroke(0, new BasicStroke(1.0f)); plot.setRenderer(1, renderer2); // -- Select the display order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #22
Source File: CumulativeCurveChart.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public JFreeChart createChart(DatasetMap datasetMap) { CategoryDataset datasetValue=(CategoryDataset)datasetMap.getDatasets().get("1"); CategoryDataset datasetCumulative=(CategoryDataset)datasetMap.getDatasets().get("2"); JFreeChart chart = ChartFactory.createBarChart( name, // chart title xLabel, // domain axis label yLabel, // range axis label datasetValue, // data PlotOrientation.VERTICAL, true, // include legend true, false ); chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.02); domainAxis.setUpperMargin(0.02); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); NumberAxis axis2 = new NumberAxis("Percent"); axis2.setNumberFormatOverride(NumberFormat.getPercentInstance()); plot.setRangeAxis(1, axis2); plot.setDataset(1, datasetCumulative); plot.setRenderer(1, renderer2); plot.mapDatasetToRangeAxis(1, 1); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #23
Source File: PlotUtil.java From dl4j-tutorials with MIT License | 4 votes |
private static JFreeChart createChart(XYZDataset dataset, double[] mins, double[] maxs, int nPoints, XYDataset xyData) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setRange(mins[0],maxs[0]); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setRange(mins[1], maxs[1]); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth((maxs[0]-mins[0])/(nPoints-1)); renderer.setBlockHeight((maxs[1] - mins[1]) / (nPoints - 1)); PaintScale scale = new GrayPaintScale(0, 1.0); renderer.setPaintScale(scale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); JFreeChart chart = new JFreeChart("", plot); chart.getXYPlot().getRenderer().setSeriesVisibleInLegend(0, false); NumberAxis scaleAxis = new NumberAxis("Probability (class 0)"); scaleAxis.setAxisLinePaint(Color.white); scaleAxis.setTickMarkPaint(Color.white); scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7)); PaintScaleLegend legend = new PaintScaleLegend(new GrayPaintScale(), scaleAxis); legend.setStripOutlineVisible(false); legend.setSubdivisionCount(20); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.red)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10); legend.setPosition(RectangleEdge.LEFT); chart.addSubtitle(legend); ChartUtilities.applyCurrentTheme(chart); plot.setDataset(1, xyData); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setBaseLinesVisible(false); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #24
Source File: Chart.java From freeacs with MIT License | 4 votes |
/** * All params can be null. * * @param min - the minimum number on the left range axis (must be set if max is set) * @param max - the maximum number on the left range axis (must be set if min is set) * @param method2 - the method to run out of Record, and populates a bar series (right range axis) * @param highLightIndex - the index to highlight * @return * @throws Exception */ public JFreeChart makeTimeChart(Double min, Double max, String method2, Integer highLightIndex) throws Exception { startTms = System.currentTimeMillis(); endTms = 0; XYBarRenderer.setDefaultShadowsVisible(false); TimeSeriesCollection data = new TimeSeriesCollection(); Map<String, TimeSeries> timeSeriesMap = makeTimeSeriesMap(method, recordMap, keyNames); for (TimeSeries timeSeries : timeSeriesMap.values()) { data.addSeries(timeSeries); } String yAxisLabel = method; String denominator = Record.getDenominator(report.getRecordClass(), method.toLowerCase()); if (denominator != null) { yAxisLabel += " (" + denominator + ")"; } chart = ChartFactory.createTimeSeriesChart(title, "Time", yAxisLabel, data, true, true, true); XYPlot plot = (XYPlot) chart.getPlot(); if (method2 != null) { Map<Key, R> recordMap2 = recordMap; TimeSeriesCollection data2 = new TimeSeriesCollection(); if (keyNames.length > 0) { recordMap2 = report.getMapAggregatedOn(); } Map<String, TimeSeries> timeSeriesMap2 = makeTimeSeriesMap(method2, recordMap2); if (timeSeriesMap2.get("Total (" + method2 + ")") != null) { data2.addSeries(timeSeriesMap2.get("Total (" + method2 + ")")); } String y2AxisLabel = method2; String demoninator2 = Record.getDenominator(report.getRecordClass(), method2.toLowerCase()); if (demoninator2 != null) { y2AxisLabel += " (" + demoninator2 + ")"; } NumberAxis axis2 = new NumberAxis(y2AxisLabel); XYBarRenderer renderer2 = new XYBarRenderer(0.20); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, data2); plot.setRenderer(1, renderer2); plot.mapDatasetToRangeAxis(1, 1); renderer2.setBarPainter(new StandardXYBarPainter()); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); } if (min != null && max != null) { plot.getRangeAxis(0).setRange(min, max); } if (highLightIndex != null) { chart.getXYPlot().getRenderer().setSeriesStroke(highLightIndex, new BasicStroke(5f)); } XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setDefaultShapesVisible(true); renderer.setUseFillPaint(true); renderer.setDefaultFillPaint(Color.white); long diff = endTms - startTms; String format; if (diff > NINTY_DAYS) { format = "MMM-yyyy"; } else if (diff > TWO_DAYS) { format = "dd-MMM"; } else if (diff > TWO_MINUTES) { format = "HH:mm"; } else { format = "HH:mm:ss"; } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat(format)); LegendTitle lt = chart.getLegend(0); lt.setPosition(RectangleEdge.RIGHT); if (displayFrame) { ChartFrame frame = new ChartFrame(title, chart); frame.pack(); frame.setVisible(true); } return chart; }
Example #25
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 #26
Source File: TwoDPlot.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
TwoDPlot(RawDataFile rawDataFile, TwoDVisualizerWindow visualizer, TwoDDataSet dataset, Range<Double> rtRange, Range<Double> mzRange, String whichPlotTypeStr) { super(null); this.rawDataFile = rawDataFile; this.rtRange = rtRange; this.mzRange = mzRange; // setBackground(Color.white); setCursor(Cursor.CROSSHAIR); // set the X axis (retention time) properties xAxis = new NumberAxis("Retention time"); xAxis.setAutoRangeIncludesZero(false); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); // set the Y axis (intensity) properties yAxis = new NumberAxis("m/z"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); // set the plot properties if (whichPlotTypeStr == "default") { plot = new TwoDXYPlot(dataset, rtRange, mzRange, xAxis, yAxis); } else if (whichPlotTypeStr == "point2D") { plot = new PointTwoDXYPlot(dataset, rtRange, mzRange, xAxis, yAxis); } plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); // chart properties chart = new JFreeChart("", titleFont, plot, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // disable maximum size (we don't want scaling) // setMaximumDrawWidth(Integer.MAX_VALUE); // setMaximumDrawHeight(Integer.MAX_VALUE); // set crosshair (selection) properties plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); peakDataRenderer = new PeakDataRenderer(); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #27
Source File: ScatterPlotChart.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public ScatterPlotChart(ScatterPlotWindow window, ScatterPlotTopPanel topPanel, PeakList peakList) { super(null); this.window = window; this.peakList = peakList; this.topPanel = topPanel; // initialize the chart by default time series chart from factory chart = ChartFactory.createXYLineChart("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation false, // create legend false, // generate tooltips false // generate URLs ); chart.setBackgroundPaint(Color.white); setChart(chart); // disable maximum size (we don't want scaling) // setMaximumDrawWidth(Integer.MAX_VALUE); // setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // Set the domain log axis LogAxis logAxisDomain = new LogAxis(); logAxisDomain.setMinorTickCount(1); logAxisDomain.setNumberFormatOverride(MZmineCore.getConfiguration().getIntensityFormat()); logAxisDomain.setAutoRange(true); plot.setDomainAxis(logAxisDomain); // Set the range log axis LogAxis logAxisRange = new LogAxis(); logAxisRange.setMinorTickCount(1); logAxisRange.setNumberFormatOverride(MZmineCore.getConfiguration().getIntensityFormat()); logAxisRange.setAutoRange(true); plot.setRangeAxis(logAxisRange); // Set crosshair properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // Create data sets; mainDataSet = new ScatterPlotDataSet(peakList); plot.setDataset(0, mainDataSet); diagonalLineDataset = new DiagonalLineDataset(); plot.setDataset(1, diagonalLineDataset); // Create renderers mainRenderer = new ScatterPlotRenderer(); plot.setRenderer(0, mainRenderer); diagonalLineRenderer = new DiagonalLineRenderer(); plot.setRenderer(1, diagonalLineRenderer); // Set tooltip properties // ttm = new ComponentToolTipManager(); // ttm.registerComponent(this); // setDismissDelay(Integer.MAX_VALUE); // setInitialDelay(0); // add items to popup menu TODO: add other Show... items ContextMenu popupMenu = getContextMenu(); // popupMenu.addSeparator(); // GUIUtils.addMenuItem(popupMenu, "Show Chromatogram", this, "TIC"); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #28
Source File: HistogramChart.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public HistogramChart() { super(ChartFactory.createHistogram("", // title "", // x-axis label "", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // create legend false, // generate tooltips false // generate URLs )); // initialize the chart by default time series chart from factory chart = getChart(); // title chartTitle = chart.getTitle(); chartTitle.setFont(titleFont); chartTitle.setMargin(5, 0, 0, 0); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // legend constructed by ChartFactory LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); chart.setBackgroundPaint(Color.white); // disable maximum size (we don't want scaling) // setMaximumDrawWidth(Integer.MAX_VALUE); // setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(true); // set the logarithmic axis NumberAxis axisDomain = new HistogramDomainAxis(); axisDomain.setMinorTickCount(1); axisDomain.setAutoRange(true); NumberAxis axisRange = new NumberAxis(); axisRange.setMinorTickCount(1); axisRange.setAutoRange(true); plot.setDomainAxis(axisDomain); plot.setRangeAxis(axisRange); ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer(); renderer.setMargin(marginSize); renderer.setShadowVisible(false); plot.setRenderer(renderer); // this.setMinimumSize(new Dimension(400, 400)); // this.setDismissDelay(Integer.MAX_VALUE); // this.setInitialDelay(0); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }
Example #29
Source File: CombinedModulePlot.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public void setPlot(RawDataFile dataFile, CombinedModuleVisualizerWindowController visualizer, Range<Double> rtRange, Range<Double> mzRange, AxisType xAxisType, AxisType yAxisType, String massList, Double noiseLevel, ColorScale colorScale) { this.visualizer = visualizer; this.dataFile = dataFile; this.rtRange = rtRange; this.mzRange = mzRange; this.noiseLevel = noiseLevel; this.colorScale = colorScale; this.massList = massList; chart = getChart(); chart.setBackgroundPaint(Color.white); plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); defaultRenderer = new CombinedModuleDataPointRenderer(false, true); defaultRenderer.setTransparency(0.4f); LookupPaintScale scale = new LookupPaintScale(rtRange.lowerEndpoint(), rtRange.upperEndpoint(), new Color(0, 0, 0)); defaultRenderer.setPaintScale(scale); NumberAxis xAxis = (NumberAxis) this.plot.getDomainAxis(); if (xAxisType == AxisType.RETENTIONTIME) { setAxes(xAxis, xAxisType, rtFormat); } else { setAxes(xAxis, xAxisType, mzFormat); } NumberAxis yAxis = (NumberAxis) this.plot.getRangeAxis(); setAxes(yAxis, yAxisType, mzFormat); }
Example #30
Source File: MsMsPlot.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
MsMsPlot(RawDataFile rawDataFile, MsMsVisualizerWindow visualizer, MsMsDataSet dataset, Range<Double> rtRange, Range<Double> mzRange) { super(ChartFactory.createXYLineChart("", "", "", null, PlotOrientation.VERTICAL, true, true, false), true, true, false, false, true); this.visualizer = visualizer; this.rawDataFile = rawDataFile; this.rtRange = rtRange; this.mzRange = mzRange; // initialize the chart by default time series chart from factory chart = getChart(); chart.setBackgroundPaint(Color.white); // disable maximum size (we don't want scaling) // setMaximumDrawWidth(Integer.MAX_VALUE); // setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // Set the domain log axis xAxis = new NumberAxis("Retention time (min)"); xAxis.setAutoRangeIncludesZero(false); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0.01); xAxis.setLowerMargin(0.01); plot.setDomainAxis(xAxis); // Set the range log axis yAxis = new NumberAxis("Precursor m/z"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0.1); yAxis.setLowerMargin(0.1); plot.setRangeAxis(yAxis); // Set crosshair properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // Create renderers mainRenderer = new MsMsPlotRenderer(); plot.setRenderer(0, mainRenderer); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // Add data sets; plot.setDataset(0, dataset); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); peakDataRenderer = new PeakDataRenderer(); // reset zoom history ZoomHistory history = getZoomHistory(); if (history != null) history.clear(); }