PolygonAnnotation.Points · Issue #2135 · oxyplot/oxyplot · GitHub
Skip to content

PolygonAnnotation.Points #2135

Open
Open

Description

@ChristianKarras

Hello,

The "Points" property in PolygonAnntoation is write protected -> Consequence: I can't add a PolygonAnnotation to the Graph as given in example code (https://github.com/ylatuya/oxyplot/blob/master/Source/Examples/ExampleLibrary/Examples/AnnotationExamples.cs)

OxyplotVersion: 2.2.0

BR,KC

Activity

  1. Spordoz commented on Apr 15, 2025

    @Spordoz

    The Points property is indeed a readOnly property, meaning you cannot assign it a list.
    But the existing list is accesable and points can be added by adding them through PolyAnno.Points.Add(DataPoint).

    var PolyAnno = new PolygonAnnotation()
    foreach ([type] point in [Your source])
    PolyAnno.Points.Add(New datapoint(point.X, point.Y)).
    Plotmodel.Annotations.add(PolyAnno)

    You might need to set some more properties such as colors and axiskeys, but this is it for points.

    The example does indeed seem to be incorrect however, which is unfortunate.

  2. ChristianKarras commented on Apr 15, 2025

    @ChristianKarras
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions