通过好的问题和答案,我的意思是:
我将示例从vega-embed
复制到了snippet
,但是在html
部分比我期望的要大一些。
点击运行以查看字符,您可以通过编辑以上代码段链接对其进行编辑。
var yourVlSpec = {
"$schema": "https://vega.github.io/schema/vega-lite/v2.0.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
{"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
{"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
}
}
vegaEmbed("#vis", yourVlSpec,{actions:{export: false, source: false}});
<script src="https://cdn.jsdelivr.net/npm/vega@3"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3">
</script>
<body>
<div id="vis"></div>
</body>