List of usage examples for org.jfree.chart.plot XYPlot setRangePannable
public void setRangePannable(boolean pannable)
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortCounterXYplotPanel.java
private JFreeChart createChart() { // 1. counter value ///*from w w w . j a v a2s. c o m*/ // -- see worker thread for following axis -- // // 2. delta/period // // -- if error counter -- // 3. include xmit and rcv traffic deltas? (own scale) // // // -- if traffic counter -- // 3. include rate and utilization values? // SMT_UpdateService updateService = SMT_UpdateService.getInstance(); OMS_Collection history = updateService.getCollection(); if ((history == null) || (history.getSize() < 2)) { // need at least two datapoints to this chart to make sense logger.severe("OMS Delta unavailable, cannot createChart(), must wait for more historical snapshots"); MessageManager.getInstance().postMessage( new SmtMessage(SmtMessageType.SMT_MSG_SEVERE, "Cannot build chart without historical data")); return null; } MessageManager.getInstance() .postMessage(new SmtMessage(SmtMessageType.SMT_MSG_INFO, "Worker Building Plot")); long deltaPeriod = history.getAveDeltaSeconds(); // the primary dataset of the desired counter which will be axis1 XYDataset dataset1 = createDataset(history); // setup the chart for the desired counter JFreeChart chart = ChartFactory.createTimeSeriesChart( PortCounter.getName() + " [" + Vertex.getName() + " port " + Port.getPortNumber() + "]", "Time of Day", PortCounterAxisLabel.COUNTS.getName(), dataset1, true, true, false); chart.addSubtitle(new TextTitle("Port Counter Activity (" + deltaPeriod + " sec. delta)")); XYPlot plot = (XYPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setDomainPannable(true); plot.setRangePannable(true); plot.getRangeAxis().setFixedDimension(15.0); return chart; }
From source file:org.locationtech.udig.processingtoolbox.tools.ScatterPlotDialog.java
private void createGraphTab(final CTabFolder parentTabFolder) { plotTab = new CTabItem(parentTabFolder, SWT.NONE); plotTab.setText(Messages.ScatterPlotDialog_Graph); XYPlot plot = new XYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainPannable(false);/*from ww w . ja v a 2 s .c o m*/ plot.setRangePannable(false); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); JFreeChart chart = new JFreeChart(EMPTY, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(java.awt.Color.WHITE); chart.setBorderVisible(false); chartComposite = new ChartComposite2(parentTabFolder, SWT.NONE | SWT.EMBEDDED, chart, true); chartComposite.setLayout(new FillLayout()); chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); chartComposite.setDomainZoomable(false); chartComposite.setRangeZoomable(false); chartComposite.setMap(map); chartComposite.addChartMouseListener(new PlotMouseListener()); plotTab.setControl(chartComposite); chartComposite.pack(); }
From source file:fr.amap.lidar.amapvox.chart.VoxelsToChart.java
public JFreeChart createChart(String title, XYSeriesCollection dataset, String xAxisLabel, String yAxisLabel) { JFreeChart chart = ChartFactory.createXYLineChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); String fontName = "Palatino"; chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18)); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainPannable(true);/*from w w w . j a v a 2s. co m*/ plot.setRangePannable(true); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14)); chart.getLegend().setFrame(BlockBorder.NONE); LegendTitle subtitle = (LegendTitle) chart.getSubtitles().get(0); subtitle.setHorizontalAlignment(HorizontalAlignment.LEFT); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); Ellipse2D.Float shape = new Ellipse2D.Float(-2.5f, -2.5f, 5.0f, 5.0f); for (int i = 0; i < voxelFiles.length; i++) { renderer.setSeriesShape(i, shape); renderer.setSeriesPaint(i, voxelFiles[i].getSeriesParameters().getColor()); renderer.setLegendTextPaint(i, voxelFiles[i].getSeriesParameters().getColor()); } } return chart; }
From source file:com.vgi.mafscaling.Rescale.java
private void createGraghPanel(JPanel dataPanel) { JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);//from w w w . j a v a 2 s. c o m chart.setBorderVisible(true); mafChartPanel = new MafChartPanel(chart, this); GridBagConstraints gbl_chartPanel = new GridBagConstraints(); gbl_chartPanel.anchor = GridBagConstraints.PAGE_START; gbl_chartPanel.insets = insets0; gbl_chartPanel.fill = GridBagConstraints.BOTH; gbl_chartPanel.weightx = 1.0; gbl_chartPanel.weighty = 1.0; gbl_chartPanel.gridx = 0; gbl_chartPanel.gridy = 2; dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel); XYSplineRenderer lineRenderer = new XYSplineRenderer(3); lineRenderer.setUseFillPaint(true); lineRenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new DecimalFormat("0.00"), new DecimalFormat("0.00"))); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f); lineRenderer.setSeriesStroke(0, stroke); lineRenderer.setSeriesStroke(1, stroke); lineRenderer.setSeriesPaint(0, new Color(201, 0, 0)); lineRenderer.setSeriesPaint(1, new Color(0, 0, 255)); lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5)); lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5)); ValueAxis mafvDomain = new NumberAxis(XAxisName); ValueAxis mafgsRange = new NumberAxis(YAxisName); XYSeriesCollection lineDataset = new XYSeriesCollection(); lineDataset.addSeries(currMafData); lineDataset.addSeries(corrMafData); XYPlot plot = chart.getXYPlot(); plot.setRangePannable(true); plot.setDomainPannable(true); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.setBackgroundPaint(new Color(224, 224, 224)); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDataset(0, lineDataset); plot.setRenderer(0, lineRenderer); plot.setDomainAxis(0, mafvDomain); plot.setRangeAxis(0, mafgsRange); plot.mapDatasetToDomainAxis(0, 0); plot.mapDatasetToRangeAxis(0, 0); LegendTitle legend = new LegendTitle(plot.getRenderer()); legend.setItemFont(new Font("Arial", 0, 10)); legend.setPosition(RectangleEdge.TOP); chart.addLegend(legend); }
From source file:com.vgi.mafscaling.VECalc.java
protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName) { JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);//from w w w. j av a2 s. c om chart.setBorderVisible(true); chartPanel = new ChartPanel(chart, true, true, true, true, true); chartPanel.setAutoscrolls(true); chartPanel.setMouseZoomable(false); GridBagConstraints gbl_chartPanel = new GridBagConstraints(); gbl_chartPanel.anchor = GridBagConstraints.CENTER; gbl_chartPanel.insets = new Insets(3, 3, 3, 3); gbl_chartPanel.weightx = 1.0; gbl_chartPanel.weighty = 1.0; gbl_chartPanel.fill = GridBagConstraints.BOTH; gbl_chartPanel.gridx = 0; gbl_chartPanel.gridy = 1; plotPanel.add(chartPanel, gbl_chartPanel); XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(); lineRenderer.setUseFillPaint(true); lineRenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new DecimalFormat("0.00"), new DecimalFormat("0.00"))); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f); lineRenderer.setSeriesStroke(0, stroke); lineRenderer.setSeriesPaint(0, Color.RED); lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5)); lineRenderer.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator() { private static final long serialVersionUID = 7593430826693873496L; public String generateLabel(XYDataset dataset, int series) { XYSeries xys = ((XYSeriesCollection) dataset).getSeries(series); return xys.getDescription(); } }); NumberAxis xAxis = new NumberAxis(xAxisName); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(yAxisName); yAxis.setAutoRangeIncludesZero(false); XYSeriesCollection lineDataset = new XYSeriesCollection(); XYPlot plot = chart.getXYPlot(); plot.setRangePannable(true); plot.setDomainPannable(true); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.setBackgroundPaint(new Color(224, 224, 224)); plot.setDataset(0, lineDataset); plot.setRenderer(0, lineRenderer); plot.setDomainAxis(0, xAxis); plot.setRangeAxis(0, yAxis); plot.mapDatasetToDomainAxis(0, 0); plot.mapDatasetToRangeAxis(0, 0); LegendTitle legend = new LegendTitle(plot.getRenderer()); legend.setItemFont(new Font("Arial", 0, 10)); legend.setPosition(RectangleEdge.TOP); chart.addLegend(legend); }
From source file:org.locationtech.udig.processingtoolbox.tools.ScatterPlotDialog.java
private void updateChart(SimpleFeatureCollection features, String xField, String yField) { // 1. Create a single plot containing both the scatter and line XYPlot plot = new XYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainPannable(false);/*from w w w .j a va2 s .co m*/ plot.setRangePannable(false); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // 2. Setup Scatter plot // Create the scatter data, renderer, and axis int fontStyle = java.awt.Font.BOLD; FontData fontData = getShell().getDisplay().getSystemFont().getFontData()[0]; NumberAxis xPlotAxis = new NumberAxis(xField); // Independent variable xPlotAxis.setLabelFont(new Font(fontData.getName(), fontStyle, 12)); xPlotAxis.setTickLabelFont(new Font(fontData.getName(), fontStyle, 10)); NumberAxis yPlotAxis = new NumberAxis(yField); // Dependent variable yPlotAxis.setLabelFont(new Font(fontData.getName(), fontStyle, 12)); yPlotAxis.setTickLabelFont(new Font(fontData.getName(), fontStyle, 10)); XYToolTipGenerator plotToolTip = new StandardXYToolTipGenerator(); XYItemRenderer plotRenderer = new XYLineAndShapeRenderer(false, true); // Shapes only plotRenderer.setSeriesShape(0, new Ellipse2D.Double(0, 0, 3, 3)); plotRenderer.setSeriesPaint(0, java.awt.Color.BLUE); // dot plotRenderer.setBaseToolTipGenerator(plotToolTip); // Set the scatter data, renderer, and axis into plot plot.setDataset(0, getScatterPlotData(features, xField, yField)); xPlotAxis.setAutoRangeIncludesZero(false); xPlotAxis.setAutoRange(false); double differUpper = minMaxVisitor.getMaxX() - minMaxVisitor.getAverageX(); double differLower = minMaxVisitor.getAverageX() - minMaxVisitor.getMinX(); double gap = Math.abs(differUpper - differLower); if (differUpper > differLower) { xPlotAxis.setRange(minMaxVisitor.getMinX() - gap, minMaxVisitor.getMaxX()); } else { xPlotAxis.setRange(minMaxVisitor.getMinX(), minMaxVisitor.getMaxX() + gap); } yPlotAxis.setAutoRangeIncludesZero(false); yPlotAxis.setAutoRange(false); differUpper = minMaxVisitor.getMaxY() - minMaxVisitor.getAverageY(); differLower = minMaxVisitor.getAverageY() - minMaxVisitor.getMinY(); gap = Math.abs(differUpper - differLower); if (differUpper > differLower) { yPlotAxis.setRange(minMaxVisitor.getMinY() - gap, minMaxVisitor.getMaxY()); } else { yPlotAxis.setRange(minMaxVisitor.getMinY(), minMaxVisitor.getMaxY() + gap); } plot.setRenderer(0, plotRenderer); plot.setDomainAxis(0, xPlotAxis); plot.setRangeAxis(0, yPlotAxis); // Map the scatter to the first Domain and first Range plot.mapDatasetToDomainAxis(0, 0); plot.mapDatasetToRangeAxis(0, 0); // 3. Setup line // Create the line data, renderer, and axis XYItemRenderer lineRenderer = new XYLineAndShapeRenderer(true, false); // Lines only lineRenderer.setSeriesPaint(0, java.awt.Color.GRAY); lineRenderer.setSeriesPaint(1, java.awt.Color.GRAY); lineRenderer.setSeriesPaint(2, java.awt.Color.GRAY); // Set the line data, renderer, and axis into plot NumberAxis xLineAxis = new NumberAxis(EMPTY); xLineAxis.setTickMarksVisible(false); xLineAxis.setTickLabelsVisible(false); NumberAxis yLineAxis = new NumberAxis(EMPTY); yLineAxis.setTickMarksVisible(false); yLineAxis.setTickLabelsVisible(false); XYSeriesCollection lineDataset = new XYSeriesCollection(); // AverageY XYSeries horizontal = new XYSeries("AverageY"); //$NON-NLS-1$ horizontal.add(xPlotAxis.getRange().getLowerBound(), minMaxVisitor.getAverageY()); horizontal.add(xPlotAxis.getRange().getUpperBound(), minMaxVisitor.getAverageY()); lineDataset.addSeries(horizontal); // AverageX XYSeries vertical = new XYSeries("AverageX"); //$NON-NLS-1$ vertical.add(minMaxVisitor.getAverageX(), yPlotAxis.getRange().getLowerBound()); vertical.add(minMaxVisitor.getAverageX(), yPlotAxis.getRange().getUpperBound()); lineDataset.addSeries(vertical); // Degree XYSeries degree = new XYSeries("Deegree"); //$NON-NLS-1$ degree.add(xPlotAxis.getRange().getLowerBound(), yPlotAxis.getRange().getLowerBound()); degree.add(xPlotAxis.getRange().getUpperBound(), yPlotAxis.getRange().getUpperBound()); lineDataset.addSeries(degree); plot.setDataset(1, lineDataset); plot.setRenderer(1, lineRenderer); plot.setDomainAxis(1, xLineAxis); plot.setRangeAxis(1, yLineAxis); // Map the line to the second Domain and second Range plot.mapDatasetToDomainAxis(1, 0); plot.mapDatasetToRangeAxis(1, 0); // 4. Setup Selection NumberAxis xSelectionAxis = new NumberAxis(EMPTY); xSelectionAxis.setTickMarksVisible(false); xSelectionAxis.setTickLabelsVisible(false); NumberAxis ySelectionAxis = new NumberAxis(EMPTY); ySelectionAxis.setTickMarksVisible(false); ySelectionAxis.setTickLabelsVisible(false); XYItemRenderer selectionRenderer = new XYLineAndShapeRenderer(false, true); // Shapes only selectionRenderer.setSeriesShape(0, new Ellipse2D.Double(0, 0, 6, 6)); selectionRenderer.setSeriesPaint(0, java.awt.Color.RED); // dot plot.setDataset(2, new XYSeriesCollection(new XYSeries(EMPTY))); plot.setRenderer(2, selectionRenderer); plot.setDomainAxis(2, xSelectionAxis); plot.setRangeAxis(2, ySelectionAxis); // Map the scatter to the second Domain and second Range plot.mapDatasetToDomainAxis(2, 0); plot.mapDatasetToRangeAxis(2, 0); // 5. Finally, Create the chart with the plot and a legend java.awt.Font titleFont = new Font(fontData.getName(), fontStyle, 20); JFreeChart chart = new JFreeChart(EMPTY, titleFont, plot, false); chart.setBackgroundPaint(java.awt.Color.WHITE); chart.setBorderVisible(false); chartComposite.setChart(chart); chartComposite.forceRedraw(); }
From source file:org.locationtech.udig.processingtoolbox.tools.MoranScatterPlotDialog.java
private void createGraphTab(final CTabFolder parentTabFolder) { plotTab = new CTabItem(parentTabFolder, SWT.NONE); plotTab.setText(Messages.MoranScatterPlotDialog_Graph); XYPlot plot = new XYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainPannable(false);/* w w w.j a v a2 s .c om*/ plot.setRangePannable(false); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); JFreeChart chart = new JFreeChart(EMPTY, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(java.awt.Color.WHITE); chart.setBorderVisible(false); chartComposite = new ChartComposite2(parentTabFolder, SWT.NONE | SWT.EMBEDDED, chart, true); chartComposite.setLayout(new FillLayout()); chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); chartComposite.setDomainZoomable(false); chartComposite.setRangeZoomable(false); chartComposite.setMap(map); chartComposite.addChartMouseListener(new PlotMouseListener()); plotTab.setControl(chartComposite); chartComposite.pack(); }
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) {// w w w. ja v a2 s . c o m 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); }
From source file:org.locationtech.udig.processingtoolbox.tools.BubbleChartDialog.java
private void createGraphTab(final CTabFolder parentTabFolder) { plotTab = new CTabItem(parentTabFolder, SWT.NONE); plotTab.setText(Messages.ScatterPlotDialog_Graph); XYPlot plot = new XYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainPannable(false);//from ww w. ja va 2 s. c om plot.setRangePannable(false); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); JFreeChart chart = new JFreeChart(EMPTY, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBackgroundPaint(java.awt.Color.WHITE); chart.setBorderVisible(false); chartComposite = new ChartComposite3(parentTabFolder, SWT.NONE | SWT.EMBEDDED, chart, true); chartComposite.setLayout(new FillLayout()); chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); chartComposite.setDomainZoomable(false); chartComposite.setRangeZoomable(false); chartComposite.setMap(map); chartComposite.addChartMouseListener(new PlotMouseListener()); plotTab.setControl(chartComposite); chartComposite.pack(); }
From source file:br.prof.salesfilho.oci.image.GraphicBuilder.java
public void createChart() { chart = ChartFactory.createXYLineChart(this.title, this.xLabel, this.yLabel, this.collectionDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); List<XYSeries> listSeries = collectionDataset.getSeries(); for (int i = 0; i < listSeries.size(); i++) { renderer.setSeriesLinesVisible(i, true); renderer.setSeriesShapesVisible(i, true); renderer.setSeriesShapesFilled(i, false); }/*from ww w . j ava 2 s . c o m*/ plot.setRenderer(renderer); plot.setRangePannable(true); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); chartPanel.setChart(chart); }