2015-12-01 48 views
0

我正在使用Kendo UI並嘗試在單個網頁上顯示多個圖表。一切工作,直到我嘗試添加第二個條形圖。其中一個圖表不顯示,只顯示一個通用圖表圖像(看起來它沒有找到數據,但如果我重新排序,它們會反轉發生的情況)。我可以顯示多個折線圖。有關可能發生什麼的任何想法?Kendo在網頁上顯示多個條形圖圖表

下面是我的兩個圖表沒有SVG信息的html:

<div kendo-chart="" k-options="vm.barChartOptions" ng-show="this.dataItem.visible" class="move k-block ng-scope k-chart" id="costPerPound" style="float: left; margin: 5px 0px; position: relative;" data-uid="b543ff9a-ee57-4ce7-a39d-8f69a0505a2b" role="option" aria-selected="false" data-role="chart"></div> 
<div kendo-chart="" k-options="vm.barChartOptions" ng-show="this.dataItem.visible" class="move k-block ng-scope k-chart" id="numShipments" style="float: left; margin: 5px 0px; position: relative;" data-uid="97094bf1-4366-4974-b92f-edf36d1980f4" role="option" aria-selected="false" data-role="chart"></div> 

這裏是爲第k選擇信息。正如你所看到的,我正在渲染大部分信息。

 vm.barChartOptions = { 
     dataSource: vm.chartData_datasource, 
     series: [ 
      { 
      } 
     ], 
     valueAxis: { 
      line: { 
       visible: false 
      }, 
      labels: { 
       rotation: "auto" 
      } 
     }, 
     tooltip: { 
      visible: true, 
      template: "#= series.name #: #= value #" 
     }, 
     render: function (e) { 
      var chart = e.sender; 
      var chartData = vm.findChartData(e); 
      if (chartData != null) { 
       chartData.categoryAxisField = vm.firstToLower(chartData.categoryAxisField); 
       chart.options.title.text = chartData.title; 
       chart.options.name = chartData.htmlID; 
       chart.options.categoryAxis.field = chartData.categoryAxisField; 
       chart.options.categoryAxis.labels.format = chartData.categoryAxisLabel; 
       chart.options.legend.position = chartData.legendPosition; 
       chart.options.seriesDefaults.type = chartData.chartType; 
       for (var i = 0; i < chart.options.series.length; i++) { 
        chart.options.series[i].type = chartData.chartType; 
        chart.options.series[i].field = vm.firstToLower(chartData.dataField); 
       } 
      } 

     } 
    } 

回答

0

我有同樣的問題。可以通過向每個圖表提供不同名稱 來解決。