Formatting vertical number axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Citlalli

Formatting vertical number axis

Post by Citlalli » Tue Jan 29, 2002 9:01 pm

Hi, I want to set the format of numbers for the vertical axis to be constant when auto tick is true, I've looked at the discussion on:

http://www.jrefinery.com/forums/read.ph ... =480&t=468

There it says that I have to hack the source code by putting the format i want in the autoTickFormats array in NumberAxis.java file but I don't know exactly where to modify this.

Do I have to erase some elements from this array and leave only the specific format that i want?

private TickUnits createStandardTickUnits() {

TickUnits units = new TickUnits();

units.add(new NumberTickUnit(new Double(0.0000001), new DecimalFormat("0.0000000")));
units.add(new NumberTickUnit(new Double(0.000001), new DecimalFormat("0.000000")));
.
.
.
.

And how can I pack again this file into jfreechart-0.7.0.jar file so that I can use it?
can anybody help me please?

Citlalli

David Gilbert

RE: Formatting vertical number axis

Post by David Gilbert » Wed Jan 30, 2002 10:11 am

Hi Citlalli,

The createStandardTickUnits() method is just building a collection of standard tick units from which the axis can select one when autoTickUnitSelection is ON.

You are free to build your own collection, and then call setStandardTickUnits(...) in the NumberAxis class. This should work in version 0.7.1 without you having to hack the JFreeChart code.

The other option is to set a single tick unit with the setTickUnit(...) method in NumberAxis, but then the tick size won't adjust as the chart resizes, so you might get overlapping tick labels.

Let me know if you run into any problems with these methods, I haven't tested them extensively...

Regards,

DG.

Citlalli

RE: Formatting vertical number axis

Post by Citlalli » Wed Jan 30, 2002 11:56 pm

Hi David

I finally used the setStandardTickUnits(...) method and it worked fine, thanks!

Citlalli

Locked