2013-07-08 59 views
1

在提供KendoUI演示站的例子,它的圖表綁定到這些格式的JSON數據:如何JSON數據綁定到KendoUI圖

[ { "Booked" : 0, 
    "Date" : "/Date(1370620800000)/", 
    "FailedAttempts" : 0, 
    "Views" : 0 
    }, 
    { "Booked" : 0, 
    "Date" : "/Date(1370707200000)/", 
    "FailedAttempts" : 0, 
    "Views" : 0 
    }] 

但如果以這種格式的服務器返回:

{ "AggregateResults" : null, "Data" : [ { "Booked" : 0, 
    "Date" : "/Date(1370620800000)/", 
    "FailedAttempts" : 0, 
    "Views" : 0 
    }, 
    { "Booked" : 0, 
    "Date" : "/Date(1370707200000)/", 
    "FailedAttempts" : 0, 
    "Views" : 0 
    },] 

}

如何設置的KendoUI圖表綁定到 「數據」 節點?

回答

2

在您定義數據源定義,定義shema.data爲「數據」。

$("#chart").kendoChart({ 
    dataSource: { 
     transport: { 
      read: { 
       ... 
      } 
     }, 
     schema : { 
      data: "Data" 
     } 
    }, 
+0

你有沒有Kendo ASP Wrapper相當於你的代碼? –