this is not an introduction to d3 - github pagesjpiscionere.github.io/d3.pdf · this is an...

61
This Is Not An Introduction to d3.js Jennifer Piscionere @ jpiscionere http://jpiscionere.github.io/

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

This Is Not An Introduction !to d3.js

Jennifer Piscionere @jpiscionere

http://jpiscionere.github.io/

Page 2: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

This Is An Introduction to Seeing Something That Looks

Cool on the Internet and Ripping it Off

Page 3: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

This Is An Introduction to Seeing Something That Looks

Cool on the Internet and Ripping it Off

Page 4: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

This Is An Introduction to Seeing Something That Looks

Cool on the Internet and Ripping it Off

https://github.com/mbostock/d3/wiki/Gallery

Page 5: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

You’ve Already Done !Koalas to the Max Right?

http://www.koalastothemax.com/

Page 6: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

MAKE YOUR OWN CODEFLOWER Final Project

http://www.redotheweb.com/CodeFlower/

Page 7: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

FORCE COLLAPSIBLE First Example

http://mbostock.github.io/d3/talk/20111116/force-collapsible.html

Page 8: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

SAVE FORCE COLLAPSIBLE WEBPAGE USING FIREFOX* ON YOUR LOCAL MACHINE

Step the First

Page 9: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

SAVE FORCE COLLAPSIBLE WEBPAGE USING FIREFOX* ON YOUR LOCAL MACHINE

Step the First

*This is non-negotiable for the time being. OMG I KNOW chrome/safari/opera/butterfly wings interpreting html IS SO MUCH BETTER

Page 10: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

OPEN FORCE-COLLAPSIBLE.HTMLUSING FIREFOX

Step the Second

Page 11: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Why Doesn’t My Flower Work?

Page 12: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

OPEN THE CONSOLE TO SEE THE ERRORS

Step the Third

Page 13: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Not helpful

Page 14: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Doctor Google Says: This Error Means There is A Missing File

Page 15: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

OPEN FORCE-COLLAPSIBLE.HTMLUSING THE TEXT EDITOR OF YOUR CHOICE (!!!)

Step the Fourth

Page 16: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 1:20 HTML / CSS / SVG

Page 17: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

What it Says? HTML How it Looks? CSS

Page 18: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

No CSS

Page 19: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

My Website With the Style Sheets

Page 20: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

My Website Without the Style Sheets

Page 21: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 1:20 HTML / CSS / SVG HEADER

Scalable Vector Graphic “Classes” There are Connected Circles How those Circles Lookish

Page 22: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 21:28 HTML / Loading d3 Engine

Think of it as import numpy

Page 23: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 29:144 d3 Javascript Details

Page 24: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 29:144 d3 Javascript Details

Page 25: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 29:144 d3 Javascript Details

Page 26: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Why Doesn’t My Flower Work?

Page 27: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

WHERE IS THE DATA? Why Doesn’t My Flower Work?

Page 28: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

What File Was This Talking About?

Page 29: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Lines 29:144 d3 Javascript Magic

Page 30: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

$ wget http://mbostock.github.io/d3/talk/20111116/flare.json

Page 31: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

flare.json

Page 32: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

flare.json

Code Flower of d3.js itself

Page 33: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Why Doesn’t My Flower Work?

Page 34: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Line 144: Firefox Saved A Static Page

Delete : <svg … /svg>

Page 35: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Why Does My Flower

STILL NOT WORK?

Page 36: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Same Origin Policy: Why We Used Firefox to Run Things Locally

https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally

Page 37: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

Does Everybody’s Flower Work?

pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease Pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease pleasepleasepleasepleasepleasepleasepleasepleaseplease

Page 38: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 39: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 40: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 41: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 42: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 43: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

ADDTHEJAVASCRIPTASANEXTERNALLIBRARY

Last Step Before CODEFLOWER

Page 44: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 45: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

MAKE YOUR OWN CODEFLOWER Final Project

Page 46: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

GO TO CODEFLOWER WEBSITE Step the First

Page 47: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

UPDATE USING FLARE.JSON Step the Second

Page 48: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

UPDATE USING FLARE.JSON Step the Second

Page 49: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

USING YOUR OWN GITHUB REPO AS THE SOURCE OF DATA

Step the 2nd.5

Page 50: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Install cloc

Page 51: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Install cloc

2.  Count the Lines in Your Repo

Your Repo Here

Page 52: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Install cloc

2.  Count the Lines in Your Repo

3.  Put cloc output into .json format use widget on codeflower website

Page 53: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

DOWNLOAD CODEFLOWER WEBSITE

Step the Third

Page 54: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off
Page 55: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

X

Page 56: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

MAKE YOUR OWN CODEFLOWER Final Project

Edited html lives here: http://jpiscionere.github.io/code_flower_try.html

Page 57: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Save Website 2.  Check Dependencies 3.  Check the Data Format 4.  Check the html 5.  Swap Out wtheta.js for flare.json

Page 58: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Save Website 2.  Check Dependencies 3.  Check the Data Format 4.  Check the html 5.  Swap Out wtheta.js for flare.json

Page 59: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Save Website 2.  Check Dependencies 3.  Check the Data Format 4.  Check the html 5.  Swap Out wtheta.js for flare.json

Page 60: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Save Website 2.  Check Dependencies 3.  Check the Data Format 4.  Check the html 5.  Swap Out wtheta.js for flare.json

Page 61: This Is Not An Introduction to d3 - GitHub Pagesjpiscionere.github.io/d3.pdf · This Is An Introduction to Seeing Something That Looks Cool on the Internet and Ripping it Off

1.  Save Website 2.  Check Dependencies 3.  Check the Data Format 4.  Check the html 5.  Swap Out wtheta.js for flare.json