March 2018
Beginner to intermediate
514 pages
13h 11m
English
Next comes the actual visualizing of the data using bars. It's important to have some basic understanding of how to use D3.js as, otherwise, this part will mean very little to you.
Firstly, we define the bar's variable by selecting the canvas and possible rectangles, and then applying the updating dataset to it using the data() function:
//MasteringQSBarChart.js - scope.render() (snippet)//Bar Width scope.bar_width = scope.width/scope.bars.length*0.8;//Visualize Bars var bars = scope.svg.select('.canvas') .selectAll('rect') .data(scope.data)
Now it's time to enter the data and append the rect SVG elements to the canvas, and apply the settings and stylings of the bars based on their underlying data:
//MasteringQSBarChart.js ...
Read now
Unlock full access