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

SparklineBuilder

Methods

Data(System.Collections.IEnumerable)

Sets the Sparkline data.

Parameters

data - System.Collections.IEnumerable

The data for the default Sparkline series.

Example


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

Data(System.Double)

Sets the Sparkline data.

Parameters

data - System.Double

The data for the default Sparkline series.

Example


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

Type(Kendo.Mvc.UI.SparklineType)

Sets the type of the sparkline.

Parameters

type - SparklineType

The Sparkline type.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .Type(SparklineType.Area)
            )

PointWidth(System.Double)

Sets the per-point width of the sparkline.

Parameters

pointWidth - System.Double

The Sparkline per-point width.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .PointWidth(2)
            )

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<ChartEventBuilder>

The client events configuration action.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .Events(events => events
                            .OnLoad("onLoad")
                        )
            )

Theme(System.String)

Sets the theme of the chart.

Parameters

theme - System.String

The Sparkline theme.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .Theme("Telerik")
            )

RenderAs(Kendo.Mvc.UI.RenderingMode)

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

Parameters

renderAs - RenderingMode

The preferred rendering engine.

ChartArea(System.Action)

Sets the Chart area.

Parameters

configurator - System.Action<ChartAreaBuilder>

The Chart area.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .ChartArea(chartArea => chartArea.margin(20))
            )

PlotArea(System.Action)

Sets the Plot area.

Parameters

configurator - System.Action<PlotAreaBuilder>

The Plot area.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .PlotArea(plotArea => plotArea.margin(20))
            )

Series(System.Action)

Defines the chart series.

Parameters

configurator - System.Action<SparklineSeriesFactory>

The add action.

Example


             @( Html.Kendo().Sparkline(Model)
                        .Name("Sparkline")
                        .Series(series =>
                        {
                            series.Bar(s => s.SalesAmount);
                        })
            )

SeriesDefaults(System.Action)

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

Parameters

configurator - System.Action<SparklineSeriesDefaultsBuilder>

The configurator.

Example


             @( Html.Kendo().Sparkline(Model)
                        .Name("Sparkline")
                        .SeriesDefaults(series => series.Bar().Stack(true))
            )

AxisDefaults(System.Action)

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

Parameters

configurator - System.Action<ChartAxisDefaultsBuilder>

The configurator.

Example


             @( Html.Kendo().Sparkline(Model)
                        .Name("Sparkline")
                        .AxisDefaults(axisDefaults => axisDefaults.MinorTickSize(5))
            )

CategoryAxis(System.Action)

Configures the category axis

Parameters

configurator - System.Action<ChartCategoryAxisBuilder>

The configurator

Example


             @( Html.Kendo().Sparkline(Model)
                        .Name("Sparkline")
                        .CategoryAxis(axis => axis
                            .Categories(s => s.DateString)
                        )
            )

ValueAxis(System.Action)

Defines value axis options

Parameters

configurator - System.Action<ChartValueAxisFactory>

The configurator

Example


             @( Html.Kendo().Sparkline(Model)
                        .Name("Sparkline")
                        .ValueAxis(a => a.Numeric().TickSize(4))
            )

DataSource(System.Action)

Data Source configuration

Parameters

configurator - System.Action<ReadOnlyAjaxDataSourceBuilder>

Use the configurator to set different data binding options.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .DataSource(ds =>
                        {
                            ds.Ajax().Read(r => r.Action("SalesData", "Sparkline"));
                        })
            )

AutoBind(System.Boolean)

Enables or disables automatic binding.

Parameters

autoBind - System.Boolean

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

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .DataSource(ds =>
                        {
                            ds.Ajax().Read(r => r.Action("SalesData", "Sparkline"));
                        })
                        .AutoBind(false)
            )

SeriesColors(System.Collections.Generic.IEnumerable)

Sets the series colors.

Parameters

colors - System.Collections.Generic.IEnumerable<String>

A list of the series colors.

Example


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

SeriesColors(System.String[])

Sets the series colors.

Parameters

colors - System.String[]

The series colors.

Example


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

Tooltip(System.Action)

Use it to configure the data point tooltip.

Parameters

configurator - System.Action<ChartTooltipBuilder>

Use the configurator to set data tooltip options.

Example


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

Tooltip(System.Boolean)

Sets the data point tooltip visibility.

Parameters

visible - System.Boolean

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

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .Tooltip(true)
            )

Transitions(System.Boolean)

Enables or disabled animated transitions on initial load and refresh.

Parameters

transitions - System.Boolean

A value indicating if transition animations should be played.

Example


             @( Html.Kendo().Sparkline()
                        .Name("Sparkline")
                        .Transitions(false)
            )

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?