Example usage for org.jfree.chart ChartFrame ChartFrame

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

Introduction

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

Prototype

public ChartFrame(String title, JFreeChart chart) 

Source Link

Document

Constructs a frame for a chart.

Usage

From source file:DATA.Grafica.java

public void mostrarGrafica() {

    this.grafica = ChartFactory.createHistogram(titulo, "Nivel Gris", "Frecuencia", coleccion,
            PlotOrientation.VERTICAL, false, false, false);
    ChartFrame frame = new ChartFrame(titulo, grafica);
    frame.pack();/*from   w w w  . j  a va2 s .  co  m*/
    frame.setVisible(true);
}

From source file:Servidor.java

private void inicializarGraficosPastel() {
    datosPastel = new DefaultPieDataset();
    chart = ChartFactory.createPieChart("Grfica de Pastel.", datosPastel, true, true, false);
    frame = new ChartFrame("Vista", chart);
    frame.pack();/*from  w ww . ja va 2 s  . com*/
    frame.setVisible(true);
}

From source file:jfreechart.ViewGirlsBoysAvgChart.java

public static void viweGirlsAvgChart(List<String> testId, ArrayList<Double> totAvg, ArrayList<Double> girlsAvg,
        ArrayList<Double> boysAvg) throws SQLException, ClassNotFoundException {
    try {// w w w .  ja v a 2s .co  m
        UIManager.setLookAndFeel(new McWinLookAndFeel());
    } catch (UnsupportedLookAndFeelException ex) {
        Logger.getLogger(ViewEachStudentChart.class.getName()).log(Level.SEVERE, null, ex);
    }
    DefaultCategoryDataset objDataset = new DefaultCategoryDataset();

    for (Double marks : totAvg) {
        //Double mark = tstId;
        //String tetId = tstId.split(",")[3];
        objDataset.addValue(marks, "Line1", marks);

    }
    for (Double marks : girlsAvg) {
        //Double mark = tstId;
        //String tetId = tstId.split(",")[3];
        objDataset.addValue(marks, "Line2", marks);

    }
    //        for (Double testMark : bAvgList) {
    //            Double mark = testMark;
    //            //String tstId = testId.split(",")[3];
    //            objDataset.setValue(mark, "", mark);
    //            
    //            
    //        }
    JFreeChart objChart = ChartFactory.createLineChart("Marks Chart", //Chart title
            "Test", //Domain axis label
            "Marks", //Range axis label
            objDataset, //Chart Data 
            PlotOrientation.VERTICAL, // orientation
            true, // include legend?
            true, // include tooltips?
            false // include URLs?
    );

    ChartFrame frame = new ChartFrame("Dakma Higher Education Center", objChart);
    frame.setLocationRelativeTo(frame);
    frame.pack();
    frame.setVisible(true);
}

From source file:geneticonreinas.data.Grafica.java

public void mostrarGrafica() {
    // Crear la serie con los datos

    grafica = ChartFactory.createXYLineChart(this.tituloGrafica, this.axisXlabel, this.axisYlabel, coleccion,
            PlotOrientation.VERTICAL, true, false, false);

    ChartFrame panel = new ChartFrame(null, grafica);
    panel.pack();/*from   ww w  . j  a v  a 2s.  c  o m*/
    panel.setVisible(true);
}

From source file:algoritmosdeordenamiento.Grafica.java

public void creaYmuestraGrafica() {

    this.grafica = ChartFactory.createXYLineChart(nombre, tituloEjeX, tituloEjeY, series);

    // utilizar un panel especial dentro de jfreechart
    ChartFrame panel = new ChartFrame("grafica", grafica);
    panel.pack();/* w w  w  .  ja  v  a 2  s .  c  o m*/
    panel.setVisible(true);

}

From source file:UserInterface.JFreeChartJPanel.java

public JFreeChartJPanel(VitalSign vs, JPanel upc) {
    initComponents();/*  www .  j a v  a 2  s  . com*/

    this.vs = vs;
    this.upc = upc;

    int rr = (vs.getRespiratoryrate());
    int hr = vs.getHeartrate();
    int bp = vs.getBloodpressure();
    double w = vs.getWeight();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(rr, "", "Respiratory Rate");
    dataset.setValue(hr, "", "Heart Rate");
    dataset.setValue(bp, "", "Blood Pressure");
    dataset.setValue(w, "", "Weight");

    //    
    org.jfree.chart.JFreeChart chart = ChartFactory.createBarChart("VitalSign", "Vital Signs", "Range", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.black);
    ChartFrame frame = new ChartFrame("Bar Chart for _---_", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
}

From source file:metier.Freechart.java

public void stats() {
    List<Produit> produits = ProduitDAO.getInstance().readAll();

    DefaultPieDataset pieDataset = new DefaultPieDataset();
    for (Produit pr : produits) {
        pieDataset.setValue(pr.getNom(), new Integer(pr.getQuantiteInitial() - pr.getQuantiteDisponible()));

    }//from  w  w w .  j  a v  a  2 s.  c o m
    JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true);
    //.createPieChart(PieChart, pieDataset, true, true, true);
    PiePlot P = (PiePlot) chart.getPlot();
    P.setForegroundAlpha(TOP_ALIGNMENT);
    ChartFrame frame = new ChartFrame("Pie Chart", chart);
    frame.setVisible(true);
    frame.setSize(450, 500);

}

From source file:rozpoznawanie_zad1_klasyf.ChartRenderer.java

public ChartRenderer(String tytul) {
    NumberAxis xAxis = new NumberAxis("Cecha 2");
    //     xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Cecha 1");
    //XYItemRenderer rend;
    // rend = new XYLineAndShapeRenderer(false, true);
    //XYItemRenderer rend = new XYLineAndShapeRenderer(true, false);
    XYDotRenderer rend = new XYDotRenderer();
    rend.setDotHeight(5);/*from   w  w  w .  j a va 2  s. c om*/
    rend.setDotWidth(5);
    XYPlot plot = new XYPlot(ds, xAxis, yAxis, rend);
    //      dataset.addSeries("sin", sin);

    plot.setOrientation(PlotOrientation.VERTICAL);
    JFreeChart fc = new JFreeChart(plot);
    cf = new ChartFrame(tytul, fc);
    cf.setSize(1280, 720);
}

From source file:UserInterface.JFreeChart.java

public JFreeChart(VitalSign vs, JPanel upc) {
    initComponents();//from  w  w w  . j  av  a2s.c o m
    this.vs = vs;
    this.upc = upc;

    int rr = (vs.getRespiratoryrate());
    int hr = vs.getHeartrate();
    int bp = vs.getBloodpressure();
    double w = vs.getWeight();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(rr, "", "Respiratory Rate");
    dataset.setValue(hr, "", "Heart Rate");
    dataset.setValue(bp, "", "Blood Pressure");
    dataset.setValue(w, "", "Weight");

    //    
    org.jfree.chart.JFreeChart chart = ChartFactory.createBarChart("VitalSign", "Vital Signs", "Range", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.black);
    ChartFrame frame = new ChartFrame("Bar Chart for _---_", chart);
    frame.setVisible(true);
    frame.setSize(450, 350);
}

From source file:mes2.Chart.java

public void createwykres() {
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection(dataSet);
    // Dodanie kolejnych serii do kolekcji:
    xySeriesCollection.addSeries(dataSet2);

    // tworzenie XYDataSet 
    XYDataset xyDataset = xySeriesCollection;
    // tworzenie wykresu 
    JFreeChart lineGraph = ChartFactory.createXYLineChart("Wykres nagrzewania wsadu", // Title 
            "Czas", // X-Axis label 
            "Temperatura", // Y-Axis label 
            xyDataset, // Dataset 
            PlotOrientation.VERTICAL, //Plot orientation 
            true, //show legend 
            true, // Show tooltips 
            false //url show 
    );/* w ww. j a  v a  2s. c  om*/
    ChartFrame frame1 = new ChartFrame("Szybkie wyswietlanie wykresu - klasa ChartFrame", lineGraph);
    frame1.pack();
    frame1.setVisible(true);
    frame1.setLocationRelativeTo(null);
    //frame1.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    ChartPanel chartPanel = new ChartPanel(lineGraph);
    //frame.getContentPane().add(chartPanel);
    // frame.getContentPane().add(new JLabel("<<< wykres dodany jako ChartPanel"));

}