bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
928 stars 330 forks source link

Export a specific division #373

Open mnurichsan opened 8 months ago

mnurichsan commented 8 months ago

question

I want to print certain divisions, as shown and not print everything.. is there a way? Thank You

bumbeishvili commented 8 months ago

You can pass node references you want chart to fit to the screen and the invoke export

Something like this

 const nodesToFit = chart
      .getChartState()
      .allNodes.filter((d) => d.id == 101 || d.id == 120);

   chart.fit({ nodes: nodesToFit });

// Wait for the fit to complete and then export
    setTimeout((d) => {
      chart.exportImg();
    }, 500);