Platform
Docs
Resources
Blog
Pricing
Sign in
Sign up
GAURAV SINGH
Workspace
Fork
Published
DataInfoViz
By
GAURAV SINGH
Edited
Nov 9, 2021
Insert cell
// Row Way
dataRow
=
[
{
area
:
"north"
,
sales
:
5
,
profit
:
2
}
,
{
area
:
"east"
,
sales
:
25
,
profit
:
8
}
,
{
area
:
"west"
,
sales
:
10
,
profit
:
6
}
,
{
area
:
"south"
,
sales
:
20
,
profit
:
5
}
,
{
area
:
"central"
,
sales
:
15
,
profit
:
3
}
]
Insert cell
vegaEmbed
=
require
(
"vega-embed"
)
Insert cell
vl
.
spec
(
{
data
:
{
values
:
dataRow
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
field
:
"area"
,
type
:
"nominal"
}
,
y
:
{
field
:
"sales"
,
type
:
"quantitative"
}
}
}
)
.
render
(
)
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
mark
:
"arc"
,
encoding
:
{
x
:
{
field
:
"area"
,
type
:
"N"
}
,
y
:
{
field
:
"sales"
,
type
:
"Q"
}
,
color
:
{
field
:
"profit"
,
type
:
"Q"
}
}
}
)
Insert cell
vegaEmbed
(
{
width
:
200
,
height
:
200
,
data
:
{
values
:
dataRow
}
,
mark
:
"arc"
,
encoding
:
{
theta
:
{
field
:
"area"
,
type
:
"N"
}
,
//color : { field: "profit", type: "Q" },
color
:
{
field
:
"sales"
,
type
:
"Q"
}
}
}
)
Insert cell
vegaEmbed
(
{
width
:
200
,
height
:
200
,
data
:
{
values
:
dataRow
}
,
mark
:
"arc"
,
encoding
:
{
theta
:
{
field
:
"profit"
,
type
:
"Q"
}
,
color
:
{
field
:
"area"
,
type
:
"N"
}
,
}
}
)
Insert cell
vegaEmbed
(
{
width
:
200
,
height
:
200
,
data
:
{
values
:
dataRow
}
,
mark
:
"arc"
,
encoding
:
{
theta
:
{
field
:
"sales"
,
type
:
"Q"
}
,
color
:
{
field
:
"area"
,
type
:
"N"
}
,
}
}
)
Insert cell
vegaEmbed
(
{
width
:
200
,
height
:
200
,
"data"
:
{
values
:
dataRow
}
,
"encoding"
:
{
"theta"
:
{
"field"
:
"sales"
,
"type"
:
"quantitative"
,
"stack"
:
true
}
,
"color"
:
{
"field"
:
"area"
,
"type"
:
"nominal"
,
"legend"
:
null
}
}
,
"layer"
:
[
{
"mark"
:
{
"type"
:
"arc"
,
"outerRadius"
:
80
}
}
,
{
"mark"
:
{
"type"
:
"text"
,
"radius"
:
90
}
,
"encoding"
:
{
"text"
:
{
"field"
:
"area"
,
"type"
:
"nominal"
}
}
}
]
}
)
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
"mark"
:
"bar"
,
"width"
:
{
"step"
:
15
}
,
"encoding"
:
{
"y"
:
{
"field"
:
"area"
}
,
"x"
:
{
"field"
:
"sales"
,
"title"
:
"Sales"
,
}
,
}
}
)
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
mark
:
"point"
,
encoding
:
{
x
:
{
field
:
"area"
,
type
:
"N"
}
,
y
:
{
field
:
"sales"
,
type
:
"Q"
}
,
color
:
{
field
:
"profit"
,
type
:
"Q"
}
}
}
)
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
mark
:
"tick"
,
"width"
:
{
"step"
:
15
}
,
encoding
:
{
x
:
{
field
:
"sales"
,
type
:
"Q"
}
,
y
:
{
field
:
"profit"
,
type
:
"Q"
}
,
}
}
)
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
"mark"
:
"circle"
,
"encoding"
:
{
x
:
{
field
:
"area"
,
type
:
"N"
}
,
"y"
:
{
"bin"
:
{
"maxbins"
:
5
}
,
"field"
:
"area"
}
,
//y: { field: "sales", type: "Q" },
}
}
)
Insert cell
{
"$schema"
:
"https://vega.github.io/schema/vega-lite/v5.json"
,
"data"
:
{
"url"
:
"data/movies.json"
}
,
"mark"
:
"circle"
,
"encoding"
:
{
"x"
:
{
"bin"
:
{
"maxbins"
:
10
}
,
"field"
:
"IMDB Rating"
}
,
"y"
:
{
"bin"
:
{
"maxbins"
:
10
}
,
"field"
:
"Rotten Tomatoes Rating"
}
,
"size"
:
{
"aggregate"
:
"count"
}
}
}
Insert cell
vegaEmbed
(
{
data
:
{
values
:
dataRow
}
,
mark
:
"line"
,
encoding
:
{
x
:
{
field
:
"area"
,
type
:
"N"
}
,
y
:
{
field
:
"sales"
,
type
:
"Q"
}
,
}
}
)
Insert cell
vegaEmbed
(
{
width
:
200
,
height
:
200
,
data
:
{
values
:
dataRow
}
,
"mark"
:
{
"type"
:
"arc"
,
"innerRadius"
:
50
}
,
encoding
:
{
theta
:
{
field
:
"profit"
,
type
:
"Q"
}
,
color
:
{
field
:
"area"
,
type
:
"N"
}
,
}
}
)
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Fork
View
Export
dataRow
Unpin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
vegaEmbed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Unpin
Add comment
Select
Duplicate
Copy link
Embed
Delete
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Platform overview
Observable Framework
Observable Cloud
Observable Notebooks
Embedded analytics
Observable
Observable Framework
Observable Plot
D3
Release notes
Examples
Data integrations
Customer stories
Community Slack
Forum