【发布时间】:2015-08-25 12:50:43
【问题描述】:
我有一个剑道图表,其中我有从一月到六月的数据,其中有多个位置。例如,Jan 使用 A,B,Total 作为位置,Feb 使用 A,B,Total。现在我必须显示带有位置的条形图和总计的折线图。为了显示条形图,我们必须按位置分组,因此对于线也显示所有位置。你能帮我解决这个问题吗?我必须绘制没有位置的折线图,它应该像每个月一样。
@(Html.Kendo().Chart(Model.CertifiedIronProductionReports)
@(Html.Kendo().Chart(Model.CertifiedIronProductionReports)
.Name("CertifiedIronProduced")
.Legend(legend => legend
.Visible(true)
.Position(ChartLegendPosition.Top)
)
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.DataSource(datasource => datasource
.Group(group => group.Add(model => model.Location))
.Sort(sort => sort.Add(model => model.Month))
)
.Series(series =>
{
series.Column(Model.CertifiedIronProductionReports).CategoryField("Month").Field("IronCount");
})
.Series(series =>
{
series.Line(Model.CertifiedIronProductionReports).CategoryField("Month").Field("Total").Axis("TotalAxis");
})
.CategoryAxis(axis => axis
.Categories(categories => categories.Month)
.AxisCrossingValue(0, 20)
)
.ValueAxis(axis => axis
.Numeric()
.Line(line => line.Visible(false))
.MajorGridLines(lines => lines.Visible(true))
)
.ValueAxis(axis => axis
.Numeric("TotalAxis")
.Line(line => line.Visible(false))
.MajorGridLines(lines => lines.Visible(true))
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= series.name #: #= value #")
)
)
[{"lstTotal":null,"Location":"Tomball","IronCount":383,"Month":"Jan-2015","Total":0},{"lstTotal":null," Location":"Average","IronCount":413,"Month":"Jan-2015","Total":0},{"lstTotal":null,"Location":"Grand Junction","IronCount": 443,"月":"2015 年 1 月","总计":0},{"lstTotal":null,"位置":"总计","IronCount":0,"月":"2015 年 1 月", "Total":826},{"lstTotal":null,"Location":"Tomball","IronCount":180,"Month":"Feb-2015","Total":0},{"lstTotal": null,"Location":"Average","IronCount":280,"Month":"Feb-2015","Total":0},{"lstTotal":null,"Location":"Grand Junction"," IronCount":381,"Month":"Feb-2015","Total":0},{"lstTotal":null,"Location":"Total","IronCount":0,"Month":"Feb- 2015","总计":561}]
【问题讨论】:
-
你能附上你的 json 数据的例子和你到目前为止尝试过的代码吗?
-
嗨 Ezanker,我已经添加了我尝试过的代码。请帮我解决这个问题
标签: kendo-ui kendo-chart