如何防止图中不必要的滚动?

时间:2016-11-09 12:33:14

标签: javascript gojs

我有以下图表概述:

var $ = go.GraphObject.make;
var diagram =
      $(go.Diagram, element[0],{
            initialContentAlignment: go.Spot.TopCenter,
            initialScale: (pageBodyWidth > 500 ? 1 : 0.6),
            contentAlignment: go.Spot.TopCenter,
            layout: $(go.LayeredDigraphLayout, { direction: 0 }),
            isReadOnly: false,
            allowLink: true,
            allowClipboard: false,
            'animationManager.duration': 200,
            'undoManager.isEnabled': false
      });
var overview = $(go.Overview, 'diagramOverview', { observed: diagram });

在此之后,我看到一个图表,但有不必要的滚动,它存在于概述中: enter image description here

如何禁用此滚动?我想要一个固定的图表区域。

我也看到该图有一个额外的空间: enter image description here

这是什么空间?是否可以使用没有此空格的图表,例如http://gojs.net/latest/samples/orgChartStatic.html

1 个答案:

答案 0 :(得分:2)

在定义图表时尝试设置“allowHorizo​​ntalScroll:false”和“allowVerticalScroll:false”,这样它将变为: var $ = go.GraphObject.make; var diagram = $(go.Diagram, element[0],{ initialContentAlignment: go.Spot.TopCenter, initialScale: (pageBodyWidth > 500 ? 1 : 0.6), contentAlignment: go.Spot.TopCenter, layout: $(go.LayeredDigraphLayout, { direction: 0 }), isReadOnly: false, allowLink: true, allowClipboard: false, 'animationManager.duration': 200, 'undoManager.isEnabled': false, allowHorizontalScroll: false, allowVerticalScroll: false }); var overview = $(go.Overview, 'diagramOverview', { observed: diagram });