How do I mix CandleChart with a Bar Chart in the same Chart

Discussion about JFreeChart related to stockmarket charts.
Locked
aditya
Posts: 4
Joined: Thu Jun 17, 2004 10:02 am

How do I mix CandleChart with a Bar Chart in the same Chart

Post by aditya » Thu Jun 17, 2004 10:14 am

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.

_athos_

Have you get in solution?

Post by _athos_ » Thu Nov 11, 2004 9:59 pm

Have you get in solution for this?
I'm facing the same problem.

MadMaXX
Posts: 3
Joined: Thu Sep 23, 2004 9:03 am

Re: Have you get in solution?

Post by MadMaXX » Wed Nov 24, 2004 2:27 pm

I search for similar problem, have you solved? :?:

Martin
Posts: 23
Joined: Thu Apr 24, 2003 10:25 am
Location: Germany-Essen

Post by Martin » Thu Dec 02, 2004 5:34 pm

Hi all,
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)
Example:

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 );
cheers
Martin

RCDran
Posts: 29
Joined: Wed Feb 25, 2004 4:18 am
Location: Japan

Post by RCDran » Thu Feb 17, 2005 9:16 am

This is ok if the Plots are same, what if I need different Plots in same ChartPanel?
--
RCDran

Locked