List of usage examples for org.jfree.chart.axis NumberAxis setAutoRangeIncludesZero
public void setAutoRangeIncludesZero(boolean flag)
From source file:be.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java
private void rescaleAxis(NumberAxis axis) { axis.setAutoRangeIncludesZero(false); }
From source file:ucar.unidata.idv.control.McVHistogramWrapper.java
/** * Assumes that {@code data} has been validated and is okay to actually try * loading./*from w w w .j ava2s. co m*/ * * @param data Data to use in histogram. Cannot be {@code null} or all NaNs. * * @throws VisADException * @throws RemoteException */ private void reallyLoadData(FlatField data) throws VisADException, RemoteException { createChart(); List dataChoiceWrappers = getDataChoiceWrappers(); try { clearHistogram(); ErrorEstimate[] errOut = new ErrorEstimate[1]; for (int paramIdx = 0; paramIdx < dataChoiceWrappers.size(); paramIdx++) { DataChoiceWrapper wrapper = (DataChoiceWrapper) dataChoiceWrappers.get(paramIdx); DataChoice dataChoice = wrapper.getDataChoice(); Unit defaultUnit = ucar.visad.Util.getDefaultRangeUnits((FlatField) data)[0]; Unit unit = ((DisplayControlImpl) imageControl).getDisplayUnit(); double[][] samples = data.getValues(false); double[] actualValues = filterData(samples[0], getTimeValues(samples, data))[0]; if ((defaultUnit != null) && !defaultUnit.equals(unit)) { actualValues = Unit.transformUnits(unit, errOut, defaultUnit, null, actualValues); } final NumberAxis domainAxis = new NumberAxis(wrapper.getLabel(unit)); domainAxis.setAutoRangeIncludesZero(false); XYItemRenderer renderer; if (getStacked()) { renderer = new StackedXYBarRenderer(); } else { renderer = new XYBarRenderer(); } if ((plot == null) && (chartPanel != null)) { plot = chartPanel.getChart().getXYPlot(); } plot.setRenderer(paramIdx, renderer); Color c = wrapper.getColor(paramIdx); domainAxis.setLabelPaint(c); renderer.setSeriesPaint(0, c); MyHistogramDataset dataset = new MyHistogramDataset(); dataset.setType(HistogramType.FREQUENCY); dataset.addSeries(dataChoice.getName() + " [" + unit + ']', actualValues, getBins()); samples = null; actualValues = null; plot.setDomainAxis(paramIdx, domainAxis, false); plot.mapDatasetToDomainAxis(paramIdx, paramIdx); plot.setDataset(paramIdx, dataset); domainAxis.addChangeListener(new AxisChangeListener() { public void axisChanged(AxisChangeEvent ae) { if (!imageControl.isInitDone()) { return; } Range range = domainAxis.getRange(); double newLow = Math.floor(range.getLowerBound() + 0.5); double newHigh = Math.floor(range.getUpperBound() + 0.5); double prevLow = getLow(); double prevHigh = getHigh(); try { ucar.unidata.util.Range newRange; if (prevLow > prevHigh) { newRange = new ucar.unidata.util.Range(newHigh, newLow); } else { newRange = new ucar.unidata.util.Range(newLow, newHigh); } ((DisplayControlImpl) imageControl).setRange(newRange); } catch (Exception e) { logger.error("Cannot change range", e); } } }); Range range = domainAxis.getRange(); low = range.getLowerBound(); high = range.getUpperBound(); } } catch (Exception exc) { System.out.println("Exception exc=" + exc); LogUtil.logException("Error creating data set", exc); } }
From source file:com.sdk.connector.chart.FrequencyDomainRenderer.java
/** * Creates a new demo application./*from w w w . j a v a2 s . c o m*/ * * @param title the frame title. */ public FrequencyDomainRenderer(String title, JPanel panel, String side, String type) { this.side = side; this.type = type; serie.setKey(side); dataset.addSeries(serie); JFreeChart chart = ChartFactory.createXYAreaChart(title, java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.xlabel"), java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.ylabel2"), dataset, PlotOrientation.VERTICAL, true, true, false); // TextTitle t1 = new TextTitle( "Espectro de Frequncia Estimado (PSD)", new Font("SansSerif", Font.BOLD, 14) ); // //TextTitle t2 = new TextTitle( "valores atualizados a cada potncia de 2", new Font("SansSerif", Font.PLAIN, 11) ); // chart.addSubtitle(t1); chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); chart.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); chart.getRenderingHints().put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_LCD_CONTRAST, 100); //chart.addSubtitle(t2); plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLUE); plot.setRangeGridlinePaint(Color.CYAN); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f)); //plot.setRangePannable(true); plot.setForegroundAlpha(0.65f); //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer = plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.BLACK); if (side.startsWith( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("side.left"))) { renderer.setSeriesPaint(0, Color.BLUE); } else { renderer.setSeriesPaint(0, Color.RED); } // renderer.setSeriesLinesVisible(0, true); // renderer.setSeriesShapesVisible(0, false); // renderer.setSeriesLinesVisible(1, true); // renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); plot.setForegroundAlpha(0.5f); Color color1 = new Color(0, 0, 0, 24); Color color2 = new Color(255, 255, 255, 24); GradientPaint gp = new GradientPaint(0, 0, color1, 0, 0, color2); plot.setBackgroundPaint(gp); final ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); NumberAxis numDomainAxis = (NumberAxis) plot.getDomainAxis(); numDomainAxis.setAutoRangeIncludesZero(true); // // final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); // // plot.setRangeAxis(rangeAxis); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); numRangeAxis = (NumberAxis) plot.getRangeAxis(); numRangeAxis.setAutoRangeIncludesZero(true); vlfTarget.setLabel("VLF"); vlfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); vlfTarget.setLabelAnchor(RectangleAnchor.CENTER); vlfTarget.setLabelTextAnchor(TextAnchor.CENTER); vlfTarget.setPaint(new Color(0, 100, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(vlfTarget, Layer.BACKGROUND); lfTarget.setLabel("LF"); lfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); lfTarget.setLabelAnchor(RectangleAnchor.CENTER); lfTarget.setLabelTextAnchor(TextAnchor.CENTER); lfTarget.setPaint(new Color(255, 255, 0, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(lfTarget, Layer.BACKGROUND); hfTarget.setLabel("HF"); hfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); hfTarget.setLabelAnchor(RectangleAnchor.CENTER); hfTarget.setLabelTextAnchor(TextAnchor.CENTER); hfTarget.setPaint(new Color(255, 0, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(hfTarget, Layer.BACKGROUND); plot.setNoDataMessage( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("message.wait")); chartPanel = new ChartPanel(chart); panel.setLayout(new GridLayout(0, 1)); panel.add(chartPanel); panel.repaint(); panel.revalidate(); }
From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformationFamilyChart.java
/** * Creates a chart./*from ww w.j a va 2s . com*/ * * @param dataset the data for the chart. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { chartTitle = "Power Transform Chart"; // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, //"Power Transform Chart", // chart title domainLabel, // x axis label rangeLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT)); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // renderer.setSeriesShape(0, java.awt.Shape.round); renderer.setBaseShapesVisible(false); renderer.setBaseShapesFilled(false); renderer.setBaseLinesVisible(true); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); //change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setUpperMargin(0.05); rangeAxis.setLowerMargin(0.05); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setAutoRangeIncludesZero(false); // domainAxis.setTickLabelsVisible(false); // domainAxis.setTickMarksVisible(false); domainAxis.setUpperMargin(0.05); domainAxis.setLowerMargin(0.05); // OPTIONAL CUSTOMISATION COMPLETED. setYSummary(dataset); return chart; }
From source file:org.jls.toolbox.math.chart.XYLineChart.java
/** * Permet de paramtrer le graphique une fois cr. *//*from w ww . ja va 2 s . com*/ private void setChartStyle() { // Paramtrage des courbes this.plot.setBackgroundAlpha((float) 0.0); this.plot.setDomainCrosshairVisible(this.isGridXVisible); this.plot.setDomainCrosshairLockedOnData(true); this.plot.setRangeCrosshairVisible(this.isGridYVisible); this.plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); this.plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); NumberAxis xAxis = (NumberAxis) this.plot.getDomainAxis(); NumberAxis yAxis = (NumberAxis) this.plot.getRangeAxis(); this.chart.setBackgroundPaint(this.CHART_BACKGROUND_COLOR); xAxis.setAxisLinePaint(this.CHART_FOREGROUND_COLOR); xAxis.setLabelPaint(this.CHART_FOREGROUND_COLOR); xAxis.setTickLabelPaint(this.CHART_FOREGROUND_COLOR); xAxis.setTickMarkPaint(this.CHART_FOREGROUND_COLOR); xAxis.setAutoRange(true); xAxis.setAutoRangeIncludesZero(false); yAxis.setAxisLinePaint(this.CHART_FOREGROUND_COLOR); yAxis.setLabelPaint(this.CHART_FOREGROUND_COLOR); yAxis.setTickLabelPaint(this.CHART_FOREGROUND_COLOR); yAxis.setTickMarkPaint(this.CHART_FOREGROUND_COLOR); yAxis.setAutoRange(true); yAxis.setAutoRangeIncludesZero(false); this.plot.setBackgroundPaint(this.CHART_FOREGROUND_COLOR); this.plot.setDomainGridlinePaint(this.CHART_FOREGROUND_COLOR); this.plot.setRangeGridlinePaint(this.CHART_FOREGROUND_COLOR); this.plot.setDomainCrosshairPaint(this.CROSSHAIR_COLOR); this.plot.setRangeCrosshairPaint(this.CROSSHAIR_COLOR); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) this.plot.getRenderer(); renderer.setBaseShapesVisible(false); renderer.setBaseShapesFilled(false); }
From source file:charts.Chart.java
public static void MultipleLineChart(XYDataset[] datasets, String title, String x_axis_label, String y_axis_label, boolean showlegend, float maxvalue, float minvalue) { JFrame chartwindow = new JFrame(title); CombinedDomainXYPlot parent = new CombinedDomainXYPlot(new NumberAxis(x_axis_label)); for (int i = 0; i < datasets.length; i++) { XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setBaseSeriesVisibleInLegend(showlegend); XYPlot subplot = new XYPlot(datasets[i], null, new NumberAxis(y_axis_label), renderer); NumberAxis axis = (NumberAxis) subplot.getRangeAxis(); //axis.setTickLabelFont(new Font("SansSerif", Font.BOLD,12)); //axis.setLabelFont(new Font("SansSerif", Font.PLAIN,10)); axis.setAutoRangeIncludesZero(true); axis.setLabelFont(new Font("SansSerif", Font.BOLD, 12)); NumberAxis daxis = (NumberAxis) parent.getDomainAxis(); daxis.setLabelFont(new Font("SansSerif", Font.BOLD, 12)); parent.add(subplot, 1);//from ww w .j a v a2 s . c om } JFreeChart jfreechart = new JFreeChart(title, parent); JPanel jpanel = new ChartPanel(jfreechart); jpanel.setPreferredSize(new Dimension(defaultwidth, defaultheight)); chartwindow.setContentPane(jpanel); chartwindow.pack(); RefineryUtilities.centerFrameOnScreen(chartwindow); chartwindow.setVisible(true); }
From source file:org.pentaho.plugin.jfreereport.reportcharts.BarLineChartExpression.java
protected void configureChart(final JFreeChart chart) { super.configureChart(chart); final CategoryPlot plot = chart.getCategoryPlot(); if (isSharedRangeAxis() == false) { final ValueAxis linesAxis = plot.getRangeAxis(1); if (linesAxis instanceof NumberAxis) { final NumberAxis numberAxis = (NumberAxis) linesAxis; numberAxis.setAutoRangeIncludesZero(isLineAxisIncludesZero()); numberAxis.setAutoRangeStickyZero(isLineAxisStickyZero()); if (getLinePeriodCount() > 0) { if (getLineTicksLabelFormat() != null) { final FastDecimalFormat formatter = new FastDecimalFormat(getLineTicksLabelFormat(), getResourceBundleFactory().getLocale()); numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount(), formatter)); } else { numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount())); }/*w w w . j ava 2s. c om*/ } else { if (getLineTicksLabelFormat() != null) { final DecimalFormat formatter = new DecimalFormat(getLineTicksLabelFormat(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale())); numberAxis.setNumberFormatOverride(formatter); } } } else if (linesAxis instanceof DateAxis) { final DateAxis numberAxis = (DateAxis) linesAxis; if (getLinePeriodCount() > 0 && getLineTimePeriod() != null) { if (getLineTicksLabelFormat() != null) { final SimpleDateFormat formatter = new SimpleDateFormat(getLineTicksLabelFormat(), new DateFormatSymbols(getResourceBundleFactory().getLocale())); numberAxis.setTickUnit(new DateTickUnit(getDateUnitAsInt(getLineTimePeriod()), (int) getLinePeriodCount(), formatter)); } else { numberAxis.setTickUnit(new DateTickUnit(getDateUnitAsInt(getLineTimePeriod()), (int) getLinePeriodCount())); } } else if (getRangeTickFormatString() != null) { final SimpleDateFormat formatter = new SimpleDateFormat(getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale())); numberAxis.setDateFormatOverride(formatter); } } if (linesAxis != null) { final Font labelFont = Font.decode(getLabelFont()); linesAxis.setLabelFont(labelFont); linesAxis.setTickLabelFont(labelFont); if (getLineTitleFont() != null) { linesAxis.setLabelFont(getLineTitleFont()); } if (getLineTickFont() != null) { linesAxis.setTickLabelFont(getLineTickFont()); } final int level = getRuntime().getProcessingContext().getCompatibilityLevel(); if (ClassicEngineBoot.isEnforceCompatibilityFor(level, 3, 8)) { if (getRangeMinimum() != 0) { linesAxis.setLowerBound(getLineRangeMinimum()); } if (getRangeMaximum() != 1) { linesAxis.setUpperBound(getLineRangeMaximum()); } if (getLineRangeMinimum() == 0 && getLineRangeMaximum() == 1) { linesAxis.setLowerBound(0); linesAxis.setUpperBound(1); linesAxis.setAutoRange(true); } } else { linesAxis.setLowerBound(getLineRangeMinimum()); linesAxis.setUpperBound(getLineRangeMaximum()); linesAxis.setAutoRange(isLineAxisAutoRange()); } } } final LineAndShapeRenderer linesRenderer = (LineAndShapeRenderer) plot.getRenderer(1); if (linesRenderer != null) { //set stroke with line width linesRenderer.setStroke(translateLineStyle(lineWidth, lineStyle)); //hide shapes on line linesRenderer.setShapesVisible(isMarkersVisible()); linesRenderer.setBaseShapesFilled(isMarkersVisible()); //set colors for each line for (int i = 0; i < lineSeriesColor.size(); i++) { final String s = (String) lineSeriesColor.get(i); linesRenderer.setSeriesPaint(i, parseColorFromString(s)); } } }
From source file:jesse.GA_ANN.DataVis.java
JFreeChart createChart()//Here Input MillSecond { total = new XYSeries[10]; XYSeriescollection = new XYSeriesCollection(); for (int i = 0; i < 10; i++) { total[i] = new XYSeries(i); XYSeriescollection.addSeries(total[i]); }/*from w w w . j av a 2 s . c om*/ dateaxis = new NumberAxis("Time"); NumberAxis Conaxis = new NumberAxis("z??"); dateaxis.setAutoRange(true); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); dateaxis.setTickLabelsVisible(true); xylineandshaperenderer = new XYLineAndShapeRenderer(true, false); xylineandshaperenderer.setSeriesPaint(0, Color.green); xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 2)); xylineandshaperenderer.setFillPaint(new Color(30, 30, 220), true); Conaxis.setRange(-1, 1); Conaxis.setAutoRange(true); Conaxis.setAutoRangeIncludesZero(false); XYPlot xyplot = new XYPlot(XYSeriescollection, dateaxis, Conaxis, xylineandshaperenderer); JFreeChart jfreechart = new JFreeChart("time-z", new Font("Arial", 1, 24), xyplot, true); ChartUtilities.applyCurrentTheme(jfreechart); ChartPanel chartpanel = new ChartPanel(jfreechart, true); chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); return jfreechart; }
From source file:umontreal.iro.lecuyer.charts.Axis.java
/** * Create a new <TT>Axis</TT> instance from an existing <TT>NumberAxis</TT> * instance with vertical (<SPAN CLASS="MATH"><I>y</I></SPAN>-axis) or horizontal (<SPAN CLASS="MATH"><I>x</I></SPAN>-axis) orientation. * /* ww w. java 2 s . c o m*/ * @param inAxis NumberAxis instance associated to the new variable. * * @param orientation axis direction, horizontal or vertical * */ public Axis(NumberAxis inAxis, boolean orientation) { this.axis = inAxis; this.orientation = orientation; this.labelsFlag = false; this.labelsValue = null; this.labelsName = null; inAxis.setAutoRangeIncludesZero(false); inAxis.setLowerMargin(0); inAxis.setUpperMargin(0); axis.setTickUnit(new NumberTickUnit(computeAutoTickValue())); }
From source file:vteaexploration.plottools.panels.XYChartPanel.java
private ChartPanel createChart(int x, int y, int l, String xText, String yText, String lText, Color imageGateColor) {//from ww w .j a va2 s . c om XYShapeRenderer renderer = new XYShapeRenderer(); XYShapeRenderer rendererGate = new XYShapeRenderer(); PaintScaleLegend psl = new PaintScaleLegend(new LookupPaintScale(0, 100, new Color(0, 0, 0)), new NumberAxis("")); if (l > 0) { double max = getMaximumOfData((ArrayList) plotValues.get(1), l); double min = this.getMinimumOfData((ArrayList) plotValues.get(1), l); double range = max - min; if (max == 0) { max = 1; } //System.out.println("PROFILING-DETAILS: Points to plot: " + ((ArrayList) plotValues.get(1)).size()); LookupPaintScale ps = new LookupPaintScale(min, max + 100, new Color(0, 0, 0)); renderer.setPaintScale(ps); ps.add(min, TENPERCENT); ps.add(min + (1 * (range / 10)), XYChartPanel.TENPERCENT); ps.add(min + (2 * (range / 10)), XYChartPanel.TWENTYPERCENT); ps.add(min + (3 * (range / 10)), XYChartPanel.THIRTYPERCENT); ps.add(min + (4 * (range / 10)), XYChartPanel.FORTYPERCENT); ps.add(min + (5 * (range / 10)), XYChartPanel.FIFTYPERCENT); ps.add(min + (6 * (range / 10)), XYChartPanel.SIXTYPERCENT); ps.add(min + (7 * (range / 10)), XYChartPanel.SEVENTYPERCENT); ps.add(min + (8 * (range / 10)), XYChartPanel.EIGHTYPERCENT); ps.add(min + (9 * (range / 10)), XYChartPanel.NINETYPERCENT); ps.add(max, XYChartPanel.ALLPERCENT); NumberAxis lAxis = new NumberAxis(lText); lAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); psl = new PaintScaleLegend(ps, lAxis); psl.setBackgroundPaint(VTC._VTC.BACKGROUND); psl.setPosition(RectangleEdge.RIGHT); psl.setMargin(4, 4, 40, 4); psl.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); } else { renderer.setBaseFillPaint(TENPERCENT); } Ellipse2D shape = new Ellipse2D.Double(0, 0, size, size); Ellipse2D shapeGate = new Ellipse2D.Double(-2, -2, size + 4, size + 4); renderer.setBaseShape(shape); rendererGate.setBaseShape(shapeGate); NumberAxis xAxis = new NumberAxis(""); NumberAxis yAxis = new NumberAxis(""); xAxis.setAutoRangeIncludesZero(false); yAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot(createXYZDataset((ArrayList) plotValues.get(1), x, y, l), xAxis, yAxis, renderer); plot.getDomainAxis(); plot.getRangeAxis(); plot.setDomainPannable(false); plot.setRangePannable(false); plot.setRenderer(0, renderer); plot.setRenderer(1, rendererGate); plot.setDataset(0, createXYZDataset((ArrayList) plotValues.get(1), x, y, l)); if (imageGate) { roiCreated(impoverlay); XYZDataset set = createXYZDataset(ImageGateOverlay, x, y, l); plot.setDataset(1, set); plot.setRenderer(1, new XYShapeRenderer() { @Override protected java.awt.Paint getPaint(XYDataset dataset, int series, int item) { return imageGateOutline; } @Override public Shape getItemShape(int row, int col) { return new Ellipse2D.Double(-2, -2, size + 4, size + 4); } }); } //System.out.println("PROFILING: Generating plot with " + plot.getDatasetCount() + " datasets."); //System.out.println("PROFILING: Generating plot with " + ImageGateOverlay.size() + " objects gated."); try { if (getRangeofData((ArrayList) plotValues.get(1), x) > 16384) { LogAxis logAxisX = new LogAxis(); logAxisX.setAutoRange(true); plot.setDomainAxis(logAxisX); } if (getRangeofData((ArrayList) plotValues.get(1), y) > 16384) { LogAxis logAxisY = new LogAxis(); logAxisY.setAutoRange(true); plot.setRangeAxis(logAxisY); } } catch (NullPointerException e) { } ; JFreeChart chart = new JFreeChart("Plot of " + xText + " vs. " + yText, plot); chart.removeLegend(); //LUT if (l > 0) chart.addSubtitle(psl); //notifiyUpdatePlotWindowListeners(); return new ChartPanel(chart, true, true, false, false, true); }