DateTimeContinuousAxis TimeSpan

3 posts, 0 answers
  1. Philipp
    Philipp avatar
    3 posts
    Member since:
    Sep 2016

    Posted 05 Sep 2016 Link to this post


    I want to use multiple line series to compare some analog sensor values over several production runs.

    The production runs start at different time or dates. To compare them all time values substracted from the production run start, thus i get a compareable timespan for each value.

    I tried to use a TimeSpan data type but that seems not to work with the DateTime Axes. With a DateTime datatype it works but if a production run takes more than one day I can only show the day of month. I can't show the day value as day 1, day 2 ... because the DateTime format string has no "elapsed days" only day on week or day of month.

    Is there a way to use a TimeSpan or customize the lable formatting.

    Thank you for your help

  2. Petar Marchev
    Petar Marchev avatar
    996 posts

    Posted 07 Sep 2016 Link to this post


    I think that you do not need a date time axis. You need to display data about the time that has elapsed, say hours. So you can use a linear axis for the hours that has passed. I think you should consider this option.

    Remember you need to use scatter series when the two axes are numeric. Let us know if the above suggestion does not satisfy your requirements.

    Petar Marchev
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Philipp
    Philipp avatar
    3 posts
    Member since:
    Sep 2016

    Posted 09 Sep 2016 in reply to Petar Marchev Link to this post


    thank you for the advice. This helped me but was not obvious how to solve it.

    My solution is:

    I use a ScatterLineSeries and provide my TimeSpan as ticks in the data model.

    My numeric axis (with the ticks as content) gets a LabelTemplate

        <DataTemplate x:Key="TimeSpanTickConverter">
            <TextBlock Text="{Binding Converter={StaticResource TicksToTimeSpanLabelConverter}, ConverterParameter='\{0:dd\} \{0:hh\\:mm\\:ss\}'}" />

    The label template contains a converter that converts ticks to my desired time string.

    This works.

Back to Top