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

Defines the fluent interface for configuring the chart labels.

Definition

Constructors

Initializes a new instance of the ChartLabelsBuilderBase<TBuilder> class.

C#
public ChartLabelsBuilderBase(ChartLabels chartLabels)
Parameters:chartLabelsChartLabels

The labels configuration.

Methods

The template which renders the ARIA label for the series labels.The fields which can be used in the template are: category - the category name. Available for area, bar, column, bubble, donut, line and pie series.; dataItem - the original data item used to construct the point. Will be null if binding to array.; percentage - the point value represented as a percentage value. Available only for 100% stacked charts.; series - the data series or value - the point value. Can be a number or object containing each bound field..

C#
public TBuilder AriaTemplate(string value)
Parameters:valuestring

The value for AriaTemplate

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series.Bar(s =&gt; s.Sales).Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif").Visible(true).AriaTemplate("ariaTemplate")))
)

The template which renders the ARIA label for the series labels.The fields which can be used in the template are: category - the category name. Available for area, bar, column, bubble, donut, line and pie series.; dataItem - the original data item used to construct the point. Will be null if binding to array.; percentage - the point value represented as a percentage value. Available only for 100% stacked charts.; series - the data series or value - the point value. Can be a number or object containing each bound field..

C#
public TBuilder AriaTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the ariatemplate.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series.Bar(s =&gt; s.Sales).Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif").Visible(true).AriaTemplate("ariaTemplate")))
)

The template which renders the ARIA label for the series labels.The fields which can be used in the template are: category - the category name. Available for area, bar, column, bubble, donut, line and pie series.; dataItem - the original data item used to construct the point. Will be null if binding to array.; percentage - the point value represented as a percentage value. Available only for 100% stacked charts.; series - the data series or value - the point value. Can be a number or object containing each bound field..

C#
public TBuilder AriaTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for AriaTemplate

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series.Bar(s =&gt; s.Sales).Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif").Visible(true).AriaTemplateHandler("ariaTemplateHandler")))
)

The template which renders the ARIA label for the series labels.The fields which can be used in the template are: category - the category name. Available for area, bar, column, bubble, donut, line and pie series.; dataItem - the original data item used to construct the point. Will be null if binding to array.; percentage - the point value represented as a percentage value. Available only for 100% stacked charts.; series - the data series or value - the point value. Can be a number or object containing each bound field..

C#
public TBuilder AriaTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for AriaTemplate

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series.Bar(s =&gt; s.Sales).Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif").Visible(true).AriaTemplateId("ariaTemplateId")))
)

The template which renders the ARIA label for the series labels.The fields which can be used in the template are: category - the category name. Available for area, bar, column, bubble, donut, line and pie series.; dataItem - the original data item used to construct the point. Will be null if binding to array.; percentage - the point value represented as a percentage value. Available only for 100% stacked charts.; series - the data series or value - the point value. Can be a number or object containing each bound field..

C#
public TBuilder AriaTemplateView(MvcHtmlString templateView)
Parameters:templateViewMvcHtmlString

The view that contains the template for AriaTemplate

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series.Bar(s =&gt; s.Sales).Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif").Visible(true).AriaTemplateView(new MvcHtmlString("#= Sales #"))))
)

Sets the labels background color

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

The labels background color.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Background("Red")
.Visible(true)
)
)
)

Configures the labels border

C#
public TBuilder Border(Action<ChartBorderBuilder> configurator)
Parameters:configuratorAction<ChartBorderBuilder>

The border configuration action

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Border(border =&gt; border.Width(2).Color("green"))
.Visible(true)
)
)
)

Sets the labels border

C#
public TBuilder Border(int width, string color, ChartDashType dashType)
Parameters:widthint

The labels border width.

colorstring

The labels border color (CSS syntax).

dashTypeChartDashType

The labels border dash type.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Border(1, "Red", ChartDashType.Dot)
.Visible(true)
)
)
)

Sets a Function that returns the JavaScript handler for the labels color.

C#
public TBuilder Color(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The labels text color.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Color(o =&gt; "colorHandler")
.Visible(true)
)
)
)

Sets the labels text color

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

The labels text color.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Color("Red")
.Visible(true)
)
)
)

Sets the labels font

C#
public TBuilder Font(string font)
Parameters:fontstring

The labels font (CSS format).

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Font("14px Arial,Helvetica,sans-serif")
.Visible(true)
)
)
)

Sets the labels format.

C#
public TBuilder Format(string format)
Parameters:formatstring

The labels format.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Format("{0:C}")
.Visible(true)
)
)
)

Sets the labels margin

C#
public TBuilder Margin(int top, int right, int bottom, int left)
Parameters:topint

The labels top margin.

rightint

The labels right margin.

bottomint

The labels bottom margin.

leftint

The labels left margin.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Margin(0, 5, 5, 0)
.Visible(true)
)
)
)

Sets the labels margin

C#
public TBuilder Margin(int margin)
Parameters:marginint

The labels margin.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Margin(20)
.Visible(true)
)
)
)

Sets the labels opacity.

C#
public TBuilder Opacity(double opacity)
Parameters:opacitydouble

The series opacity in the range from 0 (transparent) to 1 (opaque). The default value is 1.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Opacity(0.5)
.Visible(true)
)
)
)

Sets the labels padding

C#
public TBuilder Padding(int top, int right, int bottom, int left)
Parameters:topint

The labels top padding.

rightint

The labels right padding.

bottomint

The labels bottom padding.

leftint

The labels left padding.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Padding(0, 5, 5, 0)
.Visible(true)
)
)
)

Sets the labels padding

C#
public TBuilder Padding(int padding)
Parameters:paddingint

The labels padding.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Padding(20)
.Visible(true)
)
)
)

Sets the labels text rotation

C#
public TBuilder Rotation(int rotation)
Parameters:rotationint

The labels text rotation.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Rotation(45)
.Visible(true)
)
)
)

Sets the labels template.

C#
public TBuilder Template(string template)
Parameters:templatestring

The labels template.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Template("#:Sales#")
.Visible(true)
)
)
)

Sets the labels visibility

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

The labels visibility.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Visible(true)
)
)
)

Sets the function used to set the labels visibility.

C#
public TBuilder VisibleHandler(Func<object, object> visibleFunction)
Parameters:visibleFunctionFunc<object, object>

The JavaScript function that will be executed to retrieve the visible state of each label.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.VisibleHandler(
@&lt;text&gt;
function(point) {
return point.value &gt; 5;
}
&lt;/text&gt;
)
)
)
)

Sets the function used to set the labels visibility.

C#
public TBuilder VisibleHandler(string visibleFunction)
Parameters:visibleFunctionstring

The JavaScript function that will be executed to retrieve the visible state of each label.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.VisibleHandler("labelVisible")
)
)
)

Sets the labels visual handler

C#
public TBuilder Visual(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Visual(
@&lt;text&gt;
function(e) {
return e.createVisual(); // returns the default visual
}
&lt;/text&gt;
)
)
)
)

Sets the labels visual handler

C#
public TBuilder Visual(string handler)
Parameters:handlerstring

The JavaScript visual handler name.

Returns:

TBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series =&gt; series
.Bar(s =&gt; s.Sales)
.Labels(labels =&gt; labels
.Visual("labelsVisual")
)
)
)