vasturiano / sunburst-chart

A sunburst interactive chart web component for visualizing hierarchical data
https://vasturiano.github.io/sunburst-chart/example/flare/
MIT License
292 stars 89 forks source link

Chart should adjust to dynamically changed data #52

Closed hamburml closed 4 years ago

hamburml commented 4 years ago

Is your feature request related to a problem? Please describe. We love sunburst-chat! I have collegues who are responsible for reports and studies. They want to use sunburst-chart in a more dynamically way. They need to select color, change tooltip, change names, add/remove children - and all that without changing the index.html and reloading the browser.

Describe the solution you'd like I would love to have a nice creator view. On the left side of the creation-page.html there is an embedded JSONEditor like https://github.com/josdejong/jsoneditor. With it the data can be changed dynamically inside the page. Every change should trigger sunburst-chart to reload. If I think it's good, I export the JSON-data.

What I also think could be really cool - embedd proofen color palettes (like https://coolors.co/palettes/trending). On the left, you can choose between color palettes and don't need to change the every color of a node.

I tried doing it directly in the chrome developer tools but I didn't find a "reload" method on the Sunburst() object. Is there one?

Describe alternatives you've considered none

Additional context none

vasturiano commented 4 years ago

@hamburml if you wish to update the data set in the chart, you just have to re-invoke the .data(<your new data set>) method. The chart will then react to the data changes. The same is true for any of the other configuration methods, you can for example call the .color method to dynamically update the color logic in the chart.

hamburml commented 4 years ago

Thanks, didn't know that.

sort, showTooltip and other functions want a string or a function as parameter. Is there somewhere a documentation which shows what arguments the function needs to have?

vasturiano commented 4 years ago

That should be clear from the documentation, on a case by case. The sort method expects a comparator method of nodes, so (nodeA, nodeB) => .... showTooltip receives a node object and should return a boolean.

hamburml commented 4 years ago

You are right, I haven't read it thoroughly.