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:br.com.utfpr.pb.view.GraficoTotalVendasView.java

public GraficoTotalVendasView() {
    try {// w  ww . ja  v a 2  s.  c om
        // cria o grfico
        JFreeChart grafico = ChartFactory.createBarChart("Total de Vendas vs Compras por Data", "Data",
                "Valor Total", graficoDao.totalVendasPorData(), PlotOrientation.VERTICAL, true, true, false);

        //exibe o grfico
        ChartFrame frame = new ChartFrame("Grfico", grafico);
        frame.pack();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:br.com.utfpr.pb.view.GraficoQuantidadeVendasView.java

public GraficoQuantidadeVendasView() {
    try {//  w w w .j  a v  a 2 s .c  o  m
        // cria o grfico
        JFreeChart grafico = ChartFactory.createBarChart("Nmero de Vendas vs Compras por Data", "Data",
                "Quantidade", graficoDao.quantidadeVendasPorData(), PlotOrientation.VERTICAL, true, true,
                false);

        //exibe o grfico
        ChartFrame frame = new ChartFrame("Grfico", grafico);
        frame.pack();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

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();/*from w  w  w  . j  a  v  a  2s .  com*/
    panel.setVisible(true);

}

From source file:trabajoanalisis.grafico.java

public void graficar(JTable a) {
    XYSeries series = new XYSeries("t/n");

    // Introduccion de datos
    int i = 0;//w w w . j  a va2s  .co m
    while (a.getValueAt(i, 1) != null) {
        System.out.println(a.getValueAt(i, 1).toString());
        System.out.println(i);
        series.add(Integer.parseInt(a.getValueAt(i, 0).toString()),
                Integer.parseInt(a.getValueAt(i, 1).toString()));
        System.out.println("Se ha agregado " + Integer.parseInt(a.getValueAt(i, 0).toString()) + " y "
                + a.getValueAt(i, 1).toString());
        i++;

    }
    //        series.add(1, 1);
    //        series.add(2, 6);
    //        series.add(3, 3);
    //        series.add(4, 10);

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    JFreeChart chart = ChartFactory.createXYLineChart("Grafica", // Ttulo
            "n", // Etiqueta Coordenada X
            "tiempo", // Etiqueta Coordenada Y
            dataset, // Datos
            PlotOrientation.VERTICAL, true, // Muestra la leyenda de los productos (Producto A)
            false, false);

    // Mostramos la grafica en pantalla
    ChartFrame frame = new ChartFrame("Grafica", chart);
    frame.pack();
    frame.setVisible(true);

}

From source file:UserInterface.JFreeChartJPanel.java

public JFreeChartJPanel(VitalSign vs, JPanel upc) {
    initComponents();//from www.ja  v  a  2 s.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(600, 600);
}

From source file:br.unicamp.cst.behavior.bn.support.Grafico.java

public Grafico(String frametitle, String charttitle, String xlabel, String ylabel, XYSeriesCollection dataset) {
    JFreeChart chart = ChartFactory.createXYLineChart(charttitle, xlabel, ylabel, dataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYPlot plot = (XYPlot) chart.getPlot();

    plot.setBackgroundPaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setShapesVisible(true);/*from   w ww  .ja  v a2s  .  c o  m*/
    renderer.setShapesFilled(true);

    setXyplot(plot);
    setChart(chart);

    ChartFrame frame = new ChartFrame(frametitle, chart);

    frame.pack();
    frame.setVisible(true);
}

From source file:UserInterface.JFreeChart.java

public JFreeChart(VitalSign vs, JPanel upc) {
    initComponents();//ww w  .  j  a va2s . co  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:userInterface.MonitoringTeamRole.EnvironmentJPanel.java

private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
    // TODO add your handling code here:

    JFreeChart chart = createChart(createDataset());
    chart.setBackgroundPaint(Color.YELLOW);
    chart.getTitle().setPaint(Color.red);

    ChartFrame frame = new ChartFrame("XYChart", chart);
    frame.setVisible(true);
    frame.setSize(450, 500);/*from w w  w  .j ava 2 s. c  o  m*/

}

From source file:prc2.Graficos.java

public void PieGraphI(ArrayList<Integer> d, int pos, String s, String y) {
    //System.out.println("Estoy EN PIEGRAPH");
    // Fuente de Datos
    DefaultPieDataset data = new DefaultPieDataset();
    int tmp = 0;/*from  www . j  a v a 2 s  .c  o m*/
    for (int i = pos; i <= pos + 11; i++) {
        tmp += 1;
        data.setValue("Mes " + tmp + ": " + d.get(i) + " ", d.get(i));

        //data.setValue(d.get(pos), 45);
        //data.setValue("Python", 15);
    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createPieChart("Grfico de " + s + " para el ao " + y, data, true, true,
            false);

    // Mostrar Grafico
    ChartFrame frame = new ChartFrame("JFreeChart", chart);

    frame.pack();
    frame.setVisible(true);
}

From source file:muh.GrafikDeneme.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    DefaultCategoryDataset dcd = new DefaultCategoryDataset();
    dcd.setValue(78.80, "Marks", "Ganesh");
    dcd.setValue(68.80, "Marks", "Dinesh");
    dcd.setValue(88.80, "Marks", "John");
    dcd.setValue(98.80, "Marks", "Ali");
    dcd.setValue(58.80, "Marks", "Sachin");

    JFreeChart jchart = ChartFactory.createBarChart3D("Student Record", "Student Name", "Student Marks", dcd,
            PlotOrientation.VERTICAL, true, true, false);

    CategoryPlot plot = jchart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.black);

    ChartFrame chartFrm = new ChartFrame("Student Record", jchart, true);
    chartFrm.setVisible(true);
    chartFrm.setSize(500, 400);/*from  w  w w . j av a  2 s. c  o  m*/

    //SMD PENCERENN NE KOYACAAAAAAAAAAAAAAAAK

    ChartPanel chartPanel = new ChartPanel(jchart);
    //  DESGNDEN PANELN ADINI DETRD pnlReport ,,set layout=box

    pnlReport.removeAll();
    pnlReport.add(chartPanel);
    pnlReport.updateUI();

}