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

Defines the fluent interface for configuring the Sparkline<T> component.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

Syntax:

C#
public class SparklineBuilder<T> : WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>, IHtmlString where T : class

Inheritance: objectWidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>SparklineBuilder<T>

Implements: IHtmlString

Inherited Members WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ToComponent()WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.Name(string)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.Deferred(bool)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ModelMetadata(ModelMetadata)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.HtmlAttributes(object)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.AsModule(bool)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.Render()WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ScriptAttributes(object, bool)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ToHtmlString()WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ToClientTemplate()WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.ToString()WidgetBuilderBase<Sparkline<T>, SparklineBuilder<T>>.Componentobject.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 SparklineBuilder<T> class.

C#
public SparklineBuilder(Sparkline<T> component)
Parameters:componentSparkline<T>

The component.

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Type(SparklineType.Area)
)

Methods

Enables or disables automatic binding.

C#
public SparklineBuilder<T> AutoBind(bool autoBind)
Parameters:autoBindbool

Gets or sets a value indicating if the chart should be data bound during initialization. The default value is true.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.DataSource(ds =&gt;
{
ds.Ajax().Read(r =&gt; r.Action("SalesData", "Sparkline"));
})
.AutoBind(false)
)

Defines the options for all chart axes of the specified type.

C#
public SparklineBuilder<T> AxisDefaults(Action<ChartAxisDefaultsBuilder<T>> configurator)
Parameters:configuratorAction<ChartAxisDefaultsBuilder<T>>

The configurator.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline(Model)
.Name("Sparkline")
.AxisDefaults(axisDefaults =&gt; axisDefaults.MinorTickSize(5))
)

Configures the category axis

C#
public SparklineBuilder<T> CategoryAxis(Action<ChartCategoryAxisBuilder<T>> configurator)
Parameters:configuratorAction<ChartCategoryAxisBuilder<T>>

The configurator

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline(Model)
.Name("Sparkline")
.CategoryAxis(axis =&gt; axis
.Categories(s =&gt; s.DateString)
)
)

Sets the Chart area.

C#
public SparklineBuilder<T> ChartArea(Action<ChartAreaBuilder> configurator)
Parameters:configuratorAction<ChartAreaBuilder>

The Chart area.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.ChartArea(chartArea =&gt; chartArea.margin(20))
)

Sets the Sparkline data.

C#
public virtual SparklineBuilder<T> Data(double data)
Parameters:datadouble

The data for the default Sparkline series.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Data(new int[] { 1, 2 })
)

Sets the Sparkline data.

C#
public virtual SparklineBuilder<T> Data(IEnumerable data)
Parameters:dataIEnumerable

The data for the default Sparkline series.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Data(new int[] { 1, 2 })
)

Data Source configuration

C#
public SparklineBuilder<T> DataSource(Action<ReadOnlyAjaxDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<ReadOnlyAjaxDataSourceBuilder<T>>

Use the configurator to set different data binding options.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.DataSource(ds =&gt;
{
ds.Ajax().Read(r =&gt; r.Action("SalesData", "Sparkline"));
})
)

Configures the client-side events.

C#
public SparklineBuilder<T> Events(Action<ChartEventBuilder> configurator)
Parameters:configuratorAction<ChartEventBuilder>

The client events configuration action.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Events(events =&gt; events
.OnLoad("onLoad")
)
)

Sets the Plot area.

C#
public SparklineBuilder<T> PlotArea(Action<PlotAreaBuilder> configurator)
Parameters:configuratorAction<PlotAreaBuilder>

The Plot area.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.PlotArea(plotArea =&gt; plotArea.margin(20))
)

Sets the per-point width of the sparkline.

C#
public SparklineBuilder<T> PointWidth(double pointWidth)
Parameters:pointWidthdouble

The Sparkline per-point width.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.PointWidth(2)
)

Sets the preferred rendering engine. If it is not supported by the browser, the Chart will switch to the first available mode.

C#
public SparklineBuilder<T> RenderAs(RenderingMode renderAs)
Parameters:renderAsRenderingMode

The preferred rendering engine.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.RenderAs(RenderingMode.Canvas)
)

Defines the chart series.

C#
public SparklineBuilder<T> Series(Action<SparklineSeriesFactory<T>> configurator)
Parameters:configuratorAction<SparklineSeriesFactory<T>>

The add action.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline(Model)
.Name("Sparkline")
.Series(series =&gt;
{
series.Bar(s =&gt; s.SalesAmount);
})
)

Sets the series colors.

C#
public SparklineBuilder<T> SeriesColors(IEnumerable<string> colors)
Parameters:colorsIEnumerable<string>

A list of the series colors.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.SeriesColors(new string[] { "#f00", "#0f0", "#00f" })
)

Sets the series colors.

C#
public SparklineBuilder<T> SeriesColors(params string[] colors)
Parameters:colorsstring[]

The series colors.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.SeriesColors("#f00", "#0f0", "#00f")
)

Defines the options for all chart series of the specified type.

C#
public SparklineBuilder<T> SeriesDefaults(Action<SparklineSeriesDefaultsBuilder<T>> configurator)
Parameters:configuratorAction<SparklineSeriesDefaultsBuilder<T>>

The configurator.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline(Model)
.Name("Sparkline")
.SeriesDefaults(series =&gt; series.Bar().Stack(true))
)

Sets the theme of the chart.

C#
public SparklineBuilder<T> Theme(string theme)
Parameters:themestring

The Sparkline theme.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Theme("Telerik")
)

Use it to configure the data point tooltip.

C#
public SparklineBuilder<T> Tooltip(Action<ChartTooltipBuilder> configurator)
Parameters:configuratorAction<ChartTooltipBuilder>

Use the configurator to set data tooltip options.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Tooltip(tooltip =&gt;
{
tooltip.Visible(true).Format("{0:C}");
})
)

Sets the data point tooltip visibility.

C#
public SparklineBuilder<T> Tooltip(bool visible)
Parameters:visiblebool

A value indicating if the data point tooltip should be displayed. The tooltip is not visible by default.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Tooltip(true)
)

Enables or disabled animated transitions on initial load and refresh.

C#
public SparklineBuilder<T> Transitions(bool transitions)
Parameters:transitionsbool

A value indicating if transition animations should be played.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Transitions(false)
)

Sets the type of the sparkline.

C#
public SparklineBuilder<T> Type(SparklineType type)
Parameters:typeSparklineType

The Sparkline type.

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline()
.Name("Sparkline")
.Type(SparklineType.Area)
)

Defines value axis options

C#
public SparklineBuilder<T> ValueAxis(Action<ChartValueAxisFactory<T>> configurator)
Parameters:configuratorAction<ChartValueAxisFactory<T>>

The configurator

Returns:

SparklineBuilder<T>

Example:
C#
@( Html.Kendo().Sparkline(Model)
.Name("Sparkline")
.ValueAxis(a =&gt; a.Numeric().TickSize(4))
)