SlideShare a Scribd company logo
CRUSHING DATA IN
JAVASCRIPT
MODERN DEVS CHARLOTTE
BRIAN GREIG
DIGITAL CONSULTATION / JAVASCRIPT ENGINEER
- TWITTER @IGNOREINTUITION
- GITHUB /IGNOREINTUITION
CRUSHING DATA IN JAVASCRIPT
FULL DISCLAIMER
▸ Summarizing data in the front end is not advised
▸ Boil your data down on the backend
▸ Serve up a single, minimized dataset
▸ Use the techniques described to produce analytics
CRUSHING DATA IN JAVASCRIPT
PRINCIPLES OF DATA MANAGEMENT
▸ Summarize (reduce)
▸ Subset (filter)
▸ Transform (map)
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
VISUALIZING DATA
Quality Comparisons (Show comparisons, contrasts, differences)
Causality (Show causality, mechanism, explanation, systematic structure)
Multivariate Analysis (Show more than 1 or 2 variables)
Integration of Evidence (Completely integrate words, numbers, images, and diagrams)
Documentation (Thoroughly describe the evidence. Provide a detailed title, indicate the authors
and sponsors, document the data sources, show complete measurement scales, point out
relevant issues.)
Content Counts Most of All (Analytical presentations ultimately stand or fall depending on the
quality, relevance, and integrity of their content)
- Edward Tufte
CRUSHING DATA IN JAVASCRIPT
VISUALIZING DATA
https://d3js.org/
http://shop.oreilly.com/product/0636920026938.do
CRUSHING DATA IN JAVASCRIPT
DATA IN JAVASCRIPT
CRUSHING DATA IN JAVASCRIPT
WHAT WE ARE LOOKING AT
▸ Immutable functions
▸ Basic functions of the Array Prototype
▸ Well supported
CRUSHING DATA IN JAVASCRIPT
FILTER
▸ var newArray = arr.filter(callback[, thisArg])
▸ callback: Function is a predicate, to test each element of
the array. Takes three arguments: element, index, array
▸ array: array filter was called upon
CRUSHING DATA IN JAVASCRIPT
FILTER
var currObj = data.filter(function(a) {

return a.headline === arr[j];

}, []);
CRUSHING DATA IN JAVASCRIPT
REDUCE
‣ arr.reduce(callback, [initialValue])
‣ callbackFunction to execute on each value in the array,
taking four arguments: accumulator, currentValue,
currentIndex, array
‣ array: The array reduce was called upon.
‣ initialValue: Optional. Value to use as the first argument to
the first call of the callback.
CRUSHING DATA IN JAVASCRIPT
REDUCE
var sum = [0, 1, 2, 3].reduce(function (a, b) {

return a + b;

}, 0);
// sum is 6
CRUSHING DATA IN JAVASCRIPT
REDUCE
‣ Works for a single measure, dimension
‣ We want our dataset to have
‣ Several measures, Multi-dimensional
CRUSHING DATA IN JAVASCRIPT
REDUCE
data.reduce(function(a, b){

a.count++;

if (b.age > 50) { a.over50 += b.males; }

if (b.age <= 50) { a.under50 += b.males; }

return a;

}, {"count": 0,"under50": 0,"over50": 0})


CRUSHING DATA IN JAVASCRIPT
REDUCE
CRUSHING DATA IN JAVASCRIPT
MAP
‣ var new_array = arr.map(callback[, thisArg])
‣ callback: Function that produces an element of the new
Array, taking three arguments: currentValue, index, array,
thisArg
CRUSHING DATA IN JAVASCRIPT
MAP
data.map(function(a){

if (a.age > 50){

return {"age": "over50", "males": a.males}

} else {

return {"age": "under50", "males": a.males}

};});
CRUSHING DATA IN JAVASCRIPT
MAP
CRUSHING DATA IN JAVASCRIPT
USING D3
▸ D3 offers grouping / rollup capabilities
▸ d3.nest
▸ key
▸ rollup
▸ sum, average, mean, etc
CRUSHING DATA IN JAVASCRIPT
USING D3
d3.nest()

.key(function(d){return d.age})

.rollup(function(v){return d3.sum(v, function(d) {return
d.males;})})

.entries(data2);
CRUSHING DATA IN JAVASCRIPT
MORE
https://medium.com/@IgnoreIntuition/crushing-data-in-javascript-9d728b94c051#.xzef0qutd
https://github.com/ignoreintuition/Crushing-Data
CRUSHING DATA IN JAVASCRIPT
QUESTIONS?

More Related Content

PPTX
In Sync11 Presentation The Biggest Loser
PDF
Big Data Sets Seen as Big Problem and How to Deal with Them
ODP
Chetan postgresql partitioning
PDF
Manipulating Data using base R package
PDF
Efficient spatial queries on vanilla databases
PPSX
Increasing Capital Budgeting Insight Using Monte Carlo Simulation / War Gamin...
PDF
Transpose and manipulate character strings
PPTX
Geografía mundial 2
In Sync11 Presentation The Biggest Loser
Big Data Sets Seen as Big Problem and How to Deal with Them
Chetan postgresql partitioning
Manipulating Data using base R package
Efficient spatial queries on vanilla databases
Increasing Capital Budgeting Insight Using Monte Carlo Simulation / War Gamin...
Transpose and manipulate character strings
Geografía mundial 2

Viewers also liked (17)

DOCX
Tecnologias (1)
PPTX
Actividad 6 de adonis alberto mendoza conde
PDF
PDF
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
PPT
Taklimat dan Arahan Tugasan Individu
PPT
Generalidades sobre articulações
PDF
How to Become a Thought Leader in Your Niche
PPTX
Actividad13 adonis albrto mendoza conde
PPTX
3Com 299AT ACTIVE HUB
PPTX
Herramientas de word
PDF
L210 manual del usuario español
DOCX
Proceso documentar y controlar entregable (correccion final)
PDF
Guia para-la-formulacion-del-plan-de-monitoreo[1]
PDF
Trabajo de slideshare 1
PPTX
El Impacto de mi Liderazgo
PPTX
Views of the HS-BCP Credential
PPTX
3Com 3C13634A
Tecnologias (1)
Actividad 6 de adonis alberto mendoza conde
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
Taklimat dan Arahan Tugasan Individu
Generalidades sobre articulações
How to Become a Thought Leader in Your Niche
Actividad13 adonis albrto mendoza conde
3Com 299AT ACTIVE HUB
Herramientas de word
L210 manual del usuario español
Proceso documentar y controlar entregable (correccion final)
Guia para-la-formulacion-del-plan-de-monitoreo[1]
Trabajo de slideshare 1
El Impacto de mi Liderazgo
Views of the HS-BCP Credential
3Com 3C13634A
Ad

Similar to Crushing Data with JavaScript (20)

PPSX
javascript-Array.ppsx
PPTX
Feed your inner data scientist. JS Visualization Tools
PPTX
GDSC NED Frontend Bootcamp Session 1.pptx
PPTX
8558537werr.pptx
PPTX
Data analysis in JavaScript
PDF
Powerful JavaScript Tips and Best Practices
PPTX
Frontend Architecture and Data Visualization
PDF
ReactJS for Dashboards and Data Visualization: An Exceptional Choice
PDF
Data Structures in javaScript 2015
PPTX
Learn java script
PPTX
Data Visualization & HTML5 - Swedish Edition
PDF
Visualizing your data in JavaScript
PDF
Easy HTML5 Data Visualization with Kendo UI DataViz
PDF
Bringing back the excitement to data analysis
PDF
Crossfilter MadJS
PPTX
Jit abhishek sarkar
PDF
Mastering The Collections in JavaScript [Free Meetup]
PDF
SuperWeek 2016 - Garbage In Garbage Out: Data Quality in a TMS World
PPTX
JavaScript Basics and Trends
PDF
The D3 Toolbox
javascript-Array.ppsx
Feed your inner data scientist. JS Visualization Tools
GDSC NED Frontend Bootcamp Session 1.pptx
8558537werr.pptx
Data analysis in JavaScript
Powerful JavaScript Tips and Best Practices
Frontend Architecture and Data Visualization
ReactJS for Dashboards and Data Visualization: An Exceptional Choice
Data Structures in javaScript 2015
Learn java script
Data Visualization & HTML5 - Swedish Edition
Visualizing your data in JavaScript
Easy HTML5 Data Visualization with Kendo UI DataViz
Bringing back the excitement to data analysis
Crossfilter MadJS
Jit abhishek sarkar
Mastering The Collections in JavaScript [Free Meetup]
SuperWeek 2016 - Garbage In Garbage Out: Data Quality in a TMS World
JavaScript Basics and Trends
The D3 Toolbox
Ad

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”

Crushing Data with JavaScript

  • 2. BRIAN GREIG DIGITAL CONSULTATION / JAVASCRIPT ENGINEER - TWITTER @IGNOREINTUITION - GITHUB /IGNOREINTUITION
  • 3. CRUSHING DATA IN JAVASCRIPT FULL DISCLAIMER ▸ Summarizing data in the front end is not advised ▸ Boil your data down on the backend ▸ Serve up a single, minimized dataset ▸ Use the techniques described to produce analytics
  • 4. CRUSHING DATA IN JAVASCRIPT PRINCIPLES OF DATA MANAGEMENT ▸ Summarize (reduce) ▸ Subset (filter) ▸ Transform (map)
  • 5. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 6. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 7. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 8. CRUSHING DATA IN JAVASCRIPT VISUALIZING DATA Quality Comparisons (Show comparisons, contrasts, differences) Causality (Show causality, mechanism, explanation, systematic structure) Multivariate Analysis (Show more than 1 or 2 variables) Integration of Evidence (Completely integrate words, numbers, images, and diagrams) Documentation (Thoroughly describe the evidence. Provide a detailed title, indicate the authors and sponsors, document the data sources, show complete measurement scales, point out relevant issues.) Content Counts Most of All (Analytical presentations ultimately stand or fall depending on the quality, relevance, and integrity of their content) - Edward Tufte
  • 9. CRUSHING DATA IN JAVASCRIPT VISUALIZING DATA https://d3js.org/ http://shop.oreilly.com/product/0636920026938.do
  • 10. CRUSHING DATA IN JAVASCRIPT DATA IN JAVASCRIPT
  • 11. CRUSHING DATA IN JAVASCRIPT WHAT WE ARE LOOKING AT ▸ Immutable functions ▸ Basic functions of the Array Prototype ▸ Well supported
  • 12. CRUSHING DATA IN JAVASCRIPT FILTER ▸ var newArray = arr.filter(callback[, thisArg]) ▸ callback: Function is a predicate, to test each element of the array. Takes three arguments: element, index, array ▸ array: array filter was called upon
  • 13. CRUSHING DATA IN JAVASCRIPT FILTER var currObj = data.filter(function(a) {
 return a.headline === arr[j];
 }, []);
  • 14. CRUSHING DATA IN JAVASCRIPT REDUCE ‣ arr.reduce(callback, [initialValue]) ‣ callbackFunction to execute on each value in the array, taking four arguments: accumulator, currentValue, currentIndex, array ‣ array: The array reduce was called upon. ‣ initialValue: Optional. Value to use as the first argument to the first call of the callback.
  • 15. CRUSHING DATA IN JAVASCRIPT REDUCE var sum = [0, 1, 2, 3].reduce(function (a, b) {
 return a + b;
 }, 0); // sum is 6
  • 16. CRUSHING DATA IN JAVASCRIPT REDUCE ‣ Works for a single measure, dimension ‣ We want our dataset to have ‣ Several measures, Multi-dimensional
  • 17. CRUSHING DATA IN JAVASCRIPT REDUCE data.reduce(function(a, b){
 a.count++;
 if (b.age > 50) { a.over50 += b.males; }
 if (b.age <= 50) { a.under50 += b.males; }
 return a;
 }, {"count": 0,"under50": 0,"over50": 0}) 

  • 18. CRUSHING DATA IN JAVASCRIPT REDUCE
  • 19. CRUSHING DATA IN JAVASCRIPT MAP ‣ var new_array = arr.map(callback[, thisArg]) ‣ callback: Function that produces an element of the new Array, taking three arguments: currentValue, index, array, thisArg
  • 20. CRUSHING DATA IN JAVASCRIPT MAP data.map(function(a){
 if (a.age > 50){
 return {"age": "over50", "males": a.males}
 } else {
 return {"age": "under50", "males": a.males}
 };});
  • 21. CRUSHING DATA IN JAVASCRIPT MAP
  • 22. CRUSHING DATA IN JAVASCRIPT USING D3 ▸ D3 offers grouping / rollup capabilities ▸ d3.nest ▸ key ▸ rollup ▸ sum, average, mean, etc
  • 23. CRUSHING DATA IN JAVASCRIPT USING D3 d3.nest()
 .key(function(d){return d.age})
 .rollup(function(v){return d3.sum(v, function(d) {return d.males;})})
 .entries(data2);
  • 24. CRUSHING DATA IN JAVASCRIPT MORE https://medium.com/@IgnoreIntuition/crushing-data-in-javascript-9d728b94c051#.xzef0qutd https://github.com/ignoreintuition/Crushing-Data
  • 25. CRUSHING DATA IN JAVASCRIPT QUESTIONS?