Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/examples/components/ScatterChart/basic.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
export { data };
</script>

<ScatterChart {data} x="x" y="y" padding={24} height={400} />
<ScatterChart {data} xNice x="x" y="y" padding={24} height={400} />
1 change: 1 addition & 0 deletions docs/src/examples/components/ScatterChart/brush.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
props={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export { data };
</script>

<ScatterChart {data} x="x" y="y" padding={24} height={400}>
<ScatterChart {data} xNice x="x" y="y" padding={24} height={400}>
{#snippet tooltip({ context })}
<Tooltip.Root
x={context.padding.left}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/components/ScatterChart/custom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export { data };
</script>

<ScatterChart {data} x="x" y="y" padding={24} height={400}>
<ScatterChart {data} xNice x="x" y="y" padding={24} height={400}>
{#snippet children({ context })}
<Layer>
<Axis placement="left" grid rule />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ScatterChart
{data}
xNice
x="date"
y="value"
yBaseline={0}
Expand Down
10 changes: 8 additions & 2 deletions docs/src/examples/components/ScatterChart/domain-nice.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { getSpiral } from '$lib/utils/data.js';
import Blockquote from '$lib/components/Blockquote.svelte';

const data = getSpiral({ angle: 137.5, radius: 10, count: 100, width: 500, height: 500 });

let applyNice = $state(true);
setInterval(() => {
applyNice = !applyNice;
}, 5000);

export { data };
</script>

<ScatterChart {data} x="x" y="y" xNice yNice padding={24} height={400} />
{applyNice ? 'Applying Nice' : 'Not applying Nice'}
<ScatterChart {data} x="x" y="y" xNice={applyNice} yNice={applyNice} padding={24} height={400} />
2 changes: 1 addition & 1 deletion docs/src/examples/components/ScatterChart/labels.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
export { data };
</script>

<ScatterChart {data} x="x" y="y" labels padding={24} height={400} />
<ScatterChart {data} xNice x="x" y="y" labels padding={24} height={400} />
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
annotations={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
annotations={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
annotations={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
annotations={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
annotations={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { ScatterChart, defaultChartPadding } from 'layerchart';
import { getPenguins } from '$lib/data.remote';
import { flatGroup } from 'd3-array';

Expand All @@ -15,13 +15,15 @@
</script>

<ScatterChart
xNice
x="flipper_length_mm"
y="bill_length_mm"
series={data.map(([species, data], i) => {
const color = ['var(--color-primary)', 'var(--color-secondary)', 'var(--color-success)'][i];
return {
key: species,
label: species + ' 🐧',
fontSize: 16,
data,
color,
props: {
Expand All @@ -31,6 +33,6 @@
};
})}
legend
padding={{ left: 10, top: 10, right: 10, bottom: 48 }}
padding={{ ...defaultChartPadding, top: 20, bottom: 48, left: 20, right: 20 }}
height={400}
/>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { ScatterChart, defaultChartPadding } from 'layerchart';
import { getPenguins } from '$lib/data.remote';
import { flatGroup } from 'd3-array';

Expand All @@ -15,6 +15,7 @@
</script>

<ScatterChart
xNice
x="flipper_length_mm"
y="bill_length_mm"
series={data.map(([species, data], i) => {
Expand All @@ -30,6 +31,6 @@
};
})}
legend
padding={{ left: 10, top: 10, right: 10, bottom: 48 }}
padding={{ ...defaultChartPadding, top: 20, bottom: 48, left: 20, right: 20 }}
height={400}
/>
5 changes: 3 additions & 2 deletions docs/src/examples/components/ScatterChart/series-tween.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { ScatterChart, defaultChartPadding } from 'layerchart';
import { getPenguins } from '$lib/data.remote';
import { flatGroup } from 'd3-array';

Expand All @@ -15,6 +15,7 @@
</script>

<ScatterChart
xNice
x="flipper_length_mm"
y="bill_length_mm"
series={data.map(([species, data], i) => {
Expand All @@ -36,6 +37,6 @@
grid: { motion: { type: 'tween', duration: 200 } },
points: { motion: { type: 'tween', duration: 200 } }
}}
padding={{ left: 10, top: 10, right: 10, bottom: 48 }}
padding={{ ...defaultChartPadding, top: 20, bottom: 48, left: 20, right: 20 }}
height={400}
/>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { defaultChartPadding, ScatterChart } from 'layerchart';
import { getPenguins } from '$lib/data.remote';
import { flatGroup } from 'd3-array';

Expand All @@ -15,6 +15,7 @@
</script>

<ScatterChart
xNice
x="flipper_length_mm"
y="bill_length_mm"
r="body_mass_g"
Expand All @@ -31,6 +32,6 @@
}
};
})}
padding={10}
padding={{ ...defaultChartPadding, top: 20, bottom: 20, left: 20, right: 20 }}
height={400}
/>
5 changes: 3 additions & 2 deletions docs/src/examples/components/ScatterChart/series.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { ScatterChart } from 'layerchart';
import { ScatterChart, defaultChartPadding } from 'layerchart';
import { getPenguins } from '$lib/data.remote';
import { flatGroup } from 'd3-array';

Expand All @@ -15,6 +15,7 @@
</script>

<ScatterChart
xNice
x="flipper_length_mm"
y="bill_length_mm"
series={data.map(([species, data], i) => {
Expand All @@ -29,6 +30,6 @@
}
};
})}
padding={10}
padding={{ ...defaultChartPadding, top: 20, bottom: 20, left: 20, right: 20 }}
height={400}
/>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
export { data };
</script>

<ScatterChart {data} x="x" y="y" axis="y" padding={24} height={400} />
<ScatterChart {data} xNice x="x" y="y" axis="y" padding={24} height={400} />
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ScatterChart
{data}
xNice
x="x"
y="y"
onTooltipClick={(e, detail) => {
Expand Down
Loading