Platform
Solutions
Resources
Pricing
Sign in
Sign up
Brim Data
The company behind the Zed data platform.
Workspace
Fork
Public
By
Phil Rzewski
Edited
Apr 25, 2023
1 star
1
Insert cell
Insert cell
viewof
textInput
=
Inputs
.
textarea
(
{
label
:
"Text Input"
,
placeholder
:
"Enter some text input..."
,
value
:
'{"greeting": "Hello, world!"}'
}
)
Insert cell
Insert cell
viewof
zedQuery1
=
Inputs
.
textarea
(
{
label
:
"Zed Query"
,
placeholder
:
"Enter a Zed query..."
,
value
:
"yield greeting"
}
)
Insert cell
Insert cell
zed
=
import
(
"https://cdn.jsdelivr.net/npm/@brimdata/zed-wasm@0.0.13/index.js"
)
Insert cell
Insert cell
result1
=
await
zed
.
zq
(
{
input
:
textInput
,
program
:
zedQuery1
}
)
Insert cell
Insert cell
result1
Filter
Columns
Sort
Slice
Save
Type Table, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
Insert cell
Insert cell
salesData
Filter
Columns
Sort
Slice
Save
Type Table, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
viewof
zedQuery2
=
Inputs
.
textarea
(
{
label
:
"Zed Query"
,
placeholder
:
"Enter a Zed query..."
,
value
:
"regionRevenue := sum(totalRevenue) by region"
}
)
Insert cell
result2
=
await
zed
.
zq
(
{
input
:
salesData
,
program
:
zedQuery2
}
)
Insert cell
result2
Filter
Columns
Sort
Slice
Save
Type Table, then Shift-Enter. Ctrl-space for more options.
Insert cell
Insert cell
schools
=
FileAttachment
(
"schools.zng"
)
Insert cell
Insert cell
viewof
zedQuery3
=
Inputs
.
textarea
(
{
label
:
"Zed Query"
,
value
:
"count() by County"
}
)
Insert cell
Insert cell
result3
=
await
zed
.
zq
(
{
input
:
await
schools
.
stream
(
)
,
program
:
zedQuery3
}
)
Insert cell
Insert cell
Plot
.
plot
(
{
width
:
1000
,
marginBottom
:
100
,
x
:
{
tickRotate
:
-
90
}
,
marks
:
[
Plot
.
barY
(
result3
,
{
x
:
"County"
,
y
:
"count"
,
sort
:
{
x
:
"y"
,
reverse
:
true
}
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
Insert cell
viewof
fileInput
=
Inputs
.
file
(
{
label
:
"Input Data File"
}
)
Insert cell
Insert cell
viewof
inputFormat
=
Inputs
.
select
(
[
"auto"
,
"arrows"
,
"csv"
,
"json"
,
"line"
,
"zeek"
,
"zjson"
,
"zng"
,
"zson"
]
,
{
label
:
"Input Format"
,
value
:
"line"
}
)
Insert cell
Insert cell
viewof
zedQuery4
=
Inputs
.
textarea
(
{
label
:
"Zed Query"
,
placeholder
:
"Enter a Zed query..."
,
value
:
'yield string(len(this)) + " characters: " + this'
}
)
Insert cell
Insert cell
result4
=
{
if
(
!
fileInput
)
return
[
{
message
:
"Choose a local text file for input"
}
]
;
console
.
log
(
fileInput
)
;
return
await
zed
.
zq
(
{
input
:
await
fileInput
.
stream
(
)
,
program
:
zedQuery4
,
inputFormat
:
inputFormat
}
)
;
}
Insert cell
Insert cell
Insert cell
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
textInput
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
zedQuery1
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
zed
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
result1
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
Zed_Query_Output
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
result1
File attachments
Databases
Filter
Column
Operator
Columns
Sort
Column
Direction
Descending
Ascending
Slice
From
Start
To
End
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
Sales_Data_Input
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
salesData
File attachments
Databases
Filter
Column
Operator
Columns
Sort
Column
Direction
Descending
Ascending
Slice
From
Start
To
End
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
zedQuery2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
result2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Revenue_by_Region
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
result2
File attachments
Databases
Filter
Column
Operator
Columns
Sort
Column
Direction
Descending
Ascending
Slice
From
Start
To
End
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
schools
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
zedQuery3
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
result3
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
fileInput
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
inputFormat
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
zedQuery4
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
result4
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