Reputation: 497
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="d3/d3.min.js"></script>
</head>
<body>
<script type="text/javascript">
var dataA=[10,20];
d3.select("body").style("background-color", "green");
var canvas = d3.select("body")
.append("svg")
.attr("width",500)
.attr("height",500);
var bars = canvas.selectAll("rect")
.data(dataA)
.enter()
.append("rect")
.attr("width",function (d){ return d*5;})
.attr("height",10)
.attr("y",function(d,i){ return i*20;});
</script>
</body>
This is the code I used for drawing a bar char in d3. how can I use node.js to do the same chart?
Upvotes: 1
Views: 2014
Reputation: 1688
The question is not clear enough, whether you want to just use node or node as a server and a client code. But still, you can go ahead with the two use cases given below.
You can keep your D3 code as it is. But, if you want to play with dynamic data being sent from the server, just have a look at full fledged MEAN framework.
Upvotes: 1