WPF

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class AnnotationsCollection - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class AnnotationsCollection

    Represents AnnotationsCollection. Annotations at specific X-Y coordinates can be added to the chart programmatically.

    Inheritance
    System.Object
    AnnotationsCollection
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Namespace: Syncfusion.Windows.Chart
    Assembly: Syncfusion.Chart.Wpf.dll
    Syntax
    public class AnnotationsCollection : DependencyObject, INotifyPropertyChanged
    Examples

    XAML:

     <sfchart:ChartSeries Name="series1" Label="Series1" Type="Area"
    Interior="LightSkyBlue">
    <sfchart:ChartSeries.Annotations>
    <sfchart:AnnotationsCollection LineColor="White" x:Uid="Annot">
                <!-- Here we define the look and feel of the annotation. -->
                 <sfchart:AnnotationsCollection.AnnotationsTemplate>
                     <DataTemplate>
                         <Button Content="{Binding Y}" ToolTip="{Binding
    Description}" Background="LightGray" Name="Button1" Click="Button_Click" />
                     </DataTemplate>
                 </sfchart:AnnotationsCollection.AnnotationsTemplate>
             </sfchart:AnnotationsCollection>
            <!-- The annotations are added to this collection in code-behind -->
         </sfchart:ChartSeries.Annotations>
     </sfchart:ChartSeries>

    C#:

    // Series1 annotations
    ChartSeriesAnnotation ser1LowPoint = new ChartSeriesAnnotation() { X = 1, Y =
    20, Description = "Series 1 Low Point" }; 
    ChartSeriesAnnotation ser1HighPoint = new ChartSeriesAnnotation() { X = 7, Y =
    56, Description = "Series 1 High Point" }; 
    this.Chart1.Areas[0].Series[0].Annotations.Items.Add(ser1LowPoint); 
    this.Chart1.Areas[0].Series[0].Annotations.Items.Add(ser1HighPoint);

    Constructors

    AnnotationsCollection()

    Initializes a new instance of the AnnotationsCollection class.

    Declaration
    public AnnotationsCollection()

    Fields

    AnnotationsTemplateProperty

    Identifies the AnnotationsTemplate dependency property.

    Declaration
    public static readonly DependencyProperty AnnotationsTemplateProperty
    Field Value
    Type Description
    System.Windows.DependencyProperty

    IsRelativeProperty

    Identifies the IsRelative dependency property.

    Declaration
    public static readonly DependencyProperty IsRelativeProperty
    Field Value
    Type Description
    System.Windows.DependencyProperty

    LineColorProperty

    Identifies the LineColor dependency property.

    Declaration
    public static readonly DependencyProperty LineColorProperty
    Field Value
    Type Description
    System.Windows.DependencyProperty

    m_annotationsCollection

    Declares m_annotationsCollection

    Declaration
    public ObservableCollection<ChartSeriesAnnotation> m_annotationsCollection
    Field Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<ChartSeriesAnnotation>

    Properties

    AnnotationsTemplate

    Gets or sets the AnnotationsTemplate. This is a dependency property.

    Declaration
    public DataTemplate AnnotationsTemplate { get; set; }
    Property Value
    Type Description
    System.Windows.DataTemplate

    The AnnotationsTemplate.

    Count

    Gets the count.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    System.Int32

    The count.

    IsRelative

    Gets or sets a value indicating whether IsRelative value. This is a dependency property.

    Declaration
    public bool IsRelative { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if annotations should be placed relatively to axis units; otherwise, false.

    Items

    Gets the items.

    Declaration
    public ObservableCollection<ChartSeriesAnnotation> Items { get; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<ChartSeriesAnnotation>

    The items.

    LineColor

    Gets or sets the LineColor. This is a dependency property.

    Declaration
    public Brush LineColor { get; set; }
    Property Value
    Type Description
    System.Windows.Media.Brush

    The LineColor.

    Methods

    OnPropertyChanged(DependencyPropertyChangedEventArgs)

    Called when the property changed.

    Declaration
    protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    System.Windows.DependencyPropertyChangedEventArgs e

    The System.Windows.DependencyPropertyChangedEventArgs instance containing the event data.

    Events

    PropertyChanged

    Initializes PropertyChanged

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    System.ComponentModel.PropertyChangedEventHandler

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    ChartAnnotationLabel
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved