Skip to content
agershun edited this page Jan 11, 2015 · 7 revisions

#d3.js with Alasql

This is an example, how d3.js can read data from XLSX file and put it on the map:

    alasql('SELECT * FROM xlsx("https://cdn.rawgit.com/agershun/alasql-org/gh-pages/demo/014map/cities.xlsx",\
        {headers:true})',[], function(data) {
        g.selectAll("text")
        .data(data)
        .enter()
        .append('text')
        .text(function(d){return d.city})
        .attr("x", function(d) {
           return projection([d.lon, d.lat])[0];
        })
        .attr("y", function(d) {
           return projection([d.lon, d.lat])[1];
        })
   });

See the full code of this example in jsFiddle.

Clone this wiki locally