Posts

Showing posts from March, 2016

Getting started with data visualization using D3js

Introduction As per https://d3js.org/   D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. For example, you can use D3 to generate an HTML table from an array of numbers. Or, use the same data to create an interactive SVG bar chart with smooth transitions and interaction. Description Here we learn basic usage of D3js and then moved to different type of visualization chart. 1. How Selections works Modifying documents using the W3C DOM API is tedious For example, to change the text color of paragraph elements: var paragraphs = document.getElementsByTagName("p"); for (var i = 0; i < paragraphs.length; i++) { var paragraph = paragraphs.item(i); paragraph.style.setProperty("color", "white", null); } D3 uses new W3C Selectors API and supported natively by modern browsers. Elements may be selected using a variety of predicates, including containment, a