About the line chart with dot

2005-07-04
2013-01-13
  • spiritsailor
    spiritsailor
    2005-07-04

    package com.shape.xyDataShape;
    import java.util.Map;

    import org.apache.log4j.Logger;
    import org.jfree.chart.JFreeChart;

    import org.jfree.chart.plot.XYPlot;
    import org.jfree.chart.renderer.xy.*;
    import de.laures.cewolf.ChartPostProcessor;

    public class AddDots implements ChartPostProcessor {
    public void processChart(Object chart, Map params) {
        XYPlot plot = ((JFreeChart)chart).getXYPlot();
        XYItemRenderer renderer = plot.getRenderer();
        StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
        rr.setPlotShapes(true);
        rr.setShapesFilled(true);
    }

    }

    in jsp :
    <jsp:useBean id="xyDataShape" scope="page" class="com.crcs.ssa.bo.predict.income.AddDots" />
       <cewolf:chartpostprocessor id="xyDataShape"/>

    but it throw the exception:
    javax.servlet.ServletException: java.lang.ClassCastException raised by post processor com.shape.xyDataShape.AddDots@13e9b'.
    Post processing of this post processor has been ignored.

    I wondering why the exception throws ,anyideas?

     
    • spiritsailor
      spiritsailor
      2005-07-04

      solved:
      the class :
      import java.util.Map;

      import org.jfree.chart.plot.CategoryPlot;
      import org.jfree.chart.renderer.category.LineAndShapeRenderer;

      import org.jfree.chart.*;
      import de.laures.cewolf.ChartPostProcessor;

      public class AddDots implements ChartPostProcessor {

          public void processChart(Object chart, Map params) {

              CategoryPlot xyplot = ((JFreeChart) chart).getCategoryPlot();
              xyplot.setRenderer(new LineAndShapeRenderer());

          }

      }

      if use type="line" must use CategoryPlot