42 lines
2.7 KiB
HTML
42 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<style>
|
|
#vis.vega-embed {
|
|
width: 100%;
|
|
display: flex;
|
|
}
|
|
|
|
#vis.vega-embed details,
|
|
#vis.vega-embed details summary {
|
|
position: relative;
|
|
}
|
|
</style>
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega@6"></script>
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-lite@6.1.0"></script>
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-embed@7"></script>
|
|
</head>
|
|
<body>
|
|
<div id="vis"></div>
|
|
<script>
|
|
(function(vegaEmbed) {
|
|
var spec = {"usermeta": {"embedOptions": {"theme": "dark"}}, "config": {"view": {"continuousWidth": 300, "continuousHeight": 300}, "axis": {"grid": true, "labelFont": "Segoe UI Variable", "labelFontSize": 16, "labelFontWeight": 400, "titleFont": "Segoe UI Variable", "titleFontSize": 18, "titleFontWeight": 600}, "title": {"anchor": "middle", "font": "Segoe UI Variable", "fontSize": 20, "fontWeight": 600}}, "data": {"name": "data-1e6a838a8ad1a28c1e6f465de44aa528"}, "mark": {"type": "bar", "cornerRadius": 6, "height": 35}, "background": "#00000000", "encoding": {"color": {"field": "category", "legend": null, "scale": {"scheme": "set2"}, "type": "nominal"}, "tooltip": [{"field": "category", "type": "nominal"}, {"field": "value", "type": "quantitative"}], "x": {"field": "value", "title": "\u0421\u0443\u043c\u043c\u0430", "type": "quantitative"}, "y": {"axis": {"labelLimit": 200}, "field": "category", "sort": "-x", "title": "\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438", "type": "nominal"}}, "height": 400, "padding": 50, "title": "\u0420\u0430\u0441\u0445\u043e\u0434\u044b \u043f\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c", "width": 700, "$schema": "https://vega.github.io/schema/vega-lite/v6.1.0.json", "datasets": {"data-1e6a838a8ad1a28c1e6f465de44aa528": [{"category": "ent", "value": 1055}, {"category": "super", "value": 2421}, {"category": "transport", "value": 5871}, {"category": "shopping", "value": 737}, {"category": "hotel", "value": 430}, {"category": "avia", "value": 882}]}};
|
|
var embedOpt = {"mode": "vega-lite"};
|
|
|
|
function showError(el, error){
|
|
el.innerHTML = ('<div style="color:red;">'
|
|
+ '<p>JavaScript Error: ' + error.message + '</p>'
|
|
+ "<p>This usually means there's a typo in your chart specification. "
|
|
+ "See the javascript console for the full traceback.</p>"
|
|
+ '</div>');
|
|
throw error;
|
|
}
|
|
const el = document.getElementById('vis');
|
|
vegaEmbed("#vis", spec, embedOpt)
|
|
.catch(error => showError(el, error));
|
|
})(vegaEmbed);
|
|
|
|
</script>
|
|
</body>
|
|
</html> |