Two Laptop Bag*
The moose likes Other Java Products and Servers and the fly likes Charting Packages - Tick Label Customization? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Charting Packages - Tick Label Customization?" Watch "Charting Packages - Tick Label Customization?" New topic
Author

Charting Packages - Tick Label Customization?

Michael K. Wilson
Ranch Hand

Joined: Apr 23, 2008
Posts: 45
This is a follow-up to my previous post.

I decided to use JFreeChart and whereas I like it and all, it doesn't seem to support customizing the tick labels (as Strings) on the x axis. It only seems to be able to display numbers or dates.

Can anyone recommend a different Java based charting package which allows the programmer to customize tick labels and also let the developer specify the number of ticks which are displayable?

-Mike
[ May 26, 2008: Message edited by: Michael K. Wilson ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
The way to customize the axes in JFreeChart is get the Plot object from the chart (chart.getPlot), and then to cast that to the appropriate subclass (XYPlot, CategoryPlot etc.). Then you can use the getDomainAxis and getRangeAxis methods to obtain ValueAxis and/or NumberAxis objects through which you can customize the axes.

If you're using cewolf you can do this in a ChartPostProcessor.


Ping & DNS - my free Android networking tools app
Michael K. Wilson
Ranch Hand

Joined: Apr 23, 2008
Posts: 45
Not so... When you get the DomainAxis, you can only set labels for numbers or dates. What I am looking for is to set String labels.



Thank you for responding!
[ May 26, 2008: Message edited by: Michael K. Wilson ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
Ah, I read you post a bit too quick and missed the part about strings.

Maybe a CategoryPlot would be better suited than an XYPlot in this case?
Michael K. Wilson
Ranch Hand

Joined: Apr 23, 2008
Posts: 45
Category plots are well-suited for pie charts... What I am using is "time seried charts" (line based charts depending on time)...

Thanks guy!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
You'll get a CategoryPlot for various chart types, not just pie charts. In this case, you could use a line chart. Then you'll have access to a CategoryAxis, which can handle any string you wish to display.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Charting Packages - Tick Label Customization?