Published
Edited
Sep 22, 2022
Insert cell
Insert cell
Insert cell
Insert cell
cars = data['cars.json']()
Insert cell
Inputs.table(cars)
Insert cell
Insert cell
barChart = {
const bars = vl.markBar()
.title('Potência em cavalos por ano de fabricação')
.data(cars)
.encode(
vl.x().fieldN('Year')
.timeUnit('year')
.sort(vl.average('Horsepower').order('descending'))
.title('Ano de Fabricação'),
vl.y().fieldQ('Horsepower').aggregate('average')
.title('Cavalos')
)
.width(800)
.height(300)

return bars.render()
}
Insert cell
Insert cell
scatterplot = {
const colors = {
domain: ['USA', 'Japan', 'Europe'],
range: ['#F5B041 ', '#AF7AC5 ', '#7DCEA0']
};

return vl.markPoint()
.encode(
vl.x().fieldQ('Horsepower').title('Potência em Cavalos'),
vl.y().fieldQ('Acceleration').title('Aceleração'),
vl.color().fieldN('Origin').scale(colors)
)
.width(250)
.height(200)
.facet({column: vl.field('Origin')})
.data(cars)
.render();
}
Insert cell
Insert cell
> Modifique esta célula com o link:
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
data = require('vega-datasets')
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