SlideShare une entreprise Scribd logo
1  sur  19
D3.js
A picture is worth a thousand words
Why data visualization?
<- Because of that
But what do we GET?
{
“id” : 6,
“wall_id” : 55,
“resource_id” : 42,
“project_id” : 3,
“hours” : 3,
“intervals” : [
{
“start_date” : “2016-05-06” ,
“end_date” : “2016-05-08” ,
“booking_id” : 6
} ,
{
“start_date” : “2016-05-19” ,
“end_date” : “2016-05-19” ,
} ,
{
“start_date” : “2016-05-21” ,
“end_date” : “2016-05-24” ,
“booking_id” : 6
} ,
{
“start_date” : “2016-06-01” ,
“end_date” : “2016-10-25” ,
“booking_id” : 6
}
The two paths
The imperative one
For each of the element do…
Change width to 100px and then…
Rotate if rotate===true…
...
Then debug
The declarative one
I want the elements to be there
(I want an animation for the elements
that are not there)
I don’t give a …
how it all happens
D3 is...
Declarative approach
Data-oriented
Lots of built-in stuff
Basics of D3 - selection
JS
var selection = d3.select('#root')
.selectAll('span');
HTML
<div id="root">
</div>
● Looks a bit empty
Basics of D3 - enter, update, exit
JS
var updateSelection = d3.select('#root')
.selectAll('span');
.data([
'Lorem',
'Ipsum'
]);
updateSelection.enter().append('span');
updateSelection.text(el => el);
updateSelection.exit().remove();
HTML
<div id="root">
<span>Lorem</span>
<span>Ipsum</span>
</div>
Enter Exit
Data Elements
Update
Basics of D3 - complete render function
let render = function(data) {
let selection = d3.select('#root').selectAll('span');
let updateSelection = selection.data(data);
updateSelection.enter().append('span');
updateSelection.text(d => d);
updateSelection.exit().remove();
};
Components (codepen)
let spanComponent = function(selection) {
let updateSelection = selection.selectAll('span').data(data =>
data.lorem);
updateSelection.enter().append('span');
updateSelection.text(d => d + ' ');
updateSelection.exit().remove();
};
let render = function(data) {
let selection = d3.select('#root').selectAll('div');
let updateSelection = selection.data(data);
updateSelection.enter().append('div');
updateSelection.call(spanComponent);
updateSelection.exit().remove();
};
render([{lorem: ['foo', 'bar']}, {lorem: ['ipsum', 'dolor']}]);
Transitions (codepen)
let spanComponent = function(selection) {
let updateSelection = selection.selectAll('span').data(data =>
data.lorem);
updateSelection.enter().append('span')
.style('opacity', 0)
.transition()
.delay((d, i) => i * 400)
.duration(500)
.style('opacity', 1);
updateSelection
.text(d => d + ' ');
updateSelection.exit().remove();
};
Scales
let myLinearScale = d3.scale
.linear()
.domain([0, 10])
.range([0, 800]);
let x = myLinearScale(5);
console.log(x); // prints 400
Scales (2)
let myTimeScale = d3.time
.scale()
.domain([new Date('2016-01-01'), new Date('2017-01-01')])
.range([0, 800]);
let anyDate = new Date('2016-05-10');
let x = myTimeScale(anyDate);
myTimeScale.invert(x); // equals anyDate
SVG, Axes (codepen)
let svg = d3.select('#root').append('svg')
.attr("width", 300)
.attr("height", 300);
let x = d3.scale.linear()
.range([0, 300]);
let xAxis = d3.svg.axis()
.ticks(4)
.scale(x);
svg.append("g")
.attr("transform", "translate(0,100)")
.call(xAxis);
let line = d3.svg.line()
.x(d => d.x)
.y(d => d.y)
.interpolate('monotone');
svg.data([[ {x: x(0.1), y: 60}, {x: x(0.3), y: 20},
{x: x(0.5), y: 30}, {x: x(0.7), y: 10},
{x: x(0.9), y: 80} ]]);
svg.append("path")
.attr('fill', 'none')
.attr('stroke', '#000')
.attr("d", line);
Layouts
And much more
A lot of examples here: https://bl.ocks.org/mbostock
Thank you for your attention!
Tymoteusz Bleja
Junior Frontend Developer @ Apptension

Contenu connexe

Tendances

Making Games in JavaScript
Making Games in JavaScriptMaking Games in JavaScript
Making Games in JavaScriptSam Cartwright
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196Mahmoud Samir Fayed
 
Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.Michal Brys
 
D3 svg & angular
D3 svg & angularD3 svg & angular
D3 svg & angular500Tech
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31Mahmoud Samir Fayed
 
Михаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLМихаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLSergey Platonov
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without JavascriptPatrick Kettner
 
Ass day2 1_checkerboard...copy in cpp
Ass day2 1_checkerboard...copy in cppAss day2 1_checkerboard...copy in cpp
Ass day2 1_checkerboard...copy in cppRobi Parvez
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...iMasters
 
The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184Mahmoud Samir Fayed
 

Tendances (20)

Scrollytelling
ScrollytellingScrollytelling
Scrollytelling
 
Making Games in JavaScript
Making Games in JavaScriptMaking Games in JavaScript
Making Games in JavaScript
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
D3.js workshop
D3.js workshopD3.js workshop
D3.js workshop
 
The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196The Ring programming language version 1.7 book - Part 63 of 196
The Ring programming language version 1.7 book - Part 63 of 196
 
Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.
 
D3 svg & angular
D3 svg & angularD3 svg & angular
D3 svg & angular
 
MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
MongoDB Oplog入門
MongoDB Oplog入門MongoDB Oplog入門
MongoDB Oplog入門
 
D3
D3D3
D3
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
course js day 3
course js day 3course js day 3
course js day 3
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
Михаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLМихаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STL
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
 
Ass day2 1_checkerboard...copy in cpp
Ass day2 1_checkerboard...copy in cppAss day2 1_checkerboard...copy in cpp
Ass day2 1_checkerboard...copy in cpp
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
 
The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184
 

En vedette

Explore Data Distributions Using D3.js
Explore Data Distributions Using D3.jsExplore Data Distributions Using D3.js
Explore Data Distributions Using D3.jsSalesforce Developers
 
Testerzy na orbicie
Testerzy na orbicieTesterzy na orbicie
Testerzy na orbicieApptension
 
Narzędzia frontend developera A.D. 2015
Narzędzia frontend developera A.D. 2015Narzędzia frontend developera A.D. 2015
Narzędzia frontend developera A.D. 2015psmolenski
 
Universal Javascript in React
Universal Javascript in ReactUniversal Javascript in React
Universal Javascript in ReactApptension
 
D3 Basic Tutorial
D3 Basic TutorialD3 Basic Tutorial
D3 Basic TutorialTao Jiang
 
Team Happiness - O szczęściu w zespole
Team Happiness - O szczęściu w zespoleTeam Happiness - O szczęściu w zespole
Team Happiness - O szczęściu w zespoleApptension
 
AngularJS - podstawy
AngularJS - podstawyAngularJS - podstawy
AngularJS - podstawyApptension
 

En vedette (10)

Explore Data Distributions Using D3.js
Explore Data Distributions Using D3.jsExplore Data Distributions Using D3.js
Explore Data Distributions Using D3.js
 
Testerzy na orbicie
Testerzy na orbicieTesterzy na orbicie
Testerzy na orbicie
 
Narzędzia frontend developera A.D. 2015
Narzędzia frontend developera A.D. 2015Narzędzia frontend developera A.D. 2015
Narzędzia frontend developera A.D. 2015
 
Universal Javascript in React
Universal Javascript in ReactUniversal Javascript in React
Universal Javascript in React
 
D3 Basic Tutorial
D3 Basic TutorialD3 Basic Tutorial
D3 Basic Tutorial
 
D3.js mindblow
D3.js mindblowD3.js mindblow
D3.js mindblow
 
Team Happiness - O szczęściu w zespole
Team Happiness - O szczęściu w zespoleTeam Happiness - O szczęściu w zespole
Team Happiness - O szczęściu w zespole
 
D3 js
D3 jsD3 js
D3 js
 
White Space
White SpaceWhite Space
White Space
 
AngularJS - podstawy
AngularJS - podstawyAngularJS - podstawy
AngularJS - podstawy
 

Similaire à D3.js - A picture is worth a thousand words

Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutesJos Dirksen
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of usOSCON Byrum
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)Oswald Campesato
 
Dynamic Data Visualization With Chartkick
Dynamic Data Visualization With ChartkickDynamic Data Visualization With Chartkick
Dynamic Data Visualization With ChartkickDax Murray
 
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 AppsEPAM
 
Better d3 charts with tdd
Better d3 charts with tddBetter d3 charts with tdd
Better d3 charts with tddMarcos Iglesias
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...Sencha
 
What's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksWhat's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksGrgur Grisogono
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
Create Graph and Grid Using D3 Library
Create Graph and Grid Using D3 LibraryCreate Graph and Grid Using D3 Library
Create Graph and Grid Using D3 LibraryYanliang Bao (Beryl)
 
Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...Miguel González-Fierro
 

Similaire à D3.js - A picture is worth a thousand words (20)

Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
Dynamic Data Visualization With Chartkick
Dynamic Data Visualization With ChartkickDynamic Data Visualization With Chartkick
Dynamic Data Visualization With Chartkick
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
 
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
 
HTML5 - Pedro Rosa
HTML5 - Pedro RosaHTML5 - Pedro Rosa
HTML5 - Pedro Rosa
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
SVGD3Angular2React
SVGD3Angular2ReactSVGD3Angular2React
SVGD3Angular2React
 
Better d3 charts with tdd
Better d3 charts with tddBetter d3 charts with tdd
Better d3 charts with tdd
 
WebXR if X = how?
WebXR if X = how?WebXR if X = how?
WebXR if X = how?
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
What's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksWhat's Coming Next in Sencha Frameworks
What's Coming Next in Sencha Frameworks
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
NoSQL meets Microservices
NoSQL meets MicroservicesNoSQL meets Microservices
NoSQL meets Microservices
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
Create Graph and Grid Using D3 Library
Create Graph and Grid Using D3 LibraryCreate Graph and Grid Using D3 Library
Create Graph and Grid Using D3 Library
 
Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...
 

Dernier

Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Dernier (20)

Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

D3.js - A picture is worth a thousand words

  • 1. D3.js A picture is worth a thousand words
  • 2. Why data visualization? <- Because of that
  • 3. But what do we GET? { “id” : 6, “wall_id” : 55, “resource_id” : 42, “project_id” : 3, “hours” : 3, “intervals” : [ { “start_date” : “2016-05-06” , “end_date” : “2016-05-08” , “booking_id” : 6 } , { “start_date” : “2016-05-19” , “end_date” : “2016-05-19” , } , { “start_date” : “2016-05-21” , “end_date” : “2016-05-24” , “booking_id” : 6 } , { “start_date” : “2016-06-01” , “end_date” : “2016-10-25” , “booking_id” : 6 }
  • 5. The imperative one For each of the element do… Change width to 100px and then… Rotate if rotate===true… ... Then debug
  • 6. The declarative one I want the elements to be there (I want an animation for the elements that are not there) I don’t give a … how it all happens
  • 8. Basics of D3 - selection JS var selection = d3.select('#root') .selectAll('span'); HTML <div id="root"> </div> ● Looks a bit empty
  • 9. Basics of D3 - enter, update, exit JS var updateSelection = d3.select('#root') .selectAll('span'); .data([ 'Lorem', 'Ipsum' ]); updateSelection.enter().append('span'); updateSelection.text(el => el); updateSelection.exit().remove(); HTML <div id="root"> <span>Lorem</span> <span>Ipsum</span> </div>
  • 11. Basics of D3 - complete render function let render = function(data) { let selection = d3.select('#root').selectAll('span'); let updateSelection = selection.data(data); updateSelection.enter().append('span'); updateSelection.text(d => d); updateSelection.exit().remove(); };
  • 12. Components (codepen) let spanComponent = function(selection) { let updateSelection = selection.selectAll('span').data(data => data.lorem); updateSelection.enter().append('span'); updateSelection.text(d => d + ' '); updateSelection.exit().remove(); }; let render = function(data) { let selection = d3.select('#root').selectAll('div'); let updateSelection = selection.data(data); updateSelection.enter().append('div'); updateSelection.call(spanComponent); updateSelection.exit().remove(); }; render([{lorem: ['foo', 'bar']}, {lorem: ['ipsum', 'dolor']}]);
  • 13. Transitions (codepen) let spanComponent = function(selection) { let updateSelection = selection.selectAll('span').data(data => data.lorem); updateSelection.enter().append('span') .style('opacity', 0) .transition() .delay((d, i) => i * 400) .duration(500) .style('opacity', 1); updateSelection .text(d => d + ' '); updateSelection.exit().remove(); };
  • 14. Scales let myLinearScale = d3.scale .linear() .domain([0, 10]) .range([0, 800]); let x = myLinearScale(5); console.log(x); // prints 400
  • 15. Scales (2) let myTimeScale = d3.time .scale() .domain([new Date('2016-01-01'), new Date('2017-01-01')]) .range([0, 800]); let anyDate = new Date('2016-05-10'); let x = myTimeScale(anyDate); myTimeScale.invert(x); // equals anyDate
  • 16. SVG, Axes (codepen) let svg = d3.select('#root').append('svg') .attr("width", 300) .attr("height", 300); let x = d3.scale.linear() .range([0, 300]); let xAxis = d3.svg.axis() .ticks(4) .scale(x); svg.append("g") .attr("transform", "translate(0,100)") .call(xAxis); let line = d3.svg.line() .x(d => d.x) .y(d => d.y) .interpolate('monotone'); svg.data([[ {x: x(0.1), y: 60}, {x: x(0.3), y: 20}, {x: x(0.5), y: 30}, {x: x(0.7), y: 10}, {x: x(0.9), y: 80} ]]); svg.append("path") .attr('fill', 'none') .attr('stroke', '#000') .attr("d", line);
  • 18. And much more A lot of examples here: https://bl.ocks.org/mbostock
  • 19. Thank you for your attention! Tymoteusz Bleja Junior Frontend Developer @ Apptension