2013-01-18 54 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获取在图表上操作的方法列表。您可以添加系列,更改数据,更改轴限制,控制变焦等