在加载事件上选择数据条目会导致空填充(Selecting a data entry on load event causes empty fill)

编程入门 行业动态 更新时间:2024-10-26 20:21:53
在加载事件上选择数据条目会导致空填充(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/

更多推荐

本文发布于:2023-08-03 14:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1391431.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:条目   加载   事件   数据   Selecting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!