2017-07-03 192 views
0

當我在kendo折線圖中的categoryAxis中設置最小值和最大值時。我有一個錯誤。在這種情況下,我暫時設置靜態日期,但即使我動態設置它,也會發生相同的錯誤。設置jQuery中kendo ui的折線圖的類別軸的最小值和最大值

前端代碼: 請注意,請參閱類別Axis:最小值和最大值。

$("#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 
 
        } 
 
       } 
 
      });

當我打開圖表,得到了劍道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)

+0

您可以在Kendo Dojo中重新編寫您的示例嗎? –

回答

0

裏面你categoryAxis,該type屬性設置爲"date",按照在Telerik documentation的例子。

E.g.

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 
    } 
} 
+0

我讚賞你的想法@Sandman謝謝。但是,同樣的錯誤發生了。 – nyapz

相關問題