Using SciChart v5.1.0.11299, I am trying to display VerticalLineAnnotations with a TimeSpanAxis as the X axis. I can display the vertical lines using a NumericAxis, but not with the TimeSpanAxis.
<s:SciChartSurface ChartTitle="Values vs Time">
<s:SciChartSurface.XAxis>
<s:TimeSpanAxis AxisTitle="Time">
<s:TimeSpanAxis.VisibleRange>
<s:TimeSpanRange Min="00" Max="00:10:00"/>
</s:TimeSpanAxis.VisibleRange>
</s:TimeSpanAxis>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AxisTitle="Values"/>
</s:SciChartSurface.YAxis>
<s:SciChartSurface.Annotations>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="00:00:10"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="00:00:20"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="00:01:00"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="00:02:00"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="00:05:00"/>
</s:SciChartSurface.Annotations>
</s:SciChartSurface>
However, the corresponding version as a NumericAxis does render the VerticalLineAnnotations:
<s:SciChartSurface ChartTitle="Values vs Not Time">
<s:SciChartSurface.XAxis>
<s:NumericAxis AxisTitle="Not Time">
<s:NumericAxis.VisibleRange>
<s:DoubleRange Min="00" Max="1000"/>
</s:NumericAxis.VisibleRange>
</s:NumericAxis>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AxisTitle="Values"/>
</s:SciChartSurface.YAxis>
<s:SciChartSurface.Annotations>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="0010"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="0020"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="0100"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="0200"/>
<s:VerticalLineAnnotation Stroke="Orange" StrokeThickness="1" X1="0500"/>
</s:SciChartSurface.Annotations>
</s:SciChartSurface>
This must be possible, but I cannot find an example of the required differences with regards to NumericAxis?
Thanks in advance.
I think the issue here is you cannot set a TimeSpan easily in Xaml.
The property the of VerticalLineAnnotation.X1 is IComparable, so the Xaml compiler picks it up as a string.
Try setting the X1 to a TimeSpan in code, an attached behaviour or binding to a ViewModel