When the diagram is scaled, the ruler becomes very small, what is the reason?
how do i solve this problem?
Thanks.
var gradScaleHoriz =
GO(go.Node, "Graduated",
{
graduatedTickUnit: 10, pickable: false, selectable: false, layerName: "Ruler",
isInDocumentBounds: false, isAnimated: false
},
GO(go.Shape, { geometryString: "M0 0 H400" }),
GO(go.Shape, { geometryString: "M0 0 V3", interval: 1 }),
GO(go.Shape, { geometryString: "M0 0 V15", interval: 5 }),
GO(go.TextBlock,
{
font: "10px sans-serif",
interval: 5,
alignmentFocus: go.Spot.TopLeft,
segmentOffset: new go.Point(0, 7)
}
)
);
var gradScaleVert =
GO(go.Node, "Graduated",
{
graduatedTickUnit: 10, pickable: false, selectable: false, layerName: "Ruler",
isInDocumentBounds: false, isAnimated: false
},
GO(go.Shape, { geometryString: "M0 0 V400" }),
GO(go.Shape, { geometryString: "M0 0 V3", interval: 1, alignmentFocus: go.Spot.Bottom }),
GO(go.Shape, { geometryString: "M0 0 V15", interval: 5, alignmentFocus: go.Spot.Bottom }),
GO(go.TextBlock,
{
font: "10px sans-serif",
segmentOrientation: go.Link.OrientOpposite,
interval: 5,
alignmentFocus: go.Spot.BottomLeft,
segmentOffset: new go.Point(0, -7)
}
)
);
function setupScalesAndIndicators() {
diagram.startTransaction("add scales");
updateScales();
// Add each node to the diagram
diagram.add(gradScaleHoriz);
diagram.add(gradScaleVert);
diagram.commitTransaction("add scales");
}
function updateScales() {
var vb = diagram.viewportBounds;
diagram.startTransaction("update scales");
gradScaleHoriz.location = new go.Point(vb.x, vb.y);
gradScaleHoriz.graduatedMin = vb.x;
gradScaleHoriz.graduatedMax = vb.x + vb.width;
gradScaleHoriz.elt(0).width = vb.width;
gradScaleVert.location = new go.Point(vb.x, vb.y);
gradScaleVert.graduatedMin = vb.y;
gradScaleVert.graduatedMax = vb.y + vb.height;
gradScaleVert.elt(0).height = vb.height;
diagram.commitTransaction("update scales");
}
diagram.addDiagramListener("InitialLayoutCompleted", setupScalesAndIndicators);
diagram.addDiagramListener("ViewportBoundsChanged", updateScales);
normal view
zoomed out image