Nevron .NET Vision
Chart for .NET / User's Guide / Layout / Anchor Panels

In This Topic
    Anchor Panels
    In This Topic

    Anchor panels attach to docking panels position or content and are the base of the annotation support in Nevron Chart for .NET. All anchor panels derive directly or indirectly from the NAnchorPanel class.This class extends the NContentPanel class by adding the Anchor property accepting objects derived from the abstract NAnchor class. This allows you to separate the anchor panel from the content it's attached to.

     Anchors

    The following table lists the built-in anchors of the control:

    Anchor Type Description
    NPanelAnchor Allows you to attach to a specific location within a panel. For example 10 pixels away from the top of the legend.
    NModelPointAnchor Allows you to attach to a specific model coordinate in NChart panels.
    NScalePointAnchor Allows you to attach to a specific scale coordinate (defined by the current axis scaling).
    NAxisAnchor Allows you to attach to a specific axis value in scale coordinates.
    NDataPointAnchor Allows you to attach to a specific data point.
    NPieDataPointAnchor Allows you to attach to a specific data point of a pie chart.
    NLegendDataItemAnchor Allows you to attach to a specific legend data item.

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

     

    C#
    Copy Code
    NCartesianChart chart = (NCartesianChart)chartControl.Charts[0];
    NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
    
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);
    
    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";
    chartControl.Panels.Add(rectangularCallout);
    
    chartControl.Refresh();
    
    Visual Basic
    Copy Code
    Dim chart As NCartesianChart = chartControl.Charts(0)
    Dim bar As NBarSeries = chart.Series.Add(SeriesType.Bar)
    
    bar.Values.Add(10)
    bar.Values.Add(20)
    bar.Values.Add(30)
    
    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"
    chartControl.Panels.Add(rectangularCallout)
    
    chartControl.Refresh()
    
     Related Examples

    Windows Forms: Panels\Annotations\General

    Windows Forms: Panels\Annotations\Anchor Panels - Mini Charts

    Web Forms: Panels\Annotations\General

    Web Forms: Panels\Annotations\Anchor Panels - Mini Charts

    See Also