I want to pull data from a json file into google bubble chart. I am using the PHP and ajax example on a node js server. The question is how should the json code look ? I have not found specific examples. Thanks in andvance
all google charts must be drawn using a google data table.
the general json format for a google data table can be found here...
Format of the Constructor's JavaScript Literal data Parameter
which consists of two arrays, cols
and rows
{
cols: [{id: 'A', label: 'NEW A', type: 'string'},
{id: 'B', label: 'B-label', type: 'number'},
{id: 'C', label: 'C-label', type: 'date'}
],
rows: [{c:[{v: 'a'},
{v: 1.0, f: 'One'},
{v: new Date(2008, 1, 28, 0, 31, 26), f: '2/28/08 12:31 AM'}
]},
{c:[{v: 'b'},
{v: 2.0, f: 'Two'},
{v: new Date(2008, 2, 30, 0, 31, 26), f: '3/30/08 12:31 AM'}
]},
{c:[{v: 'c'},
{v: 3.0, f: 'Three'},
{v: new Date(2008, 3, 30, 0, 31, 26), f: '4/30/08 12:31 AM'}
]}
],
p: {foo: 'hello', bar: 'world!'}
}
in rows
, each column may have a value ( v:
) and a formatted value ( f:
)
each chart has a specific Data Format ,
which describes the column types the chart expects.
for Bubble...
Column 0 - string - ID (name) of the bubble
Column 1 - number - X coordinate
Column 2 - number - Y coordinate
Column 3 (optional) - string or number - Color; A value that is mapped to an actual color on a gradient scale using thecolorAxis
option
Column 4 (optional) - number - Size; values in this column are mapped to actual pixel values using thesizeAxis
option
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.