Skip to content

Commit 2e7b434

Browse files
committed
Simplify examples
1 parent 8ae2a3c commit 2e7b434

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { scaleLinear, scaleRadial, scaleUtc } from 'd3-scale';
3-
import { flatGroup, max, min, range } from 'd3-array';
3+
import { flatGroup, range } from 'd3-array';
44
import { curveLinearClosed, curveCatmullRomClosed, curveCatmullRom } from 'd3-shape';
55
import { PeriodType, cls } from 'svelte-ux';
66
@@ -25,28 +25,23 @@
2525

2626
<h1>Examples</h1>
2727

28-
<h2>Complex</h2>
28+
<h2>Line with Area</h2>
2929

30-
<Preview data={data.sfoTemperature}>
30+
<Preview data={data.sfoTemperatures}>
3131
<div class="h-[500px] p-4 border rounded">
3232
<Chart
33-
data={data.sfoTemperature}
33+
data={data.sfoTemperatures}
3434
x="date"
3535
xScale={scaleUtc()}
36-
xDomain={[new Date('2000-01-01'), new Date('2001-01-01') - 1]}
3736
xRange={[0, 2 * Math.PI]}
38-
y="avg"
37+
y={['minmin', 'maxmax']}
3938
yScale={scaleRadial()}
40-
yDomain={[
41-
min(data.sfoTemperature, (d) => d.minmin),
42-
max(data.sfoTemperature, (d) => d.maxmax),
43-
]}
4439
yRange={({ height }) => [height / 5, height / 2]}
4540
let:yScale
4641
>
4742
<Svg>
4843
<Group center>
49-
<Spline radial curve={curveCatmullRom} class="stroke-primary" />
44+
<Spline y={(d) => yScale(d.avg)} radial curve={curveCatmullRom} class="stroke-primary" />
5045
<Area
5146
radial
5247
y0={(d) => yScale(d.min)}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function load() {
1313
return { ...d, value: celsiusToFahrenheit(d.value) };
1414
});
1515
}),
16-
sfoTemperature: await fetch('/data/examples/sfo-temperature.csv').then(async (r) => {
16+
sfoTemperatures: await fetch('/data/examples/sfoTemperatures.csv').then(async (r) => {
1717
return flatGroup(
1818
csvParse(await r.text(), autoType),
1919
(d) => new Date(Date.UTC(2000, d.date.getUTCMonth(), d.date.getUTCDate())) // group by day of year

packages/layerchart/static/data/examples/sfo-temperature.csv renamed to packages/layerchart/static/data/examples/sfoTemperatures.csv

File renamed without changes.

0 commit comments

Comments
 (0)