Platform
Resources
Pricing
Sign in
Contact us
philippkoytek
Workspace
Fork
Published
D3 Tutorial
By
philippkoytek
Edited
Dec 22, 2020
Fork of
1. Draw a flower petal on the screen
6
D3 Tutorial
D3. Part 1 - HTML, SVG and a Basic Bar Chart
D3. Part 1 - Exercise: Bar Chart and Scatter Plot
D3. Part 1 - Exercise Solution
D3. Part 2 - Click Interaction
D3. Part 2 - Importing and combining Charts
D3. Part 2 - Animated Bar Chart Race
D3. Part 2 - Exercise: Interactive Charts
D3. Part 2 - Exercise Solution
D3. Part 3 - Brushing and Linking
D3. Essentials - selection.join explained
D3. Essentials - Color
D3. Essentials - Further Learning Videos
D3. Advanced - Maps
D3. Advanced - Drawing custom Shapes
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html
`
<svg width=100 height=100 style='overflow: visible; margin: 5px;'>
<path d='M0,0 C50,40 50,70 20,100 L0,85 L-20,100 C-50,70 -50,40 0,0'
fill='none' stroke='#000' stroke-width=2 transform='translate(50,0)' />
</svg>
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html
`
<svg width=100 height=100 style='border: 1px dashed'>
<path d='${
smiley
}' fill='none' stroke='#000' stroke-width=2 transform='translate(50,0)' />
</svg>
<code>100px</code>
`
Insert cell
smiley
=
`
M 0 20
A 40 40 0 0 1 0 100
A 40 40 0 0 1 0 20
M 0 60
C 13 57 13 73 0 70
M 0 85
A 5 5 0 0 1 10 85
A 5 5 0 0 1 0 85
M -15 40
L -13 50
M 15 40
L 13 50
`
/*smiley = `M 0 0
a 50 50 0 0 1 0 100
a 50 50 0 0 1 0 -100
M 0 55
c 8 0 18 10 0 10
c -8 0 -8 -10 0 -10
M -20 75
q 20 15 40 0
M -20 35
a 5 5 0 0 1 0 10
a 5 5 0 0 1 0 -10
M 20 35
a 5 5 0 0 1 0 10
a 5 5 0 0 1 0 -10
M 15 40
h 10`*/
Insert cell
Insert cell
html
`
<svg width=100 height=100 style='border: 1px dashed'>
<path d='${
petalPath
}' fill='none' stroke='#000' stroke-width=2 transform='translate(50,0)' />
</svg>
<code>100px</code>
`
Insert cell
petalPath
=
`
M 0 0
C 50 55 40 90 0 100
C -40 90 -50 55 0 0`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
window
.
localStorage
.
petalPath
=
petalPath
||
'M0,0 C50,40 50,70 20,100 L0,85 L-20,100 C-50,70 -50,40 0,0'
}
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
smiley
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
petalPath
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tableSVG
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
colorXY
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML