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

DateTimeContinuousAxis TimeSpan

2 Answers 207 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Philipp
Top achievements
Rank 1
Philipp asked on 05 Sep 2016, 01:06 PM

Hi,

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 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 07 Sep 2016, 10:42 AM
Philipp,

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.

Regards,
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.
0
Philipp
Top achievements
Rank 1
answered on 09 Sep 2016, 01:37 PM

Hi,

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\}'}" />
    </DataTemplate>

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

This works.

Tags
ChartView
Asked by
Philipp
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Philipp
Top achievements
Rank 1
Share this question
or