1 2 Previous Next 20 Replies Latest reply on Nov 30, 2007 2:33 AM by sstrenn Go to original post
      • 15. Re: Charts
        amitev

        There is a library for integrating of JFree chart http://jsf-comp.sourceforge.net/components/chartcreator/index.html

        • 16. Re: Charts

          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

            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

              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

                Thank you, hispeedsurfer!

                • 20. Re: Charts

                  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>
                  
                  
                  


                  1 2 Previous Next