本文介绍了如何在morris甜甜圈图表上添加点击处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用这个Morris js制作图表 []



我可以绑定这些图表,但我可以添加点击处理程序



i希望实现这样的事情

[]



Hi I am making charts by using this Morris js http://www.oesmith.co.uk/morris.js/donuts.html[^]

I am able to bind these charts but i am able to add click handler on it

i want achieve some thing like this
http://www.jqueryscript.net/demo/Morris-Good-looking-Charts-Plugin/examples/donut.html[^]

Morris.Donut({element: 'dvTestData',data: [ { label:  "platelets", value: 16.70 }, { label:  "Serum test", value: 50.00 }, { label:  "serum testing", value: 16.70 }, { label:  "Whole blood test", value: 16.70 }],formatter: function (x) { return x + ' % '}});





所以当我点击它时,我可以调用一个将绑定的函数grid



so when i will click it i can call a fucntion which will bind grid

解决方案






请查看下面提到的链接以获取更多信息。







更新





Please check below mentioned link for more info.

Added support for handling click events

UPDATE

Morris.Donut({
  element: 'donut-example',
  data: [
    {label: "Download Sales", value: 12},
    {label: "In-Store Sales", value: 30},
    {label: "Mail-Order Sales", value: 20}
  ]
});






现场演示:



每个细分的颜色:





LIVE DEMO : JSBin

Color for each segments :

Morris.Donut({
  element: 'donut-example',
  data: [
    {label: "Download Sales", value: 12 },
    {label: "In-Store Sales", value: 30},
    {label: "Mail-Order Sales", value: 20}
  ],
  colors:['#FF0000',"#00FF00","#FFFF00"]
});







颜色演示:


这篇关于如何在morris甜甜圈图表上添加点击处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-10 23:25