f5 / unovis

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript
https://unovis.dev
Apache License 2.0
2.2k stars 43 forks source link

Graph: Supporting custom functions for node rendering; onRenderComplete callback #404

Closed rokotyan closed 1 month ago

rokotyan commented 3 months ago

This PR will allow the users to come up with their own node rendering functions, which will be a pretty common use case for everyone designing their own graphs.

It also add the onRenderComplete callback which allows you to do even more, e.g. add custom background / foreground graphics.

https://github.com/f5/unovis/assets/755708/cd36d1c5-891e-4af9-9c9e-c2a54dd5723a

lee00678 commented 2 months ago

Do we need to add documentation for this?

rokotyan commented 2 months ago

@lee00678 Yes, definitely. And probably a new example. I feel like it's a pretty big feature so we might want to present it properly.

rokotyan commented 2 months ago

Latest commits summary:

Reworking node selection and state update logic

rokotyan commented 2 months ago

@reb-dev (cc @lee00678) After some more local testing, I think I need to make the updateNodesPartial function configurable as well. Otherwise some of the styles might get overridden. Also to give you a heads up, I might need to move the logic around using s.nodeSelectors.brushed class there because it aligns better with what we have for grayed out and selected states.

rokotyan commented 2 months ago

@reb-dev I've pushed a few new commits and tested them on my end, everything seems to be working well. I'm a bit concerned about this change because I don't remember why I did it that way initially. It would be great if you could test it with your existing graphs and let me know if everything still looks good. You can use 1.5.0-nikita.1 version to test which has all the changes from this PR.

rokotyan commented 1 month ago

No worries, thanks @reb-dev