Package org.primefaces.model.chart

Examples of org.primefaces.model.chart.BarChartModel


public class BarRenderer extends CartesianPlotRenderer {
   
    @Override
    protected void encodeData(FacesContext context, Chart chart) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        BarChartModel model = (BarChartModel) chart.getModel();
        boolean horizontal = model.getOrientation().equals("horizontal");
       
        //data
    writer.write(",data:[" );
        for(Iterator<ChartSeries> it = model.getSeries().iterator(); it.hasNext();) {
            ChartSeries series = it.next();
            int i = 1;

            writer.write("[");
            for(Iterator<Object> its = series.getData().keySet().iterator(); its.hasNext();) {
View Full Code Here


    @Override
    protected void encodeOptions(FacesContext context, Chart chart) throws IOException {
        super.encodeOptions(context, chart);
       
        ResponseWriter writer = context.getResponseWriter();
        BarChartModel model = (BarChartModel) chart.getModel();
        String orientation = model.getOrientation();
        int barPadding = model.getBarPadding();
        int barMargin = model.getBarMargin();
        List<String> ticks = model.getTicks();
       
        writer.write(",series:[");
        for(Iterator<ChartSeries> it = model.getSeries().iterator(); it.hasNext();) {
            ChartSeries series = (ChartSeries) it.next();
            series.encode(writer);

            if(it.hasNext()) {
                writer.write(",");
            }
        }
        writer.write("]");
       
        writer.write(",ticks:[");
        for(Iterator<String> tickIt = ticks.iterator(); tickIt.hasNext();) {
            writer.write("\"" + ComponentUtils.escapeText(tickIt.next()) + "\"");
            if(tickIt.hasNext()) {
                writer.write(",");
            }
        }
        writer.write("]");

        if(orientation != null) writer.write(",orientation:\"" + orientation + "\"");
        if(barPadding != 8) writer.write(",barPadding:" + barPadding);
        if(barMargin != 10) writer.write(",barMargin:" + barMargin);       
        if(model.isStacked()) writer.write(",stackSeries:true");      
        if(model.isZoom()) writer.write(",zoom:true");       
        if(model.isAnimate()) writer.write(",animate:true")
        if(model.isShowPointLabels()) writer.write(",showPointLabels:true");
        if(model.isShowDatatip()) {
            writer.write(",datatip:true");
            if(model.getDatatipFormat() != null)
                writer.write(",datatipFormat:\"" + model.getDatatipFormat() + "\"");
        }
    }
View Full Code Here

        yAxis.setMin(0);
        yAxis.setMax(200);
    }
    
    private BarChartModel initBarModel() {
        BarChartModel model = new BarChartModel();
        ChartSeries boys = new ChartSeries();
        boys.set("Auditoria", 120);
        boys.set("Secretaria", 100);
        boys.set("Operacional", 44);
        boys.set("Finanças", 150);
        boys.set("T.I", 25);
        model.addSeries(boys);
        
        return model;
    }
View Full Code Here

        
        return model;
    }
    
    private BarChartModel initBarModel2() {
        BarChartModel model = new BarChartModel();
       ChartSeries boys2 = new ChartSeries();
        boys2.set("Auditoria", 10);
        boys2.set("Secretaria", 40);
        boys2.set("Operacional", 12);
        boys2.set("Finanças", 15);
        boys2.set("T.I", 25);
        model.addSeries(boys2);
        
        return model;
    }
View Full Code Here

        
        return model;
    }
   
    private BarChartModel initBarModel3() {
        BarChartModel model = new BarChartModel();
       ChartSeries boys3 = new ChartSeries();
        boys3.set("Pendente", 10);
        boys3.set("Respondida", 40);
        boys3.set("Não procede", 12);
        boys3.set("Concluída e eficaz", 15);
        boys3.set("Concluída e ineficaz", 25);
        model.addSeries(boys3);
        
        return model;
    }
View Full Code Here

        yAxis.setMin(0);
        yAxis.setMax(200);
    }
    
    private BarChartModel initBarModel() {
        BarChartModel model = new BarChartModel();
        ChartSeries boys = new ChartSeries();
        boys.set("Auditoria", 120);
        boys.set("Secretaria", 100);
        boys.set("Operacional", 44);
        boys.set("Finanças", 150);
        boys.set("T.I", 25);
        model.addSeries(boys);
        
        return model;
    }
View Full Code Here

        
        return model;
    }
    
    private BarChartModel initBarModel2() {
        BarChartModel model = new BarChartModel();
       ChartSeries boys2 = new ChartSeries();
        boys2.set("Auditoria", 10);
        boys2.set("Secretaria", 40);
        boys2.set("Operacional", 12);
        boys2.set("Finanças", 15);
        boys2.set("T.I", 25);
        model.addSeries(boys2);
        
        return model;
    }
View Full Code Here

        
        return model;
    }
   
    private BarChartModel initBarModel3() {
        BarChartModel model = new BarChartModel();
       ChartSeries boys3 = new ChartSeries();
        boys3.set("Pendente", 10);
        boys3.set("Respondida", 40);
        boys3.set("Não procede", 12);
        boys3.set("Concluída e eficaz", 15);
        boys3.set("Concluída e ineficaz", 25);
        model.addSeries(boys3);
        
        return model;
    }
View Full Code Here

TOP

Related Classes of org.primefaces.model.chart.BarChartModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.