Hi, How to use {Legend, Swatches} in Observable Framework?
I need add legend to each chart, I’m using d3.js and I’m trying to use function legend-swatches, but the result is displayed outside of the div:
this is the code for the legend
const display_legend = view(chartSwatches(d3.scaleOrdinal(allSegments, d3.schemeCategory10), {
columns: "80px"
}))
…and this is for each chart:
<div class="grid grid-cols-3">
<div class="card">
<h2>Por Banca</h2>
${resize((width) => barr_variation(data_for_bar_variation,{width}))}
</div>
<div class="card">
<h2>Por Banca</h2>
${resize((width) => barr_variation(tipoOpe_for_bar_variation,{width}))}
</div>
<div class="card">
<h2>Por Banca</h2>
${resize((width) => barr_variation(tipoOpe_for_bar_variation,{width}))}
</div>
</div>
thank you in advance