How I can draw an OverlaidXYPlot

Jose Luis
2002-10-09
2013-01-13
  • Jose Luis

    Jose Luis - 2002-10-09

    I 'm trying to draw an OverlaidXYPlot but I don't know how to do. In the chart tag I only can use the verticalXYbar label , and when I get the XYPlot from the JFreeCHart Object in the ChartPostProcesor I don't know how to convert it to an OverlaidXYPlot.
    Thanks

     
    • Guido Laures

      Guido Laures - 2002-10-09

      I do not think that its possible to convert plots.
      I think I have to admit that OverlaidXYPlots are' not supported by cewolf at the moment.

      Regards,
      Guido

       
    • Rachel

      Rachel - 2007-01-24

      This might help you.

      package de.laures.cewolf.example;

      import org.jfree.data.xy.XYSeries;
      import org.jfree.data.xy.XYSeriesCollection;

      import de.laures.cewolf.DatasetProduceException;
      import de.laures.cewolf.DatasetProducer;
      import java.util.Map;
      import java.util.Date;

      public class KlassementChartData implements DatasetProducer {

            /**
           *These are two lines on same chart
           */
          private static final long serialVersionUID = 1L;

          /**
              * Method that produces the data for the chart
              */
             public Object produceDataset(Map params) throws DatasetProduceException {

                XYSeries series1 = new XYSeries("Label for series 1");
                XYSeries series2 = new XYSeries("Label for series 2");

                series1.add(1981,5);
                series1.add(1983,8);
                series1.add(1984,14);
                series1.add(1985,18);

                series2.add(1981,8);
                series2.add(1983,7);
                series2.add(1984,4);
                series2.add(1985,10);

                XYSeriesCollection dataset = new XYSeriesCollection();
                dataset.addSeries(series1);
                dataset.addSeries(series2);

                 return dataset;
             }

             /**
              * This producer's data is invalidated after 5 seconds. By this method the
              * producer can influence Cewolf's caching behaviour the way it wants to.
              */
            public boolean hasExpired(Map params, Date since) {
               return (System.currentTimeMillis() - since.getTime())  > 5000;
            }

            /**
             * Returns a unique ID for this DatasetProducer
             */
            public String getProducerId() {
               return "PageViewCountData DatasetProducer";
            }

            /**
             * @see java.lang.Object#finalize()
             */
            protected void finalize() throws Throwable {
               super.finalize();
            }

      }

      <%@page contentType="text/html"%>
      <%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %> 
      <html>
        <head>
          <title>MyTitle</title>
        </head>
       
        <body>
             
           <jsp:useBean id="klassementen" class="de.laures.cewolf.example.KlassementChartData"/>
         
         <cewolf:chart
             id="line"
             title=""
             type="xy"
             xaxislabel="Jaar"
             yaxislabel="Klassement">
             <cewolf:data>
                 <cewolf:producer id="klassementen"/>              
             </cewolf:data>   
         </cewolf:chart>
         <p>
            <cewolf:img chartid="line" renderer="cewolf" width="500" height="400"/>
         </p>

        </body>
      </html>

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks