javascript - Populate a pie chart dynamicaly with a range bar -
i need populate pie chart dynamicaly php script have.
my concept have range bar updates series according values contained each index in json. found pie graph looks that: http://codepen.io/kenfalcon/pen/ovkozb.
however think not implemented json.
i have example, 1 accepts 2 values default (value 1 , value 2). here http://codepen.io/jaybaz1/pen/blgfh
$.getjson('https://s3-us-west-2.amazonaws.com/s.cdpn.io/132755/gettabledata.json', function(data, response){ var jsonrowdata = data.responsedata[0].rowdata; $.each(jsonrowdata, function(i){ var $this = $(this); //save each column value seperate array commonality.arrays.complete_data.push([$this[1], $this[2]]); commonality.arrays.commonality.push(parsefloat($this[0])); var = parseint($this[1]), to2 = to.tofixed(2), = parseint($this[2]), from2 = from.tofixed(2); commonality.arrays.coverageto.push(to); commonality.arrays.coveragefrom.push(from); //set default array values commonality.value.commonality = commonality.arrays.commonality[0]; commonality.value.coverageto = commonality.arrays.coverageto[0]; commonality.value.coveragefrom = commonality.arrays.coveragefrom[0]; }); var = new rbm_init_commonality.piechart(commonality.arrays.div[0]); var b = new rbm_init_commonality.piechart(commonality.arrays.div[1]); update_graph(a, b); slider(a, b); });
this sample because uses json similar mine. in example, each row in json skiping index plot slice respective value.
then bar ranging 1 10, json this:
[ [ 1, 48, 52 ], [ 2, 49, 51 ], ... [ 10, 57, 43 ] ]
so this:
[ [ 1, 33, 33, 34 ], [ 2, 32,5, 32,5, 35 ], ... [ 10, 28,5, 28,5, 43 ] ]
should generate 3 slice graph.
tried samples highcharts, amcharts , others couldn't find solution. ps: i'm new javascript.
any idea?
thanks in advance.
Comments
Post a Comment