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, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) 

Source Link

Document

Constructs a JFreeChart panel.

Usage

From source file:UserInterface.FarmerRole.ThermometerDemo.java

public ThermometerDemo(double value, String type) {
    this.setLayout(new GridLayout());
    DefaultValueDataset dataset = new DefaultValueDataset(value);
    if (type.equals("high")) {
        ThermometerPlot plot = new ThermometerPlot(dataset);
        plot.setSubrangePaint(0, Color.green.darker());
        plot.setSubrangePaint(1, Color.ORANGE);
        plot.setSubrangePaint(2, Color.RED.darker());

        plot.setSubrangeInfo(0, 10, 28, 30, 60);

        JFreeChart chart = new JFreeChart("Cold Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true));
    } else if (type.equals("medium")) {
        ThermometerPlot plot = new ThermometerPlot(dataset);
        plot.setSubrangePaint(0, Color.green.darker());
        plot.setSubrangePaint(1, Color.ORANGE);
        plot.setSubrangePaint(2, Color.RED.darker());

        plot.setSubrangeInfo(0, 12, 14, 30, 60);

        JFreeChart chart = new JFreeChart("Medium Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true));
    } else {/*from  w  w  w  .  j  av  a  2s.c om*/
        ThermometerPlot plot = new ThermometerPlot(dataset);
        plot.setSubrangePaint(0, Color.green.darker());
        plot.setSubrangePaint(1, Color.YELLOW);
        plot.setSubrangePaint(2, Color.RED.darker());

        plot.setSubrangeInfo(0, 20, 35, 46, 60);

        JFreeChart chart = new JFreeChart("Warm Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true));
    }
}

From source file:com.sigma.applet.GraphsApplet.java

public void init() {
    final JTabbedPane tabs = new JTabbedPane();

    XYDataset data1 = createTimeSeriesCollection1(1.1);
    JFreeChart chart1 = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Rate", data1, true, true,
            false);//from  ww  w .  j  a v a 2  s .  c  o m
    ChartPanel panel1 = new ChartPanel(chart1, 400, 300, 200, 100, 400, 200, true, false, false, false, true,
            true);
    tabs.add("Chart 1", panel1);

    XYDataset data2 = createTimeSeriesCollection1(0.8);
    JFreeChart chart2 = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Rate", data2, true, true,
            false);
    ChartPanel panel2 = new ChartPanel(chart2, 400, 300, 200, 100, 400, 200, true, false, false, false, true,
            true);
    tabs.add("Chart 2", panel2);

    this.getContentPane().add(tabs);
}

From source file:org.spantus.exp.segment.draw.DrawLabeledVector.java

public void showChart() {
    int width = 600;
    int height = 600;
    JFreeChart chart = createBarChart();
    ChartPanel chartPanel = new ChartPanel(chart, width, height, 16, 16, width * 10, height * 10, true, true,
            true, true, true, true);//from w  w  w  .  ja v a 2 s  . c  o m
    JFrame frame = new JFrame(chart.getTitle().getText());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(chartPanel);
    frame.pack();
    frame.setVisible(true);
}

From source file:picocash.components.panel.statistic.AbstractPieStatisticComponent.java

private final void init() {
    this.title = getTitle();
    this.dataset = new DefaultPieDataset();
    this.chartPanel = new JXPanel(new MigLayout("fill, insets 0 0 0 0"));
    final JFreeChart piechart = ChartFactory.createPieChart(title, dataset, true, true, Locale.getDefault());
    ((PiePlot) piechart.getPlot()).setLabelGenerator(null);
    piechart.setBorderVisible(false);/* w  w w .  j av a2 s.  c o  m*/
    piechart.setAntiAlias(true);
    ChartPanel chart = new ChartPanel(piechart, 300, 300, 200, 200, 400, 400, false, false, false, false, false,
            true);
    chart.getChart().getPlot().setBackgroundAlpha(0);
    chart.getChart().getPlot().setOutlineVisible(false);
    this.chartPanel.setOpaque(false);
    this.chartPanel.add(chart, "growx, aligny top");
}