menu

MAUI Toolkit

  • User Guide
  • Demos
  • Support
Class ChartSeries - MAUI-ToolKit API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartSeries

    Represents the base class for all chart series types, including SfCartesianChart, SfCircularChart, and SfPolarChart.

    Inheritance
    System.Object
    ChartSeries
    CartesianSeries
    CircularSeries
    PolarSeries
    Namespace: Syncfusion.Maui.Toolkit.Charts
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public abstract class ChartSeries : Element, IDatapointSelectionDependent, ITooltipDependent, IDataTemplateDependent

    Constructors

    ChartSeries()

    Initializes a new instance of the ChartSeries.

    Declaration
    public ChartSeries()

    Fields

    EnableAnimationProperty

    Identifies the EnableAnimation bindable property.

    Declaration
    public static readonly BindableProperty EnableAnimationProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Indicates whether animations are enabled for the chart series.

    EnableTooltipProperty

    Identifies the EnableTooltip bindable property.

    Declaration
    public static readonly BindableProperty EnableTooltipProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Indicates whether tooltips are enabled for the chart series.

    FillProperty

    Identifies the Fill bindable property.

    Declaration
    public static readonly BindableProperty FillProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the fill brush for the chart series.

    IsVisibleOnLegendProperty

    Identifies the IsVisibleOnLegend bindable property.

    Declaration
    public static readonly BindableProperty IsVisibleOnLegendProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Indicates whether to display a legend item for the chart series.

    IsVisibleProperty

    Identifies the IsVisible bindable property.

    Declaration
    public static readonly BindableProperty IsVisibleProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Indicates whether the chart series is visible.

    ItemsSourceProperty

    Identifies the ItemsSource bindable property.

    Declaration
    public static readonly BindableProperty ItemsSourceProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the data source for the chart series.

    LabelContextProperty

    Identifies the LabelContext bindable property.

    Declaration
    public static readonly BindableProperty LabelContextProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Determines the content to be displayed in the data labels.

    LabelTemplateProperty

    Identifies the LabelTemplate bindable property.

    Declaration
    public static readonly BindableProperty LabelTemplateProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Provides a template for customizing the data label.

    LegendIconProperty

    Identifies the LegendIcon bindable property.

    Declaration
    public static readonly BindableProperty LegendIconProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the icon type for the legend.

    ListenPropertyChangeProperty

    Identifies the ListenPropertyChange bindable property.

    Declaration
    public static readonly BindableProperty ListenPropertyChangeProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property allows the ChartSeries to be notified of and react to property changes, ensuring your chart remains current and responsive in real-time scenarios. When activated, it facilitates automatic UI updates that are both adaptive and flexible, maintaining a seamless user experience. However, be mindful of the potential performance cost, particularly when dealing with large collections or multiple rapid updates, as the visual refresh may introduce additional load. For optimal performance, strategically employ this feature to maintain a balance between responsiveness and system efficiency.

    OpacityProperty

    Identifies the Opacity bindable property.

    Declaration
    public static readonly BindableProperty OpacityProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the opacity of the chart series, where 0 is fully transparent and 1 is fully opaque.

    PaletteBrushesProperty

    Identifies the PaletteBrushes bindable property.

    Declaration
    public static readonly BindableProperty PaletteBrushesProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents a collection of brushes used in the chart series palette.

    SelectionBehaviorProperty

    Identifies the SelectionBehavior bindable property.

    Declaration
    public static readonly BindableProperty SelectionBehaviorProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the behavior of data point selection in the chart series.

    ShowDataLabelsProperty

    Identifies the ShowDataLabels bindable property.

    Declaration
    public static readonly BindableProperty ShowDataLabelsProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Indicates whether data labels are shown in the chart series.

    TooltipTemplateProperty

    Identifies the TooltipTemplate bindable property.

    Declaration
    public static readonly BindableProperty TooltipTemplateProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Provides a template for customizing the tooltip display in the chart series.

    XBindingPathProperty

    Identifies the XBindingPath bindable property.

    Declaration
    public static readonly BindableProperty XBindingPathProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the binding path for the X-axis values in the chart series.

    Properties

    EnableAnimation

    Gets or sets a value indicating whether to animate the chart series on loading.

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

    It accepts bool values and its default value is False.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 EnableAnimation = "True"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              EnableAnimation = true,
        };
    
        chart.Series.Add(columnSeries);

    EnableTooltip

    Gets or sets a boolean value indicating whether the tooltip for series should be shown or hidden.

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

    It accepts bool values and its default value is False.

    Remarks

    The series tooltip will appear when you click or tap the series.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 EnableTooltip="True"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              EnableTooltip = true,
        };
    
        chart.Series.Add(columnSeries);

    Fill

    Gets or sets a brush value to customize the series appearance.

    Declaration
    public Brush Fill { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    It accepts a Microsoft.Maui.Controls.Brush value and its default value is null.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 Fill = "Red"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              Fill = new SolidColorBrush(Colors.Red),
        };
    
        chart.Series.Add(columnSeries);

    IsVisible

    Gets or sets a value that indicates whether the series is visible or not.

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

    It accepts bool values and its default value is True.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 IsVisible="False"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              IsVisible = false,
        };
    
        chart.Series.Add(columnSeries);

    IsVisibleOnLegend

    Gets or sets a value that indicates whether to show a legend item for this series.

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

    It accepts bool values and its default value is True.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
            <chart:SfCartesianChart.Legend>
               <chart:ChartLegend />
            </chart:SfCartesianChart.Legend>
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                               XBindingPath="XValue"
                               YBindingPath="YValue"
                               IsVisibleOnLegend = "False"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        chart.Legend = new ChartLegend();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              IsVisibleOnLegend = false,
        };
    
        chart.Series.Add(columnSeries);

    ItemsSource

    Gets or sets a data points collection that will be used to plot a chart.

    Declaration
    public object ItemsSource { get; set; }
    Property Value
    Type
    System.Object
    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue" />
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
        };
    
        chart.Series.Add(columnSeries);

    LabelContext

    Gets or sets an option that determines the content to be displayed in the data labels. It is recommended to use PieSeries, DoughnutSeries, and BarSeries with LabelContext set to Percentage.

    Declaration
    public LabelContext LabelContext { get; set; }
    Property Value
    Type Description
    LabelContext

    It accepts the LabelContext values and its default value is YValue.

    Examples
    • MainWindow.xaml
    • MainWindow.cs
        <chart:SfCircularChart>
    
              <chart:SfCircularChart.Series>
                  <chart:PieSeries ItemsSource="{Binding Data}"
                                   XBindingPath="XValue"
                                   YBindingPath="YValue"
                                   ShowDataLabels="True"
                                   LabelContext="Percentage">
                  </chart:PieSeries> 
              </chart:SfCircularChart.Series>
    
        </chart:SfCircularChart>
        SfCircularChart chart = new SfCircularChart();
    
        PieSeries series = new PieSeries();
        series.ItemsSource = new ViewModel().Data;
        series.XBindingPath = "XValue";
        series.YBindingPath = "YValue";
        series.ShowDataLabels = true;
        series.LabelContext = LabelContext.Percentage;
        chart.Series.Add(series);

    LabelTemplate

    Gets or sets the DataTemplate that can be used to customize the appearance of the data label.

    Declaration
    public DataTemplate LabelTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate

    It accepts the Microsoft.Maui.Controls.DataTemplate values.

    Examples
    • MainWindow.xaml
    • MainWindow.cs
        <chart:SfCartesianChart>
    
              <chart:SfCartesianChart.Resources>
                  <DataTemplate x:Key="DataLabelTemplate">
                     <VerticalStackLayout>
                        <Image Source="image.png" 
                               WidthRequest="20" 
                               HeightRequest="20"/>
                        <Label Text="{Binding Label}" 
                               TextColor="Black"
                               FontAttributes="Bold"
                               FontSize="12"/>
                     </VerticalStackLayout>
                  </DataTemplate>
              </chart:SfCartesianChart.Resources>
    
              <chart:SfCartesianChart.XAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.XAxes>
    
              <chart:SfCartesianChart.YAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.YAxes>
    
              <chart:SfCartesianChart.Series>
                  <chart:ColumnSeries ItemsSource="{Binding Data}"
                                      XBindingPath="XValue"
                                      YBindingPath="YValue"
                                      ShowDataLabels = "True"
                                      LabelTemplate="{StaticResource DataLabelTemplate}">
                  </chart:ColumnSeries> 
              </chart:SfCartesianChart.Series>
    
        </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
     NumericalAxis xAxis = new NumericalAxis();
     NumericalAxis yAxis = new NumericalAxis();
    
     chart.XAxes.Add(xAxis);
     chart.YAxes.Add(yAxis);
    
    ColumnSeries series = new ColumnSeries();
    series.ItemsSource = new ViewModel().Data;
    series.XBindingPath = "XValue";
    series.YBindingPath = "YValue";
    series.ShowDataLabels = true;
    
    DataTemplate labelTemplate = new DataTemplate(()=>
    {
        VerticalStackLayout layout = new VerticalStackLayout();
        Image image = new Image()
        {
            Source = "image.png",
            WightRequest = 20,
            HeightRequest = 20
        };
    
        Label label = new Label()
        {
            TextColor = Colors.Black,
            FontAttributes = FontAttributes.Bold,
            FontSize = 12,
        }
    
        label.SetBinding(Label.TextProperty, new Binding("Label"));
        layout.Children.Add(image);
        layout.Children.Add(label);
        return layout;
    }    
    
    series.LabelTemplate = labelTemplate;
    chart.Series.Add(series);

    LegendIcon

    Gets or sets a legend icon that will be displayed in the associated legend item.

    Declaration
    public ChartLegendIconType LegendIcon { get; set; }
    Property Value
    Type Description
    ChartLegendIconType

    It accepts ChartLegendIconType values and its default value is Circle.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
            <chart:SfCartesianChart.Legend>
               <chart:ChartLegend />
            </chart:SfCartesianChart.Legend>
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 LegendIcon = "Diamond"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        chart.Legend = new ChartLegend();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              LegendIcon = ChartLegendIconType.Diamond,
        };
    
        chart.Series.Add(columnSeries);

    ListenPropertyChange

    Gets or sets a value indicating whether the chart series should listen for changes in properties.

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

    A boolean value that specifies if property change events should be listened to. The default value is false.

    Remarks

    Setting this property to true allows the series to dynamically and automatically update in response to changes in relevant property values, enhancing the interactivity and responsiveness of your chart. It's beneficial when you have dynamic data sources or configuration changes that need reflection in real time. It is important to note that while this feature enhances interactivity, it can impact performance, especially during bulk updates or rapid consecutive changes in the data source, as the UI is updated frequently. For improved performance and responsiveness, set this property when only necessary changes are expected.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:LineSeries ItemsSource="{Binding Data}"
                               XBindingPath="XValue"
                               YBindingPath="YValue"
                               ListenPropertyChange = "True"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        LineSeries lineSeries = new LineSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              ListenPropertyChange = true,
        };
    
        chart.Series.Add(lineSeries);

    Opacity

    Gets or sets opacity of the chart series.

    Declaration
    public double Opacity { get; set; }
    Property Value
    Type Description
    System.Double

    Accepts double values ranging from 0 to 1, where 0 represents fully transparent, 1 represents fully opaque, and intermediate values provide partial transparency. The default value is 1.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 Opacity="0.5"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              Opacity = 0.5,
        };
    
        chart.Series.Add(columnSeries);

    PaletteBrushes

    Gets or sets the list of brushes that can be used to customize the appearance of the series.

    Declaration
    public IList<Brush> PaletteBrushes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IList<Microsoft.Maui.Controls.Brush>

    This property accepts a list of brushes as input and comes with a set of predefined brushes by default.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 PaletteBrushes = "{Binding CustomBrushes}"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
        List<Brush> CustomBrushes = new List<Brush>();
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(77, 208, 225)));
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(38, 198, 218)));
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(0, 188, 212)));
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(0, 172, 193)));
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(0, 151, 167)));
        CustomBrushes.Add(new SolidColorBrush(Color.FromRgb(0, 131, 143)));
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              PaletteBrushes = CustomBrushes;
        };
    
        chart.Series.Add(columnSeries);

    SelectionBehavior

    Gets or sets a value for initiating selection or highlighting of a single or multiple data points in the series.

    Declaration
    public DataPointSelectionBehavior SelectionBehavior { get; set; }
    Property Value
    Type Description
    DataPointSelectionBehavior

    It accepts the DataPointSelectionBehavior values and its default value is null

    Remarks

    This functionality is not supported for polar charts.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
            <chart:SfCartesianChart.Series>
                <chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue">
                    <chart:ColumnSeries.SelectionBehavior>
                        <chart:DataPointSelectionBehavior SelectionBrush="#314A6E"/>
                    </chart:ColumnSeries.SelectionBehavior>
                </chart:ColumnSeries>
            </chart:SfCartesianChart.Series>
    
    </chart:SfCartesianChart>
     SfCartesianChart chart = new SfCartesianChart();
    
     ViewModel viewModel = new ViewModel();
     chart.BindingContext = viewModel;
    
     DataPointSelectionBehavior behavior = new DataPointSelectionBehavior();
     behavior.SelectionBrush=Color.FromArgb("#314A6E");
    
     ColumnSeries series = new ColumnSeries()
     {
         ItemsSource = viewModel.Data,
         XBindingPath = "XValue",
         YBindingPath = "YValue",
         SelectionBehavior = behavior
     };
    
     chart.Series.Add(series);

    ShowDataLabels

    Gets or sets a value that indicates to enable the data labels for the series..

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

    It accepts bool values and the default value is False.

    Examples
    • MainWindow.xaml
    • MainWindow.cs
        <chart:SfCartesianChart>
    
              <chart:SfCartesianChart.XAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.XAxes>
    
              <chart:SfCartesianChart.YAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.YAxes>
    
              <chart:SfCartesianChart.Series>
                  <chart:ColumnSeries ItemsSource="{Binding Data}"
                                      XBindingPath="XValue"
                                      YBindingPath="YValue"
                                      ShowDataLabels="True">
                  </chart:ColumnSeries> 
              </chart:SfCartesianChart.Series>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
    
        NumericalAxis xAxis = new NumericalAxis();
        NumericalAxis yAxis = new NumericalAxis();
    
        chart.XAxes.Add(xAxis);
        chart.YAxes.Add(yAxis);
    
        ColumnSeries series = new ColumnSeries();
        series.ItemsSource = viewModel.Data;
        series.XBindingPath = "XValue";
        series.YBindingPath = "YValue";
        series.ShowDataLabels = "True";
        chart.Series.Add(series);

    TooltipTemplate

    Gets or sets the DataTemplate that can be used to customize the appearance of the tooltip.

    Declaration
    public DataTemplate TooltipTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate

    It accepts a Microsoft.Maui.Controls.DataTemplate value.

    Examples
    • MainWindow.xaml
    • C#
        <chart:SfCartesianChart>
    
              <chart:SfCartesianChart.Resources>
                  <DataTemplate x:Key="tooltipTemplate1">
                     <StackLayout Orientation = "Horizontal" >
                        <Label Text="{Binding Item.XValue}" 
                               TextColor="Black"
                               FontAttributes="Bold"
                               FontSize="12"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                        <Label Text = " : "
                               TextColor="Black"
                               FontAttributes="Bold"
                               FontSize="12"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                        <Label Text = "{Binding Item.YValue}"
                               TextColor="Black"
                               FontAttributes="Bold"
                               FontSize="12"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                     </StackLayout>
                  </DataTemplate>
              </chart:SfCartesianChart.Resources>
    
              <chart:SfCartesianChart.XAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.XAxes>
    
              <chart:SfCartesianChart.YAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.YAxes>
    
              <chart:SfCartesianChart.Series>
                  <chart:ColumnSeries ItemsSource="{Binding Data}"
                                      XBindingPath="XValue"
                                      YBindingPath="YValue"
                                      EnableTooltip="True"
                                      TooltipTemplate="{StaticResource tooltipTemplate1}">
                  </chart:ColumnSeries> 
              </chart:SfCartesianChart.Series>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              EnableTooltip = true,
              TooltipTemplate = chart.Resources["tooltipTemplate1"] as DataTemplate
        };
    
        chart.Series.Add(columnSeries);

    XBindingPath

    Gets or sets a path value on the source object to serve a x value to the series.

    Declaration
    public string XBindingPath { get; set; }
    Property Value
    Type Description
    System.String

    The string that represents the property name for the x plotting data, and its default value is null.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue" />
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        // Eliminated for simplicity
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
        };
    
        chart.Series.Add(columnSeries);

    XRange

    Gets the XRange values.

    Declaration
    public DoubleRange XRange { get; }
    Property Value
    Type
    DoubleRange

    YRange

    Gets the YRange values.

    Declaration
    public DoubleRange YRange { get; }
    Property Value
    Type
    DoubleRange

    Methods

    CreateAnimation(Action<Double>)

    Creates animation for chart elements, such as series and data labels.

    Declaration
    protected virtual Animation CreateAnimation(Action<double> callback)
    Parameters
    Type Name Description
    System.Action<System.Double> callback
    Returns
    Type
    Microsoft.Maui.Controls.Animation

    CreateSegment()

    Creates and initializes a new chart segment for the chart.

    Declaration
    protected abstract ChartSegment CreateSegment()
    Returns
    Type
    ChartSegment

    DrawDataLabel(ICanvas, Brush, String, PointF, Int32)

    Draws the data labels for the series.

    Declaration
    protected virtual void DrawDataLabel(ICanvas canvas, Brush fillColor, string label, PointF point, int index)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.ICanvas canvas
    Microsoft.Maui.Controls.Brush fillColor
    System.String label
    Microsoft.Maui.Graphics.PointF point
    System.Int32 index

    DrawSeries(ICanvas, ReadOnlyObservableCollection<ChartSegment>, RectF)

    Draw the series for the chart.

    Declaration
    protected virtual void DrawSeries(ICanvas canvas, ReadOnlyObservableCollection<ChartSegment> segments, RectF clipRect)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.ICanvas canvas
    System.Collections.ObjectModel.ReadOnlyObservableCollection<ChartSegment> segments
    Microsoft.Maui.Graphics.RectF clipRect

    GetDataPointIndex(Single, Single)

    Retrieves the index of a specific data point within a chart series, typically based on the interaction or coordinates on the chart.

    Declaration
    public virtual int GetDataPointIndex(float pointX, float pointY)
    Parameters
    Type Name Description
    System.Single pointX
    System.Single pointY
    Returns
    Type
    System.Int32
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved