sunburst-chart icon indicating copy to clipboard operation
sunburst-chart copied to clipboard

Breadcrumbs on top of the chart

Open racedin opened this issue 5 years ago • 2 comments

When we are drilling down or zooming into the sunburst chart, the hierarchical level is not shown.

A breadcrumbs showing the level of node currently focused would be ideal.

Is it possible to add the breadcrumbs as an option? So that those who need it can make use of it.

racedin avatar Sep 18 '19 19:09 racedin

@racedin you can build a side component that shows that information. You can get navigation events from the chart by tapping into the onClick method. Something like:

myChart.onClick(node => {
  myChart.focusOnNode(node); // maintain default behaviour of zooming when clicked
  updateBreadcrumb(node); // this method's implementation is up to you
});

vasturiano avatar Sep 20 '19 01:09 vasturiano

How this can be done in the react component built using react-kapsule? I tried something like this:

  <ReactSunburst
    //...
    data={data}
    onClick={(node) => {
      myChart.focusOnNode(node);
      console.log("clicked");
    }}
  /> 

The problem I faced is that myChart is undefined inside the onClick handler. So, this gives myChart is not defined error and the chart does not perform the default zooming behavior. If I omit the first line, "clicked" gets printed to the console. Link to the errored line is the codesandbox.

RajS999 avatar Jul 23 '22 06:07 RajS999