刷新rallychart

刷新rallychart,rally,Rally,我有一个显示图表的Rally SDK 2.0p5应用程序。当用户选择一个选项时,数据将被更新,我想刷新图表。但它不会重新绘制,而是在下面放置一个新图表。正确的语法是什么 // Configure and Add the chart this.add( { xtype: 'rallychart', h

我有一个显示图表的Rally 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'
                                    }
                                }
                            }
                        }
                    }
                );

在添加新图表之前,需要删除第一个图表

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

通常,最好只是就地更新图表。HighCharts是App SDK中包含的图表库。HighCharts甚至可以为您的更改设置动画。酷!!!查找在图表上操作的方法列表。您可以添加系列、更改数据、更改轴限制、控制缩放等。

我将id设置为“图表”,并且它在没有“#”重绘图表的情况下工作:函数(){this.remove('chart');this.add({…})}