Map<String, LineChart> charts = new LinkedHashMap<String, LineChart>();
int step = m_dataExtractor.getStep();
for (Entry<String, Map<String, String>> keyMapEntry : aggregationKeys.entrySet()) {
String chartTitle = keyMapEntry.getKey();
LineChart lineChart = new LineChart();
lineChart.setTitle(chartTitle);
lineChart.setHtmlTitle(chartTitle);
lineChart.setId(chartTitle);
lineChart.setStart(startDate);
lineChart.setUnit(buildUnit(chartTitle));
lineChart.setStep(step * TimeHelper.ONE_MINUTE);
if (keyMapEntry.getValue().entrySet().isEmpty()) {
lineChart.add("none", buildNoneData(startDate, endDate, 1));
}
for (Entry<String, String> ip2MetricKey : keyMapEntry.getValue().entrySet()) {
String key = ip2MetricKey.getValue();
String lineTitle = ip2MetricKey.getKey();
if (dataWithOutFutures.containsKey(key)) {
Map<Long, Double> all = convertToMap(datas.get(key), startDate, 1);
Map<Long, Double> current = convertToMap(dataWithOutFutures.get(key), startDate, step);
addLastMinuteData(current, all, m_lastMinute, endDate);
convertFlowMetric(lineChart, current, lineTitle);
} else {
lineChart.add(lineTitle, buildNoneData(startDate, endDate, 1));
}
}
charts.put(chartTitle, lineChart);
}
return charts;