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

ChartLegendBuilder

Methods

Font(System.String)

Sets the legend labels font

Parameters

font - System.String

The legend labels font (CSS format).

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Font("16px Arial,Helvetica,sans-serif"))
            )

Color(System.String)

Sets the legend labels color

Parameters

color - System.String

The labels color (CSS format).

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Color("red"))
            )

Background(System.String)

Sets the legend background color

Parameters

background - System.String

The background color.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Background("red"))
            )

Position(Kendo.Mvc.UI.ChartLegendPosition)

Sets the legend position

Parameters

position - ChartLegendPosition

The legend position.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
            )

Visible(System.Boolean)

Sets the legend visibility

Parameters

visible - System.Boolean

The legend visibility.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Visible(false))
            )

Offset(System.Int32,System.Int32)

Sets the legend X and Y offset from its position

Parameters

offsetX - System.Int32

The legend X offset from its position.

offsetY - System.Int32

The legend Y offset from its position.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Offset(10, 50))
            )

Margin(System.Int32,System.Int32,System.Int32,System.Int32)

Sets the legend margin

Parameters

top - System.Int32

The legend top margin.

right - System.Int32

The legend right margin.

bottom - System.Int32

The legend bottom margin.

left - System.Int32

The legend top margin.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Margin(0, 5, 5, 0))
            )

Margin(System.Int32)

Sets the legend margin

Parameters

margin - System.Int32

The legend margin.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Margin(20))
            )

Padding(System.Int32,System.Int32,System.Int32,System.Int32)

Sets the legend padding

Parameters

top - System.Int32

The legend top padding.

right - System.Int32

The legend right padding.

bottom - System.Int32

The legend bottom padding.

left - System.Int32

The legend left padding.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Padding(0, 5, 5, 0))
            )

Padding(System.Int32)

Sets the legend padding

Parameters

padding - System.Int32

The legend padding.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Padding(20))
            )

Border(System.Int32,System.String,Kendo.Mvc.UI.ChartDashType)

Sets the legend border

Parameters

width - System.Int32

The legend border width.

color - System.String

The legend border color (CSS syntax).

dashType - ChartDashType

The legend border dash type.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Border(1, "#000", ChartDashType.Dot))
            )

Border(System.Action)

Configures the legend border

Parameters

configurator - System.Action<ChartBorderBuilder>

The border configuration action

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Border(border => border.Width(2).Color("black")))
            )

Labels(System.Action)

Configures the legend labels

Parameters

configurator - System.Action<ChartLegendLabelsBuilder>

The labels configuration action

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Labels(labels => labels.Font("14px Arial,Helvetica,sans-serif")))
            )

Orientation(Kendo.Mvc.UI.ChartLegendOrientation)

Sets the legend orientation

Parameters

orientation - ChartLegendOrientation

The legend orientation.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Orientation(ChartLegendOrientation.Vertical))
            )

Width(System.Int32)

Sets the legend width

Parameters

width - System.Int32

The legend width.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Width(100))
            )

Height(System.Int32)

Sets the legend height

Parameters

height - System.Int32

The legend height.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Height(100))
            )

Reverse(System.Boolean)

Reverses the order of the legend items

Parameters

reverse - System.Boolean

True if the items should be reversed; false otherwise.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Reverse(true))
            )

Item(System.Action)

Configures the legend item

Parameters

configurator - System.Action<ChartLegendItemBuilder>

The legend item configuration action

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Item(item => item.Cursor("pointer")))
            )

Align(Kendo.Mvc.UI.ChartLegendAlign)

Sets the legend align option

Parameters

align - ChartLegendAlign

The legend align option.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Align(ChartLegendAlign.Start))
            )

Spacing(System.Double)

The spacing between the labels in pixels when the legend.orientation is "horizontal".

Parameters

value - System.Double

The value for Spacing

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Spacing(30))
            )

Title(System.Action)

The legend title configuration options.

Parameters

configurator - System.Action<ChartTitleBuilder>

The configurator for the title setting.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .Legend(legend => legend.Title(t => t.Color("green")))
            )

In this article
Not finding the help you need?