Posts JFreeChart: PiePlot.getSectionPaint()

JFreeChart: PiePlot.getSectionPaint()

I am starting to consider replacing the JFreeChart API with some other one in future projects - gotta start looking for it.

Anyway, today's annoyance with this tool happens to be the fact that charts don't assign colors until they're drawn.

[EDIT] I forgot to add that this small detail is not mentioned in the javadoc. :) [/EDIT]

My requirement was simple: assign the same color of each pieplot section to its respective series in an xychart. Sounds extremely simple, right? Well, after having it not work and me scrambling around, adding some ridiculous debugging messages I finally saw that PiePlot.getSectionPaint(Comparable key) was returning null. At that point I wanted to do additional debugging but getSectionKey() is protected for reasons beyond my understanding. So I gave up debugging this myself and turned to google and got slapped in the face with the above.

Damn man.
This post is licensed under CC BY 4.0 by the author.