private void SetupAnnotations()
{
var annotationLayer = new AnnotationLayer(this.flexChart1);
var orderedCost = _data.OrderBy(x => x.Cost).ToList();
var arrowCallout = new Polygon("Maximum Cost")
{
Attachment = AnnotationAttachment.DataIndex,
SeriesIndex = 0,
PointIndex = _data.IndexOf(orderedCost[_data.Count - 1]),
};
arrowCallout.Style.FillColor = Color.FromArgb(100, Color.Pink);
arrowCallout.Style.StrokeColor = Color.Red;
arrowCallout.ContentStyle.StrokeColor = Color.Red;
foreach (PointF point in GetArrowCalloutPoints(arrowCallout, orderedCost[_data.Count - 1]))
{
arrowCallout.Points.Add(point);
}
var lineCallout = new Polygon("Minimum Cost")
{
Attachment = AnnotationAttachment.DataIndex,
SeriesIndex = 0,
PointIndex = _data.IndexOf(orderedCost[0]),
ContentCenter = new PointF(30, -60),
Points = { new PointF(0, 0), new PointF(30, -40), new PointF(-30, -40), new PointF(-30, -80), new PointF(90, -80), new PointF(90, -40), new PointF(30, -40) }
};
lineCallout.Style.FillColor = Color.FromArgb(100, Color.Aqua);
lineCallout.Style.StrokeColor = Color.Blue;
lineCallout.ContentStyle.StrokeColor = Color.Blue;
annotationLayer.Annotations.Add(arrowCallout);
annotationLayer.Annotations.Add(lineCallout);
}
Private Sub SetupAnnotations()
Dim annotationLayer As AnnotationLayer = New AnnotationLayer(Me.flexChart1)
Dim orderedCost As List(Of UnitsCost) = _data.OrderBy(Function(x) x.Cost).ToList()
Dim arrowCallout As Polygon = New Polygon("Maximum Cost") With {
.Attachment = AnnotationAttachment.DataIndex,
.SeriesIndex = 0,
.PointIndex = _data.IndexOf(orderedCost(_data.Count - 1))
}
arrowCallout.Style.FillColor = Color.FromArgb(100, Color.Pink)
arrowCallout.Style.StrokeColor = Color.Red
arrowCallout.ContentStyle.StrokeColor = Color.Red
For Each point As PointF In GetArrowCalloutPoints(arrowCallout, CType(orderedCost(_data.Count - 1), UnitsCost))
arrowCallout.Points.Add(point)
Next
Dim lineCallout As Polygon = New Polygon("Minimum Cost") With {
.Attachment = AnnotationAttachment.DataIndex,
.SeriesIndex = 0,
.PointIndex = _data.IndexOf(CType(orderedCost(0), UnitsCost)),
.ContentCenter = New PointF(30, -60)
}
lineCallout.Points.Add(New PointF(0, 0))
lineCallout.Points.Add(New PointF(30, -40))
lineCallout.Points.Add(New PointF(-30, -40))
lineCallout.Points.Add(New PointF(-30, -80))
lineCallout.Points.Add(New PointF(-30, -80))
lineCallout.Points.Add(New PointF(90, -80))
lineCallout.Points.Add(New PointF(90, -40))
lineCallout.Points.Add(New PointF(30, -40))
lineCallout.Style.FillColor = Color.FromArgb(100, Color.Aqua)
lineCallout.Style.StrokeColor = Color.Blue
lineCallout.ContentStyle.StrokeColor = Color.Blue
annotationLayer.Annotations.Add(arrowCallout)
annotationLayer.Annotations.Add(lineCallout)
End Sub