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

Defines the fluent interface for configuring the ChartLegend.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ChartLegendBuilder

Inheritance: objectChartLegendBuilder

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 ChartLegendBuilder class.

C#
public ChartLegendBuilder(ChartLegend chartLegend)
Parameters:chartLegendChartLegend

The chart legend.

Methods

Sets the legend align option

C#
public ChartLegendBuilder Align(ChartLegendAlign align)
Parameters:alignChartLegendAlign

The legend align option.

Returns:

ChartLegendBuilder

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

Sets the legend background color

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

The background color.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend => legend.Background("red"))
)

Configures the legend border

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

The border configuration action

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Border(border =&gt; border.Width(2).Color("black")))
)

Sets the legend border

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

The legend border width.

colorstring

The legend border color (CSS syntax).

dashTypeChartDashType

The legend border dash type.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Border(1, "#000", ChartDashType.Dot))
)

Sets the legend labels color

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

The labels color (CSS format).

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Color("red"))
)

The legend focus highlight configuration options.

C#
public ChartLegendBuilder FocusHighlight(Action<ChartLegendFocusHighlightSettingsBuilder> configurator)
Parameters:configuratorAction<ChartLegendFocusHighlightSettingsBuilder>

The configurator for the focus highlight setting.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend
.Position(ChartLegendPosition.Bottom)
.FocusHighlight(f=&gt;f.Border(b=&gt;b
.Width(3)
.Color("brown")
.DashType(ChartDashType.Solid)
.Opacity(0.7)
))
)
)

Sets the legend labels font

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

The legend labels font (CSS format).

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Font("16px Arial,Helvetica,sans-serif"))
)

Sets the legend height

C#
public ChartLegendBuilder Height(int height)
Parameters:heightint

The legend height.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Height(100))
)

Configures the legend item

C#
public ChartLegendBuilder Item(Action<ChartLegendItemBuilder> configurator)
Parameters:configuratorAction<ChartLegendItemBuilder>

The legend item configuration action

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Item(item =&gt; item.Cursor("pointer")))
)

Configures the legend labels

C#
public ChartLegendBuilder Labels(Action<ChartLegendLabelsBuilder> configurator)
Parameters:configuratorAction<ChartLegendLabelsBuilder>

The labels configuration action

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Labels(labels =&gt; labels.Font("14px Arial,Helvetica,sans-serif")))
)

Sets the legend margin

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

The legend top margin.

rightint

The legend right margin.

bottomint

The legend bottom margin.

leftint

The legend top margin.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Margin(0, 5, 5, 0))
)

Sets the legend margin

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

The legend margin.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Margin(20))
)

Sets the legend X and Y offset from its position

C#
public ChartLegendBuilder Offset(int offsetX, int offsetY)
Parameters:offsetXint

The legend X offset from its position.

offsetYint

The legend Y offset from its position.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Offset(10, 50))
)

Sets the legend orientation

C#
public ChartLegendBuilder Orientation(ChartLegendOrientation orientation)
Parameters:orientationChartLegendOrientation

The legend orientation.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Orientation(ChartLegendOrientation.Vertical))
)

Sets the legend padding

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

The legend top padding.

rightint

The legend right padding.

bottomint

The legend bottom padding.

leftint

The legend left padding.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Padding(0, 5, 5, 0))
)

Sets the legend padding

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

The legend padding.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Padding(20))
)

Sets the legend position

C#
public ChartLegendBuilder Position(ChartLegendPosition position)
Parameters:positionChartLegendPosition

The legend position.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Position(ChartLegendPosition.Bottom))
)

Reverses the order of the legend items

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

True if the items should be reversed; false otherwise.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Reverse(true))
)

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

C#
public ChartLegendBuilder Spacing(double value)
Parameters:valuedouble

The value for Spacing

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Spacing(30))
)

The legend title configuration options.

C#
public ChartLegendBuilder Title(Action<ChartTitleBuilder> configurator)
Parameters:configuratorAction<ChartTitleBuilder>

The configurator for the title setting.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Title(t =&gt; t.Color("green")))
)

Sets the legend visibility

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

The legend visibility.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Visible(false))
)

Sets the legend width

C#
public ChartLegendBuilder Width(int width)
Parameters:widthint

The legend width.

Returns:

ChartLegendBuilder

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.Legend(legend =&gt; legend.Width(100))
)