Não consigo gerar os graficos no JSP. A mensagem é de erro na Servlet.
Existe algum macete pra construir o XML pra gerar graficos JFreeChart ou Cewolf?
Agradeço se alguem souber.
Java:
package br.com.storeautomacao;
import java .util.Date;
import java.util.Map;
import java.io.Serializable;
import org.jfree.data.contour.DefaultContourDataset;
import de.laures.cewolf.DatasetProduceException;
import de.laures.cewolf.DatasetProducer;
public class Barras implements DatasetProducer, Serializable {
private final String[] mes = {“Janeiro”, “Fevereiro”, “Março”, “Abril”, “Maio”,
" Junho", “Julho”,“Agosto”, “Setembro”, “Outubro”,
“Novembro”, “Dezembro”};
private final String[] ano = {“2000”, “2001”, “2002”, “2003”, “2004”};
public Object produceDataset(Map params) throws DatasetProduceException {
DefaultContourDataset dataset = new DefaultContourDataset();
for (int a=0; a<ano.length; a++) {
int valor = (int)(Math.random() * 1000 + 1000);
for (int i=0; i<mes.length; i++) {
final int y = valor + (int)(Math.random() * 200 - 100);
valor = y;
//(dataset.addValue((double)y, ano[a], mes[i]);
}
}
return dataset;
}
public boolean hasExpired(Map params, Date since) {
return (System.currentTimeMillis() - since.getTime()) > 5000;
}
public String getProducerId() {
return “PageViewCountData DatasetProducer”;
}
}
JSP:
<%@page contentType=“text/html”%>
<%@taglib uri=’/WEB-INF/cewolf.tld’ prefix=‘c’ %>
<HTML>
<BODY>
<H1>Page View Statistics</H1>
<HR>
<jsp:useBean id="view"
class=“br.com.storeautomacao.GraficoBarra”/>
<c:chart
id=“graficoBarra"
title=“Estatística"
type=“verticalbar3d"
xaxislabel=“Meses"
yaxislabel=“Valores”>
<cewolf:gradientpaint>
<cewolf:point x=“0” y=“0” color=”#FFFFFF”/>
<cewolf:point x=“300” y=“300” color=”#C8C8C8”/>
</cewolf:gradientpaint>
<cewolf:data>
<cewolf:producer id=“view”/>
</cewolf:data>
</cewolf:chart>
<p>
<cewolf:img chartid=“graficoBarra” renderer=“cewolf” width="800"
height=“500”/>
<P>
</BODY>
</HTML>
XML:
<servlet>
<servlet-name>TestaServlet</servlet-name>
<servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestaServlet</servlet-name>
<url-pattern>/barras</url-pattern>
</servlet-mapping>