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:org.squale.squaleweb.util.graph.AbstractGraphMaker.java

/**
 * Pour deboguer/*w ww .  j a  va2s  . c  o m*/
 * 
 * @param pTitle un titre de frame
 * @return une frame (ChartFrame) contenant le diagramme
 */
public ChartFrame getImageInFrame(String pTitle) {
    return new ChartFrame(pTitle, getChart());
}

From source file:clientesbac.frmConsultaClientes.java

public void barras() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(1, "Cliente", "Regular");
    dataset.setValue(1, "Cliente", "Corporativo");
    dataset.setValue(1, "Cliente", "Adulto Mayor");
    dataset.setValue(1, "Cliente", "Embarazada");
    dataset.setValue(1, "Cliente", "Discapacitado");
    // Creando el Grafico
    JFreeChart chart = ChartFactory.createBarChart3D("Grfico de barras por tipo de Cliente", "", "Cantidad",
            dataset, PlotOrientation.VERTICAL, true, true, false);

    ChartFrame frame = new ChartFrame("Reporte", chart);
    frame.pack();//from w  w w .  j  a va  2 s. c o m
    frame.setVisible(true);
}

From source file:dumbara.view.Chart1.java

public static void loanInfo() {
    DefaultPieDataset objDataset = new DefaultPieDataset();
    try {//w  w w  .  j  ava 2  s  . c  o m
        Loan[] loan = LoanController.viewLoan();
        for (Loan loan1 : loan) {
            objDataset.setValue(loan1.getLoanID(), Double.parseDouble(loan1.getLongAmount()));
        }
    } catch (ClassNotFoundException | SQLException ex) {
        Logger.getLogger(Chart1.class.getName()).log(Level.SEVERE, null, ex);
    }

    JFreeChart objChart = ChartFactory.createPieChart("Variation of Loan Amounts", objDataset, true, true,
            false);
    ChartFrame frame = new ChartFrame("Data Analysis Wizard - v2.1.4", objChart);
    frame.pack();
    frame.setVisible(true);
    frame.setLocationRelativeTo(null);
}

From source file:result.analysis.Chart.java

void perSemPerformace(String batch, String sem, String[] colleges) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (String college : colleges) {
        db = mongoClient.getDB(college);
        String collection_name = "cs_" + batch + "_" + sem + "_sem";
        DBCollection collection = db.getCollection(collection_name);

        analyz = new Analyze(db);
        double number = analyz.GetNumber(collection, "FAIL");
        dataset.setValue(number, college, "FAIL");
        number = analyz.GetNumber(collection, "FIRST CLASS");
        dataset.setValue(number, college, "First Class");

        number = analyz.GetNumber(collection, "SECOND CLASS");
        dataset.setValue(number, college, "Second class");

        number = analyz.GetNumber(collection, "FIRST CLASS WITH DISTINCTION");
        dataset.setValue(number, college, "First Class With Distinction");

    }//from ww w .  j  a v a  2s.c  om
    JFreeChart pieChart = ChartFactory.createMultiplePieChart("Classwise Distribution", dataset,
            TableOrder.BY_ROW, true, true, true);
    //        MultiplePiePlot plot = (MultiplePiePlot) pieChart.getPlot();
    //        plot.setStartAngle(290);
    //        plot.setDirection(Rotation.CLOCKWISE);
    //        plot.setForegroundAlpha(0.5f);
    MultiplePiePlot plot = (MultiplePiePlot) pieChart.getPlot();
    JFreeChart subchart = plot.getPieChart();
    PiePlot p = (PiePlot) subchart.getPlot();
    // p.setSimpleLabels(true);
    p.setExplodePercent("First Class With Distinction", 0.10);

    p.setExplodePercent("First Class", 0.10);
    p.setExplodePercent("Second class", 0.10);
    p.setExplodePercent("FAIL", 0.10);
    PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
            new DecimalFormat("0"), new DecimalFormat("0%"));
    p.setLabelGenerator(gen);

    ChartFrame frame = new ChartFrame("Semester Wise Performance of " + batch + " year", pieChart);
    frame.setVisible(true);
    frame.setSize(500, 500);
    save_jpeg(pieChart);

}

From source file:control.JGeraGraficos.java

private void PrintGrafico(ArrayList<DadosEstatisticos> listaJava, ArrayList<DadosEstatisticos> listaJavaThRead,
        ArrayList<DadosEstatisticos> listaOpenCl) {
    int i = 0;/*www  .  ja va 2  s  .  c  om*/
    String titulo = "";
    for (DadosEstatisticos dados : listaJava) {
        i++;
        if (listaJava.indexOf(dados) < 2) {
            titulo = titulo + "C" + i + " - " + dados.getDescricao() + "       ";
        } else {
            titulo = titulo + "C" + i + " - " + dados.getDimensoes() + "       ";
        }
    }

    JFreeChart chart = createGraficoXY("GRAFICO TOTAL DE PROCESSOS", titulo, " TEMPO (ms)",
            createDataset(listaJava, listaJavaThRead, listaOpenCl));
    ChartFrame frame = new ChartFrame("GRAFICO TOTAL DE PROCESSOS", chart);

    frame.setExtendedState(ChartFrame.MAXIMIZED_BOTH);
    frame.setVisible(true);

}

From source file:pwr.lab5.Window.java

public void showChart(Window win) {
    final JFreeChart chart = ChartFactory.createXYLineChart("DOM, SAX, StAX parsing time", // chart title
            "number of XML nodes", // x axis label
            "time [ms]", // y axis label
            win.dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );/*  ww w.j  a v  a2  s.c o m*/
    ChartFrame pane = new ChartFrame("ELO", chart);
    pane.pack();
    pane.setVisible(true);
}

From source file:application.logik.Logik.java

public void stats() {
    //http://www.math.hu-berlin.de/~ccafm/lehre_BZQ_Numerik/allg/JAVA_Pakete/JFreeChart/Codes/PieChart_code.html
    //JFreeChart Library (GNU License deshalb benutzen wir die MIT-Lizenz)
    long[] arr = new long[3];
    arr[0] = trT;//w ww .j  a v  a2  s .c  o  m
    arr[2] = trR;
    arr[1] = trC;
    arr[step] += trackStop();
    String[] timeText = new String[3];
    for (int i = 0; i < timeText.length; i++) {
        arr[i] = arr[i] / 1000;
        long sek = arr[i] % 60;
        long min = arr[i] / 60;
        if (sek < 10) {
            timeText[i] = min + " : 0" + sek;
        } else {
            timeText[i] = min + " : " + sek;
        }
    }
    long ges = (trT + trR + trC) / 100;
    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("Red: " + timeText[0] + "min", ges * arr[0]);
    pieDataset.setValue("Refactor: " + timeText[2] + "min", ges * arr[2]);
    pieDataset.setValue("Green: " + timeText[1] + "min", ges * arr[1]);

    JFreeChart chart = ChartFactory.createPieChart("Time", pieDataset, true, false, false);
    ChartFrame frame = new ChartFrame("Chart", chart);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}

From source file:com.ohalo.cn.awt.JFreeChartTest.java

public void testDataCharts() {
    DefaultPieDataset dpd = new DefaultPieDataset(); // 
    dpd.setValue("?", 25); // ?
    dpd.setValue("", 25);
    dpd.setValue("?", 45);
    dpd.setValue("", 10);

    JFreeChart chart = ChartFactory.createPieChart("???", dpd, true, true, false);
    // ?API,?????Legend??????URL

    ChartFrame chartFrame = new ChartFrame("???", chart);
    // chart?JavaChartFramejavaJframe????
    chartFrame.pack(); // ??
    chartFrame.setVisible(true);// ???
}

From source file:userInterface.MonitoringTeamRole.DashBoarJPanel.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);/*  w w  w.j av a2s.  c  o m*/
    frame.setSize(450, 500);
}

From source file:com.mycompany.task1.Chart.java

private JFreeChart displayChart(DefaultCategoryDataset dataSet) {

    JFreeChart chart;/*w  ww .jav  a2 s  .  c o m*/
    chart = ChartFactory.createBarChart("Irysy", "ilo", " ", dataSet, PlotOrientation.VERTICAL, true, true,
            true);
    CategoryPlot plot = chart.getCategoryPlot();
    //chart.removeLegend();
    plot.setRangeGridlinePaint(Color.black);
    ChartFrame frame;
    frame = new ChartFrame("Irysy", chart);
    frame.setVisible(true);
    frame.setSize(700, 550);

    return chart;
}