1

I use this eample link to customize.There are json array and create bar charts according to array.

Please guide me, this is my json format:

{ "server1": [
    {
      "mount": "test1",
      "value": 207
    },
    {
      "mount": "test2",
      "value": 20.07
    }
  ],

  "server2": [
    {
      "mount": "test1",
      "value": 45
    },
    {
      "mount": "test2",
      "value": 0.04
    }
  ]
}

I want to create 2 separate bar chart.

3 Answers 3

2

you can use loop for this

$.getJSON("./data/new.json", function(data){

for(i in data){

alert(i);

data1 = data[i]; after looping using your example this way link

Sign up to request clarification or add additional context in comments.

Comments

1

pass value like data array and loop it!

d3.json("./data/new.json", function(error,data1){

for(r in data1){

like this you can implement this

Comments

0

Convert this json to two list using javascript or jquery whichever you like

t1 = [207, 45]

t2 = [20.07, 0.04]

now replace data (d) in the http://bl.ocks.org/mbostock/3885304 with t1 for graph 1 and with t2 for graph 2 it will work for sure

1 Comment

can you give more detail for this?? i mean cord example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.