Published
Edited
Jul 21, 2021
1 fork
3 stars
Insert cell
Insert cell
import { br, estados_e_capitais } from "@dan-reznik/brasil-estados-e-capitais"
Insert cell
br
Insert cell
estados_e_capitais.view()
Insert cell
import { vl } from "@vega/vega-lite-api-v5"
Insert cell
vl
.markGeoshape()
.data(vl.topojson(br).feature("estados"))
.project(vl.projection("mercator"))
.render()
Insert cell
vl
.markGeoshape({ fill: "green", stroke: "blue", strokeWidth: 2 })
.data(vl.topojson(br).feature("estados"))
.project(vl.projection("mercator"))
.render()
Insert cell
vl
.layer(
vl
.markGeoshape({ fill: "green", stroke: "yellow", strokeWidth: 1 })
.data(vl.topojson(br).feature("estados")),
vl
.markCircle({ fill: "white" })
.data(estados_e_capitais)
.encode(
vl.longitude().fieldQ("longitude_2"),
vl.latitude().fieldQ("latitude_2")
)
)
.project(vl.projection("mercator"))
.render()
Insert cell
vl
.layer(
vl
.markGeoshape({ fill: "green", stroke: "yellow", strokeWidth: 1 })
.data(vl.topojson(br).feature("estados")),
vl
.markCircle({ fill: "white" })
.data(estados_e_capitais)
.encode(
vl.longitude().fieldQ("longitude_2"),
vl.latitude().fieldQ("latitude_2")
),
vl
.markText({ fill: "white", dy: -10 })
.data(estados_e_capitais)
.encode(
vl.longitude().fieldQ("longitude_2"),
vl.latitude().fieldQ("latitude_2"),
vl.text().fieldN("nome_2")
)
)
.project(vl.projection("mercator"))
.render()
Insert cell
vl
.layer(
vl
.markGeoshape({ fill: "green", stroke: "yellow", strokeWidth: 1 })
.data(vl.topojson(br).feature("estados")),
vl
.markCircle({ fill: "white" })
.data(estados_e_capitais)
.encode(
vl.longitude().fieldQ("longitude_2"),
vl.latitude().fieldQ("latitude_2")
),
vl
.markText({ fill: "white", dy: -10 })
.data(estados_e_capitais)
.encode(
vl.longitude().fieldQ("longitude_2"),
vl.latitude().fieldQ("latitude_2"),
vl.text().fieldN("nome_2")
)
)
.project(vl.projection("mercator"))
.background('gray')
.width(800)
.height(800)
.config({ view: { stroke: null } })
.render()
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.
Learn more