mirror of
https://github.com/olehomelchenko/minivlat-local-ua.git
synced 2025-12-21 13:12:23 +00:00
98 lines
2.0 KiB
JSON
98 lines
2.0 KiB
JSON
{
|
||
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
|
||
"title": {
|
||
"text": "Ціни на обслуговування в номері"
|
||
},
|
||
"data": {
|
||
"url": "data/stackedbarchart.csv"
|
||
},
|
||
"width": 600,
|
||
"height": 400,
|
||
"encoding": {
|
||
"x": {
|
||
"field": "CityUK",
|
||
"type": "nominal",
|
||
"axis": {
|
||
"title": "Місто",
|
||
"labelAngle": 40,
|
||
"titleFontWeight": "bold"
|
||
}
|
||
},
|
||
"y": {
|
||
"field": "value",
|
||
"type": "quantitative",
|
||
"axis": {
|
||
"title": "Ціна ($)",
|
||
"titleFontWeight": "bold",
|
||
"grid": true,
|
||
"gridDash": [1, 0],
|
||
"tickCount": 15
|
||
},
|
||
"scale": {
|
||
"domain": [
|
||
0,
|
||
70
|
||
]
|
||
}
|
||
},
|
||
"color": {
|
||
"field": "category",
|
||
"type": "nominal",
|
||
"scale": {
|
||
"domain": [
|
||
"Vodka",
|
||
"Soda",
|
||
"Peanut",
|
||
"Water",
|
||
"Sandwich"
|
||
],
|
||
"range": [
|
||
"#386cb0",
|
||
"#7fc97f",
|
||
"#beaed4",
|
||
"#fdc086",
|
||
"#fb9a99"
|
||
]
|
||
},
|
||
"legend": {
|
||
"title": null,
|
||
"orient": "right",
|
||
"labelExpr": "datum.label == 'Sandwich' ? 'Сендвіч' : datum.label == 'Water' ? 'Вода' : datum.label == 'Peanut' ? 'Арахіс' : datum.label == 'Soda' ? 'Газована вода' : 'Горілка'"
|
||
}
|
||
},
|
||
"order": {
|
||
"field": "order",
|
||
"type": "quantitative",
|
||
"sort": "descending"
|
||
}
|
||
},
|
||
"mark": "bar",
|
||
"transform": [
|
||
{
|
||
"fold": [
|
||
"Sandwich",
|
||
"Water",
|
||
"Peanut",
|
||
"Soda",
|
||
"Vodka"
|
||
],
|
||
"as": [
|
||
"category",
|
||
"value"
|
||
]
|
||
},
|
||
{
|
||
"calculate": "datum.category === 'Vodka' ? 1 : datum.category === 'Soda' ? 2 : datum.category === 'Peanut' ? 3 : datum.category === 'Water' ? 4 : 5",
|
||
"as": "order"
|
||
}
|
||
],
|
||
"config": {
|
||
"axis": {
|
||
"grid": true,
|
||
"gridColor": "#ddd"
|
||
},
|
||
"view": {
|
||
"stroke": null
|
||
}
|
||
}
|
||
} |