menu

MAUI Toolkit

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

    Show / Hide Table of Contents

    Class CartesianSeries

    CartesianSeries is the base class for all cartesian based series such as column, line, area, and so on.

    Inheritance
    System.Object
    ChartSeries
    CartesianSeries
    FinancialSeriesBase
    RangeSeriesBase
    XYDataSeries
    Inherited Members
    ChartSeries.CreateAnimation(Action<Double>)
    ChartSeries.CreateSegment()
    ChartSeries.DrawDataLabel(ICanvas, Brush, String, PointF, Int32)
    ChartSeries.DrawSeries(ICanvas, ReadOnlyObservableCollection<ChartSegment>, RectF)
    ChartSeries.EnableAnimation
    ChartSeries.EnableAnimationProperty
    ChartSeries.EnableTooltip
    ChartSeries.EnableTooltipProperty
    ChartSeries.Fill
    ChartSeries.FillProperty
    ChartSeries.GetDataPointIndex(Single, Single)
    ChartSeries.IsVisible
    ChartSeries.IsVisibleOnLegend
    ChartSeries.IsVisibleOnLegendProperty
    ChartSeries.IsVisibleProperty
    ChartSeries.ItemsSource
    ChartSeries.ItemsSourceProperty
    ChartSeries.LabelContext
    ChartSeries.LabelContextProperty
    ChartSeries.LabelTemplate
    ChartSeries.LabelTemplateProperty
    ChartSeries.LegendIcon
    ChartSeries.LegendIconProperty
    ChartSeries.ListenPropertyChange
    ChartSeries.ListenPropertyChangeProperty
    ChartSeries.Opacity
    ChartSeries.OpacityProperty
    ChartSeries.PaletteBrushes
    ChartSeries.PaletteBrushesProperty
    ChartSeries.SelectionBehavior
    ChartSeries.SelectionBehaviorProperty
    ChartSeries.ShowDataLabels
    ChartSeries.ShowDataLabelsProperty
    ChartSeries.TooltipTemplate
    ChartSeries.TooltipTemplateProperty
    ChartSeries.XBindingPath
    ChartSeries.XBindingPathProperty
    ChartSeries.XRange
    ChartSeries.YRange
    Namespace: Syncfusion.Maui.Toolkit.Charts
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public abstract class CartesianSeries : ChartSeries, IDatapointSelectionDependent, ITooltipDependent, IDataTemplateDependent

    Constructors

    CartesianSeries()

    Initializes a new instance of the CartesianSeries.

    Declaration
    public CartesianSeries()

    Fields

    DataLabelSettingsProperty

    Identifies the DataLabelSettings bindable property.

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

    Provides customization for the data labels.

    EmptyPointModeProperty

    Identifies the EmptyPointMode bindable property.

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

    Represents how to calculate value for empty point in the series.

    EmptyPointSettingsProperty

    Identifies the EmptyPointSettings bindable property.

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

    Provides customization for the empty points.

    LabelProperty

    Identifies the Label bindable property.

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

    Represents the label that will be displayed in the associated legend item.

    ShowTrackballLabelProperty

    Identifies the ShowTrackballLabel bindable property.

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

    Indicates whether to display the trackball label in the cartesian series.

    TrackballLabelTemplateProperty

    Identifies the TrackballLabelTemplate bindable property.

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

    Provides a template for customizing the trackball label display in the cartesian series.

    XAxisNameProperty

    Identifies the XAxisName bindable property.

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

    Represents the name of the X-axis for the cartesian series.

    YAxisNameProperty

    Identifies the YAxisName bindable property.

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

    Represents the name of the Y-axis for the cartesian series.

    Properties

    ActualXAxis

    Gets the actual XAxis value.

    Declaration
    public ChartAxis ActualXAxis { get; }
    Property Value
    Type
    ChartAxis

    ActualYAxis

    Gets the actual YAxis value.

    Declaration
    public ChartAxis ActualYAxis { get; }
    Property Value
    Type
    ChartAxis

    DataLabelSettings

    Gets or sets a value to customize the appearance of the displaying data labels in the cartesian series.

    Declaration
    public CartesianDataLabelSettings DataLabelSettings { get; set; }
    Property Value
    Type Description
    CartesianDataLabelSettings

    It accepts the CartesianDataLabelSettings values.

    Remarks

    This allows us to change the look of the displaying labels' content, and appearance at the data point.

    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.DataLabelSettings>
                            <chart:CartesianDataLabelSettings BarAlignment="Middle" />
                       </ chart:ColumnSeries.DataLabelSettings>
                  </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";
    
        series.DataLabelSettings = new CartesianDataLabelSettings()
        {
            BarAlignment = DataLabelAlignment.Middle,
        };
        chart.Series.Add(series);

    EmptyPointMode

    Gets or sets a value that indicates to displays NaN data points for the series.

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

    It accepts EmptyPointMode values and its default value is None.

    Remarks

    Empty points are not supported for the Histogram and BoxAndWhisker series

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
    
             <chart:ColumnSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 EmptyPointMode = "Zero"/>
    
        </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",
              EmptyPointMode = EmptyPointMode.Zero,
        };
    
        chart.Series.Add(columnSeries);

    EmptyPointSettings

    Gets or sets the configuration for how empty or missing data points are handled and displayed within a chart series.

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

    It accepts EmptyPointSettings values.

    Remarks

    EmptyPointSettings is not supported for all area-related series, as well as for FastChart and ErrorBarSeries.

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

    Label

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

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

    It accepts a string value and its default value is string.Empty.

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

    ShowTrackballLabel

    Gets or sets whether to show trackball label on the corresponding series

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

    This property takes the bool as its value and its default value is true.

    Examples
    • MainWindow.xaml
    • MainPage.xaml.cs
        <chart:SfCartesianChart>
    
              <chart:SfCartesianChart.TrackballBehavior>
                   <chart:ChartTrackballBehavior  />
              </chart:SfCartesianChart.TrackballBehavior>
    
              <chart:SfCartesianChart.XAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.XAxes>
    
              <chart:SfCartesianChart.YAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.YAxes>
    
              <chart:SfCartesianChart.Series>
                  <chart:LineSeries ItemsSource="{Binding Data}"
                                    XBindingPath="XValue"
                                    YBindingPath="YValue"
                                    ShowTrackballLabel = "True">
                  </chart:LineSeries> 
              </chart:SfCartesianChart.Series>
    
        </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    ChartTrackballBehavior trackballBehavior = new ChartTrackballBehavior();
    chart.TrackballBehavior = trackballBehavior;
    
     NumericalAxis xAxis = new NumericalAxis();
     NumericalAxis yAxis = new NumericalAxis();
    
     chart.XAxes.Add(xAxis);
     chart.YAxes.Add(yAxis);
    
    LineSeries series = new LineSeries();
    series.ItemsSource = new ViewModel().Data;
    series.XBindingPath = "XValue";
    series.YBindingPath = "YValue";
    series.ShowTrackballLabel = true;
    chart.Series.Add(series);

    TrackballLabelTemplate

    Gets or sets the DataTemplate to customize the appearance of the corresponding series Trackball labels.

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

    It accepts the Microsoft.Maui.Controls.DataTemplatevalue and its default value is null.

    Examples
    • MainWindow.xaml
    • MainPage.xaml.cs
        <chart:SfCartesianChart>
    
              <chart:SfCartesianChart.TrackballBehavior>
                   <chart:ChartTrackballBehavior  />
              </chart:SfCartesianChart.TrackballBehavior>
    
              <chart:SfCartesianChart.Resources>
                  <DataTemplate x:Key="TrackballTemplate">
                     <HorizontalStackLayout>
                        <Image Source="image.png" 
                               WidthRequest="20" 
                               HeightRequest="20"/>
                        <Label Text="{Binding Label}" 
                               TextColor="Black"
                               FontAttributes="Bold"
                               FontSize="12"/>
                     </HorizontalStackLayout>
                  </DataTemplate>
              </chart:SfCartesianChart.Resources>
    
              <chart:SfCartesianChart.XAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.XAxes>
    
              <chart:SfCartesianChart.YAxes>
                  <chart:NumericalAxis/>
              </chart:SfCartesianChart.YAxes>
    
              <chart:SfCartesianChart.Series>
                  <chart:LineSeries ItemsSource="{Binding Data}"
                                      XBindingPath="XValue"
                                      YBindingPath="YValue"
                                      ShowTrackballLabel = "True"
                                      TrackballLabelTemplate="{StaticResource TrackballTemplate}">
                  </chart:LineSeries> 
              </chart:SfCartesianChart.Series>
    
        </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    ChartTrackballBehavior trackballBehavior = new ChartTrackballBehavior();
    chart.TrackballBehavior = trackballBehavior;
    
     NumericalAxis xAxis = new NumericalAxis();
     NumericalAxis yAxis = new NumericalAxis();
    
     chart.XAxes.Add(xAxis);
     chart.YAxes.Add(yAxis);
    
    LineSeries series = new LineSeries();
    series.ItemsSource = new ViewModel().Data;
    series.XBindingPath = "XValue";
    series.YBindingPath = "YValue";
    series.ShowTrackballLabel = true;
    
    DataTemplate labelTemplate = new DataTemplate(()=>
    {
        HorizontalStackLayout layout = new HorizontalStackLayout();
        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.TrackballLabelTemplate = labelTemplate;
    chart.Series.Add(series);

    XAxisName

    Gets or sets the name of the (horizontal) axis in the XAxes collection which is used to plot the series with particular axis.

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

    It takes the string value and its default value is null.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <chart:SfCartesianChart.XAxes>
           <chart:CategoryAxis x:Name="XAxis1"/>
           <chart:NumericalAxis x:Name="XAxis2"/>
       </chart:SfCartesianChart.XAxes>
    
       <chart:SfCartesianChart.YAxes>
          <chart:NumericalAxis />
      </chart:SfCartesianChart.YAxes>
    
             <chart:SplineSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue" 
                                 XAxisName="XAxis1" />
             <chart:ColumnSeries ItemsSource = "{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 XAxisName="XAxis2" />
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        var XAxis1 = new CategoryAxis() { Name = "XAxis1" };
        var XAxis2 = new NumericalAxis() { Name = "XAxis2" }; 
        chart.XAxes.Add(XAxis1);
        chart.XAxes.Add(XAxis2);
        var YAxis = new NumericalAxis();
        chart.YAxes.Add(YAxis);
    
        SplineSeries splineSeries = new SplineSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              XAxisName = "XAxis1",
        };
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              XAxisName = "XAxis2",
        };
    
        chart.Series.Add(splineSeries);
        chart.Series.Add(columnSeries);

    YAxisName

    Gets or sets the name of the (vertical) axis in the YAxes collection which is used to plot the series with particular axis.

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

    It takes the string value and its default value is null.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <chart:SfCartesianChart.XAxes>
           <chart:CategoryAxis />
       </chart:SfCartesianChart.XAxes>
    
       <chart:SfCartesianChart.YAxes>
          <chart:NumericalAxis x:Name="YAxis1"/>
          <chart:NumericalAxis x:Name="YAxis2"/>
      </chart:SfCartesianChart.YAxes>
    
             <chart:SplineSeries ItemsSource="{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue" 
                                 YAxisName="YAxis1" />
             <chart:ColumnSeries ItemsSource = "{Binding Data}"
                                 XBindingPath="XValue"
                                 YBindingPath="YValue"
                                 YAxisName="YAxis2" />
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
        var XAxis = new CategoryAxis();
        chart.XAxes.Add(XAxis);
        var YAxis1 = new NumericalAxis(){Name = "YAxis1"};
        var YAxis2 = new NumericalAxis(){Name = "YAxis2"};
        chart.YAxes.Add(YAxis1);
        chart.YAxes.Add(YAxis2);
    
        SplineSeries splineSeries = new SplineSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              YAxisName = "YAxis1",
        };
    
        ColumnSeries columnSeries = new ColumnSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              YAxisName = "YAxis2",
        };
    
        chart.Series.Add(splineSeries);
        chart.Series.Add(columnSeries);

    Methods

    GetDataPoints(Rect)

    Retrieves a list of data points that are present within the specified rectangle.

    Declaration
    public List<object> GetDataPoints(Rect rectangle)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect rectangle
    Returns
    Type
    System.Collections.Generic.List<System.Object>

    GetDataPoints(Double, Double, Double, Double)

    Retrieves a list of data points present within the specified coordinate bounds.

    Declaration
    public List<object> GetDataPoints(double startX, double endX, double startY, double endY)
    Parameters
    Type Name Description
    System.Double startX
    System.Double endX
    System.Double startY
    System.Double endY
    Returns
    Type
    System.Collections.Generic.List<System.Object>

    OnParentSet()

    Declaration
    protected override void OnParentSet()
    Overrides
    Syncfusion.Maui.Toolkit.Charts.ChartSeries.OnParentSet()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved