Update readme on how to load JSON with attributes.
Hi, This is just a documentation update which I think Springy users may find helpful.
This just saves them a bit of time in reading the source.
Hey thanks! This is a feature I've been meaning to add for a while now. :)
I reckon this would be better as something built-in rather than asking users to patch a function in the readme. It looks like you're pretty close to getting it working already.
Yes, you are right. I thought of preserving the API. With the capability built-in I would need to extend the API -- say with a loadJSONRich command.
A new name is needed so that it does not disrupt the existing users of loadJSON.
Hmm, do you think it'd be possible to extend the existing loadJSON and still retain compatibility?
Currently nodes are expected to be passed as simple string ids, which makes passing extra metadata difficult. Perhaps nodes could be in an extended format?
e.g.
graph.loadJSON({
nodes: [
"a",
["b", { label: "B" }] // Maybe like this?
],
edges: [
["a", "b", { label: "ab" }], // I think this already works
]
});
Thanks for the insight -- yes, I think that could work... I'll do some experiments.
Added capability into springy.js and also updated README to reflect changes. Should be ready for merge -- but do remember to update the version number in the README.
Springy 1.2+ also accepts JSON with node attributes see [demo-json.html](http://dhotson.github.com/springy/demo-json.htm
I would rebase/squash commits and probably split JSON instructions into two parts.