• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Charting Packages - Tick Label Customization?

 
Michael K. Wilson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael K. Wilson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic