org.jfree.chart.plot.SeriesRenderingOrder Java Examples
The following examples show how to use
org.jfree.chart.plot.SeriesRenderingOrder.
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: KafkaFT.java From flink-perf with Apache License 2.0 | 5 votes |
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Flink Exactly-Once on Kafka with YARN Chaos Monkey", "Date", "Value", xydataset, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYLineAndShapeRenderer r0 = (XYLineAndShapeRenderer) xyplot.getRenderer(0); // draw data points as points r0.setSeriesShapesVisible(2, true); r0.setSeriesLinesVisible(2, true); // order elements as assed xyplot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); Number first = xydataset.getX(0, 0); Minute minute = new Minute(new Date((Long)first)); System.out.println("first = "+first); RelativeDateFormat relativedateformat = new RelativeDateFormat(minute.getFirstMillisecond()); relativedateformat.setSecondFormatter(new DecimalFormat("00")); dateaxis.setDateFormatOverride(relativedateformat); //dateaxis.setDateFormatOverride(new SimpleDateFormat("mm:ss")); ValueAxis valueaxis = xyplot.getRangeAxis(); valueaxis.setAutoRangeMinimumSize(1.0D); valueaxis.setLabel("Elements/Core"); xyplot.getRenderer().setSeriesPaint(2, ChartColor.DARK_MAGENTA); return jfreechart; }
Example #2
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(); }
Example #3
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 #4
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 #5
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 #6
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 #7
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 #8
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(); }