在加载事件上选择数据条目会导致空填充(Selecting a data entry on load event causes empty fill)
为什么所选切片的填充为空? 我在这里添加了一个例子: http : //jsfiddle.net/c6duaLvv/
似乎没有错误发生(根据铬的控制台)。
chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie', events: { load: function() { this.series[0].data[0].select(); this.redraw(); } } }Why is the selected slice's fill empty? I've added an example here: http://jsfiddle.net/c6duaLvv/
No errors seem to occur (according to the chromium's console).
chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie', events: { load: function() { this.series[0].data[0].select(); this.redraw(); } } }最满意答案
这个问题是由动画引起的。 您尝试在渲染和动画之前选择元素。 解决方案是在回调中设置动画后调用select()函数。
function(chart){ setTimeout(function() { chart.series[0].data[0].select(); },1000); });http://jsfiddle.net/1oyqs8t3/
The solution was to use the afterAnimate event instead:
plotOptions: { series: { events: { afterAnimate: function() { this.data[0].select(); this.redraw(); } } }http://api.highcharts.com/highcharts#plotOptions.series.events
http://jsfiddle.net/xf2wc82n/
更多推荐
发布评论