Oxyplot Tracker

carlasampaio01carlasampaio01 Carla SampaioPTMember ✭✭

hi, Im trying to add a tracker to the chart but it doesn't show up and I can't find to make it work. My code is:

`var plotModel = new PlotModel
{
Title = "",
PlotAreaBorderColor = OxyColors.Transparent,
TextColor = OxyColor.FromRgb(150, 150, 150),// texto x

        };

        plotModel.DefaultColors = new List<OxyColor>
        {
            OxyColor.FromRgb(13,30,27)  ,
            OxyColors.RoyalBlue ,
            OxyColors.Green
        };

        plotModel.Axes.Add(new LinearAxis()
        {
            IsZoomEnabled = false,
            IsPanEnabled = false,
            TextColor = OxyColor.FromRgb(150, 150, 150),
            AxislineColor = OxyColor.FromRgb(224, 224, 224),
            MinorTicklineColor = OxyColor.FromRgb(224, 224, 224),
            MajorGridlineColor = OxyColor.FromRgb(224, 224, 224),
            TicklineColor = OxyColor.FromRgb(224, 224, 224),
            ExtraGridlineColor = OxyColor.FromRgb(224, 224, 224),
            MinorGridlineColor = OxyColor.FromRgb(224, 224, 224),
            AxislineStyle = LineStyle.Solid,
            MajorGridlineStyle = LineStyle.Solid,
            MinorGridlineStyle = LineStyle.Solid
        });


        plotModel.Axes.Add(new LinearAxis()
        {
            Position = AxisPosition.Bottom ,
            IsZoomEnabled = false,
            IsPanEnabled = false,
            TextColor = OxyColor.FromRgb(150, 150, 150),
            AxislineColor = OxyColor.FromRgb(224, 224, 224),
            MinorTicklineColor = OxyColor.FromRgb(224, 224, 224),
            MajorGridlineColor = OxyColor.FromRgb(224, 224, 224),
            TicklineColor = OxyColor.FromRgb(224, 224, 224),
            ExtraGridlineColor = OxyColor.FromRgb(224, 224, 224),
            MinorGridlineColor = OxyColor.FromRgb(224, 224, 224),
            AxislineStyle = LineStyle.Solid,
            MajorGridlineStyle = LineStyle.Solid,
            MinorGridlineStyle = LineStyle.Solid,
        });

        AreaSeries series2 = new AreaSeries
        {
            MarkerType = MarkerType.Circle,
            MarkerSize = 4,
            TrackerFormatString = "{2:0.0},{4:0.0}",
            DataFieldX2 = "X",
            ConstantY2 = 0,

        };



        var Points = new List<DataPoint>
        {
            new DataPoint(0, 4),
            new DataPoint(10, 13),
            new DataPoint(20, 15),
            new DataPoint(30, 16),
            new DataPoint(40, 12),
            new DataPoint(50, 12),
        };

        series2.ItemsSource = Points;
        plotModel.Series.Add(series2);

        PlotView plot = new PlotView
        {
            Margin = new Thickness(20),
            Model = plotModel,
            HeightRequest = 250,

        };`

Answers

Sign In or Register to comment.