rveciana - playing-with-spam-js

Playing with spam.js

Open raw page in new tab

Playing with spam.js

<!DOCTYPE html>
<meta charset="utf-8" /> 
<body>
<script src="d3.min.js"></script>
<script src="topojson.min.js"></script>
<script src="rbush.min.js"></script>
<script src="d3.geo.projection.min.js"></script>
<script src="spam.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-composite-projections/0.4.0/conicConformalSpain-proj.min.js"></script>

<script type='text/javascript'>
var graticule = d3.geo.graticule()

d3.json("https://cdn.rawgit.com/rveciana/5919944/raw//provincias.json", function(error, d) {
    topojson.presimplify(d)

    var map = new StaticCanvasMap({
        element: "body",
        width: 960,
        height: 500,
        projection: d3.geo.conicConformalSpain(),
        data: [{
                features: topojson.feature(d, d.objects["provincias"]),
                static: {
                    paintfeature: function(parameters, d) {
                        parameters.context.lineWidth = 0.5
                        parameters.context.strokeStyle = "#555"
                        parameters.context.stroke()

                        parameters.context.fillStyle = "#f4efec";
                        parameters.context.fill()
                    }
                }
            }
        ]
    })
    map.init()
})
</script>