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

The following examples show how to use org.jfree.chart.ChartPanel#setMouseWheelEnabled() . 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: PieChartDemo1.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    chart.setPadding(new RectangleInsets(4, 8, 2, 2));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(600, 300));
    return panel;
}
 
Example 2
Source File: BuyAndSellSignalsToChart.java    From ta4j-origins with MIT License 5 votes vote down vote up
/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
 
Example 3
Source File: CashFlowToChart.java    From ta4j-origins with MIT License 5 votes vote down vote up
/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Cash flow to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
 
Example 4
Source File: PieChartDemo1.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 5
Source File: IndicatorsToChart.java    From ta4j-origins with MIT License 5 votes vote down vote up
/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new java.awt.Dimension(500, 270));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Indicators to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
 
Example 6
Source File: BarChartDemo1.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 7
Source File: BarChartDemo1.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 8
Source File: PieChartDemo1.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    chart.setPadding(new RectangleInsets(4, 8, 2, 2));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(600, 300));
    return panel;
}
 
Example 9
Source File: TimeSeriesChartDemo1.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 10
Source File: TimeSeriesChartDemo1.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 11
Source File: BarChartDemo1.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 12
Source File: TimeSeriesChartDemo1.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 13
Source File: TimeSeriesChartDemo1.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 14
Source File: BarChartDemo1.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 15
Source File: PieChartDemo1.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    chart.setPadding(new RectangleInsets(4, 8, 2, 2));
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(600, 300));
    return panel;
}
 
Example 16
Source File: TimeSeriesChartDemo1.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}
 
Example 17
Source File: BarChartDemo1.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 18
Source File: BarChartDemo1.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new demo instance.
 *
 * @param title  the frame title.
 */
public BarChartDemo1(String title) {
    super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
}
 
Example 19
Source File: CandlestickChart.java    From ta4j-origins with MIT License 5 votes vote down vote up
/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new java.awt.Dimension(740, 300));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Candlestick chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
 
Example 20
Source File: GrammarvizRuleChartPanel.java    From grammarviz2_src with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the chart for the original time series.
 * 
 * @return a JFreeChart object of the chart
 * @throws TSException
 */
private void chartIntervals(ArrayList<double[]> intervals) throws Exception {

  // making the data
  //
  XYSeriesCollection collection = new XYSeriesCollection();
  int counter = 0;
  for (double[] series : intervals) {
    collection.addSeries(toSeries(counter++, series));
  }

  // set the renderer
  //
  XYLineAndShapeRenderer xyRenderer = new XYLineAndShapeRenderer(true, false);
  xyRenderer.setSeriesPaint(0, new Color(0, 0, 0));
  xyRenderer.setBaseStroke(new BasicStroke(3));

  // X - the time axis
  //
  NumberAxis timeAxis = new NumberAxis();

  // Y axis
  //
  NumberAxis valueAxis = new NumberAxis();

  // put these into collection of dots
  //
  this.plot = new XYPlot(collection, timeAxis, valueAxis, xyRenderer);

  // enable panning
  //
  this.plot.setDomainPannable(true);
  this.plot.setRangePannable(true);

  // finally, create the chart
  this.chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false);

  // and put it on the show
  ChartPanel chartPanel = new ChartPanel(this.chart);
  chartPanel.setMinimumDrawWidth(0);
  chartPanel.setMinimumDrawHeight(0);
  chartPanel.setMaximumDrawWidth(1920);
  chartPanel.setMaximumDrawHeight(1200);

  chartPanel.setMouseWheelEnabled(true);

  // cleanup all the content
  //
  this.removeAll();

  // put the chart on show
  //
  this.add(chartPanel);

  // not sure if I need this
  //
  this.validate();
  this.repaint();

}