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
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; }
).
I found that in order for bar chart generation to work well, the following format works best. It's based on the the D3 post-parsed CSV format.
var dataSet1 = [
{xCoordinate: "Legend String 1", magnitude: 54, link: "http://www.if4it.com"},
{xCoordinate: "Legend String 2", magnitude: 21, link: "http://www.if4it.com/glossary.html"},
{xCoordinate: "Legend String 3", magnitude: 31, link: "http://www.if4it.com/resources.html"},
{xCoordinate: "Legend String 4", magnitude: 14, link: "http://www.if4it.com/taxonomy.html"},
{xCoordinate: "Legend String 5", magnitude: 19, link: "http://www.if4it.com/disciplines.html"},
{xCoordinate: "Legend String 6", magnitude: 47, link: "http://www.if4it.com"},
{xCoordinate: "Legend String 7", magnitude: 27, link: "http://www.if4it.com/glossary.html"}];
The format allows for the correlation of coordinates, magnitudes, legends and html links to each other.
A working example can be found at: http://bl.ocks.org/2164562.