Java Code Examples for org.jfree.chart.ChartPanel#setMouseZoomable()

The following examples show how to use org.jfree.chart.ChartPanel#setMouseZoomable() . 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: VariablePlot.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public VariablePlot(PreferencesExt prefs) {
  // this.prefs = prefs;

  setLayout(new BorderLayout());
  TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

  chart = createChart();

  ChartPanel chartPanel = new ChartPanel(chart);
  chartPanel.setPreferredSize(new java.awt.Dimension(800, 600));
  chartPanel.setMouseZoomable(true, false);

  if (prefs != null)
    chartPanel.setBounds((Rectangle) prefs.getBean("PlotWindowBounds", new Rectangle(300, 300, 600, 600)));
  else
    chartPanel.setBounds(new Rectangle(300, 300, 600, 600));

  XYPlot plot = chart.getXYPlot();

  plot.setBackgroundPaint(Color.white);
  plot.setDomainGridlinePaint(Color.GRAY);
  plot.setDomainGridlinesVisible(true);
  plot.setRangeGridlinePaint(Color.GRAY);
  plot.setAxisOffset(RectangleInsets.ZERO_INSETS);
  LegendTitle legend = chart.getLegend();
  if (legend != null) {
    legend.setPosition(RectangleEdge.BOTTOM);
  }
  add(chartPanel);

}
 
Example 2
Source File: ObdDataPlotter.java    From AndrOBD with GNU General Public License v3.0 5 votes vote down vote up
/**
 * create the graphing panel
 */
public ObdDataPlotter()
{
	setLayout(new BorderLayout());
	chart = createChart(dataset);
	ChartPanel chartPanel = new ChartPanel(chart);
	chartPanel.setMouseZoomable(true, false);
	add(chartPanel, BorderLayout.CENTER);
}
 
Example 3
Source File: XYTitleAnnotationDemo1.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A demonstration application showing how to create a simple time series 
 * chart.  This example uses monthly data.
 *
 * @param title  the frame title.
 */
public XYTitleAnnotationDemo1(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    setContentPane(chartPanel);
}
 
Example 4
Source File: TimeSeriesChartDemo1.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A demonstration application showing how to create a simple time series 
 * chart.  This example uses monthly data.
 *
 * @param title  the frame title.
 */
public TimeSeriesChartDemo1(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    setContentPane(chartPanel);
}
 
Example 5
Source File: TimeSeriesChartDemo1.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * A demonstration application showing how to create a simple time series 
 * chart.  This example uses monthly data.
 *
 * @param title  the frame title.
 */
public TimeSeriesChartDemo1(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    setContentPane(chartPanel);
}