Nevron .NET Vision Documentation

Annotations derive from the NAnnotation class and share a number of common properties like Text, TextStyle, FillStyle, StrokeStyle and ShadowStyle. The following table shows the annotation objects supported by Nevron Chart for .NET:

Annotation Type Description
NArrowAnnotation Represents an arrow annotation.
NCutEdgeRectangularCallout Represents a cut edge rectangular annotation, with controllable cut edge percent.
NOvalCallout Represents a oval rectangular annotation, with controllable oval percent.
NRectangularCallout Represents a rectangular annotation.
NRoundedRectangularCallout Represents a rounded rectangular annotation, with controllable round percent.

The NAnnotation class derives directly from the NAnchorPanel class thus allowing annotations to use anchors in order to attach to different elements of the chart content.

The following code creates a rectangular callout panel and attaches is to the second data point of a bar series.

Copy Code
NChart chart = chartControl.Charts[0];
NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);


NRectangularCallout rectangularCallout = new NRectangularCallout();
rectangularCallout.ArrowLength = new NLength(30, NRelativeUnit.ParentPercentage);
rectangularCallout.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(125, Color.White), Color.FromArgb(125, Color.CadetBlue));
rectangularCallout.UseAutomaticSize = true;
rectangularCallout.Orientation = 120;
rectangularCallout.Anchor = new NDataPointAnchor(bar, 1, ContentAlignment.MiddleCenter, StringAlignment.Center);
rectangularCallout.Text = "Rectangular callout attached \r\nto the second bar";

Visual Basic
Copy Code
Dim chart As NCartesianChart = chartControl.Charts(0)
Dim bar As NBarSeries = chart.Series.Add(SeriesType.Bar)


Dim rectangularCallout As New NRectangularCallout
rectangularCallout.ArrowLength = New NLength(30, NRelativeUnit.ParentPercentage)
rectangularCallout.FillStyle = New NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(125, Color.White), Color.FromArgb(125, Color.CadetBlue))
rectangularCallout.UseAutomaticSize = True
rectangularCallout.Orientation = 120
rectangularCallout.Anchor = New NDataPointAnchor(bar, 1, ContentAlignment.MiddleCenter, StringAlignment.Center)
rectangularCallout.Text = "Rectangular callout attached " + Environment.NewLine + "to the second bar"

Controlling the Length of the Callout Arrow

Notice that the NCutEdgeRectangularCallout , NOvalCallout etc. have the Callout suffix. This is because they all inherit from the NCallout class that provides the basic functionality for callouts. The most important characteristics of a callout is that is has an arrow showing the point of interest (pivot). To control the length of this arrow you should touch the ArrowLength property. For example:

Copy Code
rectangularCallout.ArrowLength = new NLength(30, NRelativeUnit.ParentPercentage);
Visual Basic
Copy Code
rectangularCallout.ArrowLength = New NLength(30, NRelativeUnit.ParentPercentage)
Keeping the Callout Inside the Parent Bounds

When you rotate scale or resize the chart control callouts will move according to the anchor they are attached to. This however may result in callouts that fall outside the control visible area, which decreases the readability of the chart. To ensure that callouts are always visible you may use the AlwaysInsideParent property. When set to true the callout will try not to break outside its parent bounds if possible:

Copy Code
rectangularCallout.AlwaysInsideParent = true;
Visual Basic
Copy Code
rectangularCallout.AlwaysInsideParent = True
Related Examples
Windows Forms \ Panels \ Annotations
See Also



©2019. Nevron Software LLC.

Send Feedback