我正在使用图表来显示TimeboxScopedApp
中的数据,并且我希望在范围更改时更新数据。使用remove()
然后按照描述here重新绘制图表的蛮力方法给我留下了重叠的“Loading ...”掩码,但是否则有效。使用Highchart本地redraw()
方法的自然方法是我的偏好,只是我不知道如何访问实际的Highchart对象而不是App SDK包装器。
以下是代码的相关部分:
var chart = Ext.getCmp('componentQualityChart');
if (chart) {
var chartCfg = chart.getChartConfig();
chartCfg.xAxis.categories = components;
chart.setChartConfig(chartCfg);
chart.setChartData(data);
chart.redraw(); // this doesn't work with the wrapper object
} else { // draw chart for the first time
如何使用新数据重新绘制图表?
答案 0 :(得分:3)
假设图表(componentQualityChart)是Rally.ui.chart.Chart
的实例,您可以像这样访问HighCharts实例:
var highcharts = chart.down('highchart').chart;
// Now you have access to the normal highcharts interface, so
// you could change the xAxis
highcharts.xAxis[0].setCategories([...], true);
// Or you could change the series data
highcharts.series[0].data.push({ ... }); //Add a new data point
// Or pretty much anything else highcharts lets you do
答案 1 :(得分:1)
使用_unmask()删除重叠的“Loading ..”掩码
if (this.down('#myChart')) {
this.remove('myChart');
}
this.add(
{
xtype: 'rallychart',
height: 400,
itemId: 'myChart',
chartConfig: {
//....
},
chartData: {
categories: scheduleStateGroups,
series: [
{
//...
}
]
}
}
);
this.down('#myChart')._unmask();