Time of Y-axis

Thread is closed for posting
2 posts, 0 answers
  1. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 18 Apr 2011 Link to this post


    I want to calibrate Y-axis to display time on it in the hour and min format. I dont want to display time in the equivalent decimal format.

    Also same time I want to display in HH:MM in the data-table below the chart. Is it possible to calibrate the Y-axis in time format ?

  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 21 Apr 2011 Link to this post

    Hi prayag,

          Even though you can set custom format string for your item.Label as shown in the code snippet below, this won't affect the Data Table's values. Unfortunately there is no way to set format for the values in the Data Table.

    protected void Page_Load(object sender, EventArgs e)
           RadChart1.AutoLayout = true;
           ChartSeries s = new ChartSeries();
           Random r = new Random();
           const double hourStep = 1 / 24.0;
           const double minuteStep = hourStep / 60;
           const double twentyMinuteStep = minuteStep * 20;
           double startTime = DateTime.Now.AddHours(-1).ToOADate();
           double endTime = DateTime.Now.ToOADate();
           for (double currentTime = startTime; currentTime < endTime; currentTime += twentyMinuteStep)
               ChartSeriesItem item = new ChartSeriesItem();
               item.YValue = currentTime + r.NextDouble() * twentyMinuteStep;
               item.Label.TextBlock.Text = DateTime.FromOADate(item.YValue).ToString("hh:mm");
           RadChart1.PlotArea.YAxis.AxisMode = ChartYAxisMode.Extended;
           RadChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortTime;
           RadChart1.PlotArea.YAxis.AutoScale = false;
           RadChart1.PlotArea.YAxis.AddRange(startTime, endTime, twentyMinuteStep);
           s.Appearance.LabelAppearance.Visible = true;

    Kind regards,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top