Candlestick Chart Multiple DataSeries

8 posts, 0 answers
  1. Prasad Saravate
    Prasad Saravate avatar
    2 posts
    Member since:
    Mar 2010

    Posted 29 Apr 2010 Link to this post

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

     

     

    }



     
  2. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 05 May 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Eric
    Eric avatar
    1 posts
    Member since:
    Jul 2012

    Posted 22 Jul 2012 Link to this post

    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?
  5. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 25 Jul 2012 Link to this post

    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.
  6. Chi Chong
    Chi Chong avatar
    2 posts
    Member since:
    Aug 2014

    Posted 16 Dec 2015 Link to this post

    Hi,

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

     

    Thanks.

  7. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 17 Dec 2015 Link to this post

    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
  8. Chi Chong
    Chi Chong avatar
    2 posts
    Member since:
    Aug 2014

    Posted 17 Dec 2015 in reply to Petar Marchev Link to this post

    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.

     

  9. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 18 Dec 2015 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready