Simpe way to mark a range background

4 posts, 0 answers
  1. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 23 Jan 2014 Link to this post


    I attached an image showing what I like to have.

    The idea - a chart representing values of a time series (line in the sample - could also be Bar or...).
    During the period something happens (let's say it rains) - I know the start end the end time of this event.
    Now I want to mark the rain period.

    How can this be achived?

    And I want the Y axes to be dynamic, so that if a higher value scrolls in it should expand, keeping the marked section to the top.

    Last not least - it would be great if that will also work for Windows Phone and Windows 8.

    Thank you
  2. Martin Ivanov
    Martin Ivanov avatar
    2321 posts

    Posted 24 Jan 2014 Link to this post

    Hello Manfred,

    Your requirement could be achieved if you use the RadChartView Annotaions and more specifically the CartesianPlotBandAnnotation. In order to highlight a time range in your chart you could create an annotation similar to this one:
    <telerik:CartesianPlotBandAnnotation DataContext="{Binding}"
                              From="{Binding FromDate}"
                              To="{Binding ToDate}"
                              Axis="{Binding ElementName=horizontalAxis}"/>

    where the Axis property determines with which axis the annotation must be associated, the From property is the starting point of the plot band and To is the ending point.

    I prepared a sample project to demonstrate the described approach.

    As for your last question, you can use our WPF ChartView in a WPF solution and run it in Windows8. However, if you need a charting component specifically designed for Windows8 development, you can take advantage of the Windows8 RadChart control, which also supports the CartesianPlotBandAnnotation.

    For mobile devices you can use the RadControls for Windows Phone, where you could use the same approach with the CartesianPlotBandAnnotation.

    Martin Ivanov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 30 Jan 2014 in reply to Martin Ivanov Link to this post

    Hi Martin,

    thank you for the solution!
    Telerik support at it's best :)

  4. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 30 Jan 2014 in reply to ManniAT Link to this post

    I can't mark your post (it also shows you as "missing user") as answer (gives me an error) - and I can't edit my post to add these words.
    So with a new Post:

    This qeustion is answered!
Back to Top