List of usage examples for org.jfree.chart ChartPanel setMouseZoomable
public void setMouseZoomable(boolean flag, boolean fillRectangle)
From source file:org.jfree.chart.demo.TimeSeriesDemo4.java
/** * A demonstration application showing a quarterly time series containing a null value. * * @param title the frame title.//w w w . ja v a 2s.c o m */ public TimeSeriesDemo4(final String title) { super(title); final TimeSeries series = new TimeSeries("Random Data", Hour.class); final Day today = new Day(); series.add(new Hour(1, today), 500.2); series.add(new Hour(2, today), 694.1); series.add(new Hour(3, today), 734.4); series.add(new Hour(4, today), 453.2); series.add(new Hour(7, today), 500.2); series.add(new Hour(8, today), null); series.add(new Hour(12, today), 734.4); series.add(new Hour(16, today), 453.2); final TimeSeriesCollection dataset = new TimeSeriesCollection(series); // create a title with Unicode characters (currency symbols in this case)... final String chartTitle = "\u20A2\u20A2\u20A3\u20A4\u20A5\u20A6\u20A7\u20A8\u20A9\u20AA"; final JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Time", "Value", dataset, true, true, false); final XYPlot plot = chart.getXYPlot(); // plot.setInsets(new Insets(0, 0, 0, 20)); final Marker marker = new ValueMarker(700.0); marker.setPaint(Color.blue); marker.setAlpha(0.8f); plot.addRangeMarker(marker); plot.setBackgroundPaint(null); plot.setBackgroundImage(JFreeChart.INFO.getLogo()); final XYItemRenderer renderer = plot.getRenderer(); if (renderer instanceof StandardXYItemRenderer) { final StandardXYItemRenderer r = (StandardXYItemRenderer) renderer; r.setPlotShapes(true); r.setShapesFilled(true); } final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:peakml.util.swt.widget.TimePlot.java
public TimePlot(Composite parent, int style) { super(parent, SWT.EMBEDDED | style); // layout// w w w . ja va 2s . com setLayout(new FillLayout()); // create the components timeplot = new peakml.util.jfreechart.FastTimePlot("", ""); timeplot.setBackgroundPaint(Color.WHITE); linechart = new JFreeChart("", timeplot); linechart.setBackgroundPaint(Color.WHITE); // add the components // -------------------------------------------------------------------------------- // This uses the SWT-trick for embedding AWT-controls in an SWT-Composite. // 2009-10-17: Tested the SWT setup in jfreechart.experimental - this is still better. try { System.setProperty("sun.awt.noerasebackground", "true"); } catch (NoSuchMethodError error) { ; } java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this); ChartPanel panel = new ChartPanel(linechart, false, false, false, false, false); panel.setFillZoomRectangle(true); panel.setMouseZoomable(true, true); // create a new ChartPanel, without the popup-menu (5x false) frame.add(panel); // -------------------------------------------------------------------------------- }
From source file:com.fr3ts0n.ecu.gui.application.ObdDataPlotter.java
/** * create the graphing panel/*w ww. j a v a 2 s .co m*/ */ public ObdDataPlotter() { setLayout(new BorderLayout()); chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setMouseZoomable(true, false); add(chartPanel, BorderLayout.CENTER); }
From source file:edu.umich.eecs.tac.viewer.role.advertiser.CampaignGrpahsPanel.java
private void createGraph(XYSeries reachSeries) { XYSeriesCollection seriescollection = new XYSeriesCollection(reachSeries); maxSeries = new XYSeries("Total"); for (int i = 1; i <= 1000; i++) { double err = calcEffectiveReachRatio(expectedImpressionReach * i / 1000, expectedImpressionReach); maxSeries.add(expectedImpressionReach * i / 1000, err); }/* w ww . j a v a 2s . co m*/ seriescollection.addSeries(maxSeries); JFreeChart chart = createDifferenceChart(advertiserBorder ? null : advertiser, seriescollection, "Reach Count", "Reach percentage"); ChartPanel chartpanel = new ChartPanel(chart, false); chartpanel.setMouseZoomable(true, false); add(chartpanel); this.repaint(); }
From source file:org.jfree.chart.demo.TimeSeriesDemo12.java
/** * A demo./*w w w .j a v a2s . co m*/ * * @param title the frame title. */ public TimeSeriesDemo12(final String title) { super(title); final XYDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:io.sanfran.wikiTrends.extraction.plots.PlotTimeSeries.java
public PlotTimeSeries(String title, TimeSeriesCollection data) { super(title); seriesWidth = null;/*from w w w . j av a 2 s.c om*/ seriesColor = null; ChartPanel chartPanel = (ChartPanel) createPanel(data, title); chartPanel.setPreferredSize(new java.awt.Dimension(1024, 768)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:io.sanfran.wikiTrends.extraction.plots.PlotTimeSeries.java
public PlotTimeSeries(String title, TimeSeriesCollection data, List<Double> width, List<Color> colors) { super(title); seriesWidth = new ArrayList<Float>(); for (Double i : width) { seriesWidth.add(i.floatValue()); }/*from w w w . jav a 2 s . c o m*/ seriesColor = colors; ChartPanel chartPanel = (ChartPanel) createPanel(data, title); chartPanel.setPreferredSize(new java.awt.Dimension(1024, 768)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:org.n52.oxf.ui.swing.ChartDialog.java
/** * initializes (or updates) the JFreeChart->ChartPanel. * /* w w w. j a v a 2 s . com*/ * @param parameters * @param selectedfeatures */ private void initChartPanel(OXFFeatureCollection observations, ParameterContainer paramCon) { MyGridBagLayout mainLayout = (MyGridBagLayout) getContentPane().getLayout(); int chartPanelPosition = 3; if (getContentPane().getComponentCount() > chartPanelPosition) { getContentPane().remove(chartPanelPosition); } JFreeChart chart = chartRenderer.renderChart(observations, paramCon); org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart); chartPanel.setMouseZoomable(true, true); mainLayout.addComponent(chartPanelPosition, chartPanel, 0, 0, 2, 1, 100, 100, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(9, 9, 9, 9)); getContentPane().validate(); }
From source file:peakml.util.swt.widget.DerivativeGraph.java
public DerivativeGraph(Composite parent, int style) { super(parent, SWT.EMBEDDED | style); // layout/* w w w . jav a2 s . co m*/ setLayout(new FillLayout()); // create the components spectrumplot = new FastSpectrumPlot("mass", "intensity"); spectrumplot.setBackgroundPaint(Color.WHITE); linechart = new JFreeChart("", spectrumplot); linechart.setBackgroundPaint(Color.WHITE); // org.jfree.experimental.chart.swt.ChartComposite c = // new org.jfree.experimental.chart.swt.ChartComposite(this, SWT.NONE, linechart); // // c.setRangeZoomable(true); // c.setDomainZoomable(true); // add the components // -------------------------------------------------------------------------------- // This uses the SWT-trick for embedding AWT-controls in an SWT-Composite. // 2009-10-17: Tested the SWT setup in jfreechart.experimental - this is still better. try { System.setProperty("sun.awt.noerasebackground", "true"); } catch (NoSuchMethodError error) { ; } java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this); ChartPanel panel = new ChartPanel(linechart, false, false, false, false, false); panel.setFillZoomRectangle(true); panel.setMouseZoomable(true, true); // create a new ChartPanel, without the popup-menu (5x false) frame.add(panel); // -------------------------------------------------------------------------------- }
From source file:raspihomeapp.ParamForm.java
public void Plotxy() { XYSeries series1 = new XYSeries("Punkte1"); series1.add(5, 0);/* ww w . jav a 2 s . c o m*/ series1.add(6, 6); series1.add(7, 11); series1.add(8, 22); series1.add(10, 55); XYSeries series2 = new XYSeries("Punkte2"); series2.add(5, 2); series2.add(6, 3); series2.add(7, 4); // Hinzufuegen von series1 und series2 zu der Datenmenge dataset XYSeriesCollection dataset2 = new XYSeriesCollection(); dataset2.addSeries(series1); dataset2.addSeries(series2); XYSplineRenderer dot = new XYSplineRenderer(); NumberAxis xax = new NumberAxis("x"); NumberAxis yax = new NumberAxis("y"); //xax.setLabelPaint(Color.WHITE); DateAxis taxis = new DateAxis("t"); taxis.setDateFormatOverride(new SimpleDateFormat("dd-MM")); XYPlot plot = new XYPlot(dataset2, taxis, yax, dot); //plot.setBackgroundPaint(Color.BLACK); //plot.setRangeGridlinePaint(Color.GRAY); JFreeChart chart2 = new JFreeChart(" Test ", plot); //chart2.setBackgroundPaint(Color.BLACK); ChartPanel chartPanel2 = new ChartPanel(chart2); chartPanel2.setMouseZoomable(true, false); jPanel4.setLayout(new BorderLayout()); jPanel4.add(chartPanel2, BorderLayout.CENTER); //setContentPane(chartPanel2); }