viewof view = {
let result = embed({
data : { values : topTen },
encoding : {
y : { field : 'text', type : 'ordinal', sort : 'rel', axis : { labels : false } }
},
layer : [ {
mark : { type : 'bar', color : '#ffbf79' },
encoding : {
x : { field : 'rel', type : 'quantitative', scale : { domain : [ 0, 1 ] } }
}
}, {
mark : {
type : 'text',
align : 'left',
baseline : 'middle'
},
encoding : {
text : { field : 'text', type : 'nominal' },
x : { value : 10 }
}
}
],
width : 600
});
return result;
}