I'm making an application that takes some data and it needs to make a bar chart, but the color of a bar MUST be related to data that it is representing.
Imagine that I have this kind of data:
BANANA 430
WATER MELLON 300
Now I should make a bar chart, and I would like to paint the BANANA bar with yellow paint, and WATER MELLON bar with green paint. I'm using JFreeChart library in java.
My research led me to making my custom renderer, but then if I make custom renderer the colors will appear randomly on bars.
Any solution for this?
Best Answer
Maybe this http://www.java2s.com/Code/Java/Chart/JFreeChartBarChartDemo3differentcolorswithinaseries.htm can be of help.
See how the code below is used: