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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { scaleLinear } from 'd3-scale';
import { Axis, Chart, Highlight, Layer, Spline, Tooltip } from 'layerchart';
import { scaleLinear } from 'd3-scale';
import { getNewPassengerCars } from '$lib/data.remote.js';

const data = await getNewPassengerCars();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { BarChart, Spline, Tooltip } from 'layerchart';
import { BarChart, Spline, Tooltip, defaultChartPadding } from 'layerchart';
import { getAppleTicker } from '$lib/data.remote.js';

const data = await getAppleTicker();
Expand All @@ -15,11 +15,11 @@
yNice
axis={false}
grid={false}
padding={{ left: 16, bottom: 16 }}
height={300}
props={{
bars: { radius: 1, class: 'stroke-none fill-surface-content/10' }
}}
padding={{ ...defaultChartPadding(), left: 25 }}
height={300}
/>

<!-- Second chart (line), responsible for tooltip -->
Expand All @@ -29,12 +29,12 @@
y={['open', 'close']}
yNice
yDomain={null}
padding={{ left: 16, bottom: 16 }}
height={300}
props={{
xAxis: { ticks: 10, rule: true },
tooltip: { context: { mode: 'band' } }
}}
padding={{ ...defaultChartPadding(), left: 25 }}
>
{#snippet marks()}
<Spline y="open" class="stroke-primary" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { Axis, BarChart, Tooltip, defaultChartPadding } from 'layerchart';
1;
import { scaleTime } from 'd3-scale';
import { extent } from 'd3-array';
import { Axis, BarChart, Tooltip } from 'layerchart';
import { getHydro } from '$lib/data.remote.js';

const data = await getHydro();
Expand Down Expand Up @@ -31,7 +32,6 @@
{data}
x="date"
yDomain={[0, 1000]}
padding={{ left: 32, right: 32, bottom: 20 }}
series={[
{
key: 'infiltration',
Expand Down Expand Up @@ -59,6 +59,7 @@
}
]}
seriesLayout="stack"
padding={{ ...defaultChartPadding(), top: 20, bottom: 30, right: 32, left: 32 }}
height={300}
>
{#snippet axis({ context })}
Expand Down
Loading