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

DateTimeCategoricalAxis FormatException

1 Answer 82 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
LOUGE
Top achievements
Rank 1
LOUGE asked on 10 Apr 2013, 02:39 PM
I'm trying to use LabelFormat in DateTimeCategoricalAxis but an exception occurs when i use H format string. =>it's work with HH for example
I want to use h (just hour with one digit for 1,2,3...), ddd, d (just day for 1,2,3...) and MMM in final testing

Xaml View :
<telerik:RadCartesianChart>
 
           <telerik:RadCartesianChart.HorizontalAxis>
               <telerik:DateTimeCategoricalAxis LabelFitMode="None"
                                                LabelFormat="H"
                                                DateTimeComponent="Hour" />
           </telerik:RadCartesianChart.HorizontalAxis>
 
           <telerik:RadCartesianChart.VerticalAxis>
               <telerik:LinearAxis />
           </telerik:RadCartesianChart.VerticalAxis>
 
           <telerik:LineSeries ItemsSource="{Binding}"
                               CategoryBinding="XValue"
                               ValueBinding="YValue"/>
 
       </telerik:RadCartesianChart>

Data object :
public class ChartData
   {
       public DateTime XValue
       {
           get;
           set;
       }
 
       public Double YValue
       {
           get;
           set;
       }
   }

Code for initialize data :
List<ChartData> datas = new List<ChartData>();
 
           for (int i = 0; i < 23; i++)
           {
               datas.Add(new ChartData
                   {
                       XValue = DateTime.Today.AddHours(i),
                       YValue = i
                   });
           }
 
           DataContext = datas;






1 Answer, 1 is accepted

Sort by
0
LOUGE
Top achievements
Rank 1
answered on 11 Apr 2013, 07:47 AM
%h do the trick, sorry
Tags
ChartView
Asked by
LOUGE
Top achievements
Rank 1
Answers by
LOUGE
Top achievements
Rank 1
Share this question
or