asp.net mvc - Setting Kendo Chart series name from datasource -
in kendo chart example read series line value datasource , set series name statically (eg. "series name"). i'm looking way set series name dynamically accordant data read db. here code:
@(html.kendo().chart() .name("chart") .title("chart title") .datasource(ds=>ds.read(read=>.read.action("getvalues", "controller"))) .series(series=>series.line(model=>model.value).name("series name")) )
using scatterline chart groupnametemplate can of set chart series name dynamically. bellow code snippet:
<%= html.kendo().chart(model) .name("chart") .title("stock prices") .datasource(datasource => datasource .read(read => read.action("_stockdata", "scatter_charts")) .group(group => group.add(model => model.symbol)) .sort(sort => sort.add(model => model.date).ascending()) ) .series(series => { series.scatterline(model => model.date, model => model.close) .name("close") .groupnametemplate("#= group.value # (#= series.name #)"); }) .legend(legend => legend .position(chartlegendposition.bottom) ) .yaxis(axis => axis.numeric() .labels(labels => labels .format("${0}") .skip(2) .step(2) ) ) .xaxis(axis => axis.date() .labels(labels => labels.format("mmm")) ) %>
Comments
Post a Comment