0

I'm currently looking at the following example https://bl.ocks.org/mbostock/7607999. The json file which the chart is getting its data from is in the following format {"name":"flare.analytics.cluster.MergeEdge","size":743,"imports":[]}];

Instead of the above format, is it possible to have it as

{"imports":[],"name":"flare.analytics.cluster.MergeEdge","size":743};

Many thanks in advance for taking the time to read this.

user3837019
  • 211
  • 1
  • 2
  • 16
  • The order of the keys is meaningless, so the 2 examples you provided are equivalent. What matters is the order in which you read those keys, not how they appear. If you're relying on a `for(var key in object) {...}` loop to read the keys — and that's the order you want to control — there's no way to do that and guarantee the same order in all browsers/platforms. [See more here](http://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order) – meetamit Jun 27 '16 at 17:19

1 Answers1

0

Basically, D3.js get json data via your obj.name, so that's no matter how your json data sorting, I try a demo modify

{"name":"flare.vis.data.render.ArrowType", "size":698,"imports":[]}

to

{"size":698,"imports":[],"name":"flare.vis.data.render.ArrowType"}

and the graph still show out the same.

Horken
  • 560
  • 5
  • 16