Time based Series X-Axis labels format

5 posts, 0 answers
  1. Erez
    Erez avatar
    2 posts
    Member since:
    Feb 2012

    Posted 01 Mar 2012 Link to this post

    Hi,

    My data is a time based series with a single value for each hour. The series period is 1 year so the total number of points is ~8600 (12*30*24).
    I want to display my series in a chart where the X-Axis labels will be presented with gaps and in two lines like it is in the Financial ChartView example (Screenshot attached).
    In the Financial example (screenshot attached) the Axis year’s labels are hard coded TextBlock controls and the month’s labels gaps format is specific determined. This is OK when the chart period is static, however in my application the user need to be able to select the start time and end time (with a separate control, maybe a TimeBar control) and also can do zooming to the X-Axis.

    How can I get the Financial example time based labeling display when the data time period is known only at runtime? 

    Thanks,
    Erez.
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 06 Mar 2012 Link to this post

    Hi Erez,

    Please, find attached an updated version of the user control, holding the chart in question. Note, that due to a pending change, the value converter contains dual implementation. Currently, the data context of the label is a string value, so you need to parse it in order to retrieve the DateTime value and format it as required. This will be updated and the context will be the DateTime value, so you will be able to remove the call to  String.Parse after 2012 Q1 SP1 is released.

    Best regards,
    Ves
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Erez
    Erez avatar
    2 posts
    Member since:
    Feb 2012

    Posted 07 Mar 2012 Link to this post

    Hi,

    This is helpful, however what about the hardcoded date label gaps (MajorStep="3" MajorStepUnit="Month").
    Can it be dynamic calculate according to the chart time period? Otherwise the time labels are drawn one on top of the other.

    Thanks,
    Erez.
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 12 Mar 2012 Link to this post

    Hi Erez,

    Please, find attached another version of MainView.xaml. Note, that this one uses DateTimeCategoricalAxis, so this example actually assumes there is an item for every month within the plotted period. Hope this helps.

    Best regards,
    Ves
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Steven
    Steven avatar
    22 posts
    Member since:
    May 2011

    Posted 27 Sep 2012 Link to this post

    I created a version of this code whereby the new month might occur on a weekend, but the first business day / data point is on a Monday.  I hoped to be able to use XamlReader.Loader to bind dynamically to the resource that I added to a ResourceDictionary at run-time.  

    Is this possible?  
Back to Top
DevCraft banner