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

Close

Gaining control Sector coloring in JFreechart

Help
ivin jacob
2008-10-22
2013-01-13
  • ivin jacob
    ivin jacob
    2008-10-22

    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
      2008-10-23

      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" %>'/>
      </cewolf:chartpostprocessor>

      I'll add this to the upcoming cewolf release.

      Ulf

       
    • ivin jacob
      ivin jacob
      2008-10-24

      The Java File URL that you gave is giving

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

       
    • Ulf Dittmer
      Ulf Dittmer
      2008-11-07

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