DateTimeCategoricalAxis FormatException

2 posts, 0 answers
  1. LOUGE
    LOUGE avatar
    12 posts
    Member since:
    Jun 2010

    Posted 10 Apr 2013 Link to this post

    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;






  2. LOUGE
    LOUGE avatar
    12 posts
    Member since:
    Jun 2010

    Posted 11 Apr 2013 Link to this post

    %h do the trick, sorry
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top