How not to render the grid outside of the EllipseAnnotation in oxyplot?

I want to draw a plot as shown in the picture below using oxyplot.

enter image description here

the problem here is the grid. I don't want to draw them outside the largest circle.

this is what I am getting so far:

enter image description here

PS: for anyone who wants to know how to achieve this: (thanks for @ dd4711 who helped me with this question

var model = new PlotModel {
            Title = "EllipseAnnotations",
            PlotAreaBorderColor = OxyColors.Transparent
        };

        var series = new LineSeries {
            MarkerType = MarkerType.Cross,
            MarkerSize = 7,
            MarkerStroke = OxyColors.Red,
            MarkerStrokeThickness = 3,
            Color = OxyColors.Red
        };

        series.Points.Add(new DataPoint(65, 45));

        model.Annotations.Add(new EllipseAnnotation { X = 50, Y = 50, Width = 10, Height = 10, Fill = OxyColor.FromAColor(0xaa,OxyColors.LightGray), Stroke = OxyColors.Black, StrokeThickness = 1 });
        model.Annotations.Add(new EllipseAnnotation { X = 50, Y = 50, Width = 30, Height = 30, Fill = OxyColors.Transparent, Stroke = OxyColors.Black, StrokeThickness = 1 });
        model.Annotations.Add(new EllipseAnnotation
        {
            X = 50,
            Y = 50,
            Width = 60,
            Height = 60,
            Fill = OxyColors.Transparent,
            Stroke = OxyColors.Black, StrokeThickness = 1,
        });

        for (int x = 2; x < 9; x++)
        {
            if (x != 5)
            {
                model.Annotations.Add(new TextAnnotation
                {
                    TextPosition = new DataPoint(x * 10, 50),
                    Text = (x * 10).ToString(),
                    Stroke = OxyColors.White,
                    Background = OxyColors.White,
                    TextHorizontalAlignment = HorizontalAlignment.Center,
                    TextVerticalAlignment = VerticalAlignment.Middle,
                    StrokeThickness = 0
                });

                model.Annotations.Add(new TextAnnotation
                {
                    TextPosition = new DataPoint(50, x*10),
                    Text = (x * 10).ToString(),
                    Stroke = OxyColors.White,
                    Background = OxyColors.White,
                    TextHorizontalAlignment = HorizontalAlignment.Center,
                    TextVerticalAlignment = VerticalAlignment.Middle,
                    StrokeThickness = 0
                });
            }
        }

        model.Annotations.Add(new TextAnnotation
        {
            TextPosition = new DataPoint(50, 50),
            Text = "50",
            Stroke = OxyColor.FromRgb(0xdd, 0xdd, 0xdd),
            Background = OxyColor.FromRgb(0xdd, 0xdd, 0xdd),
            TextHorizontalAlignment = HorizontalAlignment.Center,
            TextVerticalAlignment = VerticalAlignment.Middle,
            StrokeThickness = 0
        });

        model.Axes.Add(new LinearAxis
        {
            Position = AxisPosition.Bottom,
            Minimum = 15,
            Maximum = 85,
            MajorStep = 10,
            MajorGridlineStyle = LineStyle.Dot,
            ExtraGridlines = new[] { 50.0 },
            ExtraGridlineColor = OxyColors.Black,
            AxislineColor = OxyColors.Transparent,
            TextColor = OxyColors.Transparent,
            TicklineColor = OxyColors.Transparent
        });

        model.Axes.Add(new LinearAxis
        {
            Position = AxisPosition.Left,
            Minimum = 15,
            Maximum = 85,
            MajorStep = 10,
            MajorGridlineStyle = LineStyle.Automatic,
            ExtraGridlines = new[] { 50.0 },
            ExtraGridlineColor = OxyColors.Black,
            AxislineColor =OxyColors.Transparent,
            TextColor = OxyColors.Transparent,
            TicklineColor = OxyColors.Transparent
        });

        model.Series.Add(series);

      

+2


source to share





All Articles