SciChart TimeSpanAxis 不显示 VerticalLineAnnotation

SciChart TimeSpanAxis not showing VerticalLineAnnotation

使用 SciChart v5.1.0.11299,我正在尝试以 TimeSpanAxis 作为 X 轴显示 VerticalLineAnnotations。我可以使用 NumericAxis 显示垂直线,但不能使用 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>

但是,作为 NumericAxis 的相应版本确实呈现了 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>

这一定是可能的,但我找不到关于 NumericAxis 所需差异的示例?

提前致谢。

我认为这里的问题是您无法在 Xaml 中轻松设置 TimeSpan。

VerticalLineAnnotation.X1 的 属性 是 IComparable,因此 Xaml 编译器将其作为字符串拾取。

尝试在代码中将 X1 设置为 TimeSpan、附加行为或绑定到 ViewModel