Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Donut chart with partial ring around

Tags:

d3.js

I'm building a context menu using D3.js donut chart. Now I'd like to add a submenu when mousehovering a certain element, like this (sorry for my paint skills):

Menu sketch

The main donut menu is already done, but I can't figure out how to add the submenu. It must be centered around the parent element (the element that has the subitems), because other menu items in the main menu might also have a submenu.

I already looked into this question: D3.js - Donut charts with multiple rings but those are full rings.

Anyone an example?

like image 725
EsTeGe Avatar asked Jul 14 '26 13:07

EsTeGe


1 Answers

I managed to get it working! I used startAngle, endAngle, innerRadius and outerRadius.

Only the centering around the parent element isn't done yet. I just place the submenu always on top now. This is the result:

Context menu

Thanks for the help everyone!

like image 185
EsTeGe Avatar answered Jul 20 '26 20:07

EsTeGe