Question on DateAxis set with lowerMargin and upperMargin

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
tmtjond
Posts: 23
Joined: Thu Jul 24, 2008 3:21 am

Question on DateAxis set with lowerMargin and upperMargin

Post by tmtjond » Wed Nov 17, 2010 4:12 am

Hi all,

I am using a XYPlot to display a time series dataset.

When the dateAxis is set with lowerMargin and upperMargin, the dataset is properly drawn with the defined 'offset' from the left and right boundary of the chart.

When the dataAxis is set with minimumDate and maximumDate (it means that only partial data in the dataset is drawn) at the same time, the partial data is properly drawn and quite fits to the screen.

However, the lowerMargin and upperMargin settings are NOT applied. i.e., if the data is displayed with candlestick, only HALF of the first and last drawn candlesticks are drawn next to the boundary of the chart (without the defined offset).

I wanna patch it. I have go via the codes a bit. However, I can't locate the code in which it takes care of such settings during rendering.
Can anyone give me some hints ?

Thanks.

barbarius
Posts: 74
Joined: Tue Jul 27, 2010 9:33 am
antibot: No, of course not.

Re: Question on DateAxis set with lowerMargin and upperMargin

Post by barbarius » Wed Nov 17, 2010 10:11 am

it would be too simple to say (like is there electricity question if your pc is not working) but have you tried setting the margins AFTER setting minDate, maxDate?

maybe you can also debug this method

Code: Select all

org.jfree.chart.axis.ValueAxis.autoAdjustRange()

tmtjond
Posts: 23
Joined: Thu Jul 24, 2008 3:21 am

Re: Question on DateAxis set with lowerMargin and upperMargin

Post by tmtjond » Wed Nov 17, 2010 11:32 am

Not due to such kind of silly mistake.

I should say the required settings are injected and the behavior is not expected.

It should be a bug in the jfreechart.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Question on DateAxis set with lowerMargin and upperMargin

Post by skunk » Wed Nov 17, 2010 2:59 pm

setMimumumDate() and setMaximumDate() end up calling ValueAxis::setRange(...), you need to call ValueAxis::setRangeWithMargins(...) instead. I have never tried this and hopefully it will do the right thing with a segmentedTimeLine.

barbarius
Posts: 74
Joined: Tue Jul 27, 2010 9:33 am
antibot: No, of course not.

Re: Question on DateAxis set with lowerMargin and upperMargin

Post by barbarius » Thu Nov 18, 2010 10:38 am

skunk wrote:setMimumumDate() and setMaximumDate() end up calling ValueAxis::setRange(...), you need to call ValueAxis::setRangeWithMargins(...) instead. I have never tried this and hopefully it will do the right thing with a segmentedTimeLine.

right.. line 633 DateAxis
silly me, i looked in setLowerMargin method for the problem =\

Locked