List of usage examples for org.jfree.chart ChartPanel setMouseZoomable
public void setMouseZoomable(boolean flag, boolean fillRectangle)
From source file:org.jfree.chart.demo.TimePeriodValuesDemo.java
/** * A demonstration application showing how to.... * * @param title the frame title.//w w w.j a va2s . com */ public TimePeriodValuesDemo(final String title) { super(title); final XYDataset data1 = createDataset1(); final XYItemRenderer renderer1 = new XYBarRenderer(); final DateAxis domainAxis = new DateAxis("Date"); domainAxis.setVerticalTickLabels(true); domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.HOUR, 1)); domainAxis.setDateFormatOverride(new SimpleDateFormat("hh:mm")); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); final ValueAxis rangeAxis = new NumberAxis("Value"); final XYPlot plot = new XYPlot(data1, domainAxis, rangeAxis, renderer1); final XYDataset data2 = createDataset2(); final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer( StandardXYItemRenderer.SHAPES_AND_LINES); renderer2.setShapesFilled(true); plot.setDataset(1, data2); plot.setRenderer(1, renderer2); final JFreeChart chart = new JFreeChart("Supply and Demand", plot); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.TimeSeriesChartDemo1.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title./*from www . j av a2s . co m*/ */ public TimeSeriesChartDemo1(String title) { super(title); XYDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart, false); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.TimeSeriesDemo.java
/** * A demonstration application showing how to create a simple time series chart. This * example uses monthly data.// www .j a va 2 s .co m * * @param title the frame title. */ public TimeSeriesDemo(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:techtonic.WellBoreListener.java
@Override public void actionPerformed(ActionEvent e) { List<WitsmlTrajectory> trajectorys = xmlreader.getTrajectorys(wellbore); for (int i = 0; i < trajectorys.size(); i++) { System.out.println("***************************************************************"); System.out.println("Wellbore Trajectories " + trajectorys.size()); System.out.println("Trajectory Stations"); System.out.println("***************************************************************"); System.out.println("*/ " + (i + 1) + " == " + trajectorys.get(i).getName() + " has " + trajectorys.get(i).getStations().size() + " stations"); System.out.println("***************************************************************"); System.out.println("***************************************************************"); // // trajectories button // JButton btnTrajectory = new JButton("<html><b>Name: " + trajectorys.get(i).getName() // + "</b><br/> Status: " +trajectorys.get(i).getStations().size() + "<br> Type: " + trajectorys.get(i).getTvdUnit() + "</br></html>"); ///*from ww w . j a va2s . c om*/ // btnTrajectory.setBounds(5, ((100 * i) + 5), this.trajectoryPanel.getWidth() - 20, 100); // // this.trajectoryPanel.add(btnTrajectory); // // trajectoryPanel.validate(); // trajectoryPanel.repaint(); //Set<WitsmlTrajectoryStation> stations = trajectory.getStations(); //System.out.println(stations); List<WitsmlTrajectoryStation> stationsAsList = Arrays .asList(new WitsmlTrajectoryStation[trajectorys.get(i).getStations().size()]); for (WitsmlTrajectoryStation s : trajectorys.get(i).getStations()) { stationsAsList.set(s.getStationNo(), s); } // for (WitsmlTrajectoryStation station : stationsAsList) { // System.out.println( // "tvd: " + station.getTvd() + " " // + "md: " + station.getMd() + " " // + "north: " + station.getNorth() + " " // + "east: " + station.getEast() + " " // + "gravity: " + station.getInclination() + " " // + " Turn Rate :"+ station.getTurnRate() + " " // + " "+ station.getVerticalSectionDistance() + " " // + " "+ station.getAzimuth() // ); // } // create a DataSet object for storing xy data XYSeries series = new XYSeries("series name"); // add data to Dataset (here assume data is in ArrayLists x and y int count = 1; for (WitsmlTrajectoryStation station : stationsAsList) { Value tvd = station.getTvd(); if (tvd == null) { continue; } Value md = station.getNorth(); if (md == null) { continue; } // System.out.println(count + " : ===>> tvd : "+tvd.getValue()+ "; md "+md.getValue()); series.add(md.getValue(), tvd.getValue()); count++; } // XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(series); // create a chart using the createYLineChart method... JFreeChart chart = ChartFactory.createXYLineChart("Line Chart", // chart title "x", "y", // x and y axis labels data); // data Techtonic.setChart(chart); Techtonic.setcurrentWitsmlTrajectoryStation(stationsAsList); ChartPanel cp = new ChartPanel(chart); cp.setMouseZoomable(true, true); chartPanel.setLayout(new java.awt.BorderLayout()); chartPanel.add(cp, BorderLayout.CENTER); chartPanel.validate(); System.out.println(""); System.out.println(""); } }
From source file:org.jfree.experimental.chart.demo.XYTitleAnnotationDemo1.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title./*from w w w . j a v a 2 s . c o m*/ */ public XYTitleAnnotationDemo1(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:chart.JChartSegment.java
/** * Creates a new demo instance.//from w ww . j a va2 s . c om * * @param title the frame title. */ private JChartSegment(final String title, NTimeSeries series, List<NSubsequence> subsequence) { super(title); final XYDataset dataset = createDataset(series); final JFreeChart chart = createChart(dataset, subsequence); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:chart.JChart.java
/** * Creates a new demo instance.// w w w . j a va2 s . c om * * @param title the frame title. */ private JChart(final String title, NTimeSeries series, List<NSubsequence> anomalies) { super(title); final XYDataset dataset = createDataset(series); final JFreeChart chart = createChart(dataset, anomalies); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }
From source file:org.n52.oxf.ui.swing.ReducedChartDialog.java
/** * initializes (or updates) the JFreeChart->ChartPanel. * // ww w . j av a2 s. c o m * @param parameters * @param selectedfeatures */ private void initChartPanel(OXFFeatureCollection observations, ParameterContainer paramCon) { // String[] foiIdArray = (String[]) // paramCon.getParameterShellWithServiceSidedName("featureOfInterest").getSpecifiedValueArray(); MyGridBagLayout mainLayout = (MyGridBagLayout) getContentPane().getLayout(); if (getContentPane().getComponentCount() > 2) { getContentPane().remove(2); } JFreeChart chart = chartRenderer.renderChart(observations, paramCon); org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart); chartPanel.setMouseZoomable(true, false); mainLayout.addComponent(0, chartPanel, 0, 0, 1, 1, 100, 100, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(9, 9, 9, 9)); getContentPane().validate(); }
From source file:peakml.util.swt.widget.IPeakGraph.java
public IPeakGraph(Composite parent, int style) { super(parent, SWT.EMBEDDED | style); // layout//from w ww.j a va 2 s. c o m setLayout(new FillLayout()); // create the components timeplot = new FastTimePlot("retention time", "intensity"); timeplot.setBackgroundPaint(Color.WHITE); linechart = new JFreeChart("", timeplot); 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:flusim.XY_Plotter.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title./*from w w w . jav a 2 s . c o m*/ */ public XY_Plotter(String title, java.util.List[] data, String[] desc) { super(title); ChartPanel chartPanel = (ChartPanel) createPanel(data, title, desc); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); }