C# Oxyplot Tracker在Xamarin.Forms中不起作用

C# Oxyplot Tracker在Xamarin.Forms中不起作用,c#,xamarin.forms,tooltip,oxyplot,tracker,C#,Xamarin.forms,Tooltip,Oxyplot,Tracker,几天前,我开始在wpf中使用oxyplot,效果很好。现在我正试图在Xamarin中复制相同的过程,我注意到跟踪程序(工具提示)在Xamarin.Forms中不起作用,我的代码也差不多 我尝试了以下方法: 将方向改为景观,以防万一问题是地块的大小 尝试添加标记,但不可用,或者我在xmal中遗漏了一些内容 我将trackperformatstring=“X={2},\nY={4}”添加到我的lineseries中,认为可能需要指定跟踪器 我使用了示例中的一个代码,记不起创建视图模型的代码: pu

几天前,我开始在wpf中使用oxyplot,效果很好。现在我正试图在Xamarin中复制相同的过程,我注意到跟踪程序(工具提示)在Xamarin.Forms中不起作用,我的代码也差不多

我尝试了以下方法:

  • 将方向改为景观,以防万一问题是地块的大小
  • 尝试添加标记,但不可用,或者我在xmal中遗漏了一些内容
  • 我将trackperformatstring=“X={2},\nY={4}”添加到我的lineseries中,认为可能需要指定跟踪器

    我使用了示例中的一个代码,记不起创建视图模型的代码:

    public class MyOxyPlot : INotifyPropertyChanged
    {
        public PlotController CustomPlotController { get; set; }
        private PlotModel _myplotModel;
        public PlotModel MyPlotModel
        {
            get { return _myplotModel; }
            set
            {
                if (_myplotModel != value)
                {
                    _myplotModel = value;
                    OnPropertyChanged("MyPlotModel");
                }
            }
        }
    
        MyOxyPlot()
        {
            ConfigPlot();
        }
    
        public void ConfigPlot()
        {
            MyPlotModel.Axes.Add(new LinearAxis
            {
                Title = "X-Axis",
                Position = AxisPosition.Left,
                TickStyle = TickStyle.Outside
            });
            MyPlotModel.Axes.Add(new LinearAxis
            {
                Title = "Y-Axis",
                Position = AxisPosition.Bottom,
                TickStyle = TickStyle.Outside
            });
            var ls = new LineSeries
            {
                Title = "Some test plot",
                Color = OxyColors.Black,
                LineStyle = LineStyle.Solid,
                TrackerFormatString = "X={2},\nY={4}"
            };
            ls.Points.Add(new DataPoint(1, 1));
            ls.Points.Add(new DataPoint(2, 2));
            ls.Points.Add(new DataPoint(3, 3));
            ls.Points.Add(new DataPoint(4, 4));
            ls.Points.Add(new DataPoint(5, 5));
    
            CustomPlotController = new PlotController();
            CustomPlotController.UnbindAll();
            CustomPlotController.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);
            MyPlotModel.Series.Add(ls);
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    
我的绘图工作正常,但跟踪程序(工具提示)不会显示在Xamarin.Forms中。预期结果应与wpf相同,wpf是一个弹出窗口,显示已触摸的数据点的x和y坐标值