Grouped pointer tooltips
<Plot
y={{ type: 'log', grid: true }}
color={{ legend: true }}
marginRight={20}>
<Line
data={stocks2}
x="Date"
opacity={sel.length > 0 ? 0.4 : 1}
y="Close"
stroke="Symbol" />
<Pointer
data={stocks2}
x="Date"
z="Symbol"
onupdate={(e) => (sel = e)}
maxDistance={30}>
{#snippet children({ data })}
<Text
{data}
fill="Symbol"
stroke="var(--svelteplot-bg)"
strokeWidth={3}
x="Date"
y="Close"
text={(d) => d.Close.toFixed()}
lineAnchor="bottom"
fontWeight="bold"
dy={-3} />
<Dot
{data}
x="Date"
y="Close"
fill="Symbol"
strokeWidth={0.7}
stroke="var(--svelteplot-bg)" />
{/snippet}
</Pointer>
</Plot>
Open in Svelte playground