Kendo Chart category axis fix number of labels

醉酒当歌 提交于 2019-12-02 06:21:26

问题


I have a kendo chart with date time series on x-axis as below but i wanted to fix the number of labels on the axis. Could you please help me on this how to acheive.

@(Html.Kendo().Chart(Model.ParameterValueList)
                     .Name("chart")
                     .Title("Chart Title")
                     .DataSource(ds => ds
                         .Group(group => group.Add(model => model.Parameter.Name))
                     )
                     .Series(series =>
                            {
                                series.Line(Model.ParameterValueList).CategoryField("ReceiveTime").Field("Value").Stack(false);
                            })
                            .CategoryAxis(axis => axis
                                .Categories(model => model.ReceiveTime).Date().RoundToBaseUnit(true)
                                .Labels(l => l.Rotation(-45).Format("dd MMM yyyy hh:mm:ss").Step(2))                                       
                                .MajorGridLines(x=>x.Step(5))
                                .MajorTicks(x=>x.Size(5))
                            )
                            .Legend(legend => legend
                                .Visible(true).Position(ChartLegendPosition.Right)
                             )
                            .ChartArea(a => a.Width(800).Height(250))
                            .Tooltip(t => t.Visible(true).Template("${series.name} : ${value}"))
                       )

来源:https://stackoverflow.com/questions/35747532/kendo-chart-category-axis-fix-number-of-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!