2013-01-18 50 views
0

我有一個顯示圖表的拉力賽SDK 2.0p5應用程序。當用戶選擇一個選項時,數據將被更新,我想刷新圖表。但是,不要重新繪製,它會在下面放置一個新圖表。什麼是正確的語法?刷新拉力賽圖

   // Configure and Add the chart 
       this.add(
        { 
         xtype: 'rallychart', 
         height: 400, 
         id: 'chart', 
         chartConfig: { 
          chart: { 
          }, 
          title: { 
           text: 'My Chart', 
           align: 'center' 
          }, 
          xAxis: [ 
           { 
            categories: ['M0','M1','M2','M3','M4','M5'], 
            title: { 
             text: 'Interval' 
            } 
           } 
          ], 
          yAxis: { 
           title: { 
            text: yText 
           } 
          }, 
          series: [ { type: 'column', 
             name: yText, 
             data: mCount } ], 
          plotOptions : { 
           column: { 
            color: '#F00' 
           }, 
           series : { 
            animation : { 
             duration : 2000, 
             easing : 'swing' 
            } 
           } 
          } 
         } 
        } 
       ); 

回答

1

您需要在添加新圖表之前刪除第一個圖表。

redrawChart: function() { 
    this.remove('#chart'); 
    this.add({...}); 
} 
+0

我的ID設置爲「圖表」,和它的作品沒有「#」 redrawChart:函數(){ 這一點。除去( '圖表'); this.add({...}); } –

0

只是更新圖表通常會更好。 HighCharts是包含在App SDK中的圖表庫。 HighCharts甚至會動畫你的改變。涼!!!查看here獲取在圖表上操作的方法列表。您可以添加系列,更改數據,更改軸限制,控制變焦等