SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
D3.JS
ibrary
script L
Java
Proverb:
“Sebuah gambar lebih berarti daripada
seribu kata”
Apa yang bisa disimpulkan dari dataset di bawah?
NOOOOOOO

PUSING
Bagaimana jika begini:
Seenggaknya:
'Lebih enak' dilihat dan dipandang

Bahkan:
Memberikan ide lebih
Itulah kenapa dibutuhkan

VISUALISASI DATA
VISUALISASI DATA
Proses PEMETAAN DATA ke dalam bentuk

VISUAL
Visualisasi Data,
menurut Ben Fry(Processing.js)
Acquire: Membaca data dari drive, file, etc...etc...
Parse: Pengelompokkan data (membuat terstruktur).
Filter: Menyaring data berdasarkan kriteria.
Mine: Melakukan perhitungan statistik/algoritmik.
Represent: Memilih model visual (bar, pie, etc...,etc...)

Refine: Dibuat lebih “menarik”
Interact: Tambahan “interaksi”
D3.JS
(animasi)
“POWER”
D3
DATA
DRIVEN
DOCUMENTS (dot)
JAVASCRIPT
D3.JS Memanfaatkan

HTML(5)
JAVASCRIPT
CSS(3)

SVG
Huh, SVG?

“SVG: Scalable Vector
Graphics.Format gambar
vektor berbasis XML untuk
grafis dua dimensi, yang
memiliki dukungan interaksi dan
animasi”
(Google-translated wiki)
HTML + SVG
Ingat bahwa SVG berbasis XML, jadi untuk
menambahkan elemen SVG, dapat digunakan

<TAG>
Menggambar elipse

<svg width="50" height="50">
<ellipse cx="25" cy="25" rx="15" ry="10" fill="red" />
</svg>
Set up
Penggunaan D3.JS:
<html>
<meta charset="utf-8">
<head>
<style>
</style>
</head>
<body>
<script src="d3.js"></script>
<script>
</script>
<div
</body>
</html>
Elemen DOM
Pembuatan elemen DOM baru.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script type="text/javascript" src="d3/d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
d3.select.(“boddy”).append(“p”).text(“Halo Dunia”);
</script>
</body>
</html>
Chaining Method
Syntax yang 'berantai'
d3.select("body").append("p").text("New paragraph!");

Pemanggilan method dilakukan bersambungan dengan
pemanggilan 'method' lainnya.
START
d3.select("body").append("p").text("New paragraph!");

Bagaimana jika 'rantai' terlalu panjang?
d3.select("body").append("svg").attr("width",200).attr("weight",20
0).selectAll("g").data(dataset).enter().append("ellipse").attr("cx
",function(d){return
d;}).attr("cy",40).attr("rx",10).attr("ry",10).attr("fill","red");
Chaining Method,con't
Membuat 'chain-less-look', lebih mudah untuk dibaca.
var svg = d3.select("body")
.append("svg")
.attr("width",200)
.attr("weight",200);
var dot = svg.selectAll("g")
.data(dataset)
.enter()
.append("ellipse")
.attr("cx",function(d){
return d;
})
.attr("cy",40)
.attr("rx",10)
.attr("ry",10)
.attr("fill","red");

sama

d3.select("body").append("svg").attr("width",200).attr("weight",20
0).selectAll("g").data(dataset).enter().append("ellipse").attr("cx
",function(d){return
d;}).attr("cy",40).attr("rx",10).attr("ry",10).attr("fill","red");
Binding data
Bagaimana 'mengikat' data, kemudian di-'visual'-kan
var dataset =[10,30,50,70,90];
var svg = d3.select("body")
.append("svg")
.attr("width",200)
.attr("weight",200);
svg.selectAll("g")
.data(dataset)
.enter()
.append("ellipse")
.attr("cx",function(d){
return d;
})
.attr("cy",40)
.attr("rx",10)
.attr("ry",10)
.attr("fill","red");

Syntax untuk mengikat data:

.data(dataset).enter()
Power of data()
data() akan melakukan iterasi pada setiap nilai pada
dataset, lalu akan mengeksekusi method - function(d).
.data(dataset).enter().append(“circle”).attr(“r”,function(d)

{retrun d;});

Jika diberikan 10 data:
var dataset = [1,2,3,4,5,6,7,8,9,10];

Akan mengiterasi setiap data
Jika diberikan:
Akan diiterasi
sebanyak:

n

x

n

x
Dasar Transisi
Untuk melakukan transisi, dapat menggunakan method transition()
var svg = d3.select("body")
.append("svg")
.attr("width",500)
.attr("height",200);
var dot = svg.append("circle")
.attr("cx","100")
.attr("cy","100")
.attr("r",20)
.attr("fill","red");
var transition = dot.transition()
.attr("cx","200")
.duration(2000);

duration() - lama transisi
delay() - delay transisi
D3.JS
Memanfaatkan SVG
Manipulasi DOM
Memiliki Chaining-Method
Data-driven – data()
Interaksi dan animasi
Terima Kasih

Más contenido relacionado

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

VISUALISASI DATA

  • 2. Proverb: “Sebuah gambar lebih berarti daripada seribu kata”
  • 3. Apa yang bisa disimpulkan dari dataset di bawah?
  • 6. Seenggaknya: 'Lebih enak' dilihat dan dipandang Bahkan: Memberikan ide lebih
  • 8. VISUALISASI DATA Proses PEMETAAN DATA ke dalam bentuk VISUAL
  • 9. Visualisasi Data, menurut Ben Fry(Processing.js) Acquire: Membaca data dari drive, file, etc...etc... Parse: Pengelompokkan data (membuat terstruktur). Filter: Menyaring data berdasarkan kriteria. Mine: Melakukan perhitungan statistik/algoritmik. Represent: Memilih model visual (bar, pie, etc...,etc...) Refine: Dibuat lebih “menarik” Interact: Tambahan “interaksi” D3.JS (animasi) “POWER”
  • 12. Huh, SVG? “SVG: Scalable Vector Graphics.Format gambar vektor berbasis XML untuk grafis dua dimensi, yang memiliki dukungan interaksi dan animasi” (Google-translated wiki)
  • 13. HTML + SVG Ingat bahwa SVG berbasis XML, jadi untuk menambahkan elemen SVG, dapat digunakan <TAG> Menggambar elipse <svg width="50" height="50"> <ellipse cx="25" cy="25" rx="15" ry="10" fill="red" /> </svg>
  • 14. Set up Penggunaan D3.JS: <html> <meta charset="utf-8"> <head> <style> </style> </head> <body> <script src="d3.js"></script> <script> </script> <div </body> </html>
  • 15. Elemen DOM Pembuatan elemen DOM baru. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3 Test</title> <script type="text/javascript" src="d3/d3.v3.js"></script> </head> <body> <script type="text/javascript"> d3.select.(“boddy”).append(“p”).text(“Halo Dunia”); </script> </body> </html>
  • 16. Chaining Method Syntax yang 'berantai' d3.select("body").append("p").text("New paragraph!"); Pemanggilan method dilakukan bersambungan dengan pemanggilan 'method' lainnya. START d3.select("body").append("p").text("New paragraph!"); Bagaimana jika 'rantai' terlalu panjang? d3.select("body").append("svg").attr("width",200).attr("weight",20 0).selectAll("g").data(dataset).enter().append("ellipse").attr("cx ",function(d){return d;}).attr("cy",40).attr("rx",10).attr("ry",10).attr("fill","red");
  • 17. Chaining Method,con't Membuat 'chain-less-look', lebih mudah untuk dibaca. var svg = d3.select("body") .append("svg") .attr("width",200) .attr("weight",200); var dot = svg.selectAll("g") .data(dataset) .enter() .append("ellipse") .attr("cx",function(d){ return d; }) .attr("cy",40) .attr("rx",10) .attr("ry",10) .attr("fill","red"); sama d3.select("body").append("svg").attr("width",200).attr("weight",20 0).selectAll("g").data(dataset).enter().append("ellipse").attr("cx ",function(d){return d;}).attr("cy",40).attr("rx",10).attr("ry",10).attr("fill","red");
  • 18. Binding data Bagaimana 'mengikat' data, kemudian di-'visual'-kan var dataset =[10,30,50,70,90]; var svg = d3.select("body") .append("svg") .attr("width",200) .attr("weight",200); svg.selectAll("g") .data(dataset) .enter() .append("ellipse") .attr("cx",function(d){ return d; }) .attr("cy",40) .attr("rx",10) .attr("ry",10) .attr("fill","red"); Syntax untuk mengikat data: .data(dataset).enter()
  • 19. Power of data() data() akan melakukan iterasi pada setiap nilai pada dataset, lalu akan mengeksekusi method - function(d). .data(dataset).enter().append(“circle”).attr(“r”,function(d) {retrun d;}); Jika diberikan 10 data: var dataset = [1,2,3,4,5,6,7,8,9,10]; Akan mengiterasi setiap data Jika diberikan: Akan diiterasi sebanyak: n x n x
  • 20. Dasar Transisi Untuk melakukan transisi, dapat menggunakan method transition() var svg = d3.select("body") .append("svg") .attr("width",500) .attr("height",200); var dot = svg.append("circle") .attr("cx","100") .attr("cy","100") .attr("r",20) .attr("fill","red"); var transition = dot.transition() .attr("cx","200") .duration(2000); duration() - lama transisi delay() - delay transisi
  • 21. D3.JS Memanfaatkan SVG Manipulasi DOM Memiliki Chaining-Method Data-driven – data() Interaksi dan animasi