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

Time of Y-axis

1 Answer 27 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
prayag ganoje
Top achievements
Rank 1
prayag ganoje asked on 18 Apr 2011, 01:37 PM
Hi,

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 ?

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 21 Apr 2011, 01:42 PM
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");
           s.Items.Add(item);
       }
       RadChart1.AddChartSeries(s);
       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,
Evgenia
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.

Tags
Chart (Obsolete)
Asked by
prayag ganoje
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or