I am trying to understand how to create a minimalistic example of a country map using d3.js and HTML5 canvas. I managed to implement the following code,
<html>
<head>
<title></title>
</head>
<body>
</body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script type="text/javascript">
// drawing a map in a canvas
var width = 960, height = 500;
var canvas = d3.select("body").append("canvas")
.attr("width", width)
.attr("height",height);
var context = canvas.node().getContext("2d");
var projection = d3.geo.mercator();
var path = d3.geo.path()
.projection(projection)
.context(context);
d3.json("tunisia.json", function(error, topology) {
canvas
.datum(topojson.object(topology, topology.objects.governorates))
.transition();
});
</script>
</html>
But, no results have shown in the browser and no error received in the console, could you please check. Also, is there any minimalistic example of US map with canvas in d3.js