New to Telerik UI for Blazor? Download free 30-day trial

Draw Horizontal and Vertical Lines in a Blazor Chart


Product Chart for Blazor


This KB article answers the following questions:

  • How to draw horizontal and vertical lines in Telerik Blazor Charts?
  • How to put pins or markers in Telerik Blazor Charts?
  • Is it possible to add limits or thresholds on the Telerik Blazor Chart?


To configure the Chart for drawing horizontal and vertical lines, you can use plot bands or additional line series.

Using Plot Bands

Steps for drawing vertical and horizontal lines with plot bands:

  1. Add PlotBand instances inside the PlotBands collection of a Chart axis.
  2. Provide a valid CSS color to the Color parameter.
  3. Set the From and To plot band parameters.

Drawing Horizontal and Vertical lines with Plot Bands

    <ChartTitle Text="Unrecoverable Errors Per Minute vs. Signal Level"></ChartTitle>

        <ChartSeries Type="ChartSeriesType.Scatter"
                     Name="APSK modulation"

        <ChartXAxis Max="-30" AxisCrossingValue="@(new object[] { -100 })">
            <ChartXAxisTitle Text="Signal Strength, dBm"></ChartXAxisTitle>
                <ChartXAxisPlotBand From="-89.7" To="-89.5" Color="blue" />
                <ChartXAxisPlotBand From="-50" To="-49.5" Color="orange" />

        <ChartYAxis Max="20">
            <ChartYAxisTitle Text="Error count"></ChartYAxisTitle>
                <ChartYAxisPlotBand From="1.5" To="1.7" Color="green"></ChartYAxisPlotBand>
                <ChartYAxisPlotBand From="18.5" To="18.6" Color="red"></ChartYAxisPlotBand>

@code {
    #region PlotBandsData
    private List<ModelData> SeriesData { get; set; }

    protected override void OnInitialized()
        SeriesData = new List<ModelData>();

        var rnd = new Random();

        for (int i = 0; i < 60; i++)
            SeriesData.Add(new ModelData
                    Strength = rnd.Next(-90 + i / 3, -90 + i),
                    Errors = rnd.Next(i / 20, i / 3)


    public class ModelData
        public double Strength { get; set; }
        public double Errors { get; set; }

Using Additional Line Series

Steps for drawing horizontal and vertical lines with additional Lines Series:

  1. Add ChartSeries instances of type ChartSeriesType.Line based on the needed number of lines.
  2. Set data for the lines based on the information shown from the main Chart.

Drawing Horizontal and Vertical lines with additional Lines Chart

        <ChartSeries Type="ChartSeriesType.Column" Name="Column 1" Data="@firstColumnTypeData">
        <ChartSeries Type="ChartSeriesType.Column" Name="Column 2" Data="@secondColumnTypeData">
        <ChartSeries Type="ChartSeriesType.Line" Name="Line 1" Data="@firstLineTypeData">
        <ChartSeries Type="ChartSeriesType.Line" Name="Line 2" Data="@secondLineTypeData">

        <ChartCategoryAxis Categories="@xColumnAxisItems"></ChartCategoryAxis>

    <ChartTitle Text="Draw Horizontal and Vertical Lines"></ChartTitle>

    <ChartLegend Position="ChartLegendPosition.Right">

@code {
    #region LinesData
    private List<object> firstColumnTypeData = new List<object>() { 10, 2, 5, 6 };
    private List<object> secondColumnTypeData = new List<object>() { 5, 8, 2, 7 };

    private List<object> firstLineTypeData = new List<object>() { 8, 8, 8, 6 };
    private List<object> secondLineTypeData = new List<object>() { 5, 8, 2, 7 };

    private string[] xColumnAxisItems = new string[] { "Q1", "Q2", "Q3", "Q4" };

See Also

In this article