如何使用angularjs在visjs中添加放大缩小按钮

如何使用angularjs在visjs中添加放大缩小按钮

本文介绍了如何使用angularjs在visjs中添加放大缩小按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要帮助使用 angularjs 在 visjs 网络图中设置放大和缩小按钮,我找不到任何相关选项.请帮忙,我还提供了一个 plunker 链接作为示例

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

代码

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

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

推荐答案

看看 interaction, 导航按钮 选项.它具有用于缩放、平移和重置视图的内置控件.

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

您需要更改 vis 选项以包含 navigationButtons: truekeyboard: true 以启用键盘快捷键

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
  }
};

检查这个 plunker

这篇关于如何使用angularjs在visjs中添加放大缩小按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 03:52