Serving the Quantitative Finance Community

 
User avatar
JTB
Topic Author
Posts: 0
Joined: August 20th, 2010, 9:28 am

JFree: Conditioning coloring of candlesticks

February 2nd, 2012, 4:17 pm

Does anyone know how to change colors on candlesticks in java's jfree's package?e.g: if CLOSE>OPEN; give the candlestick color green. If CLOSE<OPEN; give the candlestick color red. JTB
 
User avatar
assylias
Posts: 0
Joined: January 31st, 2003, 6:20 pm

JFree: Conditioning coloring of candlesticks

February 3rd, 2012, 9:16 am

For example (up bar with white border and dark grey interior, down bar in blue): CandlestickRenderer renderer = new CandlestickRenderer(); renderer.setUpPaint(Color.DARK_GRAY); renderer.setUpBorderPaint(Color.WHITE); renderer.setDownPaint(new Color(0, 128, 255)); renderer.setDownBorderPaint(new Color(0, 128, 255)); renderer.setUseOutlinePaint(false); renderer.setDrawVolume(false); XYPlot plot = (XYPlot) getPlot(0); plot.setRenderer(renderer);
Last edited by assylias on February 2nd, 2012, 11:00 pm, edited 1 time in total.