Simple Donut Chart with Raphael

旧城冷巷雨未停 提交于 2019-12-08 05:03:09

问题


Using the example from "How to achieve donut holes with paths in raphael" ( How to achieve 'donut holes' with paths in Raphael ) I was able to tweek the code a bit more to my use-case.

My next goal with this is to enlarge one of the sectors on mouse over, without pulling it away from the inside circle. Is this possible?

Here's the current code: http://jsfiddle.net/Swivelgames/efb9n/1/

I'm hoping to make it look like this:


回答1:


Evening,

I've sort of cheated here. The way the donut is working right now is by using scaling, but to do what you want you can't go that way. The options are to recalculate the sector, or to cheat. I've done both.

I've added a second donut with bigger sectors, which I've then hidden. On the original donut, the mouseover hides the appropriate sector and displays the sector from the bigger ring.

The outer ring has a mouseout function which reverses the process.

Heres a fiddle that hopefully shows it working.

It's not the optimal solution, but it might help you along.




回答2:


just change the angleplus value from 360 to 369.5... should be sufficient... :)



来源:https://stackoverflow.com/questions/8141126/simple-donut-chart-with-raphael

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!