/** {@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;
}