Example usage for org.jfree.chart ChartPanel ChartPanel

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

Introduction

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

Prototype

public ChartPanel(JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom,
        boolean tooltips) 

Source Link

Document

Constructs a JFreeChart panel.

Usage

From source file:slash.navigation.converter.gui.elevationview.ElevationView.java

public ElevationView(PositionsModel positionsModel, final PositionsSelectionModel positionsSelectionModel) {
    this.positionsModel = positionsModel;
    XYSeriesCollection dataset = createDataset(positionsModel);
    JFreeChart chart = createChart(dataset);
    plot = createPlot(chart);/*from w  w  w . j  av a  2 s.co m*/
    chartPanel = new ChartPanel(chart, false, true, true, true, true);
    chartPanel.addChartMouseListener(new ChartMouseListener() {
        public void chartMouseClicked(ChartMouseEvent e) {
            ChartEntity entity = e.getEntity();
            if (!(entity instanceof XYItemEntity))
                return;
            int index = ((XYItemEntity) entity).getItem();
            positionsSelectionModel.setSelectedPositions(new int[] { index });
        }

        public void chartMouseMoved(ChartMouseEvent e) {
        }
    });
}

From source file:Reportes.BarChart.java

public ChartPanel reporteAportesVentas(DefaultCategoryDataset data) {
    JFreeChart chart = ChartFactory.createBarChart("Reporte de aporte por sede", "Sedes", "Aporte", data,
            PlotOrientation.VERTICAL, true, true, true);

    CategoryPlot categoryP = chart.getCategoryPlot();
    BarRenderer renderer = (BarRenderer) categoryP.getRenderer();
    renderer.setMaximumBarWidth(0.35);/*from w w w  .jav  a  2 s .  c om*/
    Color color = new Color(67, 165, 208);
    renderer.setSeriesPaint(0, color);

    ChartPanel panel = new ChartPanel(chart, true, true, true, false, false);
    panel.setSize(ancho, alto);

    return panel;
}

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

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

    // layout//from  w  w w.  j  av  a2s .  c om
    setLayout(new FillLayout());

    // create the components
    errorbarplot = new FastErrorBarPlot("", "Intensity");
    errorbarplot.setBackgroundPaint(Color.WHITE);
    linechart = new JFreeChart("", errorbarplot);
    linechart.setBackgroundPaint(Color.WHITE);

    // add the components
    // --------------------------------------------------------------------------------
    // This uses the SWT-trick for embedding awt-controls in an SWT-Composite.
    try {
        System.setProperty("sun.awt.noerasebackground", "true");
    } catch (NoSuchMethodError error) {
        ;
    }
    java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this);

    // create a new ChartPanel, without the popup-menu (5x false)
    frame.add(new ChartPanel(linechart, false, false, false, false, false));
    // --------------------------------------------------------------------------------
}

From source file:ws.moor.bt.gui.charts.ConnectionTypes.java

public ConnectionTypes(CounterRepository counterRepository) {
    super();/*from   w  w  w  .  j  a v  a 2s  . c o  m*/

    seederSource = new CounterStatisticsDataSource(
            counterRepository.getStatistics("network.connections.seed")) {
        protected double getValueToShowAt(long time) {
            return statistics.getValueAt(time);
        }
    };
    leecherSource = new CounterStatisticsDataSource(
            counterRepository.getStatistics("network.connections.leecher")) {
        protected double getValueToShowAt(long time) {
            return statistics.getValueAt(time);
        }
    };

    chart = createChart(getTimeSeriesCollection());
    setLayout(new BorderLayout());
    ChartPanel panel = new ChartPanel(chart, false, true, false, false, false);
    panel.setMouseZoomable(false);
    add(panel, BorderLayout.CENTER);
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.JVMView.java

JVMView() {
    super(new BorderLayout());
    double maxMemory = (double) memoryBean.getHeapMemoryUsage().getMax() / MEGABYTE;

    ChartPanel heapPanel = new ChartPanel(createHeapChart(maxMemory), false, // Properties
            true, // Save
            true, // Print
            false, // Zoom
            true); // Tooltips
    heapPanel.setMouseZoomable(false);//from   w  ww .  j  a v a 2 s.  c o  m
    add(heapPanel, BorderLayout.CENTER);
    add(createControls(), BorderLayout.SOUTH);

    Timer timer = new Timer(5000, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addMemoryDataPoint();
        }
    });

    // Plot start values.
    addMemoryDataPoint();

    timer.start();
}