menu

Class ChartBase - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartBase

    The ChartBase class is the base for SfCartesianChart, SfCircularChart, SfFunnelChart, SfPyramidChart, and SfPolarChart types.

    Inheritance
    System.Object
    ChartBase
    SfCartesianChart
    SfCircularChart
    SfFunnelChart
    SfPolarChart
    SfPyramidChart
    Implements
    System.IDisposable
    System.ComponentModel.INotifyPropertyChanged
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public abstract class ChartBase : Control, IDisposable, INotifyPropertyChanged

    Constructors

    ChartBase()

    Initializes a new instance of the ChartBase class.

    Declaration
    public ChartBase()

    Fields

    HeaderProperty

    The DependencyProperty for Header property.

    Declaration
    public static readonly DependencyProperty HeaderProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    HorizontalHeaderAlignmentProperty

    The DependencyProperty for HorizontalHeaderAlignment property.

    Declaration
    public static readonly DependencyProperty HorizontalHeaderAlignmentProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    InteractiveBehaviorProperty

    The DependencyProperty for InteractiveBehavior property.

    Declaration
    public static readonly DependencyProperty InteractiveBehaviorProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    LegendProperty

    The DependencyProperty for Legend property.

    Declaration
    public static readonly DependencyProperty LegendProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    TooltipBehaviorProperty

    The DependencyProperty for TooltipBehavior property.

    Declaration
    public static readonly DependencyProperty TooltipBehaviorProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    VerticalHeaderAlignmentProperty

    The DependencyProperty for VerticalHeaderAlignment property.

    Declaration
    public static readonly DependencyProperty VerticalHeaderAlignmentProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    VisibleSeriesProperty

    The DependencyProperty for Syncfusion.UI.Xaml.Charts.ChartBase.VisibleSeries property.

    Declaration
    public static readonly DependencyProperty VisibleSeriesProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    Properties

    Header

    Gets or sets the title for chart. It supports the string or any view as title.

    Declaration
    public object Header { get; set; }
    Property Value
    Type Description
    System.Object

    Default value is null.

    Remarks

    Example code for string as header.

    • MainPage.xaml
    • MainPage.xaml.cs
        <chart:SfCartesianChart Header="Average High/Low Temperature">
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        chart.Header = "Average High / Low Temperature";

    Example code for View as header.

    • MainPage.xaml
    • MainPage.xaml.cs
        <chart:SfCartesianChart>
    
           <chart:SfCartesianChart.Header>
               <TextBlock Text = "Average High/Low Temperature" 
                          HorizontalAlignment="Center"
                          HorizontalTextAlignment="Center"
                          VerticalAlignment="Center"
                          FontSize="16"
                          Foreground="Black"/>
           </chart:SfCartesianChart.Header>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        chart.Header = new TextBlock() 
        { 
            Text = "Average High / Low Temperature",
            HorizontalAlignment = HorizontalAlignment.Center,
            HorizontalTextAlignment = TextAlignment.Center,
            VerticalAlignment = VerticalAlignment.Center,
            FontSize = 16,
            Foreground = new SolidColorBrush(Colors.Black)
        };

    HorizontalHeaderAlignment

    Gets or sets a value to modify the horizontal alignment of the header.

    Declaration
    public HorizontalAlignment HorizontalHeaderAlignment { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.HorizontalAlignment

    It accepts Microsoft.UI.Xaml.HorizontalAlignment values and the default values is HorizontalAlignment.Center.

    InteractiveBehavior

    Gets or sets the interactive behavior that allows to override and customize the touch interaction methods.

    Declaration
    public ChartInteractiveBehavior InteractiveBehavior { get; set; }
    Property Value
    Type Description
    ChartInteractiveBehavior

    This property takes ChartInteractiveBehavior instance as value and its default value is null.

    Remarks

    To use those touch interaction methods, create the class inherited by ChartInteractiveBehavior class.

    Then Create the instance for that class and instance has to be added in the chart's InteractiveBehavior as per the following code snippet.

    Examples
    • ChartInteractionExt.cs
    • MainPage.xaml
    • MainPage.xaml.cs
    public class ChartInteractionExt : ChartInteractiveBehavior
    {
       <!--omitted for brevity-->
    }
    <chart:SfCartesianChart >
        <chart:SfCartesianChart.DataContext>
            <local:ViewModel />
        </chart:SfCartesianChart.DataContext>
    
        <chart:SfCartesianChart.InteractiveBehavior>
            <local:ChartInteractionExt>
            </local:ChartInteractionExt>
        </chart:SfCartesianChart.InteractiveBehavior>
     </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    ViewModel viewModel = new ViewModel();
    chart.DataContext = viewModel;
    ...
    ChartInteractionExt interaction = new ChartInteractionExt();
    chart.InteractiveBehavior = interaction;
    ...

    Legend

    Gets or sets the legend that helps to identify the corresponding series or data point in chart.

    Declaration
    public ChartLegend Legend { get; set; }
    Property Value
    Type Description
    ChartLegend

    This property takes a ChartLegend instance as value and its default value is null.

    Remarks

    To render a legend, create an instance of ChartLegend, and assign it to the Legend property.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
     
    <chart:SfCircularChart>
    
           <chart:SfCircularChart.DataContext>
               <local:ViewModel/>
           </chart:SfCircularChart.DataContext>
    
           <chart:SfCircularChart.Legend>
               <chart:ChartLegend/>
           </chart:SfCircularChart.Legend>
    
           <chart:PieSeries ItemsSource="{Binding Data}" 
                            XBindingPath="XValue"
                            YBindingPath="YValue"/>
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    
    ViewModel viewModel = new ViewModel();
    chart.DataContext = viewModel;
    
    chart.Legend = new ChartLegend();
    
    PieSeries series = new PieSeries()
    {
        ItemsSource = viewModel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue",
    };
    chart.Series.Add(series);

    SeriesClipRect

    Declaration
    public Rect SeriesClipRect { get; }
    Property Value
    Type
    Windows.Foundation.Rect

    TooltipBehavior

    Gets or sets a tooltip behavior that allows to customize the default tooltip appearance in the chart.

    Declaration
    public ChartTooltipBehavior TooltipBehavior { get; set; }
    Property Value
    Type Description
    ChartTooltipBehavior

    This property takes ChartTooltipBehavior instance as value and its default value is null.

    Remarks

    To display the tooltip on the chart, set the EnableTooltip property as true in ChartSeries.

    To customize the appearance of the tooltip elements like Background, Foreground and FontSize, create an instance of ChartTooltipBehavior class, modify the values, and assign it to the chart’s TooltipBehavior property.

    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
            <chart:SfCircularChart.DataContext>
                <local:ViewModel/>
            </chart:SfCircularChart.DataContext>
    
            <chart:SfCircularChart.TooltipBehavior>
                <chart:ChartTooltipBehavior/>
            </chart:SfCircularChart.TooltipBehavior>
    
            <chart:PieSeries EnableTooltip="True"
                             ItemsSource="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"/>
    
    </chart:SfCircularChart>
     SfCircularChart chart = new SfCircularChart();
    
     ViewModel viewModel = new ViewModel();
     chart.DataContext = viewModel;
    
     chart.TooltipBehavior = new ChartTooltipBehavior();
    
     PieSeries series = new PieSeries()
     {
        ItemsSource = viewmodel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue",
        EnableTooltip = true
     };
     chart.Series.Add(series);
    See Also
    EnableTooltip

    VerticalHeaderAlignment

    Gets or sets a value to modify the vertical alignment of the header.

    Declaration
    public VerticalAlignment VerticalHeaderAlignment { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.VerticalAlignment

    It accepts Microsoft.UI.Xaml.VerticalAlignment values and the default value is VerticalAlignment.Center.

    Methods

    Dispose()

    Declaration
    public void Dispose()

    MeasureOverride(Size)

    Declaration
    protected override Size MeasureOverride(Size availableSize)
    Parameters
    Type Name Description
    Windows.Foundation.Size availableSize
    Returns
    Type
    Windows.Foundation.Size

    OnApplyTemplate()

    Declaration
    protected override void OnApplyTemplate()

    OnDoubleTapped(DoubleTappedRoutedEventArgs)

    Declaration
    protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.DoubleTappedRoutedEventArgs e

    OnGotFocus(RoutedEventArgs)

    Declaration
    protected override void OnGotFocus(RoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.RoutedEventArgs e

    OnHolding(HoldingRoutedEventArgs)

    Declaration
    protected override void OnHolding(HoldingRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs e

    OnKeyDown(KeyRoutedEventArgs)

    Declaration
    protected override void OnKeyDown(KeyRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e

    OnKeyUp(KeyRoutedEventArgs)

    Declaration
    protected override void OnKeyUp(KeyRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e

    OnLostFocus(RoutedEventArgs)

    Declaration
    protected override void OnLostFocus(RoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.RoutedEventArgs e

    OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)

    Declaration
    protected override void OnManipulationCompleted(ManipulationCompletedRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e

    OnManipulationDelta(ManipulationDeltaRoutedEventArgs)

    Declaration
    protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e

    OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs)

    Declaration
    protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.ManipulationInertiaStartingRoutedEventArgs e

    OnManipulationStarted(ManipulationStartedRoutedEventArgs)

    Declaration
    protected override void OnManipulationStarted(ManipulationStartedRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.ManipulationStartedRoutedEventArgs e

    OnManipulationStarting(ManipulationStartingRoutedEventArgs)

    Declaration
    protected override void OnManipulationStarting(ManipulationStartingRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.ManipulationStartingRoutedEventArgs e

    OnPointerCanceled(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerCanceled(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerCaptureLost(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerCaptureLost(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerEntered(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerEntered(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerExited(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerExited(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerMoved(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerMoved(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerPressed(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerPressed(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerReleased(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerReleased(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnPointerWheelChanged(PointerRoutedEventArgs)

    Declaration
    protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    OnRightTapped(RightTappedRoutedEventArgs)

    Declaration
    protected override void OnRightTapped(RightTappedRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.RightTappedRoutedEventArgs e

    OnTapped(TappedRoutedEventArgs)

    Declaration
    protected override void OnTapped(TappedRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e

    ResumeSeriesNotification()

    Declaration
    public void ResumeSeriesNotification()

    SuspendSeriesNotification()

    Declaration
    public void SuspendSeriesNotification()

    Events

    PropertyChanged

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

    SeriesBoundsChanged

    Event correspond to plot area bound. It invokes when the plot area size changes.

    Declaration
    public event EventHandler<ChartSeriesBoundsEventArgs> SeriesBoundsChanged
    Event Type
    Type
    System.EventHandler<ChartSeriesBoundsEventArgs>
    Remarks

    ChartSeriesBoundsEventArgs

    Implements

    System.IDisposable
    System.ComponentModel.INotifyPropertyChanged
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved