Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize node formatting based on data node #1

Open
paulmelnikow opened this issue Oct 21, 2019 · 0 comments
Open

Customize node formatting based on data node #1

paulmelnikow opened this issue Oct 21, 2019 · 0 comments

Comments

@paulmelnikow
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant