Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


Gaining control Sector coloring in JFreechart

ivin jacob
  • ivin jacob
    ivin jacob

    Please help in gaining control over the sector coloring in the below code

    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("Green", new Integer(70));
    pieDataset.setValue("Black", new Integer(10));
    pieDataset.setValue("Yellow", new Integer(20));

    • Ulf Dittmer
      Ulf Dittmer

      That's really a missing functionality in cewolf. But it's not hard to create a PostProcessor that can set custom colors. I've uploaded one that can do this for pie charts and category plots to http://www.ulfdittmer.com/code/SeriesPaintProcessor.java; the class file is http://www.ulfdittmer.com/code/SeriesPaintProcessor.class

      To use it you'd do this in your JSP:

      ChartPostProcessor seriesPaint = new SeriesPaintProcessor();
      pageContext.setAttribute("seriesPaint", seriesPaint);

      and then add this to your cewolf:chart tag:

      <cewolf:chartpostprocessor id="seriesPaint">
              <cewolf:param name="0" value='<%= "#FFFFAA" %>'/>
              <cewolf:param name="1" value='<%= "#AAFFAA" %>'/>
              <cewolf:param name="2" value='<%= "#FFAAFF" %>'/>
              <cewolf:param name="3" value='<%= "#FFAAAA" %>'/>

      I'll add this to the upcoming cewolf release.


    • ivin jacob
      ivin jacob

      The Java File URL that you gave is giving

      Apache Tomcat/4.0.3 - HTTP Status 404 - /code/SeriesPaintProcessor.java;

    • Ulf Dittmer
      Ulf Dittmer

      Remove the extra semicolon at the end and it should work fine.