【问题标题】:Setting the minimum and maximum values of category axis of line chart from kendo ui in jquery在jquery中从kendo ui设置折线图类别轴的最小值和最大值
【发布时间】:2017-07-03 09:47:02
【问题描述】:

当我在剑道折线图中的 categoryAxis 中设置最小值和最大值时。我有一个错误。在这种情况下,我暂时设置了静态日期,但即使我动态设置它,也会发生同样的错误。

前端代码: 请。查看 categoryAxis:min 和 max。

 $("#chart").kendoChart({
                title: { text: "MyChart" },
                theme: "Metro",
                dataSource: dataSeries,
                series: [{
                    type: "line",
                    field: "value()",
                    categoryField: "Date",
                    name: "#= group.value #"
                }],
                legend: {
                    position: "right"
                },
                valueAxis: {
                    line: {
                        visible: false
                    }
                },
                categoryAxis: {                    
                    min: new Date("6/2/2017"),
                    max: new Date("7/3/2017"),
                    baseUnit: "days",
                    majorGridLines: {
                        visible: true
                    },
                    labels: {
                        rotation: 40,
                        padding: { right: 10 },
                        dateFormats: {
                            days: "M/d/yy"
                        },
                        step: step
                    }
                }
            });

当我加载图表时,从 kendo js 得到这个错误。

剑道js出错:

VM2938:3 Uncaught TypeError: d.value is not a function
    at eval (eval at getter (kendo.all.js:2048), <anonymous>:3:11)
    at n (kendo.all.js:142386)
    at init._bindFromObject (kendo.all.js:141977)
    at init.bindPoint (kendo.all.js:141936)
    at r._bindPoint (kendo.all.js:142838)
    at r.traverseDataPoints (kendo.all.js:142802)
    at render (kendo.all.js:142432)
    at render (kendo.all.js:143397)
    at r.init (kendo.all.js:142429)
    at new r (kendo.all.js:42)

【问题讨论】:

  • 你能在剑道道场重现你的例子吗?

标签: jquery kendo-chart


【解决方案1】:

根据Telerik documentation 中的示例,在您的categoryAxis 中,将type 属性设置为"date"

例如

categoryAxis: {                    
    min: new Date("6/2/2017"),
    max: new Date("7/3/2017"),
    type: "date",
    baseUnit: "days",
    majorGridLines: {
        visible: true
    }, 
    labels: {
        rotation: 40,
        padding: { right: 10 },
        dateFormats: {
            days: "M/d/yy"
        },
        step: step
    }
}

【讨论】:

  • 感谢您的想法@Sandman 谢谢。但是,发生了同样的错误。
猜你喜欢
  • 2014-10-22
  • 1970-01-01
  • 2014-01-03
  • 1970-01-01
  • 1970-01-01
  • 2018-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多