Element graphAnomaly = graphs.addElement("graph").addAttribute("gid", "1");
Element graphSmoothed = graphs.addElement("graph").addAttribute("gid", "2");
for (int i = 0; i < temperatureAnomalyArray.length; i++) {
String xid = String.valueOf(i);
TemperatureAnomaly data = temperatureAnomalyArray[i];
series.addElement("value").addAttribute("xid", xid).addText(String.valueOf(data.getYear()));
Element graphAnomalyValue = graphAnomaly.addElement("value").addAttribute("xid", String.valueOf(i))
.addText(String.valueOf(data.getAnomaly()));
graphAnomalyValue.addAttribute("url", url + i);
if (data.getAnomaly() < 0) {
graphAnomalyValue.addAttribute("color", "#318DBD");
}
graphSmoothed.addElement("value").addAttribute("xid", xid).addText(String.valueOf(data.getSmoothed()));
}
HttpServletResponse response = Struts2Utils.getResponse();
response.setContentType("text/xml;charset=utf-8");