• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Charting Packages - Tick Label Customization?

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic