Download
SVN location: https://carlosrodriguezdev.googlecode.com/svn/20110111_JFreeChar_BarChart
How to Run
1 - mvn jetty:run
2 - on your browser: http://localhost:8085
3 - click on the link that will appear
You should see:
| Click the Image |
How it Works
barchart.BarChartGerador
Creates the BarChartbarchart.PendenciaBarRenderer
Extends BarRenderer3D making it possible to change Bar Colors the way you want.barchart.PendenciaData
Carries all the attributes necessary for every row in the chart. It's a POJO.barchart.PendenciaDataset
Handles which bars should be created for each PendenciaData. Usually a chart has 1 bar for each Item, but this one, for example, has 2.barchart.PendenciaURLGenerator
Lets you customize all the links inside the chart imageindex.jsp
<%
PendenciaDataset dataset = BarChartGerador.mockCriarDataset();
// generates the <MAP> in the JSP for all the links inside the chart image
BarChartGerador grafico = new BarChartGerador("JFreeChart - Bar Chart Example", dataset, session, new PrintWriter(out));
String filename = grafico.getFilename();
String graficoGeradoURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%>
<img src="<%= graficoGeradoURL %>" border=0 usemap="#<%= filename %>">
Thanks for sharing. Which version of JFreeChart are you using?
ReplyDeleteI see in you .pom it is 0.9.20 - very old
ReplyDeletenp
ReplyDeleteyes, it was for a legacy system, this example is compatible with 1.0.0, but i'm not sure about newer versions
hi.. thanks for sharing.. I have to create a bar chart in struts 1.2, using db values. Can u plz guide me how to approach / if any working example code if u can share.. its urgent... thnx in advance..
ReplyDelete