javascript - Loading D3 JSON with data that has a multi-index (from Python multi-index Series) -


how can generate set of radar charts (one each store/department/role combination) below?

the javascript code i'm hacking around is:

var radars = d3.json("{% url 'api_fetch_month' id=store.id %}", function(error, data) {     if (error) throw error;      alert(json.parse(json.stringify(data )));     today=new date();      var elements = data.filter(function(d) {                     if (d[0]==today) {return d}                  })                 .map(function (e,i) {                     return {                         store: i[0],                         department: i[1],                         role: i[2],                         value: e.value                     };                 })     }); 

...and alert(json.parse(json.stringify(data ))); above returns following structure:

{"1514160000000":{                  "["new york","electronics","a","junior"]":-0.56489166                 ,"["new york","electronics","a","senior"]":0.3708967542                 ,"["new york","electronics","b","junior"]":0.1624985591                 ,"["new york","household","b","junior"]":-0.5320542944                 ,"["new york","household","b","senior"]":1.2438264269                 ,"["paris","electronics","b","junior"]":0.7407341691                 ,"["paris","electronics","b","senior"]":1.2866767014                 ,"["paris","household","b","senior"]":-1.0081989481                 ,"["paris","household","c","junior"]":0.0623007                 ,"["paris","household","c","senior"]":0.2202688673                 } ,"1514246400000":{                  "["new york","electronics","a","junior"]":-0.0438995686                 ,"["new york","electronics","a","senior"]":-1.1787308977                 ,"["new york","electronics","b","junior"]":0.1803050415                 ,"["new york","electronics","b","senior"]":0.9896253858                 ,"["new york","electronics","c","junior"]":-0.9389344253                 } ,...etc... } 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -