jQuery Flot 饼图 - 标签标注?
我一直在使用 flot 来满足我的 jquery 图表需求。现在,我需要添加一个饼图(我知道 flot 做得很好)。对于饼图,我们需要但我没有看到 flot 的一件事是对每个饼图上的值的标注(标注是带有将标签连接到饼图的线的标签)。有谁知道如何让标注在 flot 中的饼图上工作?
我们需要标注的主要原因是因为我们需要为每个饼图添加标签,无论其大小如何。标注将使我们能够获得更小的饼图,并减少文本与标签重叠的可能性。
我建议使用图例,但这对于企业来说是不可接受的。我确实知道其他图表解决方案允许标签标注,但如果可能的话希望继续使用 flot。
提前致谢。
I've been using flot for my jquery charting needs. Now, I need to add a pie chart (which I know flot does pretty well). For the pie chart, one thing that we need that I didn't see that flot had was callouts to the values on each pie piece (callouts being the label with a line connecting the label to the pie piece). Does anyone know how to get callouts to work on the pie piece in flot?
The main reason we need callouts is because we need to have the label for each pie piece regardless of its size. Callouts would allow us to have smaller pie pieces and reduce the potential for text overlaps with the labels.
I've proposed the use of a legend, but that is not acceptable to the business. I do know that other charting solutions allow label callouts, but would like to continue to use flot if possible.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我添加了类似的东西来测试绘图悬停。您需要根据您的特定场景调整解决方案,但这应该会有很大帮助。
让我知道这是否有帮助!
I added something similar to test for a plothover. You'll need to adapt the solution to your particular scenario, but this should be a big help.
Let me know if this helps!
您可以使用 plothover 事件来显示标注。标注的标签可以放在您喜欢的任何地方。这显示在 Flot 页面 的最后一个示例中。 Google Spreadsheets 使用与链接的解决方案类似的解决方案,并且效果非常好。
You could use a plothover event to show the callout. The label for the callout could be wherever you like. This is shown in the last example at the Flot Page. Google Spreadsheets uses a solution similar to the one linked and it works very well.