Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add zoom in zoom out buttons in visjs using angularjs?

Need help in having a zoom in and zoom out button in visjs network graph using angularjs, I could not find any relevant options for this. Please help, I am also providing a plunker link as an example

Code

<vis-network data="data" options="options" height="100%"></vis-network>

$scope.options = {
  autoResize: true,
  height: '800',
  width: '100%'
};

1 Answers

Take a look at the interaction, navigationButtons option. It has built in controls for zoom, pan and reset view.

You need to change your vis options to include navigationButtons: true and keyboard: true to have keboard shortcuts enabled

$scope.options = {
  autoResize: true,
  height: '600',
  width: '100%',
  interaction: {
      navigationButtons: true,
      keyboard: true
  }
};

Check this plunker

like image 173
AabinGunz Avatar answered Sep 09 '25 12:09

AabinGunz