Axis Formats

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
Mark Rosche

Axis Formats

Post by Mark Rosche » Tue Sep 05, 2000 9:10 am

Hi all,

Two questions regarding Axis values:

1. How does one control the format of the number-values on the Y-Axis i.e. when a value of 15.50 is passed to JFreeChart it displays 15.50 and not 15.5. Maybe I am missing something basic.

2. When plotting time-series data using the DefaultXYDataSource Class and passing it DateTime oriented data as an object, I pass it values that are not consecutive (i.e. 1 Jul, 3 Jul, 4 Jul, 10 Jul, etc). When generating the X-Axis ticks for these four values it gives me tick labels of 7 Jul, 8 Jul, 9 Jul, and 10 Jul respectively. Is this a bug or a feature. If it is a feature could someone please enlighten me on how to use the data passed as the datasource as the tick labels?

Cheers,
Mark Rosche

David Gilbert

RE: Axis Formats

Post by David Gilbert » Wed Sep 06, 2000 4:08 am

Hi Mark,

I don't have access to the code right now, but from (failing) memory:

(1) The number format is controlled in an array of strings in the NumberAxis class (it's defined at the bottom of the file I think - there's one array of standard tick sizes and another with corresponding format strings).

(2) Ticks are displayed on the axis at uniform intervals - the code tries to display as many ticks as possible without the labels overlapping. This is the messiest part of the code, and I'd welcome any ideas for improvement.

Regards,

DG.

Mark Rosche

RE: Axis Formats

Post by Mark Rosche » Wed Sep 06, 2000 8:55 am

Hi David,

Thanks for the tips :):)

An idea for the DateTime oriented ticks would be maybe to extract the entries from the object itself and pass them to the layout manager instead of trying to calculate them using DateTime math.

My next question is:

How do I plot a straight line...my application extracts data from a database and plots the data to a chart on the fly; if the data extracted from the db is constant (i.e. 10 AM - $10, 11 AM - $10, 12 PM - $10) I do not see the data plotted. Any help on the subject would be helpful...

Cheers,
Mark

Post Reply