Skip to main content

Posts

Showing posts from October, 2016

Brief Introduction to D3.js

This post is the short notes about D3.js (Data Driven Documents) framework, It is a JavaScript framework mainly used to generate charts using HTML, DOM, Canvas and SVG. Reference: https://github.com/mbostock/d3/wiki/API-Reference Select, Append, Text: <script src="http://d3js.org/d3.v3.min.js"></script> <script> d3.select("body") .append("p") .style("color","red") .attr("allign","center") .text("Hello World"); </script> Basic SVG Shape: var canvas=d3.select("body") .append("svg") .attr("width",500) .attr("height",500); var circle = canvas.append("circle") .attr("cx",250) .attr("cy",250) .attr("r", 50) .attr("fill","red"); var rect = canvas.append("rect") .attr("width",100) .attr("heiht",59); var line = canvas.append(...