SlideShare une entreprise Scribd logo
1  sur  52
“this is going to be AWESOME!"
& Data Visualization
Why   ?
complex
 interactive
exploratory
    novel
1. Get the data into Processing
1. Get the data into Processing
2. Parse the data into useful Objects
1. Get the data into Processing
2. Parse the data into useful Objects
3. Render the objects on screen
CSV, JSON, XML
1. Get the data into Processing
JSON
               XML
                CSV
   Flexible
Structured
      Easy
CSV (Comma-Separated Values)
  • Values (columns) are typically delimited by commas
  • Rows are typically delimited by carriage returns
  • Works for most data that can go
    in a simple spreadsheet
  • Not good for any kind of complex or relational data
  • Processing doesn’t have built in support for CSV
    but we can use JAVA libraries like opencsv
4,14,26,17,98,35,128,362,9,18,45

       dave,28,male,no
       erica,28,female,no
       roger,52,male,yes
XML (eXtensible Markup Language)
  • Data is stored in nested nodes
  • Structure of data is extremely flexible to define
    but not as flexible to change
  • Processing has built-in support for XML
  • Many APIs will return data in XML format
<patients>
 <patient name=”dave” age=28 gender=”male” smoker=”no”/>
 <patient name=”erica” age=28 gender=”female” smoker=”no”/>
 <patient name=”roger” age=52 gender=”male” smoker=”yes”/>
</patients>
JSON (JavaScript Object Notation)
   • Data is as JavaScript Objects
   • Extraordinarily flexible and lightweight
   • Lack of named structures can make stored data
     difficult to understand
   • JAVA and JavaScript do not play as nicely as you
     might think
{
    patients:[
       {name:”dave”, age:28, gender:”male”, smoker:false},
       {name:”erica”, age:28, gender:”female”, smoker:false},
       {name:”roger”, age:52, gender:”male”, true}
       ]
}
{
     Curly Braces - OBJECT
};
[ Square Brackets - ARRAY ]
{
     name:”Peter”,
     age:18,
     smoker:false,
     friends:[“April”, “Ron”, “Valerie”]
};
{
     name:”Peter”,
     age:18,
     smoker:false,
     friends:[“April”, “Ron”, “Valerie”]
};



        myJSONObject.age
{
     name:”Peter”,
     age:18,
     smoker:false,
     friends:[“April”, “Ron”, “Valerie”]
};



     myJSONObject.friends[1]
{
     name:”Peter”,
     age:18,
     smoker:false,
     friends:[“April”, “Ron”, “Valerie”]
};



     myJSONObject.getInt(“age”);
{
          name:”Peter”,
          age:18,
          smoker:false,
          friends:[“April”, “Ron”, “Valerie”]
     };


JSONArray a = myJSONObject.getJSONArray[“friends”];
a.getString(1);
myJSONObject = new JSONObject(stringData);
JSONArray a = myJSONObject.getJSONArray[“friends”];
println(a.getString(1));
try {
  myJSONObject = new JSONObject(stringData);
  JSONArray a = myJSONObject.getJSONArray[“friends”];
  println(a.getString(1));
} catch (Exception e) {
  println(“JSON LOAD FAILED.”);
}
try {
   String url = “http://test.com/?getStuff”;
  String stringData = join(loadStrings(url), “”);
  myJSONObject = new JSONObject(stringData);
  JSONArray a = myJSONObject.getJSONArray[“friends”];
  println(a.getString(1));
} catch (Exception e) {
  println(“JSON LOAD FAILED.”);
}
http://www.blprnt.com/processing/json.zip
2. Parse the data into useful Objects
class Patient {

 XML        String name;
            int age;
JSON        String gender;    ArrayList<Patient> patientList
            boolean smoker;
  CSV
            Patient();
        }
ArrayList: Store lists of objects
HashMap: Keep counts of categories
Arrays vs. ArrayLists
Arrays
           fast
       easy to use
good for known quantities
ArrayLists
          flexible
       full-featured
good for changing quantities
Basic ArrayLists
    ArrayList myList = new ArrayList();
    CheeseBurger cb = new CheeseBurger();
    myList.add(cb);
Basic ArrayLists

    CheeseBurger cb = myList.get(0);
    cb.eat();
Basic ArrayLists

    CheeseBurger cb = myList.get(0);
X   cb.eat();
Basic ArrayLists

    CheeseBurger cb = (CheeseBurger) myList.get(0);
    cb.eat();
ArrayLists w/ Generics
    ArrayList<CheeseBurger> myList = new ArrayList();
    CheeseBurger cb = new CheeseBurger();
    myList.add(cb);
ArrayLists w/ Generics

    CheeseBurger cb = myList.get(0);
√   cb.eat();
HashMaps
HashMaps
Store objects by a key
Helpful for keeping counts of categories
Useful for keeping checklists
HashMaps
HashMap<keyType, valueType>
myMap = new HashMap();

CustomObject o = new CustomObject();
myMap.put(key, o);

CustomObject o = myMap.get(key)
3. Render the objects on screen
<insert wisdom here>
position
      size
#    colour
    rotation
     sound
        ?
position
              size
#   map()    colour
            rotation
             sound
                ?
map(5,0,10,0,100)   50
map(5,0,10,0,1000)   500
map(5,0,10,20,30)   25
Processing & Dataviz
Processing & Dataviz

Contenu connexe

Tendances

SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptxSH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
MongoDB
 

Tendances (11)

Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, FlaxCoffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
Coffee, Danish & Search: Presented by Alan Woodward & Charlie Hull, Flax
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
 
06. ElasticSearch : Mapping and Analysis
06. ElasticSearch : Mapping and Analysis06. ElasticSearch : Mapping and Analysis
06. ElasticSearch : Mapping and Analysis
 
1.1 motivation
1.1 motivation1.1 motivation
1.1 motivation
 
PHP - Introduction to PHP MySQL Joins and SQL Functions
PHP -  Introduction to PHP MySQL Joins and SQL FunctionsPHP -  Introduction to PHP MySQL Joins and SQL Functions
PHP - Introduction to PHP MySQL Joins and SQL Functions
 
PHP file
PHP  filePHP  file
PHP file
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens Аuer
 
3. javascript bangla tutorials
3. javascript bangla tutorials3. javascript bangla tutorials
3. javascript bangla tutorials
 
Setup testdata
Setup testdataSetup testdata
Setup testdata
 
SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptxSH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
SH 1 - SES 3 - 3.6-Overview-Tel-Aviv.pptx
 
Dictionary part 1
Dictionary part 1Dictionary part 1
Dictionary part 1
 

En vedette

En vedette (7)

Emergence
EmergenceEmergence
Emergence
 
ITP Data Rep - Class3
ITP Data Rep - Class3ITP Data Rep - Class3
ITP Data Rep - Class3
 
Shibuya.js Lightning Talks
Shibuya.js Lightning TalksShibuya.js Lightning Talks
Shibuya.js Lightning Talks
 
Data Representation - Day 2
Data Representation - Day 2Data Representation - Day 2
Data Representation - Day 2
 
Hacking The Newsroom
Hacking The NewsroomHacking The Newsroom
Hacking The Newsroom
 
Learn Creative Coding: Begin Programming with the Processing Language
Learn Creative Coding: Begin Programming with the Processing LanguageLearn Creative Coding: Begin Programming with the Processing Language
Learn Creative Coding: Begin Programming with the Processing Language
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
 

Similaire à Processing & Dataviz

Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
lehresman
 
Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !
Alexander Korotkov
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 

Similaire à Processing & Dataviz (20)

Potential Friend Finder
Potential Friend FinderPotential Friend Finder
Potential Friend Finder
 
Json the-x-in-ajax1588
Json the-x-in-ajax1588Json the-x-in-ajax1588
Json the-x-in-ajax1588
 
Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*Native json in the Cache' ObjectScript 2016.*
Native json in the Cache' ObjectScript 2016.*
 
quick json parser
quick json parserquick json parser
quick json parser
 
Web Technology - PHP Arrays
Web Technology - PHP ArraysWeb Technology - PHP Arrays
Web Technology - PHP Arrays
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...
CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...
CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...
 
NoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовNoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросов
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
 
Json
JsonJson
Json
 
GDI Seattle - Intro to JavaScript Class 2
GDI Seattle - Intro to JavaScript Class 2GDI Seattle - Intro to JavaScript Class 2
GDI Seattle - Intro to JavaScript Class 2
 
Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !
 
4.1 PHP Arrays
4.1 PHP Arrays4.1 PHP Arrays
4.1 PHP Arrays
 
Json
JsonJson
Json
 
Java 8 Examples
Java 8 ExamplesJava 8 Examples
Java 8 Examples
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
JAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdfJAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdf
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
 
JSON
JSONJSON
JSON
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Processing & Dataviz

  • 1.
  • 2. “this is going to be AWESOME!"
  • 4. Why ?
  • 6. 1. Get the data into Processing
  • 7. 1. Get the data into Processing 2. Parse the data into useful Objects
  • 8. 1. Get the data into Processing 2. Parse the data into useful Objects 3. Render the objects on screen
  • 10. 1. Get the data into Processing
  • 11. JSON XML CSV Flexible Structured Easy
  • 12. CSV (Comma-Separated Values) • Values (columns) are typically delimited by commas • Rows are typically delimited by carriage returns • Works for most data that can go in a simple spreadsheet • Not good for any kind of complex or relational data • Processing doesn’t have built in support for CSV but we can use JAVA libraries like opencsv
  • 13. 4,14,26,17,98,35,128,362,9,18,45 dave,28,male,no erica,28,female,no roger,52,male,yes
  • 14. XML (eXtensible Markup Language) • Data is stored in nested nodes • Structure of data is extremely flexible to define but not as flexible to change • Processing has built-in support for XML • Many APIs will return data in XML format
  • 15. <patients> <patient name=”dave” age=28 gender=”male” smoker=”no”/> <patient name=”erica” age=28 gender=”female” smoker=”no”/> <patient name=”roger” age=52 gender=”male” smoker=”yes”/> </patients>
  • 16. JSON (JavaScript Object Notation) • Data is as JavaScript Objects • Extraordinarily flexible and lightweight • Lack of named structures can make stored data difficult to understand • JAVA and JavaScript do not play as nicely as you might think
  • 17. { patients:[ {name:”dave”, age:28, gender:”male”, smoker:false}, {name:”erica”, age:28, gender:”female”, smoker:false}, {name:”roger”, age:52, gender:”male”, true} ] }
  • 18. { Curly Braces - OBJECT };
  • 19. [ Square Brackets - ARRAY ]
  • 20. { name:”Peter”, age:18, smoker:false, friends:[“April”, “Ron”, “Valerie”] };
  • 21. { name:”Peter”, age:18, smoker:false, friends:[“April”, “Ron”, “Valerie”] }; myJSONObject.age
  • 22. { name:”Peter”, age:18, smoker:false, friends:[“April”, “Ron”, “Valerie”] }; myJSONObject.friends[1]
  • 23. { name:”Peter”, age:18, smoker:false, friends:[“April”, “Ron”, “Valerie”] }; myJSONObject.getInt(“age”);
  • 24. { name:”Peter”, age:18, smoker:false, friends:[“April”, “Ron”, “Valerie”] }; JSONArray a = myJSONObject.getJSONArray[“friends”]; a.getString(1);
  • 25. myJSONObject = new JSONObject(stringData); JSONArray a = myJSONObject.getJSONArray[“friends”]; println(a.getString(1));
  • 26. try { myJSONObject = new JSONObject(stringData); JSONArray a = myJSONObject.getJSONArray[“friends”]; println(a.getString(1)); } catch (Exception e) { println(“JSON LOAD FAILED.”); }
  • 27. try { String url = “http://test.com/?getStuff”; String stringData = join(loadStrings(url), “”); myJSONObject = new JSONObject(stringData); JSONArray a = myJSONObject.getJSONArray[“friends”]; println(a.getString(1)); } catch (Exception e) { println(“JSON LOAD FAILED.”); }
  • 29. 2. Parse the data into useful Objects
  • 30. class Patient { XML String name; int age; JSON String gender; ArrayList<Patient> patientList boolean smoker; CSV Patient(); }
  • 31. ArrayList: Store lists of objects HashMap: Keep counts of categories
  • 33. Arrays fast easy to use good for known quantities
  • 34. ArrayLists flexible full-featured good for changing quantities
  • 35. Basic ArrayLists ArrayList myList = new ArrayList(); CheeseBurger cb = new CheeseBurger(); myList.add(cb);
  • 36. Basic ArrayLists CheeseBurger cb = myList.get(0); cb.eat();
  • 37. Basic ArrayLists CheeseBurger cb = myList.get(0); X cb.eat();
  • 38. Basic ArrayLists CheeseBurger cb = (CheeseBurger) myList.get(0); cb.eat();
  • 39. ArrayLists w/ Generics ArrayList<CheeseBurger> myList = new ArrayList(); CheeseBurger cb = new CheeseBurger(); myList.add(cb);
  • 40. ArrayLists w/ Generics CheeseBurger cb = myList.get(0); √ cb.eat();
  • 42. HashMaps Store objects by a key Helpful for keeping counts of categories Useful for keeping checklists
  • 43. HashMaps HashMap<keyType, valueType> myMap = new HashMap(); CustomObject o = new CustomObject(); myMap.put(key, o); CustomObject o = myMap.get(key)
  • 44. 3. Render the objects on screen
  • 46. position size # colour rotation sound ?
  • 47. position size # map() colour rotation sound ?

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n