GoJS:如何将背景图像添加到图表
GoJS: How to add background image to diagram
如何向 GoJS 图表添加背景图片?
当我拖动或缩放图表时,背景图像应相应地移动和缩放。
背景图像也应该在关联的 Overview diagram 中可见。
有没有简单(或不太简单)的方法来实现这个?
如果你想让它移动和缩放等,那么只需将它添加为一个单独的部分,就像他们在 Floor Monitor 中所做的那样:
// the background image, a floor plan
myDiagram.add(
$(go.Part, // this Part is not bound to any model data
{ layerName: "Background", position: new go.Point(0, 0),
selectable: false, pickable: false },
$(go.Picture, "https://upload.wikimedia.org/wikipedia/commons/9/9a/Sample_Floorplan.jpg")
));
如何向 GoJS 图表添加背景图片? 当我拖动或缩放图表时,背景图像应相应地移动和缩放。
背景图像也应该在关联的 Overview diagram 中可见。
有没有简单(或不太简单)的方法来实现这个?
如果你想让它移动和缩放等,那么只需将它添加为一个单独的部分,就像他们在 Floor Monitor 中所做的那样:
// the background image, a floor plan
myDiagram.add(
$(go.Part, // this Part is not bound to any model data
{ layerName: "Background", position: new go.Point(0, 0),
selectable: false, pickable: false },
$(go.Picture, "https://upload.wikimedia.org/wikipedia/commons/9/9a/Sample_Floorplan.jpg")
));