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

Defines the fluent interface for configuring axes.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

TAxis

TValue

TAxisBuilder

The type of the series builder.

Syntax:

C#
public abstract class ChartAxisBuilderBase<TAxis, TValue, TAxisBuilder> where TAxis : IChartAxis<TValue> where TValue : struct where TAxisBuilder : ChartAxisBuilderBase<TAxis, TValue, TAxisBuilder>

Inheritance: objectChartAxisBuilderBase<TAxis, TValue, TAxisBuilder>

Derived Classes: ChartAxisDefaultsBuilder<TModel>ChartCategoryAxisBuilder<TModel>ChartDateAxisBuilderChartDateCategoryAxisBuilder<TModel>ChartNumericAxisBuilder

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 ChartAxisBuilderBase<TAxis, TValue, TAxisBuilder> class.

C#
protected ChartAxisBuilderBase(TAxis axis)
Parameters:axisTAxis

The axis.

Properties

Axis

TAxis

Gets or sets the axis.

C#
public TAxis Axis { get; }
Property Value:

The axis.

Methods

Sets the background color of the axis.

C#
public TAxisBuilder Background(string background)
Parameters:backgroundstring

The value that configures the background color.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis.Background("#ff0000"))
)

Sets the color for all axis elements. It can be overridden by the individual settings (Labels or Lines).

C#
public TAxisBuilder Color(string color)
Parameters:colorstring

The value of the color.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Color("#ff0000")
)
)

Defines the crosshair configuration options.

C#
public TAxisBuilder Crosshair(Action<ChartAxisCrosshairBuilder> configurator)
Parameters:configuratorAction<ChartAxisCrosshairBuilder>

The action that configures the crosshair settings.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Crosshair(c =&gt; c.Visible(true).Color("green"))
)
)

Configures the axis labels.

C#
public virtual TAxisBuilder Labels(Action<ChartAxisLabelsBuilder> configurator)
Parameters:configuratorAction<ChartAxisLabelsBuilder>

The action that configures the labels options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Labels(labels =&gt; labels.Color("green").Visible(true))
)
)

Sets the visibility of axis labels. By default, the labels are visible.

C#
public TAxisBuilder Labels(bool visible)
Parameters:visiblebool

The option that toggles the visibility of the labels.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis.Labels(false))
)

Defines the configuration of the axis lines. The line settings also affect the major and minor ticks but not the grid lines.

C#
public TAxisBuilder Line(Action<ChartLineBuilder> configurator)
Parameters:configuratorAction<ChartLineBuilder>

The action that configures the lines options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Line(line =&gt; line.Color("#f00"))
)
)

Sets the width, color, and dash type of the lines and enables them. The line settings also affect the major and minor ticks but not the grid lines.

C#
public TAxisBuilder Line(int width, string color, ChartDashType dashType)
Parameters:widthint

The value of the width.

colorstring

The value of the color (CSS syntax).

dashTypeChartDashType

The enum value that defines the dash type.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Line(2, "#f00", ChartDashType.Dot)
)
)

Configures the axis major grid lines. These lines are an extension of the major ticks through the body of the chart.

C#
public TAxisBuilder MajorGridLines(Action<ChartMajorGridLinesBuilder> configurator)
Parameters:configuratorAction<ChartMajorGridLinesBuilder>

The action that configures the major grid lines options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MajorGridLines(lines =&gt; lines.Visible(true))
)
)

Sets the width, color, and dash type of the major grid lines and enables them. These lines are an extension of the major ticks through the body of the chart.

C#
public TAxisBuilder MajorGridLines(int width, string color, ChartDashType dashType)
Parameters:widthint

The value of the width.

colorstring

The value of the color (CSS syntax).

dashTypeChartDashType

The enum value that defines the dash type.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MajorGridLines(2, "red", ChartDashType.Dot)
)
)

Configures the axis major ticks.

C#
public TAxisBuilder MajorTicks(Action<ChartAxisTicksBuilder> configurator)
Parameters:configuratorAction<ChartAxisTicksBuilder>

The action that configures the major ticks options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MajorTicks(m =&gt; m.Visible(false))
)
)

Configures the axis minor grid lines. These lines are an extension of the minor ticks through the body of the chart.

C#
public TAxisBuilder MinorGridLines(Action<ChartMinorGridLinesBuilder> configurator)
Parameters:configuratorAction<ChartMinorGridLinesBuilder>

The action that configures the minor grid lines options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MinorGridLines(lines =&gt; lines.Visible(true))
)
)

Sets the width, color, and dash type of the minor grid lines and enables them. These lines are an extension of the minor ticks through the body of the chart.

C#
public TAxisBuilder MinorGridLines(int width, string color, ChartDashType dashType)
Parameters:widthint

The value of the width.

colorstring

The value of the color (CSS syntax).

dashTypeChartDashType

The enum value that defines the dash type.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MinorGridLines(2, "red", ChartDashType.Dot)
)
)

Configures the axis minor ticks.

C#
public TAxisBuilder MinorTicks(Action<ChartAxisTicksBuilder> configurator)
Parameters:configuratorAction<ChartAxisTicksBuilder>

The action that configures the minor ticks options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.MinorTicks(m =&gt; m.Visible(false))
)
)

Sets the axis name.

C#
public TAxisBuilder Name(string name)
Parameters:namestring

The value that configures the axis name.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis.Name("year-axis"))
)

If set to "true", the Chart will narrow the value axis range to display data points in detail. When the option is disabled, the Chart will force the automatic axis range to start from 0 or the explicitly specified.

C#
public TAxisBuilder NarrowRange(bool narrowRange)
Parameters:narrowRangebool

The value that enables or disables the NarrowRange option.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.ValueAxis(axis =&gt; axis
.Numeric()
.NarrowRange(false)
)
)

Defines the name of the pane that the axis must be rendered in. The axis will be rendered in the first (default) pane if not set.

C#
public TAxisBuilder Pane(string pane)
Parameters:panestring

The value that configures the name of the pane.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.Panes(panes =&gt; {
panes.Add().Title("Value");
panes.Add("volumePane").Title("Volume");
})
.CategoryAxis(axis =&gt; axis
.Pane("volumePane")
)
)

Defines the plot bands of the axis.

C#
public TAxisBuilder PlotBands(Action<ChartAxisPlotBandsFactory<TAxis, TValue>> configurator)
Parameters:configuratorAction<ChartAxisPlotBandsFactory<TAxis, TValue>>

The action that configures the plot bands options.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.PlotBands(bands =&gt;
{
bands.Add().From(0).To(4).Color("lightgreen");
bands.Add().From(4).To(10).Color("lightblue");
})
)
)

Defines the configuration of the range labels of the date axis.

C#
public virtual TAxisBuilder RangeLabels(Action<ChartAxisRangeLabelsBuilder> configurator)
Parameters:configuratorAction<ChartAxisRangeLabelsBuilder>

The action that configures the range labels settings.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date()
.RangeLabels(labels =&gt; labels.Color("green").Visible(true))
)
)

Reverses the direction of the axis.

C#
public TAxisBuilder Reverse()
Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Reverse()
)
)

If set to "true", the axis direction will be reversed.

C#
public TAxisBuilder Reverse(bool reverse)
Parameters:reversebool

A value indicating if the axis labels must be rendered in reverse.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Reverse(true)
)
)

Defines the title configuration of the axis.

C#
public TAxisBuilder Title(Action<ChartAxisTitleBuilder> configurator)
Parameters:configuratorAction<ChartAxisTitleBuilder>

The action that configures the title settings.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Title(title =&gt; title.Text("Category").Background("yellow"))
)
)

Sets the text of the axis title.

C#
public TAxisBuilder Title(string title)
Parameters:titlestring

The value that configures the text of the title.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis.Title("Category Axis"))
)

Sets the visibility of the axis.

C#
public TAxisBuilder Visible(bool visible)
Parameters:visiblebool

The option that toggles the visibility of the axis.

Returns:

TAxisBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Visible(false)
)
)