Change axis values to string

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lebtho
Posts: 7
Joined: Fri Jul 21, 2006 2:36 pm

Change axis values to string

Post by lebtho » Thu Aug 24, 2006 12:26 pm

Hello, is it possible to change the axis values in own definded string values?
For example convert y value 1 to own defined String1 y value 2 to own definded String2 and so on?

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 » Thu Aug 24, 2006 1:17 pm

Yes, another developer wrote the SymbolAxis class for that very purpose.
David Gilbert
JFreeChart Project Leader

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

lebtho
Posts: 7
Joined: Fri Jul 21, 2006 2:36 pm

Post by lebtho » Thu Aug 24, 2006 3:43 pm

Oh thanks.

Can you give me a code example please?
That will be very helpfull in this case.

Regards Thorsten

dan1son
Posts: 12
Joined: Thu Jun 29, 2006 7:06 pm
Location: Austin, TX

Post by dan1son » Thu Aug 24, 2006 6:14 pm

I did the same thing overriding the numbertickunit.

Basically override the "valueToString(double d)" function in there and have it output the string you are looking for.

Then I create a new TickUnits object and load it up with the new NumberTickUnit that I created for the values I want displayed and then set that TickUnits object to the TickUnits on the axis (Range in my case) that I want those for.

My code examples will probably not fit you, as my valueToStrings are received from another object I already have.

Seems to work just fine.

Dan

lebtho
Posts: 7
Joined: Fri Jul 21, 2006 2:36 pm

Post by lebtho » Thu Aug 24, 2006 6:19 pm

Thanks again

I tried the solution from gilbert and it works!

Locked