Hi
I have this XamTimeline
<ig:XamTimeline x:Name="MyTimeLine" Grid.Row="1"> <ig:XamTimeline.Axis> <ig:DateTimeAxis Minimum="01/01/10" AutoRange="False" Maximum="01/30/10" ShowLabels="True" ShowMajorTickMarks="True" ShowMinorTickMarks="True" UnitType="Hours" ShowThumb="True"> </ig:DateTimeAxis> </ig:XamTimeline.Axis> </ig:XamTimeline>
I want it to display both date AND time based on the zoom resolution but it seems that the "resolution" is calculated based on the DateTimeAxis range therefore it displays date OR time
Thx
Hi,
You can format the date time labels with:
<Style x:Key="labelStyle" TargetType="ig:AxisLabel">
<Setter Property="StringFormat" Value="{}{0:f}" />
</Style>
…
<ig:XamTimeline.Axis>
<ig:DateTimeAxis Minimum="01/01/2012"
Maximum="04/01/2013"
LabelStyle="{StaticResource labelStyle}"
AutoRange="False"
Unit="1"/>
</ig:XamTimeline.Axis>
More info you can find:
http://help.infragistics.com/NetAdvantage/DV/2010.3/CLR4.0/?page=SL_DV_xamWebTimeline_Format_DateTime_Values.html
Thanks for your fast reply but what I need is different
I need to "adapt" the UnitType and Unit by the XamTimeLine.DateTimeAxis VisibleMinimum and VisibleMaximum. Something like that:
or
so the user will see both the days and the hours, and not like the default that display hours without indication of days
So is there a way to do it automatically through XAML or do i need to in the code : void Zoombar_ZoomChanged(object sender, Infragistics.Controls.ZoomChangedEventArgs e) { TimeSpan diff = (((DateTimeAxis)MyTimeLine.Axis).VisibleMaximum - ((DateTimeAxis)MyTimeLine.Axis).VisibleMinimum); SetResolution(diff); } private void SetResolution(TimeSpan diff) { DateTimeAxis axis = MyTimeLine.Axis as DateTimeAxis; if (axis == null) return; _monthSeries.Entries.Clear(); _daySeries.Entries.Clear(); if (diff.Hours < 24) { axis.UnitType = DateTimeUnitType.Minutes; axis.Unit = 1; } if (diff.Days < 4) { axis.UnitType = DateTimeUnitType.Hours; axis.Unit = 1; var days = GetDays(axis.VisibleMinimum , axis.VisibleMaximum); SetDaysSeries(days); } else if (diff.Days > 4 && diff.Days < 30) { axis.UnitType = DateTimeUnitType.Days; axis.Unit = 1; } else { axis.UnitType = DateTimeUnitType.Months; axis.Unit = 1; var months = GetMonths(axis.VisibleMinimum , axis.VisibleMaximum); SetMonthSeries(months); } }
So is there a way to do it automatically through XAML or do i need to in the code :