@Resource
private ProjectService projectService;
@RequestMapping(value = "/projects/{projectName}/metrics", method = RequestMethod.GET)
public @ResponseBody ModelMap renderVar(ModelMap map, @PathVariable String projectName, String metricName,String newChartTitle) {
Project project = projectService.findProject(projectName);
if(StringUtils.isNotEmpty(newChartTitle)){
project.getViews().put(newChartTitle, metricName);
projectService.saveProject(project);
}
String[] metrics = metricName.split(",");
List<List<MetricValue>> metricLists=Lists.newArrayList();
for(String name:metrics){
metricLists.add(project.findMetricData(name));
}
map.put("data", ChartUtil.format(metricLists));
return map;
}