如何通过模型绑定Kendo堆积条形图 [英] How to bind Kendo stacked bar chart through Model
本文介绍了如何通过模型绑定Kendo堆积条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过MVC模型绑定堆叠的kendo条形图,但出现错误无法将lambda表达式转换为'double'类型,因为它不是委托类型".
I am trying to bind a stacked kendo Bar chart Through MVC model ,but getting an error "cannot convert lambda expression to type 'double' because it is not a delegate type".
@(Html.Kendo().Chart(Model)
.Name("chart3")
.Title(title => title
.Text("Comments per day")
.Align(ChartTextAlignment.Left)
)
.Legend(legend => legend
.Visible(false)
)
.Series(series =>
{
series.Column(new double[]{model => model.PerIdlingHours}
)
.Labels(labels => labels.Background("transparent").Visible(true));
})
.CategoryAxis(axis => axis
.Categories(model => model.DataDate)
.MajorGridLines(lines => lines.Visible(false))
.Line(line => line.Visible(false))
)
.ValueAxis(axis => axis.Numeric()
.Max(28)
.MajorGridLines(lines => lines.Visible(false))
.Visible(false)
)
)
推荐答案
这是我们创建剑道条形图的方式
This is how we can create the kendo bar chart
@model IEnumerable< Hitec.Blackbox.Models.AllMachinesUtilization>
<div class="chart-wrapper">
@(Html.Kendo().Chart(Model)
.Name("DailyChart")
.HtmlAttributes(new { style = "width:auto;height:200px" })
.Title(title => title
.Text("Daily Utilization Chart")
.Align(ChartTextAlignment.Left)
)
.Legend(legend => legend
.Visible(true)
.Position(ChartLegendPosition.Bottom)
)
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Column().Stack(ChartStackType.Stack100))
.Series(series =>
{
series.Column(model => model.IdlingHours).Color("#b8b8b8");
series.Column(model => model.StopHours).Color("#bb6e36");
series.Column(model => model.EngineWorkingHours).Color("#f3ac32");
})
.CategoryAxis(axis => axis
.Categories(model => model.DataDate)
.MajorGridLines(lines => lines.Visible(false))
.Line(line => line.Visible(false))
)
.ValueAxis(axis => axis.Numeric()
// .Max(100)
.Visible(false)
.Line(line => line.Visible(false))
.MajorGridLines(lines => lines.Visible(true))
.Visible(false)
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= series.name #:<br/> #= value #")
))
</div>
这篇关于如何通过模型绑定Kendo堆积条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文