# .NET MAUI Cartesian Chart Line Series

The `LineSeries` connects the data points with straight line segments.

## Data Binding

The `LineSeries` binds to data through the following properties:

* `ItemsSource` (`IEnumerable`)—Defines the collection of data items that the series plots.
* `HorizontalBinding` (`string`)—Defines the name of the data-item member that provides the value of each data point and this value is plotted along the horizontal axis.
* `VerticalBinding` (`string`)—Defines the name of the data-item member that provides the value of each data point and this value is plotted along the vertical axis.
* `VerticalAxis` (`Telerik.Maui.Controls.Charts.ChartAxis`)—Defines the vertical axis for the series which values resolved from the `VerticalBinding` property are plotted against.
* `HorizontalAxis` (`Telerik.Maui.Controls.Charts.ChartAxis`)—Defines the horizontal axis for the series which values resolved from the `HorizontalBinding` property are plotted against.

## Line Customization

Use the following properties to customize the appearance of the line:

* `Stroke` (`Brush`)—Defines the brush to paint the stroke of the line.
* `StrokeThickness` (`double`)—Defines the thickness of the line stroke.

## Labels Customization

Use the following properties to configure the labels visualized for each data point:

* `ShowLabels` (`bool`)—Defines whether the axis labels will be displayed.
* `LabelOffset` (`Size`)—Defines the offset of the labels from the line.
* `LabelStyle` (`Style` with target type `ChartLabelAppearance`)—Defines the style of the axis labels.

## Combine Mode

The `CombineMode` (`enum` of type `Telerik.Maui.Controls.Charts.ChartLineAreaCombineMode`) property defines how the values of the series are combined with the values of sibling series from the same line or area family that share the same axes and category slot. The available options are:

* `None` (default)—Plots each series independently.
* `Stack`—Stacks the values of the series on top of the values of the previous series, so that each data point represents the summed value.
* `Stack100`—Stacks the values of the series and normalizes the stack to 100 percent, so that each data point represents its percentage of the category total.

## Scatter Line

When plotting the `LineSeries` against two `NumericalAxis` instances and bind `HorizontalBinding` to a numeric member, the series works as a scatter line series—the data points are positioned by their actual X and Y values. For more information, see [Scatter Series](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/series/scatter-series).

## Example

The following example shows how to define a `LineSeries`.

1. Define the `LineSeries` and the chart definition in XAML:

```XAML
<charts:RadCartesianChart>
    <charts:RadCartesianChart.BindingContext>
        <models:CategoricalViewModel />
    </charts:RadCartesianChart.BindingContext>
    <charts:RadCartesianChart.Axes>
        <charts:CategoricalAxis />
        <charts:NumericalAxis />
    </charts:RadCartesianChart.Axes>
    <charts:RadCartesianChart.Series>
        <charts:LineSeries HorizontalBinding="Category"
                           VerticalBinding="Value"
                           ItemsSource="{Binding Data}" />
    </charts:RadCartesianChart.Series>
</charts:RadCartesianChart>
```

2. Add the `charts` namespace:

```XAML
xmlns:charts="clr-namespace:Telerik.Maui.Controls.Charts;assembly=Telerik.Maui.Controls"
```

3. Add the data model:

```C#
public class CategoricalData
{
    public string Category { get; set; }

    public double Value { get; set; }
}
```

4. Add the `ViewModel`:

```C#
public class CategoricalViewModel
{
    public ObservableCollection<CategoricalData> Data { get; } = new ObservableCollection<CategoricalData>
    {
        new CategoricalData { Category = "Jan", Value = 42 },
        new CategoricalData { Category = "Feb", Value = 58 },
        new CategoricalData { Category = "Mar", Value = 37 },
        new CategoricalData { Category = "Apr", Value = 71 },
        new CategoricalData { Category = "May", Value = 64 },
        new CategoricalData { Category = "Jun", Value = 88 },
    };
}
```

This is the result:

![Telerik UI for .NET MAUI CartesianChart LineSeries with a red line across monthly categories](https://www.telerik.com/maui-ui/documentation/assets/7dc9dc7746eb99847a346522b5689da0/charts-cartesian-line-series.png)

> For a runnable example with the Cartesian Chart line series, go to the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and navigate to the **Charts > Series** category.

## See Also

* [BarSeries](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/series/bar-series)
* [AreaSeries](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/series/area-series)
* [PointSeries](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/series/point-series)
* [Scatter Series](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/series/scatter-series)
* [Categorical Axis](https://www.telerik.com/maui-ui/documentation/controls/charts/cartesian-chart/axes/categorical-axis)
