NullPointerException in ProducerTag.doEndTag

Help
2006-06-22
2013-01-13
  • Dave Seagraves

    Dave Seagraves - 2006-06-22

    I am attempting to create an overlaid chart using cewolf's taglib. When I execute the code that creates the chart, I get the following error:

    java.lang.NullPointerException at de.laures.cewolf.taglib.tags.ProducerTag.doEndTag(ProducerTag.java:59) at org.apache.jsp.reports_0002dweightChart_jsp._jspx_meth_cewolf_producer_1(reports_0002dweightChart_jsp.java:1077)

    Here is the XML:

    <jsp:useBean id="SPRC_DateYChartDP" class="com.webfeetcreations.charting.SPRC_DateYChartDP"/>
    <jsp:useBean id="SPRC_DateYChartPP" class="com.webfeetcreations.charting.SPRC_DateYChartPP"/>
    <jsp:useBean id="SPRC_XYAreaChartDP" class="com.webfeetcreations.charting.SPRC_XYAreaChartDP"/>
    <jsp:useBean id="SPRC_XYAreaChartPP" class="com.webfeetcreations.charting.SPRC_XYAreaChartPP"/>
    <cewolf:chart
        id="Weight"
        title="Weight Progress Chart"
        type="areaxy"
        yaxislabel="Pounds">
        <cewolf:data>
            <cewolf:producer id="SPRC_XYAreaChartDP"/>
        </cewolf:data>
        <cewolf:chartpostprocessor id="SPRC_XYAreaChartPP"/>
    </cewolf:chart>
    <cewolf:overlaidchart
        id="Weight"
        type="overlayxy"
        xaxistype="date">
        <cewolf:data>
            <cewolf:producer id="SPRC_DateYChartDP"/>
        </cewolf:data>
        <cewolf:chartpostprocessor id="SPRC_DateYChartPP"/>
    </cewolf:overlaidchart>
    <cewolf:img chartid="Weight" renderer="cewolf" width="545" height="300">
        <cewolf:map tooltipgeneratorid="SPRC_DateYChartPP"/>
    </cewolf:img>

    The Data Producers and Post Processors are defined appropriately.

    Does this information suggest where my mistake might be?

    Cheers,
    Dave Seagraves

     
    • Zoltan Luspai

      Zoltan Luspai - 2006-06-23

      Hi,

      I think you are missing the <plot> tag from inside the overlaidchart. This should look like:

      <cewolf:overlaidchart>
         <cewolf:plot type="highlow">
          <cewolf:data>

      But what you have is that the data tag is directly below the overlaidchart. Like this:
      <cewolf:overlaidchart>
         <cewolf:data>

      Cheers,
      Zoltan

       
    • Dave Seagraves

      Dave Seagraves - 2006-06-24

      Thanks, Zoltan, for the response. I added the <cewolf:plot...> tag, but still get the same error.

      It's curious that the tablib documentation does not say anything about the plot tag belonging within the overlaidchart tag. Should it go within that tag, or after it and before the img tag? Do I also need a plot tag within the chart tag?

      Cheers,
      Dave

       
    • Zoltan Luspai

      Zoltan Luspai - 2006-06-26

      Hi,

      Well the doc is not quite detailed on it. Have a look at the overlaid chart examples in the cewolfexamples subproject.
      I've tried your jsp definition, and the following fixed structure has worked for me:

      <cewolf:overlaidchart
          id="Weight"
          type="overlaidxy"
          xaxistype="date">
          <cewolf:plot type="xyline">
              <cewolf:data>
                  <cewolf:producer id="xyData"/>
              </cewolf:data>
          </cewolf:plot>
          <%--<cewolf:chartpostprocessor id="SPRC_DateYChartPP"/>  --%>
      </cewolf:overlaidchart>
      <cewolf:img chartid="Weight" renderer="cewolf" width="545" height="300">
              <%--
              <cewolf:map tooltipgeneratorid="SPRC_DateYChartPP"/>
              --%>
      </cewolf:img>

      Obviously I could not use your data producer...
      Cheers,
      Zoltan

       
    • Dave Seagraves

      Dave Seagraves - 2006-06-26

      Hi Zoltan,

      Thank you, your example was very helpful. I did not have the data tag embedded within the plot tag, and had specified the chart type incorrectly.

      I am now able to make the overlaid chart display. However, it displays as a separate chart, after the background chart, rather than overlaid over it. How do I get it to do that?

      Also, I am trying to NOT display the legend for the background chart, since I am using annotations to indicate what the areas mean there. I want to display only the legend for the overlay chart. I tried using 'renderer.setSeriesVisibleInLegend(0,false);', but the method doesn't seem to be defined for any of the renderer types I have tried. I tried setting the size to 1x1 pixels, set the style attribute of the legend tag to "display:none" and "visibility:hidden", and tried to set class="invisible", where "invisible" is a CSS class I defined with the attribute display:none. Nothing works. The legend displays anyway. Can you tell me how to suppress the display of a legend?

      Here is the tag code I am using:

      <cewolf:chart
          id="Background"
          title="Weight Progress Chart"
          type="areaxy"
          yaxislabel="Pounds">
          <cewolf:data>
              <cewolf:producer id="SPRC_XYAreaChartDP"/>
          </cewolf:data>
          <cewolf:chartpostprocessor id="SPRC_XYAreaChartPP"/>
      </cewolf:chart>
      <cewolf:legend id="Background" renderer="cewolf" width="1" height="1" style="display:none" />
      <cewolf:img chartid="Background" renderer="cewolf" width="545" height="300">
      </cewolf:img>
      <cewolf:overlaidchart
          id="Weight"
          type="overlaidxy"
          xaxistype="date">
          <cewolf:plot type="xyshapesandlines">
              <cewolf:data>
                  <cewolf:producer id="SPRC_DateYChartDP"/>
              </cewolf:data>
          </cewolf:plot>
          <cewolf:chartpostprocessor id="SPRC_DateYChartPP"/>
      </cewolf:overlaidchart>
      <cewolf:img chartid="Weight" renderer="cewolf" width="545" height="300">
          <cewolf:map tooltipgeneratorid="SPRC_DateYChartPP"/>
      </cewolf:img>

       
    • Zoltan Luspai

      Zoltan Luspai - 2006-06-27

      The 'background' image should be moved inside the overlaidchart, and should become a "plot" tag. This way the two charts will be overlaid.
      I'm not exactly sure about the orders of the plots -i.e. which becomes in front of the other- but I think that's the order of them inside the overlaidchart. Give it a go and you'll see.

      cheers,
      zoltan

       
    • Zoltan Luspai

      Zoltan Luspai - 2006-06-27

      I think to remove the legend you will need to call it do it on your post processor - as general hint do everything there :-). So this would be:

          public void processChart(Object chart, Map args){
              JFreeChart jfreechart = ((org.jfree.chart.JFreeChart)chart);
              jfreechart.removeLegend();
      ...etc...
           }

      Cheers,
      Zoltan

       

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

Sign up for the SourceForge newsletter:





No, thanks