<div class="notebook">
<div class="nb-cell html" name="htm1">
<title>Vega-Lite Bar Chart</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vega@6.2.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@6.4.1"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@7.0.2"></script>
<style media="screen">
/* Add space between Vega-Embed links */
.vega-actions a {
margin-right: 5px;
}
</style>
<h1>Template for Embedding Vega-Lite Visualization</h1>
<!-- Container for the visualization -->
<div id="vis"></div>
<script>
// Assign the specification to a local variable vlSpec.
var vlSpec = {
$schema: 'https://vega.github.io/schema/vega-lite/v6.json',
data: {
values: [
{a: 'C', b: 2},
{a: 'C', b: 7},
{a: 'C', b: 4},
{a: 'D', b: 1},
{a: 'D', b: 2},
{a: 'D', b: 6},
{a: 'E', b: 8},
{a: 'E', b: 4},
{a: 'E', b: 7},
],
},
mark: 'bar',
encoding: {
y: {field: 'a', type: 'nominal'},
x: {
aggregate: 'average',
field: 'b',
type: 'quantitative',
axis: {
title: 'Average of b',
},
},
},
};
// Embed the visualization in the container with id `vis`
vegaEmbed('#vis', vlSpec);
</script>
</div>
</div>