Example usage for org.jfree.chart ChartRenderingInfo ChartRenderingInfo

List of usage examples for org.jfree.chart ChartRenderingInfo ChartRenderingInfo

Introduction

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

Prototype

public ChartRenderingInfo() 

Source Link

Document

Constructs a new ChartRenderingInfo structure that can be used to collect information about the dimensions of a rendered chart.

Usage

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Constructs a JFreeChart panel.//from  w  w  w .ja v  a 2 s  .  c  o m
 * 
 * @param comp
 *          The parent.
 * @param style
 *          The style of the composite.
 * @param jfreechart
 *          the chart.
 * @param width
 *          the preferred width of the panel.
 * @param height
 *          the preferred height of the panel.
 * @param minimumDrawW
 *          the minimum drawing width.
 * @param minimumDrawH
 *          the minimum drawing height.
 * @param maximumDrawW
 *          the maximum drawing width.
 * @param maximumDrawH
 *          the maximum drawing height.
 * @param usingBuffer
 *          a flag that indicates whether to use the off-screen buffer to
 *          improve performance (at the expense of memory).
 * @param properties
 *          a flag indicating whether or not the chart property editor should
 *          be available via the popup menu.
 * @param save
 *          a flag indicating whether or not save options should be available
 *          via the popup menu.
 * @param print
 *          a flag indicating whether or not the print option should be
 *          available via the popup menu.
 * @param zoom
 *          a flag indicating whether or not zoom options should be added to
 *          the popup menu.
 * @param tooltips
 *          a flag indicating whether or not tooltips should be enabled for
 *          the chart.
 */
public FixedChartComposite(final Composite comp, final int style, final JFreeChart jfreechart, final int width,
        final int height, final int minimumDrawW, final int minimumDrawH, final int maximumDrawW,
        final int maximumDrawH, final boolean usingBuffer, final boolean properties, final boolean save,
        final boolean print, final boolean zoom, final boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:org.jfree.experimental.chart.swt.ChartComposite.java

/**
 * Constructs a JFreeChart panel./* w  ww  .  ja v  a2s .c o  m*/
 * 
 * @param comp The parent.
 * @param style The style of the composite.
 * @param jfreechart the chart.
 * @param width the preferred width of the panel.
 * @param height the preferred height of the panel.
 * @param minimumDrawW the minimum drawing width.
 * @param minimumDrawH the minimum drawing height.
 * @param maximumDrawW the maximum drawing width.
 * @param maximumDrawH the maximum drawing height.
 * @param usingBuffer a flag that indicates whether to use the off-screen buffer to improve
 *        performance (at the expense of memory).
 * @param properties a flag indicating whether or not the chart property editor should be
 *        available via the popup menu.
 * @param save a flag indicating whether or not save options should be available via the popup
 *        menu.
 * @param print a flag indicating whether or not the print option should be available via the
 *        popup menu.
 * @param zoom a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips a flag indicating whether or not tooltips should be enabled for the chart.
 */
public ChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height, int minimumDrawW,
        int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer, boolean properties,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    this.setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    this.setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    this.setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    if (this.chart != null) {
        this.chart.addChangeListener(this);
        Plot plot = this.chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:rulebender.editors.dat.view.CustomizedChartComposite.java

/**
 * Constructs a JFreeChart panel./*from   w w  w  .  j  av a 2s . c o m*/
 *
 * @param comp The parent.
 * @param style The style of the composite.
 * @param jfreechart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawW  the minimum drawing width.
 * @param minimumDrawH  the minimum drawing height.
 * @param maximumDrawW  the maximum drawing width.
 * @param maximumDrawH  the maximum drawing height.
 * @param usingBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 */
public CustomizedChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height,
        int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer,
        boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:jhplot.HPlotChart.java

public void drawToGraphics2D(Graphics2D g, int width, int height) {
    // self.chartCoordsMap = {} #Maps a chart to its raw screen coords, used
    // for converting coords
    g.setColor(Color.white);//from   w  ww  .j  a v a2  s  . c  o m
    g.fillRect(0, 0, width, height);
    //
    // int boxWidth = width / this.chartarray[0].length;
    // int boxHeight = height / this.chartarray.length;

    int cols = 1;
    int rows = 1;
    int boxWidth = width / cols;
    int boxHeight = height / rows;

    //
    // # print "boxWidth ", boxWidth
    // # print "boxHeight ", boxHeight

    // for (int row = 0; row < chartarray.length; row++)
    int currentChartIndex = 0;

    for (int i2 = 0; i2 < rows; i2++) {
        for (int i1 = 0; i1 < cols; i1++) {

            currentChartIndex++;
            if (chart != null) {

                int rowsUsed = 1;
                int colsUsed = 1;
                int chartX = boxWidth * i1;
                int chartY = boxHeight * i2;
                int chartwidth = boxWidth;
                int chartheight = boxHeight;
                // #Get Horizontalspace
                // for (int c = col; c > -1; c--)
                // {
                // // for c in range(col, -1, -1):
                // // if self.chartArray[row][c] == None:
                // if(this.chartarray[row][c] == null)
                // rowsUsed++;
                //
                // // rowsUsed = rowsUsed + 1
                // // #print "adding row"
                // }
                chartwidth = boxWidth * rowsUsed;
                chartheight = boxHeight;
                chartX = chartX - (rowsUsed - 1) * boxWidth;
                //
                // # chart.configureDomainAxes()
                // # chart.configureRangeAxes()
                //
                // #Testing axes ranges not updated
                // from org.jfree.chart.event import PlotChangeEvent
                // chart[i1][i2].plotChanged(new
                // PlotChangeEvent(chart[i1][i2].getXYPlot()));
                chart.plotChanged(new PlotChangeEvent(chart.getPlot()));
                //
                ChartRenderingInfo info = new ChartRenderingInfo();
                //
                chart.draw(g, new java.awt.Rectangle(chartX, chartY, chartwidth, chartheight),
                        new Point(chartX, chartY), info);
                // self.chartToInfoMap[chart] = info
                //
                // self.chartCoordsMap[chart] = [chartX ,chartY,chartwidth,
                // chartheight]

            }
        }
    }

}

From source file:com.rcp.wbw.demo.ChartComposite.java

/**
 * Constructs a JFreeChart panel.// w w w  .j a va  2  s .  c om
 * 
 * @param comp
 *            The parent.
 * @param style
 *            The style of the composite.
 * @param jfreechart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawW
 *            the minimum drawing width.
 * @param minimumDrawH
 *            the minimum drawing height.
 * @param maximumDrawW
 *            the maximum drawing width.
 * @param maximumDrawH
 *            the maximum drawing height.
 * @param usingBuffer
 *            a flag that indicates whether to use the off-screen
 *            buffer to improve performance (at the expense of
 *            memory).
 * @param properties
 *            a flag indicating whether or not the chart property
 *            editor should be available via the popup menu.
 * @param save
 *            a flag indicating whether or not save options should be
 *            available via the popup menu.
 * @param print
 *            a flag indicating whether or not the print option
 *            should be available via the popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be
 *            added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be
 *            enabled for the chart.
 */
public ChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height, int minimumDrawW,
        int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer, boolean properties,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:com.munch.exchange.parts.neuralnetwork.results.NeuralNetworkResultChartComposite.java

/**
 * Constructs a JFreeChart panel./*from ww  w.j  a v  a2  s.  c  o m*/
 *
 * @param comp The parent.
 * @param style The style of the composite.
 * @param jfreechart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawW  the minimum drawing width.
 * @param minimumDrawH  the minimum drawing height.
 * @param maximumDrawW  the maximum drawing width.
 * @param maximumDrawH  the maximum drawing height.
 * @param usingBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 */
public NeuralNetworkResultChartComposite(Composite comp, int style, JFreeChart jfreechart, int width,
        int height, int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer,
        boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);
    this.canvas.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            org.eclipse.swt.graphics.Image img;
            img = (org.eclipse.swt.graphics.Image) canvas.getData("double-buffer-image");
            if (img != null) {
                img.dispose();
            }
        }
    });

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:com.munch.exchange.ExchangeChartComposite.java

/**
 * Constructs a JFreeChart panel.//from www  .ja va 2 s  .  c  o m
 *
 * @param comp The parent.
 * @param style The style of the composite.
 * @param jfreechart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawW  the minimum drawing width.
 * @param minimumDrawH  the minimum drawing height.
 * @param maximumDrawW  the maximum drawing width.
 * @param maximumDrawH  the maximum drawing height.
 * @param usingBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 */
public ExchangeChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height,
        int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer,
        boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);
    this.canvas.addMouseWheelListener(this);
    this.canvas.addMouseTrackListener(this);
    //TODO Add other listener
    this.canvas.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            org.eclipse.swt.graphics.Image img;
            img = (org.eclipse.swt.graphics.Image) canvas.getData("double-buffer-image");
            if (img != null) {
                img.dispose();
            }
        }
    });

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:edu.pitt.dbmi.odie.ui.jfreechart.EnhancedChartComposite.java

/**
 * Constructs a JFreeChart panel.//from  www . j  a  v  a 2s .com
 * 
 * @param comp
 *            The parent.
 * @param style
 *            The style of the composite.
 * @param jfreechart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawW
 *            the minimum drawing width.
 * @param minimumDrawH
 *            the minimum drawing height.
 * @param maximumDrawW
 *            the maximum drawing width.
 * @param maximumDrawH
 *            the maximum drawing height.
 * @param usingBuffer
 *            a flag that indicates whether to use the off-screen buffer to
 *            improve performance (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor
 *            should be available via the popup menu.
 * @param save
 *            a flag indicating whether or not save options should be
 *            available via the popup menu.
 * @param print
 *            a flag indicating whether or not the print option should be
 *            available via the popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added
 *            to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled
 *            for the chart.
 */
public EnhancedChartComposite(Composite comp, int style, JFreeChart jfreechart, int width, int height,
        int minimumDrawW, int minimumDrawH, int maximumDrawW, int maximumDrawH, boolean usingBuffer,
        boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(comp, style);
    setChart(jfreechart);
    this.chartMouseListeners = new EventListenerList();
    setLayout(new FillLayout());
    this.info = new ChartRenderingInfo();
    this.useBuffer = usingBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawW;
    this.minimumDrawHeight = minimumDrawH;
    this.maximumDrawWidth = maximumDrawW;
    this.maximumDrawHeight = maximumDrawH;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;
    setDisplayToolTips(tooltips);
    // create the canvas and add the required listeners
    this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
    this.canvas.addPaintListener(this);
    this.canvas.addMouseListener(this);
    this.canvas.addMouseMoveListener(this);

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom)
        this.popup = createPopupMenu(properties, save, print, zoom);

    this.enforceFileExtensions = true;
}

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Constructs a JFreeChart panel./*from  w ww .j a  v  a 2s .  c om*/
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param copy
 *            a flag indicating whether or not a copy option should be available via the popup
 *            menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 * 
 * @since 1.0.13
 */
public AbstractChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean copy,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(chart, width, height, minimumDrawWidth, minimumDrawHeight, maximumDrawWidth, maximumDrawHeight, false,
            properties, copy, save, print, zoom, tooltips);
    setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));

    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || copy || save || print || zoom) {
        this.popup = createPopupMenu(properties, copy, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    // mouse listener registered in super class
    // addMouseListener(this);
    // addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;
    this.selectionOutlinePaint = Color.blue;
    this.selectionFillPaint = new Color(0, 0, 255, 63);

    this.panMask = InputEvent.CTRL_MASK;
    // for MacOSX we can't use the CTRL key for mouse drags, see:
    // http://developer.apple.com/qa/qa2004/qa1362.html
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.startsWith("mac os x")) {
        this.panMask = InputEvent.ALT_MASK;
    }

    this.overlays = new java.util.ArrayList<>();

    // adding wheel listener
    addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                return;
            }
            if (e.getWheelRotation() < 0) {
                shrinkSelectionOnCenter(e.getX(), e.getY(), e);
            } else {
                enlargeSelectionOnCenter(e.getX(), e.getY(), e);
            }
        }
    });
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Constructs a JFreeChart panel./*ww w  .  j  a  v  a2 s  .com*/
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 */
public TraceViewChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();
}