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
candlesticks and lines in same chart
Not sure how you create your chart. Do you use ChartFactory?
If so the code should look something like this
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