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:org.jfree.chart.demo.MouseListenerDemo1.java

public MouseListenerDemo1(String s) {
    super(s);//from   ww  w  . j  a  va 2s. co  m
    DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
    defaultpiedataset.setValue("Java", new Double(43.200000000000003D));
    defaultpiedataset.setValue("Visual Basic", new Double(0.0D));
    defaultpiedataset.setValue("C/C++", new Double(17.5D));
    org.jfree.chart.JFreeChart jfreechart = ChartFactory.createPieChart("Pie Chart Demo 1", defaultpiedataset,
            true, true, false);
    ChartPanel chartpanel = new ChartPanel(jfreechart, false, false, false, false, false);
    chartpanel.addChartMouseListener(this);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartpanel);
}

From source file:org.jfree.chart.demo.PriceVolumeDemo1.java

public PriceVolumeDemo1(String s) {
    super(s);//  ww w.  j  a  va  2 s  .  com
    JFreeChart jfreechart = createChart();
    ChartPanel chartpanel = new ChartPanel(jfreechart, true, true, true, false, true);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartpanel);
}

From source file:org.kalypso.ogc.sensor.diagview.jfreechart.ChartFactory.java

/**
 * Create a ChartPanel over the given ObservationChart. The created panel has no popup menu.
 * <p>//  www  . j  a v a  2  s.  c  o  m
 * Takes care of registering the ChartPanel within the ObservationChart so that the chart can refer to it once print is called for instance.
 */
public static ChartPanel createChartPanel(final ObservationChart obsChart) {
    final ChartPanel chartPanel = new ChartPanel(obsChart, false, false, false, false, false);
    chartPanel.setMouseZoomable(true, false);

    obsChart.setPanel(chartPanel);

    return chartPanel;
}

From source file:org.jfree.chart.demo.PriceVolumeDemo2.java

public PriceVolumeDemo2(String s) {
    super(s);//  www .ja  v  a2 s  .  com
    JFreeChart jfreechart = createChart();
    ChartPanel chartpanel = new ChartPanel(jfreechart, true, true, true, false, true);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartpanel);
}

From source file:Reportes.BarChart.java

public ChartPanel reporteEmpleados(DefaultCategoryDataset data) {
    JFreeChart JFchart = ChartFactory.createBarChart("Reporte de empleados", "Sedes", "Cantidad", data,
            PlotOrientation.VERTICAL, true, true, true);
    /*/* w  w w. ja va2 s  .co  m*/
    CategoryPlot plot = new CategoryPlot();
            
    ChartFrame chartFrame = new ChartFrame("Reporte de empleadoos", JFchart, false);
    chartFrame.setSize(300, 300);
    chartFrame.setVisible(true);
    */

    CategoryPlot categoryP = JFchart.getCategoryPlot();
    BarRenderer renderer = (BarRenderer) categoryP.getRenderer();
    renderer.setMaximumBarWidth(0.35);
    Color color = new Color(67, 165, 208);
    renderer.setSeriesPaint(0, color);

    ChartPanel panel = new ChartPanel(JFchart, true, true, true, false, false);

    panel.setSize(ancho, alto);

    return panel;
}

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

public BlockOrigin(CounterRepository counterRepository) {
    super();/*  w w  w.  ja  v  a  2  s. co  m*/
    this.counterRepository = counterRepository;

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

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

public RemotePeerCompletion(TorrentDownload download) {
    super();/*from   ww  w .  j av  a 2 s.c  o  m*/
    this.download = download;

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

From source file:de.cebitec.readXplorer.plotting.CreatePlots.java

public synchronized static ChartPanel createPlot(Map<PersistentFeature, Pair<Double, Double>> data,
        String xName, String yName, XYToolTipGenerator toolTip) {
    XYSeriesCollection normal = new XYSeriesCollection();
    XYSeries nor = new XYSeries("Normal");
    for (Iterator<PersistentFeature> it = data.keySet().iterator(); it.hasNext();) {
        PersistentFeature key = it.next();
        Pair<Double, Double> pair = data.get(key);
        Double X = pair.getFirst();
        Double Y = pair.getSecond();
        nor.add(new PlotDataItem(key, X, Y));
    }//from  w  w w .  j a v a2 s  .  c  o m
    normal.addSeries(nor);
    // create subplot 1...
    final XYItemRenderer renderer1 = new XYShapeRenderer();
    renderer1.setBaseToolTipGenerator(toolTip);
    final NumberAxis domainAxis1 = new NumberAxis(xName);
    final NumberAxis rangeAxis1 = new NumberAxis(yName);
    final XYPlot subplot1 = new XYPlot(normal, domainAxis1, rangeAxis1, renderer1);
    JFreeChart chart = new JFreeChart(subplot1);
    chart.removeLegend();
    ChartPanel panel = new ChartPanel(chart, true, false, true, true, true);
    panel.setInitialDelay(0);
    panel.setMaximumDrawHeight(1080);
    panel.setMaximumDrawWidth(1920);
    panel.setMouseWheelEnabled(true);
    panel.setMouseZoomable(true);
    MouseActions mouseAction = new MouseActions();
    panel.addChartMouseListener(mouseAction);
    ChartPanelOverlay overlay = new ChartPanelOverlay(mouseAction);
    panel.addOverlay(overlay);
    return panel;
}

From source file:com.vgi.mafscaling.MafChartPanel.java

public MafChartPanel(JFreeChart chart, IMafChartHolder holder) {
    pointDraggableSet = new HashSet<Integer>();
    chartPanel = new ChartPanel(chart, true, true, true, true, true);
    chartHolder = holder;/*w  ww.j  av a  2 s  .co  m*/
    chartPanel.addMouseMotionListener(this);
    chartPanel.addMouseListener(this);
    chartPanel.addMouseWheelListener(this);
    chartPanel.setAutoscrolls(true);
    chartPanel.setMouseZoomable(false);
}

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

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

    // layout/*from  w  w  w. j  a  va 2  s. c  o  m*/
    setLayout(new FillLayout());

    // create the components
    timeplot = new peakml.util.jfreechart.FastTimePlot("", "");
    timeplot.setBackgroundPaint(Color.WHITE);
    linechart = new JFreeChart("", timeplot);
    linechart.setBackgroundPaint(Color.WHITE);

    // 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);
    // --------------------------------------------------------------------------------
}