Example usage for org.jfree.data.category DefaultCategoryDataset setValue

List of usage examples for org.jfree.data.category DefaultCategoryDataset setValue

Introduction

In this page you can find the example usage for org.jfree.data.category DefaultCategoryDataset setValue.

Prototype

public void setValue(double value, Comparable rowKey, Comparable columnKey) 

Source Link

Document

Adds or updates a value in the table and sends a DatasetChangeEvent to all registered listeners.

Usage

From source file:swing.PrincipalMDI.java

private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
    // TODO add your handling code here:

    DefaultCategoryDataset barDataSet = new DefaultCategoryDataset();
    barDataSet.setValue(cptAttente, "ticket", "En attente");
    barDataSet.setValue(cptEnCours, "ticket", "En cours");
    barDataSet.setValue(cptNonAttribue, "ticket", "Non attribu");
    barDataSet.setValue(cptResolu, "ticket", "Resolu");
    barDataSet.setValue(cptATraiter, "ticket", "A traiter");
    JFreeChart chart = ChartFactory.createBarChart3D("Camembert", "Bar", "Ticket", barDataSet,
            PlotOrientation.VERTICAL, false, true, false);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.blue);
    ChartFrame frame = new ChartFrame("Bar", chart);
    frame.setVisible(true);/*w w  w.j a v  a2  s  . com*/
    frame.setSize(600, 500);
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getOilCheck(), "Oil", carList.getTimestamp());
    }//from  w w  w .ja va 2 s . com
    JFreeChart chart = ChartFactory.createBarChart("Oil", "Timestamp", "Oil", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("OIL GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600); // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getTyrePressure(), "Tyre Pressure", carList.getTimestamp());
    }//from  www .j a  va  2s  .  co  m
    JFreeChart chart = ChartFactory.createBarChart("Tyre Pressure", "Timestamp", "Tyre Pressure", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("TYRE PRESSURE GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600); // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getPollutionLevel(), "Pollution", carList.getTimestamp());
    }//from   w  ww .  ja v a 2  s . co  m
    JFreeChart chart = ChartFactory.createBarChart("Pollution", "Timestamp", "Pollution", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("POLLUTION GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600); // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void viewAlignmentBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewAlignmentBtnActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getAlignment(), "Alignment", carList.getTimestamp());
    }/*from  w w w . j a v  a2s  . com*/
    JFreeChart chart = ChartFactory.createBarChart("Alignment", "Timestamp", "Alignment", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("ALIGNMENT GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
    // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void batteryBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_batteryBtnActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getBattery(), "Battery", carList.getTimestamp());
    }/*from   ww w  . j a  va 2  s  .  c o m*/
    JFreeChart chart = ChartFactory.createBarChart("Battery", "Timestamp", "Battery", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("BATTERY GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
    // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getBrakingSys(), "Brakes", carList.getTimestamp());
    }//from w  w w.j a v a 2 s  . c o  m
    JFreeChart chart = ChartFactory.createBarChart("Brakes", "Timestamp", "Brakes", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("BRAKES GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
    // TODO add your handling code here:
}

From source file:WeeklyReport.Sections.Declines.java

private JFreeChart declinesByCommodityClassChart() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    Map<Double, Map<String, String>> mp = DECLINES_BY_COMMODITY_CLASS;
    mp.entrySet().stream().forEach((mapEntry) -> {
        Map<String, String> m1 = mapEntry.getValue();
        m1.entrySet().stream().forEach((pair) -> {
            dataset.setValue(mapEntry.getKey(), pair.getValue(), pair.getKey());
        });/*ww  w  .  jav a2  s. c  o  m*/
    });
    JFreeChart barChart = ChartFactory.createBarChart3D("Declines by Commodity Class", "Commodity Class",
            "Cubic Meters", dataset, PlotOrientation.VERTICAL, true, true, false);
    return barChart;

}

From source file:javaapplication1.AlgoritmoGenetico.java

public void graficarErrorPatron(double[] errorPatron) {

    //Fuentes de datos       
    DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();

    for (int i = 0; i < errorPatron.length; i++) {

        line_chart_dataset.setValue(errorPatron[i], "Error", String.valueOf(i + 1));
    }/*from   ww  w  .j  a  v a  2 s .co  m*/

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createLineChart("Errores por patron", "patrones", "Errores",
            line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel1.removeAll();
    panel1.add(chartPanel, BorderLayout.CENTER);
    panel1.validate();

}

From source file:UserInterface.AdminWorkArea.InventoryUsageJPanel.java

private void usageJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usageJButtonActionPerformed
    DefaultTableModel dtm = (DefaultTableModel) deviceUsageJTable.getModel();
    int rows = dtm.getRowCount();

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (int i = 0; i < rows; i++) {
        int num = (int) deviceUsageJTable.getValueAt(i, 1);
        dataSet.setValue(num, "Number Of Reservations", String.valueOf(deviceUsageJTable.getValueAt(i, 0)));
    }/*from w  w  w  .j  av  a 2s  .c o  m*/

    JFreeChart chart = ChartFactory.createBarChart("Device Usage Chart", "Device Name",
            "Number of Reservations", dataSet, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLACK);

    ChartFrame frame = new ChartFrame("Sales Overview", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
}