List of usage examples for org.jfree.chart ChartPanel setMouseWheelEnabled
public void setMouseWheelEnabled(boolean flag)
From source file:org.jfree.chart.demo.selection.SelectionDemo6Pie.java
public final JPanel createDemoPanel() { this.dataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension<PieCursor<String>> datasetExtension = new PieDatasetSelectionExtension<String>( this.dataset); datasetExtension.addChangeListener(this); //standard setup JFreeChart chart = createChart(this.dataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); //add a selection handler with shift modifier for clicking RegionSelectionHandler selectionHandler = new FreeRegionSelectionHandler(); AbstractMouseHandler clickHandler = new MouseClickSelectionHandler(InputEvent.SHIFT_MASK); panel.addMouseHandler(selectionHandler); panel.addMouseHandler(clickHandler); 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:uom.research.thalassemia.util.PieChartCreator.java
/** * Creates a panel for the demo (used by SuperDemo.java). * * @param pPieDataset dataset/*from w w w . j ava 2s.co m*/ * @param pTitle title * @return A panel. */ public JPanel createPanel(final PieDataset pPieDataset, final String pTitle) { title = pTitle; pieDataset = pPieDataset; // set a theme using the new shadow generator feature available in // 1.0.14 - for backwards compatibility it is not enabled by default ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); JFreeChart chart = createChart(pieDataset); chart.setPadding(new RectangleInsets(4, 8, 2, 2)); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); panel.setPreferredSize(new Dimension(600, 300)); return panel; }
From source file:uom.research.thalassemia.util.BarChartCreator.java
/** * Creates a panel for the demo (used by SuperDemo.java). * * @param pCategoryDataset dataset//from www. j av a 2 s . co m * @param pTitle main title * @param psubTitle sub title * @param pxTitle x Axis Title * @param pyTitle y axis title * @return A panel. */ public JPanel createPanel(final CategoryDataset pCategoryDataset, final String pTitle, final String psubTitle, final String pxTitle, final String pyTitle) { mainTitle = pTitle; subTitle = psubTitle; xTitle = pxTitle; yTitle = pyTitle; categoryDataset = pCategoryDataset; JFreeChart chart = createChart(categoryDataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); return chartPanel; }
From source file:diplomawork.model.ViewForDiagram.java
/** * Creates a panel.// w w w.j a va 2 s . co m * * @return A panel. */ private ChartPanel createChartPanel() { JFreeChart chart = createChart(createDataset()); ChartPanel panel = new ChartPanel(chart); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); return panel; }
From source file:org.jfree.chart.demo.selection.SelectionDemo4.java
/** * Creates a panel for the demo (used by SuperDemo.java). * //from w w w . j a va 2 s .c o m * @return A panel. */ public final JPanel createDemoPanel() { IntervalXYDataset xydataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension<XYCursor> datasetExtension = new XYDatasetSelectionExtension(xydataset); datasetExtension.addChangeListener(this); //standard setup JFreeChart chart = createChart(xydataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new FreePathSelectionHandler(); panel.addMouseHandler(selectionHandler); panel.addMouseHandler(new MouseClickSelectionHandler()); panel.removeMouseHandler(panel.getZoomHandler()); // add a selection manager with intersection selection DatasetExtensionManager dExManager = new DatasetExtensionManager(); dExManager.registerDatasetExtension(datasetExtension); EntitySelectionManager selectionManager = new EntitySelectionManager(panel, new Dataset[] { xydataset }, dExManager); selectionManager.setIntersectionSelection(true); panel.setSelectionManager(selectionManager); return panel; }
From source file:org.jfree.chart.demo.selection.SelectionDemo2.java
/** * Creates a panel for the demo (used by SuperDemo.java). * * @return A panel./*from w w w . ja v a 2s . co m*/ */ public JPanel createDemoPanel() { XYDataset dataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension<XYCursor> datasetExtension = new XYDatasetSelectionExtension(dataset); datasetExtension.addChangeListener(this); //standard setup JFreeChart chart = createChart(dataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new CircularRegionSelectionHandler(); 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.SelectionDemo5Category.java
public final JPanel createDemoPanel() { this.dataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension<CategoryCursor<String, String>> datasetExtension = new CategoryDatasetSelectionExtension<String, String>( this.dataset); datasetExtension.addChangeListener(this); //standard setup JFreeChart chart = createChart(this.dataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new RectangularRegionSelectionHandler(); 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[] { this.dataset }, dExManager)); return panel; }
From source file:org.jfree.expdemo.SelectionDemo5Category.java
public JPanel createDemoPanel() { this.dataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension datasetExtension = new CategoryDatasetSelectionExtension(this.dataset); datasetExtension.addSelectionChangeListener(this); //standard setup JFreeChart chart = createChart(this.dataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new RectangularRegionSelectionHandler(); 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[] { this.dataset }, dExManager)); return panel; }
From source file:org.jfree.expdemo.SelectionDemo4.java
/** * Creates a panel for the demo (used by SuperDemo.java). * //from w w w .jav a 2 s . c o m * @return A panel. */ public JPanel createDemoPanel() { IntervalXYDataset dataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension datasetExtension = new XYDatasetSelectionExtension(dataset); datasetExtension.addSelectionChangeListener(this); //standard setup JFreeChart chart = createChart(dataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new FreePathSelectionHandler(); panel.addMouseHandler(selectionHandler); panel.addMouseHandler(new MouseClickSelectionHandler()); panel.removeMouseHandler(panel.getZoomHandler()); // add a selection manager with intersection selection DatasetExtensionManager dExManager = new DatasetExtensionManager(); dExManager.registerDatasetExtension(datasetExtension); EntitySelectionManager selectionManager = new EntitySelectionManager(panel, new Dataset[] { dataset }, dExManager); selectionManager.setIntersectionSelection(true); panel.setSelectionManager(selectionManager); return panel; }
From source file:org.jfree.chart.demo.selection.SelectionDemo3.java
/** * Creates a panel for the demo (used by SuperDemo.java). * * @return A panel.//from w ww. ja v a 2s . c o m */ public final JPanel createDemoPanel() { XYDataset xydataset = createDataset(); //extend dataset and add selection change listener for the demo DatasetSelectionExtension<XYCursor> datasetExtension = new XYDatasetSelectionExtension(xydataset); datasetExtension.addChangeListener(this); //standard setup JFreeChart chart = createChart(xydataset, datasetExtension); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); // add a selection handler RegionSelectionHandler selectionHandler = new RectangularRegionSelectionHandler(); 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[] { xydataset }, dExManager)); return panel; }