Changing default properties of a model


the graphlinksmodel gets a json as follows

{ “class”: “go.GraphLinksModel”,
“linkFromPortIdProperty”: “fromPort”,
“linkToPortIdProperty”: “toPort”,
“nodeDataArray”: [
{“category”:“Comment”, “loc”:“360 -10”, “text”:“Kookie Brittle”, “key”:-13},
{“key”:-1, “category”:“Start”, “loc”:“175 0”, “text”:“Start”},
{“key”:0, “loc”:“0 77”, “text”:“Preheat oven to 375 F”},
{“key”:1, “loc”:“175 100”, “text”:“In a bowl, blend: 1 cup margarine, 1.5 teaspoon vanilla, 1 teaspoon salt”},
{“key”:2, “loc”:“175 190”, “text”:“Gradually beat in 1 cup sugar and 2 cups sifted flour”},
{“key”:3, “loc”:“175 270”, “text”:“Mix in 6 oz (1 cup) Nestle’s Semi-Sweet Chocolate Morsels”},
{“key”:4, “loc”:“175 370”, “text”:“Press evenly into ungreased 15x10x1 pan”},
{“key”:5, “loc”:“352 85”, “text”:“Finely chop 1/2 cup of your choice of nuts”},
{“key”:6, “loc”:“175 440”, “text”:“Sprinkle nuts on top”},
{“key”:7, “loc”:“175 500”, “text”:“Bake for 25 minutes and let cool”},
{“key”:8, “loc”:“175 570”, “text”:“Cut into rectangular grid”},
{“key”:-2, “category”:“End”, “loc”:“175 640”, “text”:“Enjoy!”}
“linkDataArray”: [
{“from”:1, “to”:2, “fromPort”:“B”, “toPort”:“T”},
{“from”:2, “to”:3, “fromPort”:“B”, “toPort”:“T”},
{“from”:3, “to”:4, “fromPort”:“B”, “toPort”:“T”},
{“from”:4, “to”:6, “fromPort”:“B”, “toPort”:“T”},
{“from”:6, “to”:7, “fromPort”:“B”, “toPort”:“T”},
{“from”:7, “to”:8, “fromPort”:“B”, “toPort”:“T”},
{“from”:8, “to”:-2, “fromPort”:“B”, “toPort”:“T”},
{“from”:-1, “to”:0, “fromPort”:“B”, “toPort”:“T”},
{“from”:-1, “to”:1, “fromPort”:“B”, “toPort”:“T”},
{“from”:-1, “to”:5, “fromPort”:“B”, “toPort”:“T”},
{“from”:5, “to”:4, “fromPort”:“B”, “toPort”:“T”},
{“from”:0, “to”:4, “fromPort”:“B”, “toPort”:“T”}

is it possible to change “linkDataArray” to “mylinkDataArray” and “nodeDataArray” to “mynodeDataArray” , so that

i have read this from your intro page , still wanted to confirm

The node data and the link data in models can be any JavaScript object. You get to decide what properties those objects have – add as many as you need for your app.

how can i do this ? is this possible ?

No, one cannot change the names of the properties of the top-level JSON object. It would be really odd to want to rename properties like “linkToPortIdProperty” or “class”, and if we supported that, there would need to be some non-ambiguous mechanism by which GoJS would know which properties were which. So that could be very confusing, and I do not see what would be gained.

But within the node data or link data objects, yes, you can change which property names are used.

By the way, if you want to add your own persisted properties to the model that are not on individual node or link data objects but are shared by all nodes and links, add properties to the Model.modelData object.