Hi,
I have a bar chart on which I want to display a date below each bar on the X -axis. I got to know that CategoryItemLabelGenerator is to be used. But I am not able to understand how to do that. Can somebody please help me??
Custom label for bar chart-Using CategoryItemLabelGenerator?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Custom label for bar chart-Using CategoryItemLabelGenera
No, the x-axis labels in a CategoryPlot are derived by JFreeChart calling the toString() method on the objects you are using for the column keys in your dataset. These keys can be any instance of Comparable (for example, the String class). If you use the String class, then obviously the toString() method returns the string itself, so the label is the same as the key. But you could just as easily implement your own CustomCategory class that implements Comparable (so can be used as a key in the dataset) *and* overrides the toString() method to return whatever label you want.rahul wrote:Hi,
I have a bar chart on which I want to display a date below each bar on the X -axis. I got to know that CategoryItemLabelGenerator is to be used. But I am not able to understand how to do that. Can somebody please help me??
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Hi, I think I need to explain my problem in detail
This is the chart that I have
http://picasaweb.google.com/khirerahul/JFreeChart
Just below the keys on the X-axis I want to display another text(dates) for each bar. How to do that?
Thanks.
This is the chart that I have
http://picasaweb.google.com/khirerahul/JFreeChart
Just below the keys on the X-axis I want to display another text(dates) for each bar. How to do that?
Thanks.