绘制饼图-外部选择切片 [英] Flot pie charts - externally selecting slices

查看:70
本文介绍了绘制饼图-外部选择切片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了此解决方案.

如果图表类型为 pie ,则如何指定参数(突出显示(x,y)的x,y)?

If type of chart is pie, how specify parameters (x,y) of highlight(x, y)?

谢谢

对不起,我的英语不好.

Sorry for my bad English.

推荐答案

不幸的是,flot并没有向用户公开饼图突出显示代码.因此,我们很不走运,但是对您来说可行的是在页面上适当的位置合成一个点击事件:

Unfortunately, flot doesn't expose the pie highlighting code to the user. So we are pretty much out of luck, but what may work for you is synthesizing a click event at the appropriate place on the page:

$("#highligher").click(function () {
    var e = jQuery.Event('click');
    e.pageX = 250; //add a made up x/y coordinate to the click event
    e.pageY = 250;
    $('#plot canvas:first').trigger(e); //trigger the click event on the canvas
});

这里正在起作用: http://jsfiddle.net/ryleyb/mHJm5/

问题是您必须知道要突出显示的切片在哪里.如果图形是静态的,这将很容易设置.如果是动态图,则必须深入了解饼图代码的来源,以弄清楚如何计算饼图切片的位置.在这种情况下,仅拥有所有饼图功能的副本并在饼图叠加层上进行手动绘制可能会更容易.

The problem is you have to know where the slice you want to highlight is already. This would be easy enough to set if the graph is static. If it's a dynamic graph, you'd have to dig into the source of the pie code to figure out how to calculate where the pie slice is. It might be easier in that case to just have a copy of all the pie functions and manually draw on the pie overlay.

这篇关于绘制饼图-外部选择切片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆