Skip to content

Commit ac6cf3f

Browse files
committed
Move opacity scale and data grouping to <Preview> for better readability
1 parent e7b41ca commit ac6cf3f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • packages/layerchart/src/routes/docs/examples/RadialLine

packages/layerchart/src/routes/docs/examples/RadialLine/+page.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
1515
export let data;
1616
17-
$: opacityScale = scaleLinear().domain([1940, 2024]).range([0.1, 0.2]);
18-
$: dataByYear = flatGroup(data.dailyTemperatures, (d) => d.year);
19-
2017
/**
2118
* TODO:
2219
* - [ ] Tooltip (manual with path, radial bisect?). Work with Highlight
@@ -25,7 +22,7 @@
2522

2623
<h1>Examples</h1>
2724

28-
<h2>Line with Area</h2>
25+
<h2>Line with Areas</h2>
2926

3027
<Preview data={data.sfoTemperatures}>
3128
<div class="h-[500px] p-4 border rounded">
@@ -64,7 +61,7 @@
6461
</div>
6562
</Preview>
6663

67-
<h2>Multi line</h2>
64+
<h2>Multi-year Lines</h2>
6865

6966
<Preview data={data.dailyTemperatures}>
7067
<div class="h-[500px] p-4 border rounded">
@@ -78,10 +75,13 @@
7875
_yRange={({ height }) => [0, height / 2]}
7976
yRange={({ height }) => [height / 5, height / 2]}
8077
yPadding={[0, 20]}
78+
zDomain={[1940, 2024]}
79+
zRange={[0.1, 0.2]}
80+
let:zScale
8181
>
8282
<Svg>
8383
<Group center>
84-
{#each dataByYear as [year, yearData]}
84+
{#each flatGroup(data.dailyTemperatures, (d) => d.year) as [year, yearData]}
8585
<Spline
8686
data={yearData}
8787
radial
@@ -93,7 +93,7 @@
9393
? 'stroke-primary/50'
9494
: 'stroke-surface-content'
9595
)}
96-
opacity={[2023, 2024].includes(year) ? 1 : opacityScale(year)}
96+
opacity={[2023, 2024].includes(year) ? 1 : zScale(year)}
9797
/>
9898
{/each}
9999
<Axis placement="angle" grid format={PeriodType.Month} />

0 commit comments

Comments
 (0)