Search in sources :

Example 16 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowPlanSummary method divide.

private Map<String, DataPair> divide(Map<String, DataPair> numerators, Map<String, DataPair> denominators) {
    Map<String, DataPair> result = new LinkedHashMap<String, DataPair>();
    for (Entry<String, DataPair> e : denominators.entrySet()) {
        String phaseName = e.getKey();
        DataPair denominator = e.getValue();
        DataPair numerator = numerators.get(phaseName);
        if (numerator == null)
            continue;
        DataPair ratio = new DataPair(numerator).divide(denominator);
        result.put(phaseName, ratio);
    }
    return result;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) DataPair(net.sourceforge.processdash.util.DataPair)

Example 17 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class ProcessAnalysisPage method getTimeInPhaseToDate.

@//
Chart(//
id = "phaseToDate", //
type = "pie", //
titleKey = "Plan.Time_In_Phase_Title", //
smallFmt = "hideLegend=t", format = "colorScheme=consistent\nconsistentSkip=2")
public ResultSet getTimeInPhaseToDate(ChartData chartData) {
    Map<String, DataPair> time = chartData.histData.getTotalTimeInPhase();
    double totalTime = time.remove(WorkflowHistDataHelper.TOTAL_PHASE_KEY).actual;
    List<String> phases = new ArrayList(time.keySet());
    ResultSet data = new ResultSet(phases.size(), 2);
    data.setColName(0, getRes("Phase"));
    data.setColName(1, getRes("Hours"));
    data.setColName(2, getRes("Percent_Units"));
    data.setFormat(2, "100%");
    for (int row = phases.size(); row > 0; row--) {
        String onePhase = phases.get(row - 1);
        data.setRowName(row, onePhase);
        data.setData(row, 1, num(time.get(onePhase).actual / 60));
        data.setData(row, 2, num(time.get(onePhase).actual / totalTime));
    }
    return data;
}
Also used : ArrayList(java.util.ArrayList) ResultSet(net.sourceforge.processdash.data.util.ResultSet) DataPair(net.sourceforge.processdash.util.DataPair)

Aggregations

DataPair (net.sourceforge.processdash.util.DataPair)17 LinkedHashMap (java.util.LinkedHashMap)7 Map (java.util.Map)6 ResultSet (net.sourceforge.processdash.data.util.ResultSet)3 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 DoubleData (net.sourceforge.processdash.data.DoubleData)1 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 WorkflowHistDataHelper (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)1 Enactment (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment)1