-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Is your feature request related to a problem? Please describe.
I'd like to have a way to apply formatting to individual rendered elements.
Describe the solution you'd like
I'd like to have a .className(node)
function that lets me apply classes to the SVG that is being rendered for each node.
Describe alternatives you've considered
I'm doing this now like this:
setTimeout(() => {
const rectElements = document.querySelectorAll('#chart rect')
// Do stuff with rectElements
}, 0)
However, it's tricky, since I can't easily introspect the DOM elements to determine which ones correspond to which nodes in the tree.
As an alternative to emitting class names, there could be a visitor function that receives both the rendered DOM node and the data node it came from.
The setTimeout
is also a bit icky.
Additional context
If this makes sense to you, I might be able to contribute it at some point in the future.