New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Creates plot bands for the ChartAxisPlotBandsFactory<TAxis, TValue>.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

TAxis

TValue

Syntax:

C#
public class ChartAxisPlotBandsFactory<TAxis, TValue> where TAxis : IChartAxis<TValue> where TValue : struct

Inheritance: objectChartAxisPlotBandsFactory<TAxis, TValue>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ChartAxisPlotBandsFactory<TAxis, TValue> class.

C#
public ChartAxisPlotBandsFactory(TAxis axis)
Parameters:axisTAxis

The axis.

Methods

Adds a plot band.

C#
public ChartPlotBandsBuilder Add()
Returns:

ChartPlotBandsBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.ValueAxis(a =&gt; a
.Numeric()
.PlotBands(pb =&gt;
{
pb.Add().From(20000).To(40000).Color("red").Opacity(20);
})
)
)

Defines a plot band.

C#
public ChartPlotBandsBuilder Add(double from, double to, string color)
Parameters:fromdouble

The start position of the plot band in axis units.

todouble

The end position of the plot band in axis units.

colorstring

The color of the plot band.

Returns:

ChartPlotBandsBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.ValueAxis(a =&gt; a
.Numeric()
.PlotBands(pb =&gt;
{
pb.Add(20000, 40000, "red");
})
)
)

Defines a plot band.

C#
public ChartPlotBandsBuilder Add(TValue from, TValue to, string color, ChartPlotBandLabel label)
Parameters:fromTValue

The start position of the plot band in axis units.

toTValue

The end position of the plot band in axis units.

colorstring

The color of the plot band.

labelChartPlotBandLabel

The label configuration of the plot band.

Returns:

ChartPlotBandsBuilder

Example:
C#
@{
var plotBandLabelSettings = new ChartPlotBandLabel
{
Border = new ChartPlotBandLabelBorder
{
Color = "pink",
Width = 2
},
Text = "Label Text"
};
}
@(Html.Kendo().Chart()
.Name("Chart")
.ValueAxis(a =&gt; a
.Numeric()
.PlotBands(pb =&gt;
{
pb.Add(new DateTime(2024, 1, 1), new DateTime(2024, 1, 20), "green", @plotBandLabelSettings);
})
)
)

Defines a plot band.

C#
public ChartPlotBandsBuilder Add(TValue from, TValue to, string color)
Parameters:fromTValue

The start position of the plot band in axis units.

toTValue

The end position of the plot band in axis units.

colorstring

The color of the plot band.

Returns:

ChartPlotBandsBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.ValueAxis(a =&gt; a
.Date()
.PlotBands(pb =&gt;
{
pb.Add(new DateTime(2024, 1, 1), new DateTime(2024, 1, 20), "red");
})
)
)