2013-11-15 58 views
1

我使用kendo dataviz圖表並想添加註釋。這是我寫的代碼Kendo線條圖註釋未顯示

$("#resultChart").kendoChart({ 
      dataSource: resultsDataSource, 
      title: { 
       text: "Results" 
      }, 
      legend: { 
       position: "bottom" 
      }, 
      chartArea: { 
       background: "" 
      }, 
      seriesDefaults: { 
       type: "line" 
      }, 
      series: [{ 
       field: "Points", 
       name: "Points", 
       noteTextField: "EventName", 
       notes: { 
        label: { 
         position: "outside" 
        }, 
        position: "bottom" 
       } 
      }], 
      valueAxis: { 
       labels: { 
        format: "{0}" 
       }, 
       line: { 
        visible: false 
       }, 
       axisCrossingValue: -10 
      }, 
      categoryAxis: { 
       field: "EventDate", 
       majorGridLines: { 
        visible: false 
       } 
      }, 
      tooltip: { 
       visible: true, 
       format: "{0}%", 
       template: "#= series.name #: #= value #" 
      } 
     }); 

所有工作都按需要進行,即使用適當的數據繪製圖表,但不顯示註釋。

請幫我找出爲什麼筆記不顯示,如果有「EventName」屬性中的數據(我檢查過)。我想提一提的是我正在使用kendo ui 2013.1.514版本。

預先感謝您。

+0

您是否在數據中有EventName屬性,其值幾乎與「」或undefined不同?這些註釋必須位於數據內(resultsDataSource) – ccsakuweb

回答

0

在您的系列定義中,您有noteTextField: "EventName",這意味着您必須爲您的數據源中的每個項目定義屬性EventName,正如@ccsakuweb所暗指的那樣。

這意味着,在您的數據源,數據項應該是這個樣子:

var data = [ 
    { Id: 1, Name: "Result #1", EventName: "Note 1" }, 
    { Id: 2, Name: "Result #2", EventName: "Note 2" } 
]; 

劍道的有關Notes功能位於http://docs.telerik.com/kendo-ui/dataviz/chart/notes文檔。