Example usage for org.jfree.chart ChartPanel setMouseWheelEnabled

List of usage examples for org.jfree.chart ChartPanel setMouseWheelEnabled

Introduction

In this page you can find the example usage for org.jfree.chart ChartPanel setMouseWheelEnabled.

Prototype

public void setMouseWheelEnabled(boolean flag) 

Source Link

Document

Enables or disables mouse wheel support for the panel.

Usage

From source file:org.jfree.chart.demo.MinMaxCategoryPlotDemo1.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart(createDataset());
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setMouseWheelEnabled(true);
    return chartpanel;
}

From source file:org.jfree.chart.demo.CompareToPreviousYearDemo.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart();
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setMouseWheelEnabled(true);
    return chartpanel;
}

From source file:javatest.IndicatorsToChart.java

/**
 * Displays a chart in a frame.//from  www  .jav a  2 s .c  om
 * @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(1000, 540));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("neli - Indicators to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}

From source file:ta4jexamples.indicators.IndicatorsToChart.java

/**
 * Displays a chart in a frame.//  w  w  w.  ja v a 2s. co m
 * @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);
}

From source file:org.jfree.expdemo.SelectionDemo7ScatterRenderer.java

/**
 * Creates a panel for the demo (used by SuperDemo.java).
 * //from w w  w.  jav a  2  s  .  co m
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    MultiValueCategoryDataset dataset = createDataset();
    //extend dataset and add selection change listener for the demo
    DatasetSelectionExtension datasetExtension = new CategoryDatasetSelectionExtension(dataset);

    //standard setup
    JFreeChart chart = createChart(dataset, datasetExtension);
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);

    //add a selection handler with shift modifier for clicking
    RegionSelectionHandler selectionHandler = new FreeRegionSelectionHandler();
    panel.addMouseHandler(selectionHandler);
    panel.addMouseHandler(new MouseClickSelectionHandler());
    panel.removeMouseHandler(panel.getZoomHandler());

    // add a selection manager
    DatasetExtensionManager dExManager = new DatasetExtensionManager();
    dExManager.registerDatasetExtension(datasetExtension);
    panel.setSelectionManager(new EntitySelectionManager(panel, new Dataset[] { dataset }, dExManager));

    return panel;
}

From source file:org.jfree.chart.demo.selection.SelectionDemo7ScatterRenderer.java

/**
 * Creates a panel for the demo (used by SuperDemo.java).
 * //from   ww  w.  j a v  a  2s .c  om
 * @return A panel.
 */
public static JPanel createDemoPanel() {
    MultiValueCategoryDataset dataset = createDataset();
    //extend dataset and add selection change listener for the demo
    DatasetSelectionExtension<CategoryCursor<String, String>> datasetExtension = new CategoryDatasetSelectionExtension<String, String>(
            dataset);

    //standard setup
    JFreeChart chart = createChart(dataset, datasetExtension);
    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);

    //add a selection handler with shift modifier for clicking
    RegionSelectionHandler selectionHandler = new FreeRegionSelectionHandler();
    panel.addMouseHandler(selectionHandler);
    panel.addMouseHandler(new MouseClickSelectionHandler());
    panel.removeMouseHandler(panel.getZoomHandler());

    // add a selection manager
    DatasetExtensionManager dExManager = new DatasetExtensionManager();
    dExManager.registerDatasetExtension(datasetExtension);
    panel.setSelectionManager(new EntitySelectionManager(panel, new Dataset[] { dataset }, dExManager));
    return panel;
}

From source file:ta4jexamples.analysis.CashFlowToChart.java

/**
 * Displays a chart in a frame.//from  ww  w .  j a  v a 2  s .  c  o m
 * @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);
}

From source file:ta4jexamples.indicators.CandlestickChart.java

/**
 * Displays a chart in a frame./*  ww  w  .j  av  a2s . c o m*/
 * @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);
}

From source file:ta4jexamples.analysis.BuyAndSellSignalsToChart.java

/**
 * Displays a chart in a frame.// w  w  w. j  av  a 2 s.  c  o  m
 * @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);
}

From source file:PieChartDemo1.java

/**
 * Creates a panel for the demo (used by SuperDemo.java).
 *
 * @return A panel./*  ww  w .  j  av  a  2s. co m*/
 */
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;
}