Platform
Resources
Pricing
Sign in
Get started
Jo Wood
Professor of Visual Analytics interested in design, geovisualization, visual storytelling and computational thinking.
Workspace
Fork
Public
Hello
By
Jo Wood
Edited
Jun 24, 2022
4 stars
Insert cell
Insert cell
{
const
cx
=
50
;
return
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
.
ellipse
(
cx
,
50
,
30
)
.
render
(
)
;
}
Insert cell
Insert cell
Insert cell
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
.
ellipse
(
cx
,
50
,
30
)
.
render
(
)
Insert cell
Insert cell
Insert cell
{
const
r
=
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
;
for
(
let
i
=
30
;
i
<
610
;
i
++
)
{
yield
r
.
clear
(
)
.
ellipse
(
i
,
50
,
30
)
.
render
(
)
;
}
}
Insert cell
Insert cell
Insert cell
{
restart
// Make reference to a GUI element in another cell.
const
r
=
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
;
for
(
let
i
=
30
;
i
<
610
;
i
++
)
{
yield
r
.
clear
(
)
.
ellipse
(
i
,
50
,
30
)
.
render
(
)
;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
function
*
ticker1
(
w
)
{
let
i
=
0
;
while
(
true
)
{
i
=
(
i
+
1
)
%
w
;
yield
i
;
}
}
Insert cell
Insert cell
cx1
=
ticker1
(
600
)
Insert cell
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
.
ellipse
(
cx1
,
50
,
30
)
.
render
(
)
Insert cell
Insert cell
function
*
ticker2
(
w
)
{
let
i
=
0
;
while
(
true
)
{
i
=
(
i
+
60
)
%
w
;
yield
Promises
.
delay
(
1000
,
i
)
;
}
}
Insert cell
cx2
=
ticker2
(
600
)
Insert cell
Insert cell
Insert cell
function
*
ticker
(
timeToComplete
=
1000
,
delay
=
10
)
{
const
start
=
Date
.
now
(
)
;
// Poll the current time in milliseconds.
const
end
=
start
+
timeToComplete
;
let
t
=
0
;
yield
t
;
// Yield an immediate result at start
while
(
t
<=
1
)
{
t
=
(
Date
.
now
(
)
-
start
)
/
(
end
-
start
)
;
// Yield subsequent results after the given delay.
yield
Promises
.
delay
(
delay
,
Math
.
min
(
1
,
t
)
)
;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
.
ellipse
(
10
+
t
*
600
,
50
,
10
+
t
*
30
)
.
render
(
)
Insert cell
Insert cell
t2
=
{
trigger
return
ticker
(
1000
)
;
}
Insert cell
mutable
trigger
=
false
Insert cell
Insert cell
{
const
r
=
new
Renderer
(
width
,
100
)
.
fill
(
"rgba(180,90,45,0.5)"
)
.
ellipse
(
10
+
t2
*
600
,
50
,
10
+
t2
*
30
)
;
r
.
addListener
(
"click"
,
(
ev
)
=>
(
mutable
trigger
=
true
)
)
;
return
r
.
render
(
)
;
}
Insert cell
Insert cell
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
Fork
View
Export
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
cx
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
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
restart
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
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
ticker1
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
cx1
Add comment
Copy import
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
ticker2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
cx2
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
ticker
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
timeToComplete
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pollingInterval
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
reset
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
t
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
t2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
trigger
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
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