Published
Edited
Nov 24, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof dia3 = embed(vega_gold_bars)
Insert cell
vega_gold_bars
= {
let obj = {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"title" : {
"fontSize" : 24,
"anchor" : "start",
"text" : "Слои"
},
"width" : 600,
"height" : 400

}
//data
obj.data = {
"values" : chinaVSusa
};

obj.mark = "line";
/*
obj.encoding = {
"color": {"value": "#d4af37"},
"x": {"field": "Data", "type": "temporal" , "title" : "Year"},
"y": {"field": "Китай",
"type": "quantitative" ,
"title" : "Price, $" ,
"axis" : {
"format" : "f",
"tickCount": 5
}
}
}
*/
obj.layer = [
{
"mark" : {"type" : "bar" , "xOffset": -2 , "width" : 4},
encoding : {
"color": {"value": "#e53434"},
"x": {"field": "Data", "type": "temporal" , "title" : "Год"},
"y": {"field": "Китай",
"type": "quantitative" ,
"title" : "Выбросы углекислого газа, ppm" ,
"axis" : {
"format" : "f",
"tickCount": 3
}
}
}
}, //one
{
"mark" : {"type" : "bar" , "xOffset": 2 },
encoding : {
"color": {"value": "#1386f2"},
"x": {"field": "Data", "type": "temporal" },
"y": {"field": "США",
"type": "quantitative" ,
}
}
}, //two
]



return obj;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chinaVSusa = {return await FileAttachment("china_vs_usa_co2_2.csv").csv() } //Ctrl + Shift + U
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