Using an associative array as data for D3

前端 未结 2 734
慢半拍i
慢半拍i 2021-02-12 11:50

I have a very simple D3 example that first reads data into an associative array, then displays it in a bar graph.

I can\'t seem to get anything to display using this met

2条回答
  •  面向向阳花
    2021-02-12 12:27

    You can use the functions d3.values or d3.entries to work directly with associative arrays. You simply need to take it into account in the functions that set attributes (e.g. function(d) { return d.value; }).

提交回复
热议问题