Platform
Resources
Pricing
Sign in
Get started
Emu Analytics
Workspace
Fork
Public
By
Robin Summerhill
Edited
Jul 31
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
<
flow-ui-alert
variant
=
"success"
open
>
Welcome to Flo.w RDF v4
</
flow-ui-alert
>
Insert cell
{
const
button
=
html
`<flow-ui-button variant="primary">Click Me</flow-ui-button>`
;
button
.
addEventListener
(
"click"
,
(
)
=>
console
.
log
(
"Hello from Flo.w RDF UI"
)
)
;
return
button
;
}
Insert cell
Insert cell
<
div
>
<
flow-ui-icon
name
=
"fas-house"
>
</
flow-ui-icon
>
<
flow-ui-icon
name
=
"fas-gear"
>
</
flow-ui-icon
>
<
flow-ui-icon
name
=
"fas-heart"
>
</
flow-ui-icon
>
<
flow-ui-icon
name
=
"unknown"
>
</
flow-ui-icon
>
</
div
>
Insert cell
Insert cell
viewof
timeVal
=
Flow
.
bindControl
(
html
`<flow-ui-timer running style="width: 300px;"><flow-ui-timer>`
)
Insert cell
timeVal
Insert cell
Insert cell
viewof
rangeVal
=
Flow
.
bindControl
(
html
`<flow-ui-range style="width: 300px;"></flow-ui-range>`
,
"flow-ui-input"
)
Insert cell
rangeVal
Insert cell
Insert cell
viewof
inputVal
=
Flow
.
bindControl
(
html
`<input placeholder="Enter a value"></input>`
,
"input"
)
Insert cell
inputVal
Insert cell
Insert cell
Insert cell
viewof
qb
=
Flow
.
queryBuilder
(
qbConfig
,
{
condition
:
"and"
,
rules
:
[
{
enabled
:
true
}
]
}
)
Insert cell
Insert cell
qbConfig
=
Flow
.
queryBuilderConfig
(
{
datasetId
:
"airquality"
,
size
:
"small"
,
// Extra fields or overrides
fields
:
{
field1
:
{
name
:
"Field 1"
,
type
:
"string"
}
}
}
)
Insert cell
console
.
log
(
qbConfig
)
Insert cell
Insert cell
Insert cell
Insert cell
Flow
.
ui
.
flowQueryConverter
(
qb
,
qbConfig
)
Insert cell
Insert cell
Flow
.
ui
.
mapLayerFilterConverter
(
qb
,
qbConfig
)
Insert cell
Insert cell
Insert cell
viewof
mainMap
=
Flow
.
map
(
{
id
:
"main-map"
,
center
:
[
-
0.1
,
51.5
]
,
zoom
:
10
,
height
:
"500px"
,
timer
:
true
// Display a timer control on the map
}
)
Insert cell
Insert cell
popupTemplate
=
{
// Popup header template
const
popupHeaderTemplate
=
(
title
)
=>
Flow
.
html
`<h4>${
title
}</h4>`
;
// Table header template
const
tableHeaderTemplate
=
(
)
=>
Flow
.
html
`<thead><tr><th>Property</th><th>Value</th></tr></thead>`
;
// Property row template
const
rowTemplate
=
(
props
,
key
)
=>
Flow
.
html
`<tr><td>${
key
}</td><td>${
props
[
key
]
}</td></tr>`
;
// Main popup template
return
(
feature
)
=>
Flow
.
html
`
${
popupHeaderTemplate
(
feature
.
properties
.
name
)
}
<table>
${
tableHeaderTemplate
(
)
}
${
Object
.
keys
(
feature
.
properties
)
.
filter
(
(
key
)
=>
key
!==
"name"
)
.
map
(
(
key
)
=>
rowTemplate
(
feature
.
properties
,
key
)
)
}
</table>
`
;
}
Insert cell
Insert cell
{
mainMap
.
popupPlugin
.
registerPopup
(
"popup"
,
{
content
:
popupTemplate
}
)
;
const
source
=
new
Flow
.
MapDataSource
(
{
id
:
"airquality"
,
type
:
"vector"
,
src
:
"airquality"
,
featureId
:
"label"
}
)
;
const
circleLayer
=
new
Flow
.
MapLayer
(
{
id
:
"circle-layer"
,
type
:
"circle"
,
source
:
"airquality"
,
style
:
Flow
.
layerStyle
(
"circle"
)
.
circleColor
(
Flow
.
expr
(
`@no2 ? from-palette('YlOrRd', @no2, 0, 100) : gray`
)
)
.
circleStrokeWidth
(
Flow
.
expr
(
"@@hover ? 5 : 0"
)
)
.
circleRadius
(
Flow
.
expr
(
`@no2 ? @no2 / 5 : 5`
)
)
.
build
(
)
}
)
;
const
symbolStyle
=
Flow
.
layerStyle
(
"symbol"
)
.
visibility
(
true
)
.
textField
(
Flow
.
expr
(
"@name"
)
)
.
textColor
(
"white"
)
.
textSize
(
Flow
.
expr
(
"interpolate(linear(), zoom(), 10, 10, 15, 20)"
)
)
.
textVariableAnchor
(
[
"top"
,
"left"
]
)
.
textRadialOffset
(
0.5
)
.
build
(
)
;
const
symbolLayer
=
new
Flow
.
MapLayer
(
{
id
:
"symbol-layer"
,
type
:
"symbol"
,
source
:
"airquality"
,
interactive
:
false
,
style
:
symbolStyle
}
)
;
mainMap
.
transaction
(
(
)
=>
{
mainMap
.
addSource
(
source
)
;
mainMap
.
addLayer
(
circleLayer
)
;
mainMap
.
addLayer
(
symbolLayer
)
;
}
)
;
mainMap
.
selectionPlugin
.
enableSelection
(
"airquality"
,
{
mode
:
"multi"
,
popup
:
"popup"
}
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Flow
.
mapClickedFeature
(
mainMap
)
Insert cell
Insert cell
Flow
.
mapSelection
(
mainMap
,
"airquality"
)
Insert cell
Insert cell
time
=
Flow
.
stateGet
(
"time"
)
Insert cell
Insert cell
viewof
selectedNumber
=
Inputs
.
range
(
[
0
,
10
]
,
{
label
:
"Select a value:"
,
step
:
0.5
}
)
Insert cell
Flow
.
stateSet
(
"numberVal"
,
selectedNumber
)
Insert cell
num
=
Flow
.
stateGet
(
"numberVal"
)
Insert cell
Insert cell
Flow
.
datasetSummary
(
"airquality"
,
{
headingLevel
:
4
}
)
Insert cell
viewof
selected
=
Flow
.
datasetQueryTable
(
{
datasetId
:
"airquality"
}
)
Insert cell
Insert cell
config
=
{
return
{
host
:
"https://flow.flow-ng.emu-analytics.net"
,
apiKey
:
"f7748763-e75f-4a79-a40a-92148855da49"
,
state
:
{
numberVal
:
0
,
time
:
new
Date
(
)
.
toISOString
(
)
,
timerRunning
:
true
}
,
enableDebug
:
true
,
version
:
"^4.0.4"
}
;
}
Insert cell
Insert cell
Insert cell
Flow
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
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
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
timeVal
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
rangeVal
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
inputVal
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
qb
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
qbConfig
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
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
mainMap
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
popupTemplate
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
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
time
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
selectedNumber
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
num
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
selected
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
config
Add comment
Copy import
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML