How do I mix CandleChart with a Bar Chart in the same ChartPanel sharing a common X-axis [i.e. Date/Time] and also sharing a trace [either horizontal or vertical or both]
Apparently the 2 plots are different, Candle is of type XYPlot and Bar is of type CategoryPlot. Or am I getting it all wrong?
Please let me know a workaround, or the existing way.
How do I mix CandleChart with a Bar Chart in the same Chart
Have you get in solution?
Have you get in solution for this?
I'm facing the same problem.
I'm facing the same problem.
Re: Have you get in solution?
I search for similar problem, have you solved? 

Hi all,
have you checked the opportunities of the XYPlot class.
Check out the following methods:
cheers
Martin
have you checked the opportunities of the XYPlot class.
Check out the following methods:
- setDataset(int index, XYDataset dataset)
mapDatasetToRangeAxis(int index, int axisIndex)
setRenderer(int index, XYItemRenderer renderer)
Code: Select all
OHLCDataset dataset=createDataset(); //method to create corresponding dataset
TimeSeriesCollection dataset2 =createDataset2(); //method to create corresponding dataset
XYPlot plot = new XYPlot(dataset, new DateAxis("Date"), new NumberAxis("MyAxis"), new CandlestickRenderer(4,false,new HighLowItemLabelGenerator()));
plot.setDataset(1, dataset2);
plot.mapDatasetToRangeAxis(1, 0);
plot.setRenderer(1,new XYBarRenderer());
JFreeChart chart = new JFreeChart(charttitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true );
Martin
Code: Select all