Example usage for org.jfree.chart ChartFrame setVisible

List of usage examples for org.jfree.chart ChartFrame setVisible

Introduction

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

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:no.met.jtimeseries.MeteogramWrapper.java

public static void main(String[] args) {
    JFreeChart jchart;//from  w  ww .jav  a  2  s. c o  m
    try {
        ChartPlottingInfo cpi = new ChartPlottingInfo.Builder(10.48, 59.88).altitude(0).width(800).height(300)
                .showAirTemperature(true).showDewpointTemperature(true).showPressure(true).timezone("UTC")
                .showCloudSymbol(true).showWeatherSymbol(true).showWindSymbol(true).showPrecipitation(true)
                .showWindSpeed(true).showWindDirection(true).windSpeedUnit("knop").build();

        MeteogramWrapper wrapper = new MeteogramWrapper("en");

        jchart = wrapper.createMeteogram(cpi, SHORT_TERM_HOURS);

        ChartFrame frame = new ChartFrame(jchart, new java.awt.Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
        frame.pack();
        frame.setVisible(true);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    System.out.println("Done!");
}

From source file:spectrex.Charts.java

/**
 * @param data initial data for chart creation
 * @param title text which would be displayed at the top of the frame and in
 * the frame's title// www  .  java  2  s  . c  o  m
 * @param columnLabel text which would be displayed on the left of the
 * Y-axis
 * @param rowLabel text which would be displayed under X-axis
 * @param frameSize size of chart frame
 * @return Bar chart JFrame link
 * @author ReaLgressA
 */
public static JFrame createBarChart(ChartData data, String title, String columnLabel, String rowLabel,
        Dimension frameSize) {
    JFreeChart chart = ChartFactory.createStackedBarChart(title, columnLabel, rowLabel, data.getDataset(),
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame(title, chart, true);
    frame.setVisible(true);
    frame.setSize(frameSize);
    frame.setResizable(true);
    return (JFrame) frame;
}

From source file:helpers.Plots.java

public static void plotSimpleLineXY(ArrayList<double[][]> data, ArrayList<String> seriesName, String title,
        String xname, String yname) {
    DefaultXYDataset ds = new DefaultXYDataset();

    for (int i = 0; i < data.size(); i++) {
        System.out.println(data.get(i)[0][0]);
        ds.addSeries(seriesName.get(i), data.get(i));
    }//from  www. java2  s  . c om

    JFreeChart chart = ChartFactory.createXYLineChart(title, xname, yname, ds, PlotOrientation.VERTICAL, true,
            true, false);
    ChartFrame frame = new ChartFrame(title, chart);
    frame.pack();
    frame.setVisible(true);
}

From source file:br.unesp.rc.desafio.utils.Utils.java

public static void createPie(DefaultPieDataset pieDataset) {

    JFreeChart chart = ChartFactory.createPieChart("Grafico Torta", pieDataset, true, true, true);
    PiePlot p = (PiePlot) chart.getPlot();
    ChartFrame frame = new ChartFrame("Grafico Torta", chart);

    frame.setVisible(true);
    frame.setSize(450, 500);/*from   ww  w  . ja v  a2s  . co m*/
    ManagerGUI.centralizar(frame);

}

From source file:br.unesp.rc.desafio.utils.Utils.java

public static void createBar(DefaultCategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart("Grafico", " ", " ", dataset);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.black);
    ChartFrame frame = new ChartFrame("Grafico de BArras", chart);
    frame.setVisible(true);
    //frame.setSize(400,350);
    ManagerGUI.centralizar(frame);/*from w  w  w. ja  v  a 2 s . c  om*/

}

From source file:br.unesp.rc.desafio.utils.Utils.java

public static void createLine(DefaultCategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createLineChart("Grafico", " ", " ", dataset);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.black);
    ChartFrame frame = new ChartFrame("Grafico de BArras", chart);
    frame.setVisible(true);
    frame.setSize(400, 350);//from ww  w.ja va 2  s .  c  om
    ManagerGUI.centralizar(frame);

}

From source file:frequencyassignment.charts.Charts.java

public static void displayPie(String name, HashMap<String, Double> categoryValue) {
    DefaultPieDataset data = new DefaultKeyedValuesDataset();
    for (Map.Entry<String, Double> entry : categoryValue.entrySet()) {
        data.setValue(entry.getKey(), entry.getValue());
    }//from w  ww. j  ava2 s  .  c  om
    JFreeChart chart = ChartFactory.createPieChart("Pie Chart", data, true, true, true);
    ChartFrame frame = new ChartFrame(name, chart);
    frame.pack();
    frame.setVisible(true);
}

From source file:frequencyassignment.charts.Charts.java

public static void displayBarChart(String name, HashMap<Integer, Integer> categoryValue) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (Map.Entry<Integer, Integer> entry : categoryValue.entrySet()) {
        dataset.addValue(entry.getValue(), name, entry.getKey());
    }/*from  w ww.  ja  v  a  2  s  . co  m*/
    JFreeChart chart = ChartFactory.createBarChart("Bar Chart", "Category", "Value", dataset);
    ChartFrame frame = new ChartFrame(name, chart);
    frame.pack();
    frame.setVisible(true);
}

From source file:no.met.jtimeseries.CreateChart.java

private static void show(JFreeChart chart) {
    ChartFrame frame = new ChartFrame(chart, new java.awt.Dimension(800, 300));
    frame.pack();// w  ww . j  av a2  s  . c  o  m
    frame.setVisible(true);
}

From source file:frequencyassignment.charts.Charts.java

public static void displayScatterPlot(String name, HashMap<Double, Double> values) {
    XYSeries xyData = new XYSeries(name);
    for (Map.Entry<Double, Double> entry : values.entrySet()) {
        xyData.add(entry.getKey(), entry.getValue());
    }/*www. j  a v a  2  s  .c  o m*/
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection(xyData);
    JFreeChart chart = ChartFactory.createScatterPlot(name, "X", "Y", (XYDataset) xySeriesCollection);
    ChartFrame frame = new ChartFrame(name, chart);
    frame.pack();
    frame.setVisible(true);
}