2016-04-04 16 views
1

条件(具体的には変数の値)に基づいてgo.Shapeを表示するにはどうすればよいですか?例えばGoJS表示形状の条件

go$(go.Shape, "Rectangle", 
{ height: diagram.width, strokeWidth: 0.5 }, 
new go.Binding("fill", "color"), 
new go.Binding("width", "span", function (w) { return ScaleSegmentWidth(w); }) 

「スパン」はdata.spanと仮定すると0

+0

templateMapsを使用するhttp://gojs.net/latest/intro/templat eMaps.html – Sachink

答えて

2

ある場合、私は、この形状を表示したくない数です:

ところで
new go.Binding("visible", "span", function(span) { return span !== 0; }) 

、マイナーな改善かもしれません引数が1つしかない場合は、他のバインディングでも可能です。

new go.Binding("width", "span", ScaleSegmentWidth) 
関連する問題