Microsoft Chart Control for .NET Framework supports a large number of
events, giving developers many different ways to customize their charts.
All events are made available by the Chart object. The name of the event usually indicates the nature of the event and the object to which it applies, such as the AxisScrollBarClicked event.
There are two special events that allow for custom painting: PrePaint and PostPaint. The PrePaint event is triggered just before the Chart object is painted, and the PostPaint event is triggered just after the chart is painted. Use these events for custom painting. The figure below demonstrates using PostPaint to place an image in the chart picture.
The following lists chart elements that have one or more associated events:
Chart Element | Related Events |
---|---|
Annotation | AnnotationPlaced, AnnotationPositionChanging, AnnotationPositionChanged, AnnotationSelectionChanged |
Axis | AxisScrollBarClicked, AxisViewChanging, AxisViewChanged |
Chart (root object) | PrePaint, PostPaint |
Cursor | CursorPositionChanging, CursorPositionChanged, SelectionRangeChanging, SelectionRangeChanged |
multiple elements | GetTooltipText |