integer scale in dial chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
asd
Posts: 19
Joined: Tue Sep 26, 2006 11:28 pm

integer scale in dial chart

Post by asd » Mon Sep 22, 2008 2:10 pm

Hi all!

I just bought the jfreechart guide, and I haven't been able to find a way to set integer values in the scale. All the dial chart examples don't have integer values, so I don't know how to do this.

Thanks in advance.

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 » Tue Sep 23, 2008 7:48 am

You can set the formatting for the tick labels on the axis:

Code: Select all

StandardDialScale s = (StandardDialScale) plot.getScale(0);
s.setTickLabelFormatter(NumberFormat.getIntegerInstance());
Note that the cast here assumes that the scale in your plot *is* an instance of StandardDialScale (it most likely is, but then it is also possible to create your own scale class).
David Gilbert
JFreeChart Project Leader

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

asd
Posts: 19
Joined: Tue Sep 26, 2006 11:28 pm

Post by asd » Tue Sep 23, 2008 1:33 pm

Worked like a charm!

Thanks David.

Locked