Cewolf and StatisticalChart

  • ygizard

    ygizard - 2006-10-25

    My simple question is: it is possible to create StatisticalBarChart with cewolf and how?
    In my java source I have :
    public Object produceDataset(Map params) {

            DefaultStatisticalCategoryDataset result = new DefaultStatisticalCategoryDataset();
            for (int i = 0; i < this.getResult().size(); i++) {
                tabObj = (Object[]) this.getResult().get(i);
                Comparable myBloc = (Comparable) tabObj[0];
                String myToxic = (String) tabObj[1];
                Comparable conc = (Comparable) vectorConcArray[i];
                Integer cellAvg = (Integer) vectorCellAvgArray[i];
                float vary = (Float) tabObj[2];
                Double varDble = new Double (vary);
                Double cellAvgDle = new Double(cellAvg);
                result.add(cellAvgDle, varDble,  myToxic+ " on Bloc : " + myBloc, conc + "µM");
            return result;

    And in my jsp :
            title="Cells Number for Toxic concentration"
                <cewolf:producer id="pageViews"/>
        <cewolf:img chartid="bar" renderer="cewolf" width="1000" height="500"/>

    But this just create a barchart with no statistic values (standart deviation)

    • Zoltan Luspai

      Zoltan Luspai - 2006-10-25


      You can create any new chart types, by registering a new customn chart factory. See this where it is described: http://sourceforge.net/forum/message.php?msg_id=3840051

    • ygizard

      ygizard - 2006-11-03

      Thx you for the response but a I don't understand where a insert :
      CewolfChartFactory.registerFactory(new CewolfChartFactory("myChartType", IntervalXYDataset.class) { 
      public JFreeChart getChartInstance(String title, String xAxisLabel, String yAxisLabel, Dataset data) throws IncompatibleDatasetException { 
      return createMyChart(data);

      In my jsp???

      • Zoltan Luspai

        Zoltan Luspai - 2006-11-03

        This is obviously some java code ;-) . That can go either anywhere in your java class or inside a scriptlet tag ( <% ...code %> ) in your jsp. Just ensure that the new chart-type has to be registered before the jsp gets rendered!
        By this code you can create a new chart-type and tell the cewolf how this chart is to be rendered. For details you'll need to know how the jfreechart internals' work. Go and hack it!

    • ygizard

      ygizard - 2006-11-03

      thx but when I use this code in a JSP, I have a error like this :
      <%@ page import="java.sql.*,de.laures.cewolf.taglib.*,
          CewolfChartFactory.registerFactory(new CewolfChartFactory("Stat", DefaultStatisticalCategoryDataset.class)
          public JFreeChart getChartInstance( String title, String xAxisLabel, String yAxisLabel, Dataset data)
          throws IncompatibleDatasetException
          return createChart(data);
          });  %>

      The errors are :
      This constructor CewolfChartFactory(String, Class <DefaultStatisticalCategoryDataset> ) is undefined
      The type CewolfChartFactory() {} must implement the inherited abstract method CewolfChartFactory.getChartInstance(String,String,String,Dataset)


Log in to post a comment.