Example usage for org.jfree.chart.ui ChartPropertyEditPanel ChartPropertyEditPanel

List of usage examples for org.jfree.chart.ui ChartPropertyEditPanel ChartPropertyEditPanel

Introduction

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

Prototype

public ChartPropertyEditPanel(JFreeChart chart) 

Source Link

Document

Standard constructor - the property panel is made up of a number of sub-panels that are displayed in the tabbed pane.

Usage

From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java

/**
 * Handles an action event.//from  w w  w .j a  v  a2s . com
 * 
 * @param evt
 *            the event.
 */
public void actionPerformed(ActionEvent evt) {
    try {
        String acmd = evt.getActionCommand();

        if (acmd.equals(ACTION_CHART_ZOOM_BOX)) {
            setPanMode(false);
        } else if (acmd.equals(ACTION_CHART_PAN)) {
            setPanMode(true);
        } else if (acmd.equals(ACTION_CHART_ZOOM_IN)) {
            ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            Rectangle2D rect = info.getPlotInfo().getDataArea();
            zoomBoth(rect.getCenterX(), rect.getCenterY(), ZOOM_FACTOR);
        } else if (acmd.equals(ACTION_CHART_ZOOM_OUT)) {
            ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            Rectangle2D rect = info.getPlotInfo().getDataArea();
            zoomBoth(rect.getCenterX(), rect.getCenterY(), 1 / ZOOM_FACTOR);
        } else if (acmd.equals(ACTION_CHART_ZOOM_TO_FIT)) {

            // X-axis (has no fixed borders)
            chartPanel.autoRangeHorizontal();
            Plot plot = chartPanel.getChart().getPlot();
            if (plot instanceof ValueAxisPlot) {
                XYPlot vvPlot = (XYPlot) plot;
                ValueAxis axis = vvPlot.getRangeAxis();
                if (axis != null) {
                    axis.setLowerBound(yMin);
                    axis.setUpperBound(yMax);
                }
            }
        } else if (acmd.equals(ACTION_CHART_EXPORT)) {
            try {
                chartPanel.doSaveAs();
            } catch (IOException i) {
                MsgBox.error(i.getMessage());
            }
        } else if (acmd.equals(ACTION_CHART_PRINT)) {
            chartPanel.createChartPrintJob();

        } else if (acmd.equals(ACTION_CHART_PROPERTIES)) {
            ChartPropertyEditPanel panel = new ChartPropertyEditPanel(jFreeChart);
            int result = JOptionPane.showConfirmDialog(this, panel,
                    localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE);
            if (result == JOptionPane.OK_OPTION) {
                panel.updateChartProperties(jFreeChart);
            }
        }

    } catch (Exception e) {
        MsgBox.error(e.getMessage());
    }
}

From source file:org.tsho.dmc2.core.chart.jfree.DmcChartPanel.java

/**
 * Displays a dialog that allows the user to edit the properties for the
 * current chart.//from  ww w  .  j a  va2  s.  c  o  m
 */
private void attemptEditChartProperties() {

    ChartPropertyEditPanel panel = new ChartPropertyEditPanel(chart);
    int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Chart_Properties"),
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    if (result == JOptionPane.OK_OPTION) {
        panel.updateChartProperties(chart);
    }
}