Highcharts:如何在禁用切片时重新调整切片?
这可能吗?我希望饼图中的其他切片在图例中禁用时调整为完整的圆圈,而不是仅仅制作一个空切片。
Is this possible? I want the other slices in the pie chart to adjust to a full circle when one is disabled in the legend, rather than just making an empty slice..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果更改
legendItemClick
事件处理程序的行为,您可以删除该扇区而不是隐藏它。但这只能让你成功一半。问题是您无法取回该点,因为它也会从图例中删除。
解决这个问题的一种方法是添加一个重置按钮,通过
series.setData()
返回原始数据集。请参阅此 jsfiddle 示例。If you change the behavior of the
legendItemClick
event handler you can remove the sector instead of hiding it.This will only get you half the way though. The problem is that you cannot get the point back since it will be removed from the legend as well.
A way to get around this would be to add a reset button that brings back the original data set with
series.setData()
. See this jsfiddle example.