I'm trying to add a sparkline column into a grid.
I've tried using a client template to do this, but it just shows [object HTMLScriptElement] in the column, rather than the chart.
I have a template:-
This doesn't yet have pass any parameters to the controller - but obviously this will be needed as well.
The grid is:-
What's the best way to embed a chart into a column - I specifically want the chart in a column and not a detail template - something a sparkline looks ideal for.
Thanks
I've tried using a client template to do this, but it just shows [object HTMLScriptElement] in the column, rather than the chart.
I have a template:-
<
script
id
=
"sparkTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Sparkline()
.Name("temp-log_#=ID#")
.Type(SparklineType.Column)
.Tooltip(tooltip => tooltip.Format("{0} °C"))
.Data(ViewBag.TemperatureData)
.ToClientTemplate()
)
</
script
>
The grid is:-
@(Html.Kendo().Grid<
CMS_2013.Models.CMSSummaryOne
>()
.Name("tabGrid")
.Columns(columns=>
{columns.Bound(p=>p.DivisionName).Title("Division");
columns.Bound(p => p.Specialty).Title("Specialty");
columns.Bound(p => p.Activity).Title("Activity");
columns.Bound(p => p.Plan).Title("Plan");
columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#= formatNumber(Variance) #");
columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#=sparkTemplate#");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource=>dataSource
.Ajax()
.PageSize(5)
.Read(read=>read.Action("GetTableData","Dashboard")
.Data("chartFilter")
)
)
)
What's the best way to embed a chart into a column - I specifically want the chart in a column and not a detail template - something a sparkline looks ideal for.
Thanks