Platform
Resources
Pricing
Sign in
Get started
Chris Henrick
Maps, Data, Viz, UX, Design
Workspace
Fork
Published
data visualization
By
Chris Henrick
Edited
Mar 23, 2018
1 fork
2 stars
Insert cell
Insert cell
MapdCon
=
require
(
"https://rawgit.com/mapd/mapd-connector/master/dist/browser-connector.js"
)
.
catch
(
(
)
=>
new
window
.
MapdCon
)
Insert cell
connector
=
new
Promise
(
(
resolve
,
reject
)
=>
MapdCon
.
protocol
(
"https"
)
.
host
(
"metis.mapd.com"
)
.
port
(
"443"
)
.
dbName
(
"mapd"
)
.
user
(
"mapd"
)
.
password
(
"HyperInteractive"
)
.
connect
(
(
error
,
connector
)
=>
{
if
(
error
)
reject
(
error
)
;
else
resolve
(
connector
)
;
}
)
)
Insert cell
tables
=
{
const
result
=
await
connector
.
getTablesAsync
(
)
return
result
.
map
(
d
=>
d
.
name
)
}
Insert cell
Insert cell
{
const
n
=
await
connector
.
queryAsync
(
`SELECT
COUNT(*) AS n
FROM flights_donotmodify`
)
return
n
[
0
]
.
n
}
Insert cell
Insert cell
new
Promise
(
(
resolve
,
reject
)
=>
{
connector
.
getFields
(
"flights_donotmodify"
,
(
error
,
results
)
=>
{
if
(
error
)
reject
(
error
)
;
else
resolve
(
results
)
;
}
)
;
}
)
Insert cell
Insert cell
data
=
connector
.
queryAsync
(
`SELECT
carrier_name,
AVG(airtime) AS avg_airtime,
origin_city
FROM flights_donotmodify
WHERE airtime IS NOT NULL
GROUP BY carrier_name, origin_city
LIMIT 100`
)
Insert cell
Insert cell
vegalite
(
{
data
:
{
values
:
data
}
,
mark
:
{
type
:
"bar"
}
,
width
,
height
:
600
,
autosize
:
"fit"
,
encoding
:
{
x
:
{
field
:
"carrier_name"
,
type
:
"nominal"
,
sort
:
null
}
,
y
:
{
field
:
"avg_airtime"
,
type
:
"quantitative"
}
,
color
:
{
field
:
"origin_city"
}
}
}
)
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
MapdCon
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
connector
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tables
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
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
vegalite
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML