Blazor

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class NodeAnnotationOffset - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class NodeAnnotationOffset

    Represents the position of the label relative to the bounds of the node.

    Inheritance
    System.Object
    SfDiagramBase
    NodePortOffset
    NodeAnnotationOffset
    Inherited Members
    NodePortOffset.X
    NodePortOffset.Y
    SfDiagramBase.UpdateCollection(IList, Boolean)
    SfDiagramBase.RandomString(Int32)
    Namespace: Syncfusion.Blazor.Diagrams
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class NodeAnnotationOffset : NodePortOffset
    Remarks
    NodeAnnotationOffset is used to align the annotation in the node based on the fractions. Fraction value ranges from 0 to 1. Default value for NodeAnnotationOffset is set to X=0.5 and Y=0.5.
    1. When x= 0 and y = 0, then the label will be position at the top left corner of the node.
    2. When x= 0.5 and y = 0.5, then the label will be position at the center of the node.
    3. When x= 1 and y = 1, then the label will be position at the bottom right corner of the node.
    Examples
    <SfDiagram Height="600px" Nodes="@NodeCollection">
    <DiagramSnapSettings Constraints = "SnapConstraints.None" ></ DiagramSnapSettings >
    </ SfDiagram >
    @code{
      public ObservableCollection<DiagramNode> NodeCollection = new ObservableCollection<DiagramNode>() { };
      protected override void OnInitialized()
      {
        // A node is created and stored in the node array.
        DiagramNode Node = new DiagramNode()
        {
         // Position of the node
         OffsetX = 250,
         OffsetY = 250,
         // Size of the node
         Width = 100,
         Height = 100,
         Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" },
         // Initialize port collection
         Annotations = new ObservableCollection<DiagramNodeAnnotation>()
         {
           // An annotation is created and stored in an Annotation collection of Node.
           new DiagramNodeAnnotation() { Content = "Offset(0,0)",
           //set offset value to an annotation
           Offset = new NodeAnnotationOffset() { X = 0, Y = 0 }}
          }
        };
        NodeCollection.Add(Node);
       }
     }

    Constructors

    NodeAnnotationOffset()

    Represents the position of the label relative to the bounds of the node.

    Declaration
    public NodeAnnotationOffset()
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved