Kendo ui MVC剑道图的动态分类
目前我有这个,效果很好。。我需要的是CategoryAxis中的类别是动态的,而不是静态的 我已经从我的模型中得到了我想要输入的值,它的@item.SurveyLinearCounts.FirstOrDefault().Min表示最小值,@item.SurveyLinearCounts.FirstOrDefault()表示最大值 我该怎么做Kendo ui MVC剑道图的动态分类,kendo-ui,kendo-asp.net-mvc,Kendo Ui,Kendo Asp.net Mvc,目前我有这个,效果很好。。我需要的是CategoryAxis中的类别是动态的,而不是静态的 我已经从我的模型中得到了我想要输入的值,它的@item.SurveyLinearCounts.FirstOrDefault().Min表示最小值,@item.SurveyLinearCounts.FirstOrDefault()表示最大值 我该怎么做 @(Html.Kendo().Chart<AnalyzeResponseViewModel>()
@(Html.Kendo().Chart<AnalyzeResponseViewModel>()
.Name(@item.SurveyQuestionID.ToString())
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
.Visible(true)
)
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.Series(series =>
{
series.Column(model => model.ResponseCount).Name("Count").Tooltip(tooltip => tooltip.Visible(true).Template("#= series.name #: #= value #"));
})
.CategoryAxis(axis => axis
.Categories("1", "2", "3", "4", "5")
.MajorGridLines(lines => lines.Visible(false))
)
.
)
.ValueAxis(axis => axis
.Numeric()
.Line(line => line.Visible(false))
.MajorGridLines(lines => lines.Visible(true))
)
.DataSource(ds => ds
.Read(read => read.Action("GetSurveyResponseChart", "DataSource", new { item.SurveyQuestionID })))
.Tooltip(tooltip => tooltip.Visible(true).Template("#= series.name #: #= value #")))
@(Html.Kendo().Chart())
.Name(@item.SurveyQuestionID.ToString())
.Legend(Legend=>Legend
.位置(ChartLegendPosition.Top)
.可见(真实)
)
.ChartArea(ChartArea=>ChartArea
.背景(“透明”)
)
.系列(系列=>
{
series.Column(model=>model.ResponseCount).Name(“Count”).Tooltip(Tooltip=>Tooltip.Visible(true).Template(“#=series.Name#::#=value#”);
})
.CategoryAxis(轴=>轴
.类别(“1”、“2”、“3”、“4”、“5”)
.MajorGridLines(lines=>lines.Visible(false))
)
.
)
.ValueAxis(轴=>轴
.Numeric()
.Line(Line=>Line.Visible(false))
.MajorGridLines(lines=>lines.Visible(true))
)
.DataSource(ds=>ds
.Read(Read=>Read.Action(“GetSurveyResponseChart”,“DataSource”,新的{item.SurveyQuestionID})))
.Tooltip(Tooltip=>Tooltip.Visible(true).Template(“#=series.name:#=value#”)
假设所需的值位于项中。SurveyLinearCounts
属性中,您应该能够执行以下操作:
.CategoryAxis(axis => axis
.Categories(item.SurveyLinearCounts)
.MajorGridLines(lines => lines.Visible(false))
)
如果您希望其中有其他物业,您可以执行以下操作:
.Categories(item.SurveyLinearCounts.Select(x => x.MyProp))
你想要什么还不清楚。是否只想在已生成图表后更新类别标签?我想使用模型中的值动态设置标签