Skip to content

Commit

Permalink
Highlight yearToDate series on mouse over
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Sep 24, 2023
1 parent 97f5022 commit 08b3a26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/routes/analysis/yearToDate/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
yNice
padding={{ left: 32, bottom: 24, right: 32 }}
tooltip={{ mode: 'voronoi', snapToDataX: true, snapToDataY: true }}
let:tooltip
>
<Svg>
<Axis placement="left" grid={{ style: 'stroke-dasharray: 2' }} rule format="metric" />
<Axis placement="bottom" rule ticks={0} />
{#each data.valuesByYear.sort(createPropertySortFunc((d) => d[0])) as [year, yearData], i}
{@const color = colorScale(year)}
{@const color =
tooltip.data == null || tooltip.data.start_date.getFullYear() === year
? colorScale(year)
: '#ddd'}
<Spline data={yearData.values} width={2} stroke={color}>
<svelte:fragment slot="end">
<circle r={3} fill={color} />
Expand Down

0 comments on commit 08b3a26

Please sign in to comment.