candlesticks and lines in same chart

Discussion about JFreeChart related to stockmarket charts.
Locked
u_turn
Posts: 3
Joined: Fri Jun 27, 2008 10:14 am

candlesticks and lines in same chart

Post by u_turn » Fri Jun 27, 2008 12:12 pm

To combine a candlestick chart with a linechart in the same graph seems to be easier said than done. Sure enough this must be considered a quite essential part of finance charting, an yet I cant find out how to do it, I've seen this question posted before but with no answer, so I'll ask again.

Is it possible to create a chart with both a candlestick series and a line series?
Say for examle I want to display a candlestick stockchart, and in front of it I want to draw a refference index as a polyline.

Is this even possible to achive inJFreeChart, and if so, how??

kind regards/ u_turn

RoyW
Posts: 93
Joined: Wed Apr 23, 2008 7:42 pm
Contact:

Post by RoyW » Fri Jun 27, 2008 2:14 pm

Not sure how you create your chart. Do you use ChartFactory?

If so the code should look something like this

Code: Select all

        XYPlot plot = (XYPlot)chart.getPlot();
        XYDataset dataset2 = getDataset2(); //This is where you get your line data
        plot.setRenderer(1, new XYLineAndShapeRenderer(true, false));
        plot.setDataset(1, dataset2);
The answer does not come from thinking outside the box, rather the answer comes from realizing the truth; There is no Box. my js site

u_turn
Posts: 3
Joined: Fri Jun 27, 2008 10:14 am

Post by u_turn » Fri Jun 27, 2008 7:27 pm

That did the trick!
:D
Thanx!!

Locked