This is a migrated thread and some comments may be shown as answers.

Candlestick Chart Multiple DataSeries

7 Answers 94 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Prasad Saravate
Top achievements
Rank 1
Prasad Saravate asked on 29 Apr 2010, 09:06 PM
I am using candlestick chart and adding two dataseries on the same chart.

what I expect is individual candlestick (from two series) should align next to each other (if they belong to same XCategory value). However, I could see they overlap on top of each other.

see attached (expected).

I am using following code:

 

private void FillSampleChartData()

 

{

 

XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection<Temporal>));

 

 

using (StreamReader wr = new StreamReader("TemporalDataNew.xml"))

 

{

TemporalData = xs.Deserialize(wr)

as ObservableCollection<Temporal>;

 

}

 

DataSeries cs = new DataSeries();

 

cs.Definition =

new CandleStickSeriesDefinition();

 

 

DataSeries ps = new DataSeries();

 

ps.Definition =

new CandleStickSeriesDefinition();

 

 

DataSeries ls = new DataSeries();

 

ls.Definition =

new LineSeriesDefinition();

 

 

CoMorbidityChartData = TemporalData.Where<

Temporal>(f => f.Id == "CoMorbidityChartDetail").ToList<Temporal>();

 

 

int count = 1;

 

 

foreach (TemporalItem ti in CoMorbidityChartData[0].TemporalItem)

 

{

 

DataPoint dpPopulation = new DataPoint();

 

dpPopulation.XCategory = ti.Id;

dpPopulation.Low =

Convert.ToDouble(ti.Readings[0].Low);

 

dpPopulation.High =

Convert.ToDouble(ti.Readings[0].High);

 

dpPopulation.Close =

Convert.ToDouble(ti.Readings[0].Close);

 

dpPopulation.Open =

Convert.ToDouble(ti.Readings[0].Open);

 

 

DataPoint dpLine = new DataPoint();

 

dpLine.YValue =

Convert.ToDouble(ti.Readings[0].Open);

 

 

ls.Add(dpLine);

cs.Add(dpPopulation);

count++;

}

 

 

foreach (TemporalItem ti in CoMorbidityChartData[0].TemporalItem)

 

{

 

DataPoint dpCriteria = new DataPoint();

 

dpCriteria.XCategory = ti.Id;

dpCriteria.Low =

Convert.ToDouble(ti.Readings[1].Low);

 

dpCriteria.High =

Convert.ToDouble(ti.Readings[1].High);

 

dpCriteria.Close =

Convert.ToDouble(ti.Readings[1].Close);

 

dpCriteria.Open =

Convert.ToDouble(ti.Readings[1].Open);

 

 

ps.Add(dpCriteria);

}

 

this.RadChart1.DefaultView.ChartArea.DataSeries.Add(cs);

 

 

this.RadChart1.DefaultView.ChartArea.DataSeries.Add(ps);

 

 

}



 

7 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 05 May 2010, 01:08 PM
Hi Prasad Saravate,

We are not entirely sure that the CandleStick type series should behave like that. Usually the "candles" should be aligned exactly over the value they stand for in stock charts. It looks like you are using them for something different from tracking stock prices. Can you elaborate a bit on your case? Perhaps we can help with some advice how to better plot your data.

All the best,
Vladimir Milev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Eric
Top achievements
Rank 1
answered on 22 Jul 2012, 04:14 PM
Two examples that I want to graph with multi series candlesticks.
Two or more companies on the same chart, to compare with side by side candle sticks.

I am doing a non-financial project and candlesticks work great, but now I want to expand to multi series.
I am graphing hours of sleep on a 0-24 hour Yaxis and days on Xaxis.
The candle stick shows wake-up time and lights out time and the skinny lines are uncertainty.
I can plot a week or a month, works great!

Now I want to plot 4 weeks side by side so Xaxis has 7 days. That way I show 4 Sundays, 4 Mondays ... next to each other
for easy viewing.

How to do that?

I could do Xaxis 28 days (35 to get some white space), and graph module 4 or 5.
Is there a better way?
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 25 Jul 2012, 02:49 PM
Hello Eric,

It seems the latest version of the control renders the candlestick series side-by-side (see the attached screenshot) with the following code snippet:
DataSeries series = new DataSeries();
series.Definition = new CandleStickSeriesDefinition();
series.Add(new DataPoint() { Open = 10, High = 30, Low = 10, Close = 20 });
series.Add(new DataPoint() { Open = 20, High = 40, Low = 5, Close = 5 });
series.Add(new DataPoint() { Open = 5, High = 10, Low = 5, Close = 10 });
 
RadChart1.DefaultView.ChartArea.DataSeries.Add(series);
 
DataSeries series2 = new DataSeries();
series2.Definition = new CandleStickSeriesDefinition();
series2.Add(new DataPoint() { Open = 15, High = 30, Low = 10, Close = 20 });
series2.Add(new DataPoint() { Open = 20, High = 30, Low = 5, Close = 15 });
series2.Add(new DataPoint() { Open = 15, High = 15, Low = 5, Close = 5 });
 
RadChart1.DefaultView.ChartArea.DataSeries.Add(series2);


Greetings,
Bart.
0
Chi Chong
Top achievements
Rank 1
answered on 16 Dec 2015, 08:19 AM

Hi,

Instead of showing side by side, is it possible to stack those candlestick on top of each other? Or overlap together?

 

Thanks.

0
Petar Marchev
Telerik team
answered on 17 Dec 2015, 11:34 AM
Hello Chi,

The original question in this thread concerns the old RadChart control. We suggest that you do not use it for new development as the new RadChartView is much faster, very flexible and easy to set up, and resolves many of the old chart's limitations. The new control is actually a set of controls: RadCartesianChart, RadPieChart, RadPolarChart, ChartDataSource.

The candlesticks in the chartview will be drawn in the manner you expect.

qsf example
online documentation

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Chi Chong
Top achievements
Rank 1
answered on 18 Dec 2015, 12:52 AM

I'm actually using RadCartesianChart WPF, and I thought I in UI for WPF/Chart .... the same forum :-).

Anyway, how to do it in RadCartesianChart WPF?
I tried the above code in WPF, it doesn't seem working.

Please Help.

 

0
Petar Marchev
Telerik team
answered on 18 Dec 2015, 08:31 AM
Hello Chi,

I am unsure what you need. Did you take a look at the links I gave? If you were to run a new project with the chartview and a candlestick series, you would see that it behaves in the manner that you expect. If you need further assistance I will ask that you open a new thread, because we think it is easier to have different questions in different sections so that it is easier to follow the communication and search for answers. You can open a new forum post and send an image of what you have so far and a drawing of the results you are after. Thank you for understanding.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Prasad Saravate
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Eric
Top achievements
Rank 1
Bartholomeo Rocca
Top achievements
Rank 1
Chi Chong
Top achievements
Rank 1
Petar Marchev
Telerik team
Share this question
or