MeasurementChartsManagerLocal chartsManager = LookupUtil.getMeasurementChartsManager();
Map<MeasurementDefinition, List<MetricDisplaySummary>> data = chartsManager
.getMetricDisplaySummariesForMetricsCompare(subject, resourceIds, definitionIds, begin, end);
Map<MeasurementCategory, Map<MeasurementDefinition, List<MetricDisplaySummary>>> compareMetrics = new HashMap<MeasurementCategory, Map<MeasurementDefinition, List<MetricDisplaySummary>>>();
for (MeasurementDefinition definition : data.keySet()) {
MeasurementCategory category = definition.getCategory();
Map<MeasurementDefinition, List<MetricDisplaySummary>> listWithinCategory = compareMetrics.get(category);
if (listWithinCategory == null) {
listWithinCategory = new HashMap<MeasurementDefinition, List<MetricDisplaySummary>>();
compareMetrics.put(category, listWithinCategory);
}