-
15. Re: Charts
amitev Sep 9, 2007 5:46 PM (in response to jknotzke)There is a library for integrating of JFree chart http://jsf-comp.sourceforge.net/components/chartcreator/index.html
-
16. Re: Charts
supernovasoftware.com Sep 9, 2007 10:22 PM (in response to jknotzke)I have used both, but not extensively. The drill down feature looked nice in Trinidad. I haven't checked for a similar feature in JFreeChart.
-
17. Re: Charts
aloleary Nov 4, 2007 2:47 PM (in response to jknotzke)Trinidad unfortunately (or fortunately depending on your situation) is SVG based, therefore only supports newer browsers and IE through an Adobe plugin.
What I am looking for, related to this, is if anyone know of an existing open source project that takes JFreeChart and brings it into the Ajax/JSF world ?... I know there are commercial implementations (ILog JViews) but I would prefer to use an open source package that allows me to both have the ability to modify the code and contribute to the project.
Any information/pointers to an Ajax enabled charting solution for the JBoss 'stack' : JBoss/Seam/RichFaces ...
I really like JFreeChart and have used it for many years... I would love to see a solution based around that software... I know the future is SVG but its not an option for me to enforce end users using a plugin....
Thanks in advance
-A- -
18. Re: Charts
hispeedsurfer Nov 12, 2007 4:18 AM (in response to jknotzke)Here is an example based on engelme idea that is working for me
import java.io.IOException; import java.io.Serializable; import org.jboss.seam.annotations.Name; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PiePlot; import org.jfree.data.general.DefaultPieDataset; @Name("chartprocesser") public class ChartProcessor implements Serializable{ /** * */ private static final long serialVersionUID = 1L; byte[] chart; public void createChart() { final DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("One", new Double(43.2)); dataset.setValue("Two", new Double(10.0)); dataset.setValue("Three", new Double(27.5)); dataset.setValue("Four", new Double(17.5)); dataset.setValue("Five", new Double(11.0)); dataset.setValue("Six", new Double(19.4)); final JFreeChart chart = ChartFactory.createPieChart( "Pie Chart Demo 2", // chart title dataset, // dataset true, // include legend true, false ); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setNoDataMessage("No data available"); try{ this.chart = ChartUtilities.encodeAsPNG(chart.createBufferedImage(400, 400)); } catch (IOException e){ e.printStackTrace(); } } public byte[] getChart() { createChart(); return chart; } public void setChart(byte[] chart) { this.chart = chart; } }
<a:form id="chartform"> <a:outputPanel id="chart"> <s:graphicImage value="#{chartprocesser.chart}"/> </a:outputPanel> </a:form>
-
19. Re: Charts
siobhan.ernest Nov 29, 2007 10:42 PM (in response to jknotzke)Thank you, hispeedsurfer!
-
20. Re: Charts
sstrenn Nov 30, 2007 2:33 AM (in response to jknotzke)If you want very cool, interactive charts, you might try http://www.fusioncharts.com/free/.
Here is an example screenshot:
https://www.cs.sbcc.edu/strenn/cs129/TopOrdersFusionChart.jpg
All you have to do is provide the data in XML format, which I did with a standard facelet and <ui:repeat>:<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:fn="http://java.sun.com/jsp/jstl/functions"> <graph caption='Top Sales Orders' xAxisName='' yAxisName='Sales Subtotal' showNames='1' rotateNames='1' decimalPrecision='0' formatNumberScale='0' numberPrefix="$" bgSWF='img/ContentBackgroundWide.jpg' baseFont="Arial" baseFontSize="12" outCnvBaseFont="Arial" outCnvsBaseFontSize="16" animation="1"> <ui:repeat value="#{topOrders.bySubTotal}" var="topOrder"> <set name='#{topOrder.customerName}' value='#{topOrder.subtotal}' color="#{colorManager.nextColor}" link="SalesOrderView.seam?salesOrderId=#{topOrder.id}" hoverText="#{topOrder.customerName}: Order ##{topOrder.id} on #{fn:substring(topOrder.orderDate, 0, 10)}" /> </ui:repeat> </graph> </ui:composition>