money: thick €0 baseline on the wealth charts (all modes) so dips toward zero or below stand out
All checks were successful
Deploy production / deploy (push) Successful in 1m8s
All checks were successful
Deploy production / deploy (push) Successful in 1m8s
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
title,
|
title,
|
||||||
unit = '€',
|
unit = '€',
|
||||||
marker,
|
marker,
|
||||||
grid
|
grid,
|
||||||
|
zeroLine
|
||||||
}: {
|
}: {
|
||||||
series: ChartSeries[];
|
series: ChartSeries[];
|
||||||
title: string;
|
title: string;
|
||||||
@@ -14,7 +15,10 @@
|
|||||||
marker?: { date: string; label: string };
|
marker?: { date: string; label: string };
|
||||||
/** Vertical gridlines: every month (1 January drawn stronger), every year, or every decade. */
|
/** Vertical gridlines: every month (1 January drawn stronger), every year, or every decade. */
|
||||||
grid?: GridMode;
|
grid?: GridMode;
|
||||||
|
/** Thick baseline at 0 (default on for money charts) so dips toward zero stand out. */
|
||||||
|
zeroLine?: boolean;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
let showZero = $derived(zeroLine ?? unit === '€');
|
||||||
let clientWidth = $state(800);
|
let clientWidth = $state(800);
|
||||||
let width = $derived(Math.max(280, clientWidth));
|
let width = $derived(Math.max(280, clientWidth));
|
||||||
let compact = $derived(width < 520);
|
let compact = $derived(width < 520);
|
||||||
@@ -189,6 +193,9 @@
|
|||||||
font-size="11">{format(value)}</text
|
font-size="11">{format(value)}</text
|
||||||
>
|
>
|
||||||
{/each}
|
{/each}
|
||||||
|
{#if showZero && min <= 0 && max >= 0}
|
||||||
|
<line class="zero-line" x1={plot.left} x2={width - plot.right} y1={y(0)} y2={y(0)} />
|
||||||
|
{/if}
|
||||||
{#each axisTicks as tick (tick)}
|
{#each axisTicks as tick (tick)}
|
||||||
<text
|
<text
|
||||||
x={x(tick)}
|
x={x(tick)}
|
||||||
@@ -328,6 +335,13 @@
|
|||||||
stroke-opacity: 0.55;
|
stroke-opacity: 0.55;
|
||||||
shape-rendering: crispEdges;
|
shape-rendering: crispEdges;
|
||||||
}
|
}
|
||||||
|
/* The €0 baseline: thicker and higher contrast than the gridlines, under the data lines. */
|
||||||
|
.zero-line {
|
||||||
|
stroke: var(--site-text, currentColor);
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke-opacity: 0.6;
|
||||||
|
shape-rendering: crispEdges;
|
||||||
|
}
|
||||||
.grid-x.year {
|
.grid-x.year {
|
||||||
stroke: var(--site-muted);
|
stroke: var(--site-muted);
|
||||||
stroke-width: 1.5;
|
stroke-width: 1.5;
|
||||||
|
|||||||
Reference in New Issue
Block a user