vasturiano / treemap-chart

A treemap interactive chart web component for visualizing hierarchical data

Home Page:https://vasturiano.github.io/treemap-chart/example/flare/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Back button

mawid6 opened this issue · comments

Is your feature request related to a problem? Please describe.
Hi! Testing the demo quickly - a bit frustrated that there is no clear & easy way to zoom out to previous view.

Describe the solution you'd like
Implement back support to move to previous zoom.

Describe alternatives you've considered
Zoom out with mouse scroller, etc. works terrible - as treemap and web page competes for handling the scroll events and behavior is then as a result inconsistent and unreliable. Also, it is timeconsuming and not precise as I often quite specifically want to revert back to previous view, not actually do any free zooming out - there difference in intention and need.

Additional context
N/A

Maybe this is up to the consumer of the widget? Sorry if this has already been addressed.

@mawid6 thanks for reaching out.

You could keep history on your app of what nodes the user zooms into by clicking on a node. Something like:

const nodeClickHistory = [];

...

myChart.onClick(node => {
  nodeClickHistory.push(node);
  myChart.zoomToNode(node);
})

Then you could add a back button that just pops the last node item from your history and zooms to it.