user5772908
user5772908

Reputation: 11

"Cartograms with d3 " how to use data from MySQL?

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

Answers (1)

Hugo G
Hugo G

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

Related Questions