SlideShare a Scribd company logo
1 of 28
What is data visualisation?
Data visualization is the presentation of data in a graphical format.
Why you should visualize data?
● Visuals are processed faster by the brain
● Visuals are committed to long-term memory easier than text
● Visuals can reveal patterns, trends, changes, and correlations
● Visuals can help simplify complex information
● Visuals can often be more effective than words at changing people’s
minds
● Visuals help people see things that were not obvious to them before
History
The concept of using pictures to understand data has been around for
centuries, from maps and graphs in the 17th century to the invention of the
pie chart in the early 1800s.
Nowadays
● HTML
● SVG
● Canvas
Data-driven documents
D3 (or D3.js) is a JavaScript library for visualizing data using web standards. D3
helps you bring data to life using SVG, Canvas and HTML.
It was created by Mike Bostock. He now works at the New York Times who
sponsors his open source work.
D3 is good at
● being general purpose visualization library
● providing a way to map data to documents
● handling data transformation
● providing basic math and layout algorithms
Why D3?
You choose how to visualize
https://bl.ocks.org/kerryrodden/raw/7090426/
https://bl.ocks.org/curran/raw/a9555f8041f04a5cbfb53e6f5c53caae/
https://bl.ocks.org/mbostock/raw/4062045/
Instalation
● via NPM:
npm install d3-selection
● load directly from d3js.org:
<script src="https://d3js.org/d3-selection.v1.min.js"></script>
npm install d3
<script src="https://d3js.org/d3.v4.js"></script>
D3 vs jQuery
d3.json('foo.json',
function(err, data) { });
d3.select('#foo')
.style('background', '#000')
.attr('height', '500')
.on('click', function() {})
.append('div');
$.getJSON('foo.json',
function(data) { });
$('#foo')
.css('background', '#000')
.attr('width', '500')
.click(function() {})
.append($('<div></div>'));
What is SVG?
● SVG stands for Scalable Vector Graphics
● SVG is used to define vector-based graphics for the Web
● SVG defines the graphics in XML format
● SVG graphics do NOT lose any quality if they are zoomed or resized
● Every element and every attribute in SVG files can be animated
SVG Shapes
● Rectangle <rect>
● Circle <circle>
● Ellipse <ellipse>
● Line <line>
● Polyline <polyline>
● Polygon <polygon>
● Path <path>
● Text <text>
https://codepen.io/sahanr/pen/JrLEEY
Selections
Selections allow powerful data-driven transformation of the document object
model (DOM).
const block = d3.select('.container');
const rectangles = block.selectAll('rect');
https://codepen.io/sahanr/pen/aLYOQr
Selections
Difference
Only selectAll has special behavior regarding grouping; select preserves the
existing grouping. The select method differs because there is exactly one
element in the new selection for each element in the old selection. Thus,
select also propagates data from parent to child, whereas selectAll does not
(hence the need for a data-join)!
Modifying Elements
const svg = d3
.select('svg')
.attr('name', 'container') // add attribute
.classed('green', true); // add class
const paragraphs = svg
.selectAll('text')
.filter(':nth-child(even)')
.style('text-decoration', 'underline') // add styles
.text('new inner text'); // added text
https://codepen.io/sahanr/pen/yzKeqV
Creating element
The append and insert methods are wrappers on top of select, so they also
preserve grouping and propagate data.
const svg = d3
.select('svg')
.append('rect') // add new element
.attr('y', 30) // modify <rect> element
.attr('x', 0);
svg.select('text)
.remove(); // remove first text element
https://codepen.io/sahanr/pen/aLYmgG
Bound to data
The magic of D3 comes from the ability to use data and web page elements
together.
Elements can be selected and their appearance modified to reflect differences
in the data.
Data is not a property of the selection, but a property of its elements (__data__
property).
The data join
● pairs an object and an element;
● keeps track of new and old objects;
● lets you animate differences
between new & old.
d3.selectAll('text')
.data(data)
.enter()
.append('text');
Binding data
const block = d3.select('.container')
.selectAll('p') // an enmpty selection, looking for data
.data(['first', 'second', 'third']); // data, which would be bound to selection
block
.enter() // for every time that we see data, but we do not see an element
.append('p') // append an element
.text(function (d) {
return d;
}); // fill the element with text
https://codepen.io/sahanr/pen/NaMPdm
Binding data
Data is bound to elements one of several ways:
● Joined to groups of elements via selection.data
● Assigned to individual elements via selection.datum
● Inherited from a parent via append, insert, or select
Loading data
d3-request
This module provides a convenient alternative to XMLHttpRequest.
d3.text("/path/to/file.txt", function(error, text) {
if (error) throw error;
console.log(text); // Hello, world!
});
d3.json()
d3.tsv()
d3.csv()
d3.xml()
d3.html()
svg output
https://codepen.io/sahanr/pen/KXopZZ?editors=0010
Scale
Scales are a convenient abstraction for a fundamental task in visualization:
mapping a dimension of abstract data to a visual representation.
Scale
var scores = [96, 74, 88, 65, 82 ];
const xScale = d3.scaleLinear()
.domain([0, d3.max(scores)]) -----> value range of the dataset
.range([0, 300]); ----------------> value range for the visualized graph
newItemGroup
.append('rect')
.attr('class', 'bar')
.attr('width', (d) => xScale(d))
.attr('height', barHeight - 5);
https://codepen.io/sahanr/pen/YraXeP
Scale types
● linear - https://codepen.io/sahanr/pen/MEVbRP
● time - https://codepen.io/sahanr/pen/wrmobr
● sequential- https://codepen.io/sahanr/pen/oGyrNV
● quantize- https://codepen.io/sahanr/pen/gGeLNm
● ordinal - https://codepen.io/sahanr/pen/BwrQgd
Handling events
We can bind an event listener to any DOM element using d3.selection.on()
method.
https://codepen.io/sahanr/pen/mBxJxP
Links
https://bost.ocks.org/mike/join/ - Thinking with Joins,
https://bost.ocks.org/mike/circles/ - Three Little Circles,
https://bost.ocks.org/mike/selection/ - How Selections Work,
https://github.com/d3 - D3 docs
To be continued...

More Related Content

What's hot

What's hot (10)

UMLtoNoSQL : From UML domain models to NoSQL Databases
UMLtoNoSQL : From UML domain models to NoSQL DatabasesUMLtoNoSQL : From UML domain models to NoSQL Databases
UMLtoNoSQL : From UML domain models to NoSQL Databases
 
Advanced D3 Charting
Advanced D3 ChartingAdvanced D3 Charting
Advanced D3 Charting
 
Exploring Large Chemical Data Sets
Exploring Large Chemical Data SetsExploring Large Chemical Data Sets
Exploring Large Chemical Data Sets
 
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
NOSQL IMPLEMENTATION OF A CONCEPTUAL DATA MODEL: UML CLASS DIAGRAM TO A DOCUM...
 
D3 data visualization
D3 data visualizationD3 data visualization
D3 data visualization
 
Adding new type to Druid
Adding new type to DruidAdding new type to Druid
Adding new type to Druid
 
A Quick and Dirty D3.js Tutorial
A Quick and Dirty D3.js TutorialA Quick and Dirty D3.js Tutorial
A Quick and Dirty D3.js Tutorial
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
The GetLOD Story
The GetLOD StoryThe GetLOD Story
The GetLOD Story
 
Data base
Data baseData base
Data base
 

Similar to Academy PRO: D3, part 1

Similar to Academy PRO: D3, part 1 (20)

Introduction to D3.js
Introduction to D3.jsIntroduction to D3.js
Introduction to D3.js
 
chapter 6 data visualization ppt.pptx
chapter 6 data visualization ppt.pptxchapter 6 data visualization ppt.pptx
chapter 6 data visualization ppt.pptx
 
D3 Mapping Visualization
D3 Mapping VisualizationD3 Mapping Visualization
D3 Mapping Visualization
 
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
 
D3 & MeteorJS
D3 & MeteorJSD3 & MeteorJS
D3 & MeteorJS
 
D3 & MeteorJS
D3 & MeteorJSD3 & MeteorJS
D3 & MeteorJS
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talk
 
The D3 Toolbox
The D3 ToolboxThe D3 Toolbox
The D3 Toolbox
 
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
Html5
Html5Html5
Html5
 
Html5
Html5Html5
Html5
 
Autodesk civil3 d_tutorail
Autodesk civil3 d_tutorailAutodesk civil3 d_tutorail
Autodesk civil3 d_tutorail
 
Datascape Introduction
Datascape IntroductionDatascape Introduction
Datascape Introduction
 
Sharing Data Between Angular Components
Sharing Data Between Angular ComponentsSharing Data Between Angular Components
Sharing Data Between Angular Components
 
Charlotte Front End - D3
Charlotte Front End - D3Charlotte Front End - D3
Charlotte Front End - D3
 
Sebastian Hellmann
Sebastian HellmannSebastian Hellmann
Sebastian Hellmann
 
A Modern Interface for Data Science on Postgres/Greenplum - Greenplum Summit ...
A Modern Interface for Data Science on Postgres/Greenplum - Greenplum Summit ...A Modern Interface for Data Science on Postgres/Greenplum - Greenplum Summit ...
A Modern Interface for Data Science on Postgres/Greenplum - Greenplum Summit ...
 
Data Visualizations with D3.js
Data Visualizations with D3.jsData Visualizations with D3.js
Data Visualizations with D3.js
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web Apps
 

More from Binary Studio

More from Binary Studio (20)

Academy PRO: D3, part 3
Academy PRO: D3, part 3Academy PRO: D3, part 3
Academy PRO: D3, part 3
 
Academy PRO: Cryptography 3
Academy PRO: Cryptography 3Academy PRO: Cryptography 3
Academy PRO: Cryptography 3
 
Academy PRO: Cryptography 1
Academy PRO: Cryptography 1Academy PRO: Cryptography 1
Academy PRO: Cryptography 1
 
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobXAcademy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobX
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - OrderlyBinary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - Orderly
 
Binary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - UnicornBinary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - Unicorn
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneous
 
Academy PRO: React native - publish
Academy PRO: React native - publishAcademy PRO: React native - publish
Academy PRO: React native - publish
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigation
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenes
 
Academy PRO: React Native - introduction
Academy PRO: React Native - introductionAcademy PRO: React Native - introduction
Academy PRO: React Native - introduction
 
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis BeketskyAcademy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis Beketsky
 
Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 4Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 4
 
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
 
Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1
 
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 

Recently uploaded (20)

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 

Academy PRO: D3, part 1

  • 1.
  • 2. What is data visualisation? Data visualization is the presentation of data in a graphical format.
  • 3. Why you should visualize data? ● Visuals are processed faster by the brain ● Visuals are committed to long-term memory easier than text ● Visuals can reveal patterns, trends, changes, and correlations ● Visuals can help simplify complex information ● Visuals can often be more effective than words at changing people’s minds ● Visuals help people see things that were not obvious to them before
  • 4. History The concept of using pictures to understand data has been around for centuries, from maps and graphs in the 17th century to the invention of the pie chart in the early 1800s.
  • 6. Data-driven documents D3 (or D3.js) is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML. It was created by Mike Bostock. He now works at the New York Times who sponsors his open source work.
  • 7. D3 is good at ● being general purpose visualization library ● providing a way to map data to documents ● handling data transformation ● providing basic math and layout algorithms
  • 8. Why D3? You choose how to visualize https://bl.ocks.org/kerryrodden/raw/7090426/ https://bl.ocks.org/curran/raw/a9555f8041f04a5cbfb53e6f5c53caae/ https://bl.ocks.org/mbostock/raw/4062045/
  • 9. Instalation ● via NPM: npm install d3-selection ● load directly from d3js.org: <script src="https://d3js.org/d3-selection.v1.min.js"></script> npm install d3 <script src="https://d3js.org/d3.v4.js"></script>
  • 10. D3 vs jQuery d3.json('foo.json', function(err, data) { }); d3.select('#foo') .style('background', '#000') .attr('height', '500') .on('click', function() {}) .append('div'); $.getJSON('foo.json', function(data) { }); $('#foo') .css('background', '#000') .attr('width', '500') .click(function() {}) .append($('<div></div>'));
  • 11. What is SVG? ● SVG stands for Scalable Vector Graphics ● SVG is used to define vector-based graphics for the Web ● SVG defines the graphics in XML format ● SVG graphics do NOT lose any quality if they are zoomed or resized ● Every element and every attribute in SVG files can be animated
  • 12. SVG Shapes ● Rectangle <rect> ● Circle <circle> ● Ellipse <ellipse> ● Line <line> ● Polyline <polyline> ● Polygon <polygon> ● Path <path> ● Text <text> https://codepen.io/sahanr/pen/JrLEEY
  • 13. Selections Selections allow powerful data-driven transformation of the document object model (DOM). const block = d3.select('.container'); const rectangles = block.selectAll('rect'); https://codepen.io/sahanr/pen/aLYOQr Selections
  • 14. Difference Only selectAll has special behavior regarding grouping; select preserves the existing grouping. The select method differs because there is exactly one element in the new selection for each element in the old selection. Thus, select also propagates data from parent to child, whereas selectAll does not (hence the need for a data-join)!
  • 15. Modifying Elements const svg = d3 .select('svg') .attr('name', 'container') // add attribute .classed('green', true); // add class const paragraphs = svg .selectAll('text') .filter(':nth-child(even)') .style('text-decoration', 'underline') // add styles .text('new inner text'); // added text https://codepen.io/sahanr/pen/yzKeqV
  • 16. Creating element The append and insert methods are wrappers on top of select, so they also preserve grouping and propagate data. const svg = d3 .select('svg') .append('rect') // add new element .attr('y', 30) // modify <rect> element .attr('x', 0); svg.select('text) .remove(); // remove first text element https://codepen.io/sahanr/pen/aLYmgG
  • 17. Bound to data The magic of D3 comes from the ability to use data and web page elements together. Elements can be selected and their appearance modified to reflect differences in the data. Data is not a property of the selection, but a property of its elements (__data__ property).
  • 18. The data join ● pairs an object and an element; ● keeps track of new and old objects; ● lets you animate differences between new & old. d3.selectAll('text') .data(data) .enter() .append('text');
  • 19. Binding data const block = d3.select('.container') .selectAll('p') // an enmpty selection, looking for data .data(['first', 'second', 'third']); // data, which would be bound to selection block .enter() // for every time that we see data, but we do not see an element .append('p') // append an element .text(function (d) { return d; }); // fill the element with text https://codepen.io/sahanr/pen/NaMPdm
  • 20. Binding data Data is bound to elements one of several ways: ● Joined to groups of elements via selection.data ● Assigned to individual elements via selection.datum ● Inherited from a parent via append, insert, or select
  • 21. Loading data d3-request This module provides a convenient alternative to XMLHttpRequest. d3.text("/path/to/file.txt", function(error, text) { if (error) throw error; console.log(text); // Hello, world! }); d3.json() d3.tsv() d3.csv() d3.xml() d3.html()
  • 23. Scale Scales are a convenient abstraction for a fundamental task in visualization: mapping a dimension of abstract data to a visual representation.
  • 24. Scale var scores = [96, 74, 88, 65, 82 ]; const xScale = d3.scaleLinear() .domain([0, d3.max(scores)]) -----> value range of the dataset .range([0, 300]); ----------------> value range for the visualized graph newItemGroup .append('rect') .attr('class', 'bar') .attr('width', (d) => xScale(d)) .attr('height', barHeight - 5); https://codepen.io/sahanr/pen/YraXeP
  • 25. Scale types ● linear - https://codepen.io/sahanr/pen/MEVbRP ● time - https://codepen.io/sahanr/pen/wrmobr ● sequential- https://codepen.io/sahanr/pen/oGyrNV ● quantize- https://codepen.io/sahanr/pen/gGeLNm ● ordinal - https://codepen.io/sahanr/pen/BwrQgd
  • 26. Handling events We can bind an event listener to any DOM element using d3.selection.on() method. https://codepen.io/sahanr/pen/mBxJxP
  • 27. Links https://bost.ocks.org/mike/join/ - Thinking with Joins, https://bost.ocks.org/mike/circles/ - Three Little Circles, https://bost.ocks.org/mike/selection/ - How Selections Work, https://github.com/d3 - D3 docs

Editor's Notes

  1. dependency
  2. select, selectAll, null, parentNode, filter, function(d,i,n) empty, node, nodes, size
  3. property, html second parameter null
  4. what is data
  5. Instead of telling D3 how to do something, tell D3 what you want. why? how it works? perfomance
  6. key
  7. request, header, send, error, load
  8. add margins
  9. power, log, sqrt, identity Utc
  10. event, mouse, touch