selectively display DomainAxis values

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
pelski
Posts: 16
Joined: Thu Feb 23, 2006 2:02 am

selectively display DomainAxis values

Post by pelski » Fri Apr 28, 2006 7:04 am

Hi,

I am rendering a DefaultCategoryDataset using a a BarRenderer
and would only like to display the very first and very last Category Label (i.e. the label for an actual Bar). Is it possible to use a specific Axis class to do this or is the only way to leave the values out of the dataset to begin with.

Cheers,
nick

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Re: selectively display DomainAxis values

Post by angel » Fri Apr 28, 2006 7:17 am

pelski wrote: or is the only way to leave the values out of the dataset to begin with.
This may not be the sole solution, but certainly the easiest.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Apr 28, 2006 5:06 pm

The key for each category is an instance of Comparable and the toString() method is used to create the displayed label. So one way to get a category with no label is to write a small class that implements Comparable and has a toString() method that returns the empty string. But bear in mind that your users will see some data with no explanatory label...
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked