Skip to content

Commit

Permalink
Update bar highlight examples to only fill-gray when chart is hovered
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Oct 13, 2023
1 parent c93f8e1 commit ed04294
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/routes/docs/examples/Bars/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<h2>with Tooltip and Bar Highlight</h2>

<Preview>
<div class="h-[300px] p-4 border rounded">
<div class="h-[300px] p-4 border rounded group">
<Chart
{data}
x="value"
Expand All @@ -161,7 +161,11 @@
<Svg>
<Axis placement="bottom" grid rule />
<Axis placement="left" format={(d) => formatDate(d, PeriodType.Day, 'short')} rule />
<Bars radius={4} strokeWidth={1} class="fill-gray-300" />
<Bars
radius={4}
strokeWidth={1}
class="fill-accent-500 group-hover:fill-gray-300 transition-colors"
/>
<Highlight area bar={{ class: 'fill-accent-500', strokeWidth: 1, radius: 4 }} />
</Svg>
<Tooltip header={(data) => format(data.date, 'eee, MMMM do')} let:data>
Expand Down
10 changes: 7 additions & 3 deletions src/routes/docs/examples/Columns/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<h2>with Tooltip and Bar Highlight</h2>

<Preview>
<div class="h-[300px] p-4 border rounded">
<div class="h-[300px] p-4 border rounded group">
<Chart
{data}
x="date"
Expand All @@ -162,8 +162,12 @@
<Svg>
<Axis placement="left" grid rule />
<Axis placement="bottom" format={(d) => formatDate(d, PeriodType.Day, 'short')} rule />
<Bars radius={4} strokeWidth={1} class="fill-gray-300" />
<Highlight area bar={{class: "fill-accent-500", strokeWidth: 1, radius: 4}} />
<Bars
radius={4}
strokeWidth={1}
class="fill-accent-500 group-hover:fill-gray-300 transition-colors"
/>
<Highlight area bar={{ class: 'fill-accent-500', strokeWidth: 1, radius: 4 }} />
</Svg>
<Tooltip header={(data) => format(data.date, 'eee, MMMM do')} let:data>
<TooltipItem label="value" value={data.value} />
Expand Down

1 comment on commit ed04294

@vercel
Copy link

@vercel vercel bot commented on ed04294 Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.