How to set CustomPoints for the Chart ?
One can set the custom point by plotting points on the Chart Area even if they don't belong to a series. These are stored in the ChartControl.CustomPoints collection.They can be used for annotation of interesting data on the chart.
The ChartCustomPoint class can be used to set text, background, border or symbols at a particular point on the chart area.
One can exposed the Custom points in the following four categories,
- PointFollow - This custom point will follow the regular points of any series, to which it is assigned.
- ChartCoordinates - This lets you render a point type at any location in the chart.
- Percent - The coordinates are specified as the percentage of the chart area.
- Pixel - The coordinates are specified to be in pixels of the chart area.
C#
//Customize the Custom Point
ChartCustomPoint cp1=new ChartCustomPoint();
cp1.PointIndex = 0;
cp1.SeriesIndex = 1;
cp1.CustomType = ChartCustomPointType.PointFollow;
cp1.Text = "(Follows data point)";
cp1.Symbol.Shape = ChartSymbolShape.Circle;
// Adding PoinFollow type CustomPoint
this.chartControl1.CustomPoints.Add(cp1);
VB
'Customize the Custom Point
Dim cp1 As ChartCustomPoint = New ChartCustomPoint()
cp1.PointIndex = 0
cp1.SeriesIndex = 1
cp1.CustomType = ChartCustomPointType.PointFollow
cp1.Text = "(Follows data point)"
cp1.Symbol.Shape = ChartSymbolShape.Circle
' Adding PoinFollow type CustomPoint
Me.chartControl1.CustomPoints.Add(cp1)