Candlesticks run off edges with small number of candlesticks

Discussion about JFreeChart related to stockmarket charts.
Locked
jhpacker
Posts: 1
Joined: Fri Mar 11, 2005 5:29 pm

Candlesticks run off edges with small number of candlesticks

Post by jhpacker » Fri Mar 11, 2005 5:43 pm

I've run into a problem where if I'm using less than about 8 candlesticks in my graph the first and last one run off the edges of my graph and don't line up with their tick marks. This happens even when I just use the sample jfree demo code and lower the number of candles to <8. Here's what it looks like with the demo code:

Looks all ok with 10 candles:
Image

Starts to run off the edge at 8 candles:
Image

Is significantly off the edge at 4 candles:
Image

Since my application uses < 5 candles this is a big problem for me that I haven't been able to work around. Any suggestions? Seems like something with CandlestickRenderer.java but I don't see what.

I'm using jfreechart-0.9.21, though it looks like CandlestickRenderer.java hasn't changed since then.

Thanks,
Jason

jerrys

Post by jerrys » Mon Mar 14, 2005 7:19 am

I also get this similar problem where the first bar (rightmost bar) is chopped off at the middle if I specify axis.setFixedAutoRange(20*60000.0); to display only 20 minute bars.

It seems like the call to
double xx = domainAxis.valueToJava2D(x.doubleValue(), dataArea, domainEdge);

returns xx at the rightmost edge and is not taking into consideration the "width" of the stick.

David, can you suggest a fix for this problem?

thanks
jerry

Locked