Skip to content

Commit

Permalink
fix(BarChart): Compatibility with Svelte 3/4 after accidental introdu…
Browse files Browse the repository at this point in the history
…ction of typescript in markup
  • Loading branch information
techniq committed Jan 16, 2025
1 parent bec9207 commit 59dc772
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-apes-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

fix(BarChart): Compatibility with Svelte 3/4 after accidental introduction of typescript in markup
5 changes: 3 additions & 2 deletions packages/layerchart/src/lib/components/charts/BarChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
findRelatedData,
type Accessor,
} from '../../utils/common.js';
import { asAny } from '../../utils/types.js';
type ChartProps = ComponentProps<Chart<TData>>;
Expand Down Expand Up @@ -343,7 +344,7 @@
{@const seriesItems = stackSeries ? [...series].reverse() : series}
{#each seriesItems as s}
{@const seriesTooltipData = s.data ? findRelatedData(s.data, data, x) : data}
{@const valueAccessor = accessor(s.value ?? (s.data ? (y as any) : s.key))}
{@const valueAccessor = accessor(s.value ?? (s.data ? asAny(y) : s.key))}
<Tooltip.Item
label={s.label ?? (s.key !== 'default' ? s.key : 'value')}
value={seriesTooltipData ? valueAccessor(seriesTooltipData) : null}
Expand All @@ -360,7 +361,7 @@
label="total"
value={sum(series, (s) => {
const seriesTooltipData = s.data ? findRelatedData(s.data, data, x) : data;
const valueAccessor = accessor(s.value ?? (s.data ? (y as any) : s.key));
const valueAccessor = accessor(s.value ?? (s.data ? asAny(y) : s.key));
return valueAccessor(seriesTooltipData);
})}
format="integer"
Expand Down

0 comments on commit 59dc772

Please sign in to comment.