Example usage for org.jfree.chart ChartPanel setFillZoomRectangle

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

Introduction

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

Prototype

public void setFillZoomRectangle(boolean flag) 

Source Link

Document

A flag that controls how the zoom rectangle is drawn.

Usage

From source file:peakml.util.swt.widget.IPeakGraph.java

public IPeakGraph(Composite parent, int style) {
    super(parent, SWT.EMBEDDED | style);

    // layout//from  w  w w. j a v  a2 s . c om
    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:org.hxzon.demo.jfreechart.PieDatasetDemo2.java

public PieDatasetDemo2(String title) {
    super(title);
    ChartPanel chartPanel = new ChartPanel(pieChart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.addMouseListener(new MyChartClickHandler(chartPanel));
    chartPanel.setPreferredSize(new Dimension(500, 270));
    getContentPane().add(chartPanel);//from   ww w  . ja v a  2s  .  c o m
    getContentPane().add(new ChartComboBox(chartPanel), BorderLayout.SOUTH);
}

From source file:grafici.StatisticheBarChart.java

/**
 * Creates a new demo instance.// ww w . j a  va 2s. co m
 * 
 * @param title
 *            the frame title.
 */
public StatisticheBarChart(Table risultati, Composite parent, int style, int variabile, int valore) {
    super(parent, style);
    try {
        this.titolo = risultati.getColumn(variabile).getText().toUpperCase() + " - "
                + risultati.getColumn(valore).getText().toUpperCase();
        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;
        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        CategoryDataset dataset = createDataset(risultati, variabile, valore);
        JFreeChart chart = createChart(dataset, risultati, variabile, valore);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setFillZoomRectangle(true);
        // chartPanel.setMouseWheelEnabled(true);
        // chartPanel.setPreferredSize(new Dimension(1000, 700));
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

    } catch (Exception e) {
        alertGraficoNonDisp();
    }
}

From source file:com.mxgraph.examples.swing.chart.BarChartDemo1.java

/**
 * Creates a new demo instance./*from   w  ww .  j av  a  2 s  .  co m*/
 *
 * @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);
}

From source file:grafici.PazientiBarChart.java

/**
 * Creates a new demo instance./*  www. j  a va 2  s .c  om*/
 * 
 * @param title
 *            the frame title.
 */
public PazientiBarChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);
    try {
        this.titolo = title;
        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;
        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        CategoryDataset dataset = createDataset(tipo);
        JFreeChart chart = createChart(dataset);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setFillZoomRectangle(true);
        // chartPanel.setMouseWheelEnabled(true);
        // chartPanel.setPreferredSize(new Dimension(1000, 700));
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:item.analysis.report.MainFrame.java

private void itemChartSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemChartSelectorActionPerformed
    if (itemChartSelector.getModel().getSize() < 1)
        return;//from  w  w w. j  ava 2  s.  co  m

    //System.out.println("selected: " + itemChartSelector.getSelectedItem() + " (" + itemChartSelector.getSelectedIndex() + ")");
    int index = itemChartSelector.getSelectedIndex();
    CategoryDataset dataset = repGen.createDataset(index);
    chartPanel.removeAll();
    chart = repGen.createChart(dataset, index);

    ChartPanel chartPanelOuter = new ChartPanel(chart);
    chartPanelOuter.setFillZoomRectangle(true);
    chartPanelOuter.setMouseWheelEnabled(true);
    chartPanelOuter.setPreferredSize(new Dimension(585, 268));

    chartPanel.setLayout(new BorderLayout());
    chartPanel.add(chartPanelOuter, BorderLayout.CENTER);
    chartPanel.validate();
}

From source file:grafici.MediciBarChart.java

/**
 * Creates a new demo instance./* ww  w  . j  av  a2 s  . c o m*/
 * 
 * @param title
 *            the frame title.
 */
public MediciBarChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);
    try {
        this.titolo = title;
        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;
        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        CategoryDataset dataset = createDataset(tipo);
        JFreeChart chart = createChart(dataset);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setFillZoomRectangle(true);
        // chartPanel.setMouseWheelEnabled(true);
        // chartPanel.setPreferredSize(new Dimension(1000, 700));
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:grafici.PrenotazioniBarChart.java

/**
 * Creates a new demo instance./*from w  w  w. j a v a  2s. c  o m*/
 * 
 * @param title
 *            the frame title.
 */
public PrenotazioniBarChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);
    try {
        this.titolo = title;
        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;
        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        CategoryDataset dataset = createDataset(tipo);
        JFreeChart chart = createChart(dataset);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setFillZoomRectangle(true);
        // chartPanel.setMouseWheelEnabled(true);
        // chartPanel.setPreferredSize(new Dimension(1000, 700));
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.hxzon.demo.jfreechart.DatasetVisibleDemo3.java

public DatasetVisibleDemo3(String title) {
    super(title);
    ChartPanel chartPanel = new ChartPanel(timeSeriesChart);
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    getContentPane().add(chartPanel);/*from www  .j  av a 2  s.  c  o  m*/
    JPanel buttonPanel = new JPanel(new SimpleLayout(true));
    buttonPanel.add(new ChartCheckBox(series1Name, chartPanel));
    buttonPanel.add(new ChartCheckBox(series2Name, chartPanel));
    buttonPanel.add(new ChartCheckBox(series3Name, chartPanel));
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortHeatMapPlotPanel.java

/**
 * Creates a panel for heat map (make it zoomable)
 *
 * @return A panel./*from   www .ja  va2s.c o  m*/
 */
public JPanel createHeatPanel(OMS_Collection history, ArrayList<IB_Vertex> includedNodes,
        EnumSet<IB_Depth> includedDepths) {
    // this will return quickly, it uses a swing worker to
    // develop the dataset, which can take considerable time
    // so a dummy chart is returned, to be fixed later
    createHeatChart(new XYSeriesCollection(), history, includedNodes, includedDepths);
    heatChart.addChangeListener(this);
    ChartPanel panel = new ChartPanel(heatChart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    return panel;
}