Overlay Candlestick Chats

Thread is closed for posting
2 posts, 0 answers
  1. Alex Witkowski
    Alex Witkowski avatar
    5 posts
    Member since:
    Aug 2009

    Posted 26 Aug 2009 Link to this post

    Hi there,
    I have coded something for creating an cnadlestick-chart with datetime values on x-axis using time.ToOADate().
    The problem I have is that the Candlesticks Overlay each other somtimes.

    Heres some Code:
    RadChart1.PlotArea.XAxis.MinValue = startTime.ToOADate(); 
    RadChart1.PlotArea.XAxis.MaxValue = endTime.ToOADate(); 
    RadChart1.PlotArea.XAxis.IsZeroBased = false
    RadChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortTime; 
    RadChart1.PlotArea.XAxis.Step = DateTime.Now.AddMinutes(10).ToOADate() - DateTime.Now.ToOADate(); 
    RadChart1.PlotArea.XAxis.LabelStep = 6; 
    while (startTime < endTime) 
    RadChart1.Series[0].Items.Add(new Telerik.Charting.ChartSeriesItem { XValue = startTime.ToOADate(), YValue = begin, YValue2 = end, YValue3 = max, YValue4 = min }); 
    startTime = startTime.AddMinutes(10); 
    Please help.

    Greetings Alex ;)

    Second problem, how can i add a linebreak to an tooltip-text?

  2. Velin
    Velin avatar
    391 posts

    Posted 28 Aug 2009 Link to this post

    Hi Alex,

    Unfortunately, this seems to be a problem which our developers will further investigate and will provide a solution in a future version of the control. In the meanwhile, I can suggest you to create the ChartSeriesItems without XValue and after that setting the labels right on the XAxis. Here is how you could do this:
    List<string> xLabels = new List<string>(); 
        protected void Page_Load(object sender, EventArgs e) 
            DateTime today = DateTime.Today; 
            DateTime startTime = today.AddHours(8); 
            DateTime endTime = today.AddHours(10); 
            ChartSeries candleStickSeries = new ChartSeries("Candles", ChartSeriesType.CandleStick); 
            RadChart1.PlotArea.XAxis.LabelStep = 6
            int timeShift = 0
            while (startTime.AddMinutes(timeShift)<= endTime) 
                ChartSeriesItem item = new ChartSeriesItem { YValue = 1YValue2 = 5YValue3 = 8YValue4 = 0 }; 
                timeShift += 10; 
            RadChart1.BeforeLayout += new EventHandler<EventArgs>(RadChart1_BeforeLayout); 
        void RadChart1_BeforeLayout(object sender, EventArgs e) 
            for (int i = 0; i < RadChart1.PlotArea.XAxis.Items.Count; i++) 
                RadChart1.PlotArea.XAxis.Items[i].TextBlock.Text = xLabels[i]; 

      Hope this will help.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top