SlideShare a Scribd company logo
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

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
Jordi Cabot
 
Advanced D3 Charting
Advanced D3 ChartingAdvanced D3 Charting
Advanced D3 Charting
dcryan
 
Exploring Large Chemical Data Sets
Exploring Large Chemical Data SetsExploring Large Chemical Data Sets
Exploring Large Chemical Data Sets
kylelutz
 
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...
ijdms
 
D3 data visualization
D3 data visualizationD3 data visualization
D3 data visualization
Keenan Holloway
 
Adding new type to Druid
Adding new type to DruidAdding new type to Druid
Adding new type to Druid
Navis Ryu
 
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
Young-Ho Kim
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
Partnered Health
 
The GetLOD Story
The GetLOD StoryThe GetLOD Story
The GetLOD Story
Piergiorgio Cipriano
 
Data base
Data baseData base
Data base
bodabody
 

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

Introduction to D3.js
Introduction to D3.jsIntroduction to D3.js
Introduction to D3.js
Oleksii Prohonnyi
 
chapter 6 data visualization ppt.pptx
chapter 6 data visualization ppt.pptxchapter 6 data visualization ppt.pptx
chapter 6 data visualization ppt.pptx
sayalisonavane3
 
D3 Mapping Visualization
D3 Mapping VisualizationD3 Mapping Visualization
D3 Mapping Visualization
Sudhir Chowbina
 
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.)
Oleksii Prohonnyi
 
D3 & MeteorJS
D3 & MeteorJSD3 & MeteorJS
D3 & MeteorJS
saarmstrong
 
D3 & MeteorJS
D3 & MeteorJSD3 & MeteorJS
D3 & MeteorJS
saarmstrong
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talk
benosteen
 
The D3 Toolbox
The D3 ToolboxThe D3 Toolbox
The D3 Toolbox
Mark Rickerby
 
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
MoscowJS
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
Jos Dirksen
 
Html5
Html5Html5
Html5
prithag92
 
Html5
Html5Html5
Html5
prithag92
 
Autodesk civil3 d_tutorail
Autodesk civil3 d_tutorailAutodesk civil3 d_tutorail
Autodesk civil3 d_tutorail
Kushal Patel
 
Datascape Introduction
Datascape IntroductionDatascape Introduction
Datascape Introduction
Daden Limited
 
Sharing Data Between Angular Components
Sharing Data Between Angular ComponentsSharing Data Between Angular Components
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
Charlotte Front End - D3
Charlotte Front End - D3Charlotte Front End - D3
Charlotte Front End - D3
Brian Greig
 
Sebastian Hellmann
Sebastian HellmannSebastian Hellmann
Sebastian Hellmann
Connected Data World
 
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 ...
VMware Tanzu
 
Data Visualizations with D3.js
Data Visualizations with D3.jsData Visualizations with D3.js
Data Visualizations with D3.js
Brian Greig
 
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
EPAM
 

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

Academy PRO: D3, part 3
Academy PRO: D3, part 3Academy PRO: D3, part 3
Academy PRO: D3, part 3
Binary Studio
 
Academy PRO: Cryptography 3
Academy PRO: Cryptography 3Academy PRO: Cryptography 3
Academy PRO: Cryptography 3
Binary Studio
 
Academy PRO: Cryptography 1
Academy PRO: Cryptography 1Academy PRO: Cryptography 1
Academy PRO: Cryptography 1
Binary Studio
 
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobXAcademy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobX
Binary Studio
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
Binary Studio
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
Binary Studio
 
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
 
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
Binary Studio
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneous
Binary Studio
 
Academy PRO: React native - publish
Academy PRO: React native - publishAcademy PRO: React native - publish
Academy PRO: React native - publish
Binary Studio
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigation
Binary Studio
 
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
Binary Studio
 
Academy PRO: React Native - introduction
Academy PRO: React Native - introductionAcademy PRO: React Native - introduction
Academy PRO: React Native - introduction
Binary Studio
 
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis BeketskyAcademy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis Beketsky
Binary Studio
 
Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 4Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 4
Binary Studio
 
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3
Binary Studio
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
Binary Studio
 
Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1
Binary Studio
 
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
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

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 

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