Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to make a graduated panel stretch to full width of the diagram?

$
0
0

@Lucian wrote:

Hello,

I am trying to make a graduated panel extend to the full width of the diagram, which is resized together with the window. I used the thermometer and the rulers examples and I am binding the width of the line to the width of the node and I am updating the width of the node at ViewportBoundsChanged with setDataProperty(node, ‘width’, vb.width).

My node template is this:

$(go.Node, 'Graduated', {
        graduatedTickUnit: 10,
        pickable: false,
        layerName: 'Foreground',
        isInDocumentBounds: false,
        isAnimated: false
    },
    $(go.Shape, { geometryString: 'M0 0 H1000' }, new go.Binding('width')),
    $(go.Shape, { geometryString: 'M0 0 V20', interval: 1 }),
    $(go.TextBlock, {
        font: '10px sans-serif',
        interval: 1,
        alignmentFocus: go.Spot.TopLeft,
        segmentOffset: new go.Point(1, 1),
        graduatedFunction: function(n) {
            const value = new Date(n * 100);

            return new Intl.DateTimeFormat(navigator.language, {
                    year: 'numeric',
                    month: 'numeric',
                    day: 'numeric'}).format(value)
                + '\n'
                + new Intl.DateTimeFormat(navigator.language, {
                    hour: 'numeric',
                    minute: 'numeric',
                    second: 'numeric'
                }).format(value);
        }
    })
);

Why does my node stay 1000px wide and doesn’t expand further than that?

Best,
Lucian

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles