2013-07-08 60 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相当于你的代码? –