Skip to content

Commit c813993

Browse files
committed
fix: layerchart template (and use simplified AreaChart)
1 parent bbc80a3 commit c813993

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

.changeset/six-beds-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-svelte-ux': patch
3+
---
4+
5+
fix: `layerchart` template (and use simplified AreaChart)
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
11
<script lang="ts">
2-
import { Area, Axis, Chart, Highlight, Svg, Tooltip, TooltipItem } from 'layerchart';
3-
import { PeriodType, format } from 'svelte-ux';
4-
import { scaleTime } from 'd3-scale';
2+
import { AreaChart } from 'layerchart';
53
64
import { data } from './data';
75
</script>
86

97
<main class="p-2">
108
<h1 class="text-xl font-semibold mb-1">Area example</h1>
119
<div class="h-[300px] p-4 border rounded">
12-
<Chart
13-
{data}
14-
x="date"
15-
xScale={scaleTime()}
16-
y="value"
17-
yDomain={[0, null]}
18-
yNice
19-
padding={{ left: 16, bottom: 24 }}
20-
tooltip
21-
>
22-
<Svg>
23-
<Axis placement="left" grid rule />
24-
<Axis placement="bottom" format={(d) => format(d, PeriodType.Day, 'short')} rule />
25-
<Area line={{ class: 'stroke-2 stroke-primary' }} class="fill-primary/30" />
26-
<Highlight points lines />
27-
</Svg>
28-
29-
<Tooltip header={(data) => format(data.date, PeriodType.Day)} let:data>
30-
<TooltipItem label="value" value={data.value} />
31-
</Tooltip>
32-
</Chart>
10+
<AreaChart {data} x="date" y="value" />
3311
</div>
3412
</main>

0 commit comments

Comments
 (0)