Platform
Resources
Pricing
Sign in
Get started
Michele Weigle
Professor of Computer Science at Old Dominion University
Workspace
Fork
Public
CS 725/825, Spring 2023
By
Michele Weigle
Edited
Feb 9, 2023
Paused
Fork of
CS725-S22, D3 Vis Intro
•
3 forks
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
Insert cell
// write your answer here
Insert cell
Insert cell
Insert cell
Insert cell
bardata
=
[
{
xPos
:
10
,
yPos
:
50
,
width
:
30
,
height
:
50
,
color
:
'blue'
}
,
{
xPos
:
45
,
yPos
:
20
,
width
:
30
,
height
:
80
,
color
:
'red'
}
,
{
xPos
:
80
,
yPos
:
70
,
width
:
30
,
height
:
30
,
color
:
'yellow'
}
]
Insert cell
// write your answer here
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bars
=
[
{
name
:
'a'
,
value
:
5
,
color
:
'blue'
}
,
{
name
:
'b'
,
value
:
8
,
color
:
'red'
}
,
{
name
:
'c'
,
value
:
3
,
color
:
'yellow'
}
]
Insert cell
width
=
300
Insert cell
height
=
100
Insert cell
x
=
d3
.
scaleBand
(
)
.
domain
(
[
0
,
0
]
)
// EDIT THIS LINE - need an array with the list of names
.
range
(
[
0
,
width
]
)
.
padding
(
0.2
)
Insert cell
Insert cell
y
=
d3
.
scaleLinear
(
)
.
domain
(
[
0
,
0
]
)
// EDIT THIS LINE
.
range
(
[
0
,
height
]
)
Insert cell
Insert cell
{
const
svg
=
d3
.
create
(
'svg'
)
.
attr
(
"width"
,
width
)
.
attr
(
"height"
,
height
)
;
svg
.
selectAll
(
'rect'
)
.
data
(
bars
)
.
join
(
'rect'
)
.
attr
(
'fill'
,
d
=>
d
.
color
)
.
attr
(
'x'
,
d
=>
0
)
// EDIT THIS LINE
.
attr
(
'y'
,
d
=>
0
)
// EDIT THIS LINE (remember that 0 starts at the top)
.
attr
(
'width'
,
0
)
// EDIT THIS LINE
.
attr
(
'height'
,
d
=>
0
)
;
// EDIT THIS LINE
return
svg
.
node
(
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3
=
require
(
"d3@7"
)
Insert cell
import
{
solution
}
from
"@nyuvis/d3-introduction"
Insert cell
import
{
chart
as
scaleDiagram
}
from
"@uw-info474/animated-scale-diagram"
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
Compare latest
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
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
bardata
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bars
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
x
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
y
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
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
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML