PolygonAnnotation
Imports Oxyplot.Axes
Imports Oxyplot.Annotations
Public Class Form
Private WithEvents PolygonAnt As PolygonAnnotation
Private hitCount As Integer
Private plotModel As PlotModel
Private Sub Form_Load(sender As Object, e As EventArgs) Handles Me.Load
plotModel = New PlotModel With {
.Subtitle = "Click the polygon",
.Title = "PolygonAnnotation",
.Background = OxyColors.White
}
Dim linearAxisX = New LinearAxis With {
.Maximum = 20,
.Minimum = -20,
.Position = AxisPosition.Bottom
}
plotModel.Axes.Add(linearAxisX)
Dim linearAxisY = New LinearAxis With {
.Maximum = 20,
.Minimum = -20
}
plotModel.Axes.Add(linearAxisY)
PolygonAnt = New PolygonAnnotation With {
.Text = "Polygon 1"
}
PolygonAnt.Points.Add(New DataPoint(4, -2))
PolygonAnt.Points.Add(New DataPoint(8, -4))
PolygonAnt.Points.Add(New DataPoint(17, 7))
PolygonAnt.Points.Add(New DataPoint(5, 8))
PolygonAnt.Points.Add(New DataPoint(2, 5))
plotModel.Annotations.Add(PolygonAnt)
PlotView.Model = plotModel
hitCount = 1
End Sub
Private Sub PolygonAnt_MouseDown(sender As Object, e As OxyMouseDownEventArgs) Handles PolygonAnt.MouseDown
If Not e.ChangedButton = OxyMouseButton.Left Then
Return
End If
hitCount = hitCount + 1
PolygonAnt.Text = String.Format("Hit # {0}", hitCount)
plotModel.InvalidatePlot(False)
e.Handled = True
End Sub
End Class

0 件のコメント:
コメントを投稿