Published
Edited
Oct 26, 2020
Insert cell
md`# My lesson`
Insert cell
Insert cell
vega_gold = {
let obj = {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"title" : {
"fontSize" : 24,
"anchor" : "start",
"text" : "Gold Prices over time"
},
"width" : 800,
"height" : 600
}
//data
obj.data = {
"values" : gold_fixed
};
obj.mark = "line"
obj.encoding = {
"color": {"value": "#d4af37"},
"x": {"field": "date", "type": "temporal" , "title" : "Year"},
"y": {"field": "price",
"type": "quantitative" ,
"title" : "Price, $" ,
"axis" : {
"format" : "f",
"tickCount": 5
}
}
}

return obj;
}
Insert cell
gold_fixed //Shift + Enter

Insert cell
embed = require( "vega-embed@6" )
Insert cell
import { gold_fixed } from "@glebtr/vega-start"
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