I am trying to add a chart to my website using d3plus.js. I get the following error message:
Uncaught TypeError: Cannot read property 'buttons' of null
at SVGGElement.<anonymous> (d3plus.js:23745)
at SVGGElement.__onmousemove (d3.js:1120)
I have tried placing the script to the beginning of the page and to after the footer too.
**head.php**
<script src="../wp-content/themes/sage/bower_components/d3/d3.js"> </script>
<script src="../wp-content/themes/sage/bower_components/d3plus/d3plus.js"></script>
**page.php**
<div id="viz" width="1356" height="579"></div>
<script>
var data = [
{"year": 1991, "name":"alpha", "value": 15},
{"year": 1991, "name":"beta", "value": 10},
{"year": 1991, "name":"gamma", "value": 5},
{"year": 1991, "name":"delta", "value": 50},
{"year": 1992, "name":"alpha", "value": 20},
{"year": 1992, "name":"beta", "value": 10},
{"year": 1992, "name":"gamma", "value": 10},
{"year": 1992, "name":"delta", "value": 43},
{"year": 1993, "name":"alpha", "value": 30},
{"year": 1993, "name":"beta", "value": 40},
{"year": 1993, "name":"gamma", "value": 20},
{"year": 1993, "name":"delta", "value": 17},
{"year": 1994, "name":"alpha", "value": 60},
{"year": 1994, "name":"beta", "value": 60},
{"year": 1994, "name":"gamma", "value": 25},
{"year": 1994, "name":"delta", "value": 32}
]
var visualization = d3plus.viz()
.container("#viz")
.data(data)
.type("bar")
.id("name")
.height(300)
.width(1100)
.x("year")
.y("value")
.draw()
</script>
On mouseover, the label should appear on the chart, but I get the error message:
Uncaught TypeError: Cannot read property 'buttons' of null
at SVGGElement.<anonymous> (d3plus.js:23745)
at SVGGElement.__onmousemove (d3.js:1120)