Package org.ff4j.audit.graph

Examples of org.ff4j.audit.graph.PieGraph


    }
   
    /** {@inheritDoc} */
    @Override
    public PieGraph getTotalHitsPie(long startTime, long endTime) {
        PieGraph pieGraph = new PieGraph("Total Hits Count");
        List < String > colors   = Util.getColorsGradient(mapOfEvents.size());
        List < String > features = new ArrayList<String>(mapOfEvents.keySet());
        for(int idx = 0; idx < mapOfEvents.size();idx++) {
            Queue< Event > qEvents = mapOfEvents.get(features.get(idx));
            int counter = 0;
            for (Event evt : qEvents) {
                if (evt.getTimestamp() > startTime && evt.getTimestamp() < endTime) {
                    if (EventType.HIT_FLIPPED.equals(evt.getType())) {
                        counter++;
                    }
                }
            }
            pieGraph.getSectors().add(new PieSector(features.get(idx), counter, colors.get(idx)));
        }
        return pieGraph;
    }
View Full Code Here


    /** {@inheritDoc} */
    @Override
    public PieGraph getFeatureHitsPie(String featureId, long startTime, long endTime) {
        List < String > colors   = Util.getColorsGradient(4);
        Queue< Event > qEvents = mapOfEvents.get(featureId);
        PieGraph pieGraph = new PieGraph("Hits Count for " + featureId);
        int nbEnable = 0;
        int nbDisable = 0;
        int nbFlip = 0;
        int notFlip = 0;
        if (null != qEvents) {
            for (Event evt : qEvents) {
                if (evt.getTimestamp() > startTime && evt.getTimestamp() < endTime) {
                    switch (evt.getType()) {
                        case HIT_FLIPPED:
                            nbFlip++;
                        break;
                        case HIT_NOT_FLIPPED:
                            notFlip++;
                        break;
                        case ENABLE:
                            nbEnable++;
                        break;
                        case DISABLE:
                            nbDisable++;
                        default:
                        break;
                    }
                }
            }
        }
        pieGraph.getSectors().add(new PieSector("ENABLE", nbEnable, colors.get(0)));
        pieGraph.getSectors().add(new PieSector("DISABLE", nbDisable, colors.get(1)));
        pieGraph.getSectors().add(new PieSector("FLIP", nbFlip, colors.get(2)));
        pieGraph.getSectors().add(new PieSector("NOT_FLIP", notFlip, colors.get(3)));
        return pieGraph;
    }
View Full Code Here

        // Create Today PIE
        Calendar c = Calendar.getInstance();
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        PieGraph pie = getTotalHitsPie(c.getTimeInMillis(), System.currentTimeMillis());
        sb.append(",\"todayHitsPie\": " + pie);
       
        // Create today curve
        Curve curve = getTotalHitsCurve(c.getTimeInMillis(), System.currentTimeMillis(), 100);
        sb.append(",\"todayHitsCurve\": " + curve);
       
        int total = 0;
        for(PieSector sector : pie.getSectors()) {
            total += sector.getValue();
        }
        sb.append(",\"todayHitTotal\":" + total);
        sb.append("}");
        return sb.toString();
View Full Code Here

TOP

Related Classes of org.ff4j.audit.graph.PieGraph

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.