I am using Jfreechart to render candlesticks. I find that using a black background results in better looking charts (see pix below). However with the black background, the wicks/shadows of the candlestick bars are not visible (see first image below).
I found a workaround this using the following:
Code: Select all
candleRenderer.setUseOutlinePaint(true);
candleRenderer.setSeriesOutlinePaint(0, Color.DARK_GRAY);
My question is: Is there is a way to make the candle outline color the same as its fill color (ie switch outline color from red to green depending on the candle bodies fill color, rather than using a fixed outline color)? It appears by overiding the CandleRenderer.drawItem(. . . .) method this is possible but I dont fully understand the drawItem(...) method. If someone can show me how to achieve this, i would be very much grateful!
Also, on this thread (http://www.jfree.org/phpBB2/viewtopic.php?t=24952) , RoyW made the following remark:
It would appear from my plots that RoyW's theory was right, as I notice volume bars on Mondays are thinner (see first image below). I was wondering if anyone has implemented a fix (overide method in XYBarRenderer subclass for example).If that doesn't work then it appears to be a bug in XYBarRenderer.
Here is the relevant code from XYBarRenderer Code:
....................
Unfortunately StartX will be a time that is less than the time segment so when it gets translated it gets truncated.
E.g.
Suppose your segment is 8am to 4pm
Your data is at 8.00
StartX = 8:00 - 1 min - 7:59
EndX = 8:00 + 1 min = 8:01
StartX lies outside the segment so it seems to be returning 8:00 for startX so the bar at the beginning of the segment is always thinner than the rest.
I would need to create a demo program to test the theory.
Thanks for your time.