SlideShare a Scribd company logo
1 of 34
Download to read offline
React with D3:
Who’s in control?
By Ridhwana Khan
@Ridhwana_K
@Ridhwana_K
Ridhwana Khan
Senior Software Engineer at DEV
Co-Founder and Director of Kasi Maths
South African
@Ridhwana_K
What people think South
Africa looks like ...
@Ridhwana_K
Well, only sometimes ...
@Ridhwana_K
What Johannesburg
looks like ...
@Ridhwana_K
What Cape Town looks
like ...
@Ridhwana_K
What Cape Town looks
like ...
@Ridhwana_K
Agenda
❖ What makes the topic special & why am I talking about it?
❖ What is D3?
❖ Refresher on how does D3 work?
❖ Why is it daunting to use D3 & React together?
❖ Use cases and options for integration
❖ Recap
❖ Conclusion
@Ridhwana_K
Why am I talking about this?
@Ridhwana_K
@Ridhwana_K
What is D3?
@Ridhwana_K
“D3.js is a JavaScript library for manipulating documents based on
data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s
emphasis on web standards gives you the full capabilities of modern
browsers without tying yourself to a proprietary framework,
combining powerful visualization components and a data-driven
approach to DOM manipulation.”
@Ridhwana_K
Why do developers use D3?
❖ Robust
❖ Works efficiently with large data sets
❖ Gives complete control to build custom visualizations
❖ Re-use of code and functions across charts
Examples can be found here: https://observablehq.com/@d3/gallery
@Ridhwana_K
How does D3 work?
@Ridhwana_K
Domains
Ranges
SVG stuff?!?
Margins
Axes
D3 Methods
@Ridhwana_K
D3 Bar Chart
Coding Example
https://codepen.io/Ridhwana/pen/eYZdGPb
@Ridhwana_K
Scales
Linear ScaleInput Output
max: 10
min: 0
max: 800
min: 0
5 400
@Ridhwana_K
D3 Pie Chart
Coding Example
https://codepen.io/Ridhwana/pen/LYNbGJr
@Ridhwana_K
Why is it daunting to use D3 &
React together?
❖ Difficult to find combined relevant resources
❖ They both try to control the DOM
❖ React uses the virtual DOM whilst D3 uses actual DOM
@Ridhwana_K
What are my options ?
❖ D3 for rendering
❖ React for rendering
❖ D3 for updates; React for rendering elements
@Ridhwana_K
D3 for rendering:
React Refs
@Ridhwana_K
React & D3 Pie Chart
Coding Example
@Ridhwana_K
Evaluation
❖ Common approach
❖ Simple to convert d3 vanilla js example code to work within React
❖ Add transitions with D3 methods
❖ Use all the built in D3 functions
❖ Scales really well
❖ Going against the normal flow of a React application that controls the DOM
@Ridhwana_K
React for rendering:
React
Components
render calculations
D3
@Ridhwana_K
React & D3 Pie Chart
Coding Example
@Ridhwana_K
Evaluation
❖ Modular component approach
❖ Promotes reuse
❖ Readable and easy to follow code
❖ Continue within the React paradigm
❖ Not able to use D3 functions that access the DOM
❖ React plugin for transitions
@Ridhwana_K
React for rendering elements;
D3 for updates
Render elements
React
Components
Updates like
styles & attributes
D3
@Ridhwana_K
React & D3 Pie Chart
Coding Example
@Ridhwana_K
Evaluation
❖ Each library does what it's best at
❖ Interactivity
❖ Transitions easy to implement
❖ Confusing and difficult
❖ Possible scaling issues
@Ridhwana_K
Recap
@Ridhwana_K
Option D3 for render React for render React for element
creation; D3 for updates
Advantages - Common approach
- Simple to convert d3
vanilla js example code to
work within React
- Add transitions with D3
methods
- Use built in D3 functions
- Scales really well
- Modular component
approach
- Promotes reuse
- Readable and easy to
follow code
- Continue within the
React paradigm
- Each library does what
it's best at
- Interactivity
- Transitions easy to
implement
Disadvantages - Going against the normal
flow of a React application
that controls the DOM
- Not able to use D3
functions that access
the DOM
- React plugin for
transitions
- Confusing and difficult
- Possible scaling issues
@Ridhwana_K
Conclusion
@Ridhwana_K
Resources
● http://slides.com/shirleywu/deck#/4/0/2
● https://nicolashery.com/integrating-d3js-visualizations-in-a-react-app/
● https://www.createwithdata.com/integrating-react-and-d3
● https://medium.com/localmed-engineering/svg-pie-chart-using-react-and-
d3-43a381ce7246
● https://dev.to/julienassouline/let-s-get-started-with-react-and-d3-2nd7
● https://medium.com/shidanqing/build-a-dashboard-application-with-react-
d3-6ba4f46b876b
@Ridhwana_K
@Ridhwana_K

More Related Content

Similar to React with D3 - who’s in control?

Similar to React with D3 - who’s in control? (20)

Microservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learnedMicroservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learned
 
Informatica + Hadoop = Best of Both Worlds
Informatica + Hadoop = Best of Both WorldsInformatica + Hadoop = Best of Both Worlds
Informatica + Hadoop = Best of Both Worlds
 
React and d3
React and d3React and d3
React and d3
 
You’ve Only Got Two Eyeballs: Designing Products for the Responsive Web
You’ve Only Got Two Eyeballs: Designing Products for the Responsive WebYou’ve Only Got Two Eyeballs: Designing Products for the Responsive Web
You’ve Only Got Two Eyeballs: Designing Products for the Responsive Web
 
DeepaPrabhu_Resume
DeepaPrabhu_ResumeDeepaPrabhu_Resume
DeepaPrabhu_Resume
 
R in Power BI
R in Power BIR in Power BI
R in Power BI
 
Ultimate Guide: PDF to DXF Conversion
Ultimate Guide: PDF to DXF Conversion Ultimate Guide: PDF to DXF Conversion
Ultimate Guide: PDF to DXF Conversion
 
How R Developers Can Build and Share Data and AI Applications that Scale with...
How R Developers Can Build and Share Data and AI Applications that Scale with...How R Developers Can Build and Share Data and AI Applications that Scale with...
How R Developers Can Build and Share Data and AI Applications that Scale with...
 
When Should We Use SharePoint OOTB, Add Third Party Products, Or Build Custom...
When Should We Use SharePoint OOTB, Add Third Party Products, Or Build Custom...When Should We Use SharePoint OOTB, Add Third Party Products, Or Build Custom...
When Should We Use SharePoint OOTB, Add Third Party Products, Or Build Custom...
 
TOPdesk Product Development - From Vision to Themes to Roadmap - TOPdesk on T...
TOPdesk Product Development - From Vision to Themes to Roadmap - TOPdesk on T...TOPdesk Product Development - From Vision to Themes to Roadmap - TOPdesk on T...
TOPdesk Product Development - From Vision to Themes to Roadmap - TOPdesk on T...
 
Data Engineering in LINE Fukuoka DataLabs: A Newcomer’s View
Data Engineering in LINE Fukuoka DataLabs: A Newcomer’s ViewData Engineering in LINE Fukuoka DataLabs: A Newcomer’s View
Data Engineering in LINE Fukuoka DataLabs: A Newcomer’s View
 
OrientDB - Perché le tue applicazioni meritano un DB Multi-Model
OrientDB - Perché le tue applicazioni meritano un DB Multi-ModelOrientDB - Perché le tue applicazioni meritano un DB Multi-Model
OrientDB - Perché le tue applicazioni meritano un DB Multi-Model
 
Intro to Node.js (German)
Intro to Node.js (German)Intro to Node.js (German)
Intro to Node.js (German)
 
From Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, LvivFrom Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, Lviv
 
Oracle APEX for Beginners
Oracle APEX for BeginnersOracle APEX for Beginners
Oracle APEX for Beginners
 
Building an Academic Program Database and API with Contentful and Amazon Web ...
Building an Academic Program Database and API with Contentful and Amazon Web ...Building an Academic Program Database and API with Contentful and Amazon Web ...
Building an Academic Program Database and API with Contentful and Amazon Web ...
 
GraphQL - hot or not? How to simplify API based services?
GraphQL - hot or not? How to simplify  API based services?GraphQL - hot or not? How to simplify  API based services?
GraphQL - hot or not? How to simplify API based services?
 
Building Data Quality pipelines with Apache Spark and Delta Lake
Building Data Quality pipelines with Apache Spark and Delta LakeBuilding Data Quality pipelines with Apache Spark and Delta Lake
Building Data Quality pipelines with Apache Spark and Delta Lake
 
React, D3 and the dataviz ecosystem
React, D3 and the dataviz ecosystemReact, D3 and the dataviz ecosystem
React, D3 and the dataviz ecosystem
 
SPS Toronto 2018 - Your first PowerApps in 30 minutes
SPS Toronto 2018 - Your first PowerApps in 30 minutesSPS Toronto 2018 - Your first PowerApps in 30 minutes
SPS Toronto 2018 - Your first PowerApps in 30 minutes
 

More from Ridhwana Khan

More from Ridhwana Khan (8)

EmberConf - Building Apps for African soil
EmberConf - Building Apps for African soilEmberConf - Building Apps for African soil
EmberConf - Building Apps for African soil
 
Teaching Digital Skills and STEM to Empower South African Students (Offerzen ...
Teaching Digital Skills and STEM to Empower South African Students (Offerzen ...Teaching Digital Skills and STEM to Empower South African Students (Offerzen ...
Teaching Digital Skills and STEM to Empower South African Students (Offerzen ...
 
From Strangers to Team Players (DevFest 2019)
From Strangers to Team Players (DevFest 2019)From Strangers to Team Players (DevFest 2019)
From Strangers to Team Players (DevFest 2019)
 
Problem Solving
Problem SolvingProblem Solving
Problem Solving
 
Expand your toolkit for self development (Keynote @ Pycon Balkan 2018)
Expand your toolkit for self  development (Keynote @ Pycon Balkan 2018)Expand your toolkit for self  development (Keynote @ Pycon Balkan 2018)
Expand your toolkit for self development (Keynote @ Pycon Balkan 2018)
 
Javascript under the hood
Javascript under the hoodJavascript under the hood
Javascript under the hood
 
LinkedIn final presentation
LinkedIn final presentationLinkedIn final presentation
LinkedIn final presentation
 
Ruby fuza
Ruby fuzaRuby fuza
Ruby fuza
 

Recently uploaded

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Marc Lester
 

Recently uploaded (20)

GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdfThe Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
 
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
Sourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing ManufacturerSourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing Manufacturer
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Jax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined DeckJax, FL Admin Community Group 05.14.2024 Combined Deck
Jax, FL Admin Community Group 05.14.2024 Combined Deck
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 

React with D3 - who’s in control?