problem with candlestick color

Discussion about JFreeChart related to stockmarket charts.
Locked
sschong

problem with candlestick color

Post by sschong » Tue Feb 21, 2006 5:41 pm

Hi all,

I am a student and a newbie in using JFreeChart (v.1.0.1). I am currently doing a project related to stock, and while I am building a candlestick chart with JFreeChart class, I met a problem where my code: setUpPaint(new Color(0xFFFFFF)) works, but setDownPaint(new Color(0x000000)) failed, so results in my chart displayed with all candlestick filled with only white color (or if i didn't set the up and down paint, by default all candlesticks are filled with green, instead of green/red where it suppose to).

here's the portion of my code:
CandlestickRenderer renderer = new CandlestickRenderer();
renderer.setDrawVolume(false);
renderer.setAutoWidthMethod(renderer.WIDTHMETHOD_AVERAGE);
renderer.setDownPaint(new Color(0x000000));
enderer.setUpPaint(new Color(0xFFFFFF));
chart.getXYPlot().setRenderer(renderer);
chart.setBackgroundPaint(Color.white);
Anyone have idea why the problem exists? I have saw many posts in forum, and seems no one have this problem except me. Thanks for your time! :)

sschong

Post by sschong » Tue Feb 21, 2006 5:47 pm

Another problem that I met is when I am creating a high low chart, all the high/low prices lines created seems to be scattered into some kind of messed up images. I think its cause of the high data population (7000++ records). Can anyone teach me how to solve this and make the high low chart look nice even with large data size?

Thanks again :)

sschong

Post by sschong » Thu Mar 02, 2006 3:57 pm

aha, I finally found out that the above problem occured because of my careless mistake, where the correct sequence of creating DefaultHighLowChart is

date[], high[], low[], open[], close[], volume[]

but I used

date[], open[], high[], low[], close[], volume[]

Sorry for the careless mistake i made :oops:

Locked