ZoomStates 的问题:'ISciChartSurface' 不包含 'ZoomStates' 的定义

Trouble with ZoomStates: 'ISciChartSurface' does not contain a definition for 'ZoomStates'

我一直在浏览新的(而且真的很棒!)SciChart Tutorial,并且 运行 遇到了一个问题。我正在尝试使用 ViewportManager API 使实时更新图表可缩放和滚动。然而,这段代码不起作用:

// Don't Scroll if user is Zooming
if (ParentSurface.ZoomState == ZoomStates.UserZooming) {
    return currentVisibleRange;
}

我遇到了 ZoomState 和 ZoomStates 的错误,让我知道 ISciChartSurface 不包含 ZoomState 的定义。据我所知,ZoomStates 应该是 SciChart.Charting.Visuals 中的一个枚举,但我无法在 Assembly Explorer 中找到它。我安装的 SciChart 是否以某种方式丢失了它?还是我——像往常一样——犯了一些非常愚蠢的错误?我该怎么办?谢谢!

信息: SciChart 版本 4.1.1.8645

完整 class 代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SciChart.Charting.ViewportManagers;
using SciChart.Charting.Visuals;
using SciChart.Charting.Visuals.Axes;
using SciChart.Data.Model;



namespace SciCharter {
    /// <summary>
    /// Applies a scrolling window to the chart unless the user is zooming or panning
    /// </summary>
    public class ScrollingViewportManager : DefaultViewportManager {
        private readonly double _windowSize;
        public ISciChartSurface ParentSurface { get; set; }

        public ScrollingViewportManager(double windowSize) {
            _windowSize = windowSize;
        }

        public override void AttachSciChartSurface(ISciChartSurface scs) {
            base.AttachSciChartSurface(scs);
            this.ParentSurface = scs;
        }

        protected override IRange OnCalculateNewXRange(IAxis xAxis) {
            // The Current XAxis Visible Range
            var currentVisibleRange = xAxis.VisibleRange.AsDoubleRange();

            // Don't Scroll if user is Zooming
            if (ParentSurface.ZoomState == ZoomStates.UserZooming) {
                return currentVisibleRange;
            }

            var maxXRange = xAxis.GetMaximumRange().AsDoubleRange();
            double xMax = Math.Max(maxXRange.Max, currentVisibleRange.Max);

            // Scroll showing latest window range
            return new DoubleRange(xMax - _windowSize, xMax);

        }
    }
}

文章SciChart WPF: New set of tutorials now online中说:

Tutorials Include ... WPF Chart Tutorial 06 – Adding Realtime Updates (15 minutes) uses some features from SciChart v4.2, which is in QA now and available on the nightly build feed only.

SciChart WPF Nightly Builds 可从私人 nuget 源获得。可以找到有关如何访问它们的完整说明 here

希望对您有所帮助!