dear mr.walter,
Greetings! iam trying to get below items,
alert(diagram.viewportBounds.center);
alert(diagram.grid.height);
it gives the answer as NaN and point(NaN,NaN).
pls tell me what is teh reason?
my full code is below:
function init() {
if (window.goSamples) goSamples(); // init for these samples – you don’t need to call this
var $ = go.GraphObject.make; // for conciseness in defining templates
diagram = $(go.Diagram, "myDiagramDiv", // create a Diagram for the DIV HTML element
{
"undoManager.isEnabled": true // enable undo & redo
});
alert(diagram.grid.height);
alert(diagram.viewportBounds.center);
diagram.nodeTemplate =
(go.Node, "Auto",
new go.Binding("visible","visible"),
(go.Shape, “RoundedRectangle”,
{ fill: “white” },
new go.Binding(“fill”, “color”)), // shape.fill = data.color
$(go.TextBlock,
{ margin: 5 },
new go.Binding(“text”, “txt”)),
{click: function(e,obj){changeName(obj)}} // textblock.text = data.key
);
diagram.linkTemplate =
(go.Link,
(go.Shape,
new go.Binding(“stroke”, “color”), // shape.stroke = data.color
new go.Binding(“strokeWidth”, “thick”)), // shape.strokeWidth = data.thick
$(go.Shape,
{ toArrow: “OpenTriangle”, fill: null },
new go.Binding(“stroke”, “color”), // shape.stroke = data.color
new go.Binding(“strokeWidth”, “thick”)) // shape.strokeWidth = data.thick
);
var nodeDataArray = [
{ txt: “Alpha”, color: “lightblue” },
{ txt: “Beta”, color: “pink” }
];
var linkDataArray = [
{ from: “Alpha”, to: “Beta”, color: “blue”, thick: 2 }
];
diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
}