public static PieChartJson productPieChart(String diagName, Map<String, DiagCountDTO> values) { PieChart chart = new PieChart(); chart.setCaption(diagName); chart.setFormatnumberscale("0"); chart.setUnescapeLinks("0"); List<Data> data = new ArrayList<Data>(); Iterator<String> it = values.keySet().iterator(); while (it.hasNext()) { String key = it.next(); String dName = key.substring(0, key.lastIndexOf("-")); String dValue = key.substring(key.lastIndexOf("-") + 1); String value = Integer.toString(values.get(key).getCount()); key = key.endsWith("1") ? key.substring(0, key.lastIndexOf("1") - 1) : key; data.add( new PieData( key, value, "javascript:showPatientTable('" + DiagMap.getKey(dName) + "','" + DiagMap.getKey(dValue) + "')")); } PieChartJson chartJson = new PieChartJson(); chartJson.setData(data); chartJson.setChart(chart); return chartJson; }