Reputation: 11
demo is here:a d3-cartogram demo
It gets data from a .csv file . how could I use data from MySQL or static data in HTML File?
I tried some ways but didn't work.
Upvotes: 1
Views: 80
Reputation: 16516
Put the data in JS, HTML or anywhere and pass it to a selection's data() function like so:
d3.selectAll('#mydiv')
.data([1, 2, 3])
.enter()
.append('div')
The array here could as well be passed as argument, fetched from a hidden html element or you can render it directly into the JavaScript.
Upvotes: 1