lintje 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist-elements/actions.js +1 -1
- package/dist-elements/chunks/{base-DRGvkF-r.js → base-Bd2pmq86.js} +102 -99
- package/dist-elements/chunks/chart-styles-DEd0uIWK.js +108 -0
- package/dist-elements/chunks/{dialog-B7aRBtjy.js → dialog-BNbkcAxH.js} +2 -2
- package/dist-elements/chunks/disclosure-BK-MJsEn.js +4 -0
- package/dist-elements/chunks/{disclosure-DirPLy2E.js → disclosure-CcTr_FLd.js} +1 -1
- package/dist-elements/chunks/download-BGe7rpQo.js +103 -0
- package/dist-elements/chunks/{focus-trap-Dv8zu64A.js → focus-trap-Cl99vti9.js} +1 -1
- package/dist-elements/chunks/input-Dg1o0Sfu.js +4 -0
- package/dist-elements/chunks/{input-BGMLam-O.js → input-KqBT3qWD.js} +1 -1
- package/dist-elements/chunks/{key-CuuOw1KE.js → key-D5wy9ZTj.js} +1 -1
- package/dist-elements/chunks/{player-BApadXr8.js → player-BRG7bk_h.js} +1 -1
- package/dist-elements/chunks/{sentence-0wO85ZdJ.js → sentence-DIByCXQV.js} +1 -1
- package/dist-elements/chunks/{stagger-BB_gcxBI.js → stagger-DGRHP_We.js} +95 -94
- package/dist-elements/content.js +1 -0
- package/dist-elements/core.js +1 -1
- package/dist-elements/custom-elements.json +120 -2
- package/dist-elements/data-types.json +208 -1
- package/dist-elements/feedback.js +1 -1
- package/dist-elements/guides/loading.md +5 -1
- package/dist-elements/inputs.js +2 -2
- package/dist-elements/layout.js +1 -1
- package/dist-elements/lintje.js +2850 -1929
- package/dist-elements/overlays.js +1 -1
- package/dist-elements/tag/activity-log.js +2 -2
- package/dist-elements/tag/ai-label.js +2 -2
- package/dist-elements/tag/announcement.js +2 -2
- package/dist-elements/tag/app-search.js +3 -3
- package/dist-elements/tag/audio-player.js +2 -2
- package/dist-elements/tag/badge.js +1 -1
- package/dist-elements/tag/breadcrumbs.js +1 -1
- package/dist-elements/tag/button.js +1 -1
- package/dist-elements/tag/card-list.js +1 -1
- package/dist-elements/tag/card.js +2 -2
- package/dist-elements/tag/chart.js +1020 -961
- package/dist-elements/tag/chat-answer.js +2 -2
- package/dist-elements/tag/chat-composer.js +3 -3
- package/dist-elements/tag/chat-message.js +2 -2
- package/dist-elements/tag/chat-strip.js +2 -2
- package/dist-elements/tag/chat-suggestions.js +1 -1
- package/dist-elements/tag/chat.js +1 -1
- package/dist-elements/tag/checkbox-group.js +3 -3
- package/dist-elements/tag/checkbox.js +3 -3
- package/dist-elements/tag/code.js +1 -1
- package/dist-elements/tag/combobox.js +3 -3
- package/dist-elements/tag/conflict-alert.js +2 -2
- package/dist-elements/tag/copy-button.js +1 -1
- package/dist-elements/tag/data-table.js +266 -265
- package/dist-elements/tag/date-input.js +3 -3
- package/dist-elements/tag/date-range.js +5 -5
- package/dist-elements/tag/description-list.js +2 -2
- package/dist-elements/tag/dialog.js +3 -3
- package/dist-elements/tag/document-viewer.js +1 -1
- package/dist-elements/tag/drawer.js +3 -3
- package/dist-elements/tag/empty-state.js +1 -1
- package/dist-elements/tag/error-page.js +1 -1
- package/dist-elements/tag/error-summary.js +30 -30
- package/dist-elements/tag/expander.js +3 -3
- package/dist-elements/tag/explainer.js +3 -3
- package/dist-elements/tag/field.js +2 -2
- package/dist-elements/tag/file-upload.js +58 -58
- package/dist-elements/tag/filter-bar.js +3 -3
- package/dist-elements/tag/filter-sheet.js +3 -3
- package/dist-elements/tag/filter-zone.js +3 -3
- package/dist-elements/tag/find.js +16 -12
- package/dist-elements/tag/footer.js +1 -1
- package/dist-elements/tag/form-actions.js +1 -1
- package/dist-elements/tag/form-section.js +1 -1
- package/dist-elements/tag/form.js +1 -1
- package/dist-elements/tag/gallery.js +1 -1
- package/dist-elements/tag/grid-item.js +1 -1
- package/dist-elements/tag/grid.js +1 -1
- package/dist-elements/tag/hero.js +2 -2
- package/dist-elements/tag/highlight.js +1 -1
- package/dist-elements/tag/icon-button.js +1 -1
- package/dist-elements/tag/icon.js +1 -1
- package/dist-elements/tag/job-list.js +1 -1
- package/dist-elements/tag/kpi-row.js +1 -1
- package/dist-elements/tag/kpi.js +38 -36
- package/dist-elements/tag/level-meter.js +1 -1
- package/dist-elements/tag/list.js +3 -3
- package/dist-elements/tag/log-viewer.d.ts +1 -0
- package/dist-elements/tag/log-viewer.js +847 -0
- package/dist-elements/tag/logo.js +1 -1
- package/dist-elements/tag/map.js +185 -184
- package/dist-elements/tag/menu-button.js +14 -9
- package/dist-elements/tag/modal.js +3 -3
- package/dist-elements/tag/multiselect.js +5 -5
- package/dist-elements/tag/note.js +2 -2
- package/dist-elements/tag/notifications.js +2 -2
- package/dist-elements/tag/number-input.js +3 -3
- package/dist-elements/tag/page-header.js +2 -2
- package/dist-elements/tag/pagination.js +16 -16
- package/dist-elements/tag/popover.js +1 -1
- package/dist-elements/tag/progress-bar.js +1 -1
- package/dist-elements/tag/prose.js +1 -1
- package/dist-elements/tag/qr-code.js +1 -1
- package/dist-elements/tag/radio-group.js +3 -3
- package/dist-elements/tag/range.js +3 -3
- package/dist-elements/tag/recording-status.js +2 -2
- package/dist-elements/tag/repeater.js +2 -2
- package/dist-elements/tag/segmented.js +3 -3
- package/dist-elements/tag/select.js +3 -3
- package/dist-elements/tag/shell.js +4 -4
- package/dist-elements/tag/skeleton.js +1 -1
- package/dist-elements/tag/slot-picker.js +3 -3
- package/dist-elements/tag/sortable-list.js +1 -1
- package/dist-elements/tag/spinner.js +1 -1
- package/dist-elements/tag/split-pane.js +1 -1
- package/dist-elements/tag/status-dot.js +1 -1
- package/dist-elements/tag/stepper.js +2 -2
- package/dist-elements/tag/streaming-text.js +2 -2
- package/dist-elements/tag/sub-nav.js +1 -1
- package/dist-elements/tag/tabs.js +2 -2
- package/dist-elements/tag/tag-input.js +4 -4
- package/dist-elements/tag/text-editor.js +3 -3
- package/dist-elements/tag/text-input.js +3 -3
- package/dist-elements/tag/textarea.js +4 -4
- package/dist-elements/tag/tile.js +1 -1
- package/dist-elements/tag/time-input.js +3 -3
- package/dist-elements/tag/toast.js +2 -2
- package/dist-elements/tag/toggle.js +3 -3
- package/dist-elements/tag/toggletip.js +2 -2
- package/dist-elements/tag/token-value.js +1 -1
- package/dist-elements/tag/tooltip.js +1 -1
- package/dist-elements/tag/transcript.js +2 -2
- package/dist-elements/tag/translator.js +1 -1
- package/dist-elements/tag/tree-view.js +1 -1
- package/dist-elements/tag/user-menu.js +1 -1
- package/dist-elements/tag/video-player.js +2 -2
- package/dist-elements/tokens.css +22 -12
- package/dist-elements/tokens.json +10 -6
- package/dist-elements/types/bundle/content.d.ts +1 -0
- package/dist-elements/types/bundle/index.d.ts +1 -1
- package/dist-elements/types/components/actions/menu-button/menu-button.d.ts +4 -1
- package/dist-elements/types/components/content/log-viewer/lines.d.ts +33 -0
- package/dist-elements/types/components/content/log-viewer/log-viewer.d.ts +117 -0
- package/dist-elements/types/components/index.d.ts +2 -0
- package/dist-elements/types/components/inputs/find/find.d.ts +1 -0
- package/dist-elements/types/components/shared/charts/shared/axes.d.ts +7 -1
- package/dist-elements/types/components/shared/charts/shared/controller.d.ts +0 -1
- package/dist-elements/types/components/shared/charts/shared/layer-motion.d.ts +21 -0
- package/dist-elements/types/components/shared/download.d.ts +2 -0
- package/dist-elements/types/types.d.ts +44 -0
- package/package.json +1 -1
- package/dist-elements/chunks/disclosure-D39vAR5q.js +0 -4
- package/dist-elements/chunks/download-C68kcwPj.js +0 -206
- package/dist-elements/chunks/input-lQTmOMOz.js +0 -4
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { F as e, I as t, Kt as n, O as r, Yt as i, Zt as a, _ as o, bt as s, c,
|
|
1
|
+
import { F as e, I as t, Kt as n, O as r, Yt as i, Zt as a, _ as o, bt as s, d as c, en as l, f as u, g as d, l as f, m as p, nn as m, o as h, p as g, r as _, rn as v, v as y, y as b } from "../chunks/base-Bd2pmq86.js";
|
|
2
2
|
import { t as x } from "./announcement.js";
|
|
3
3
|
import "./segmented.js";
|
|
4
|
-
import {
|
|
5
|
-
import { C as D, E as O, S as k, T as A, _ as j, a as M, b as N, c as P,
|
|
4
|
+
import { i as S, n as C, t as w } from "../chunks/download-BGe7rpQo.js";
|
|
5
|
+
import { C as T, D as E, E as D, O, S as k, T as A, _ as j, a as M, b as N, c as P, d as F, f as I, h as L, i as R, l as ee, m as z, n as B, o as V, r as H, s as U, t as W, u as G, v as K, w as q, x as te, y as J } from "../chunks/stagger-DGRHP_We.js";
|
|
6
|
+
import { n as Y, r as X } from "../chunks/chart-styles-DEd0uIWK.js";
|
|
6
7
|
import "./data-table.js";
|
|
7
8
|
//#region src/components/shared/charts/shared/plot-keys.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
9
|
+
var ne = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), Z = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]);
|
|
10
|
+
function Q(e) {
|
|
10
11
|
return [`${e.title}: ${e.rows.map((e) => `${e.label} ${e.value}`.trim()).join(", ")}`, ...(e.events ?? []).map((e) => `Gebeurtenis ${e.number}: ${e.label}`)].join(". ");
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function $(e) {
|
|
13
14
|
try {
|
|
14
15
|
return e.matches(":focus-visible");
|
|
15
16
|
} catch {
|
|
16
17
|
return !0;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function re(e, t, n) {
|
|
20
21
|
let r = (t, r) => {
|
|
21
22
|
let i = n(r), a = t.closest("[data-tooltip-anchor]"), o = t.getBoundingClientRect(), s = a?.getBoundingClientRect() ?? o;
|
|
22
|
-
e.hoverIndex = r, e.status =
|
|
23
|
+
e.hoverIndex = r, e.status = Q(i.content), e.showTooltipAt(o.left - s.left + i.x, o.top - s.top + i.y, i.content);
|
|
23
24
|
};
|
|
24
25
|
return {
|
|
25
26
|
keydown(n) {
|
|
26
27
|
if (n.target !== n.currentTarget || t === 0) return;
|
|
27
28
|
let i = e.hoverIndex ?? -1, a;
|
|
28
|
-
if (
|
|
29
|
-
else if (
|
|
29
|
+
if (ne.has(n.key)) a = Math.min(t - 1, i + 1);
|
|
30
|
+
else if (Z.has(n.key)) a = Math.max(0, i - 1);
|
|
30
31
|
else if (n.key === "Home") a = 0;
|
|
31
32
|
else if (n.key === "End") a = t - 1;
|
|
32
33
|
else return;
|
|
@@ -34,205 +35,206 @@ function Z(e, t, n) {
|
|
|
34
35
|
},
|
|
35
36
|
focus(n) {
|
|
36
37
|
let i = n.currentTarget;
|
|
37
|
-
n.target === i && t !== 0 &&
|
|
38
|
+
n.target === i && t !== 0 && $(i) && r(i, Math.min(e.hoverIndex ?? 0, t - 1));
|
|
38
39
|
},
|
|
39
40
|
blur() {
|
|
40
41
|
(e.hoverIndex != null || e.status) && (e.hoverIndex = null, e.status = "", e.hideTooltip(), e.requestUpdate());
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
45
|
+
function ie(e) {
|
|
46
|
+
return m`<p class="visually-hidden" role="status">${e.status}</p>`;
|
|
46
47
|
}
|
|
47
48
|
//#endregion
|
|
48
49
|
//#region src/components/shared/charts/line-chart/line-chart.ts
|
|
49
|
-
var
|
|
50
|
-
function
|
|
50
|
+
var ae = 18, oe = 4, se = 8;
|
|
51
|
+
function ce(e) {
|
|
51
52
|
let t = [];
|
|
52
53
|
return e.map((e) => {
|
|
53
54
|
let n = t.findIndex((t) => t.every((t) => Math.abs(t - e) >= 22));
|
|
54
55
|
return n === -1 && (n = t.push([]) - 1), t[n].push(e), n;
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
let { controller: n, description: r } = t, { labels: i, axisTitle: a, unit: o, asOfIndex: c, asOfLabel: d, pendingHours: f = 0, fixedMax: g, small:
|
|
58
|
+
function le(e, t) {
|
|
59
|
+
let { controller: n, description: r } = t, { labels: i, axisTitle: a, unit: o, asOfIndex: c, asOfLabel: d, pendingHours: f = 0, fixedMax: g, small: _ = !1 } = e, y = (e.events ?? []).filter((e) => Number.isInteger(e.index) && e.index >= 0 && e.index < i.length).sort((e, t) => e.index - t.index).map((e, t) => ({
|
|
59
60
|
...e,
|
|
60
61
|
number: t + 1
|
|
61
62
|
})), b = n.id;
|
|
62
63
|
n.measure({
|
|
63
64
|
width: !0,
|
|
64
|
-
height: t.height ?? (
|
|
65
|
+
height: t.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
65
66
|
fit: !!t.expanded && !t.mobile
|
|
66
67
|
});
|
|
67
68
|
let x = e.series.filter((e) => !e.comparison).length > 1, S = 0, C = e.series.map((e) => ({
|
|
68
69
|
...e,
|
|
69
|
-
color:
|
|
70
|
-
symbol: x && !e.comparison ?
|
|
71
|
-
})), w = C.filter((e) => !n.hiddenSeries.includes(e.label)),
|
|
70
|
+
color: z(e.color),
|
|
71
|
+
symbol: x && !e.comparison ? K(e.color) ? e.color : j[S++ % j.length] : void 0
|
|
72
|
+
})), w = C.filter((e) => !n.hiddenSeries.includes(e.label)), D = C.flatMap((e) => e.values).filter((e) => e != null), { max: M, ticks: N } = T(g ?? Math.max(...D, 1)), I = k(N, n.width, {
|
|
72
73
|
fontFamily: n.fontFamily,
|
|
73
|
-
minimum: Math.ceil(
|
|
74
|
-
}),
|
|
75
|
-
left:
|
|
76
|
-
...
|
|
77
|
-
}), G = (e) =>
|
|
74
|
+
minimum: Math.ceil(p(i[0] ?? "", n.fontFamily) / 2)
|
|
75
|
+
}), R = te(t, { left: I.width }), B = y.map((e) => Math.min(R.width - ae / 2, Math.max(ae / 2, E(e.index, i.length, R)))), V = ce(B), U = V.length ? Math.max(...V) + 1 : 0, W = te(t, {
|
|
76
|
+
left: I.width,
|
|
77
|
+
...U ? { top: U * 22 + se } : {}
|
|
78
|
+
}), G = (e) => oe + V[e] * 22, q = f > 6, Y = c ?? i.length - 1, X = (e) => e.comparison ? "var(--color-chart-secondary)" : e.color ?? "var(--color-chart-default)", ne = C.map((e) => ({
|
|
78
79
|
label: e.label,
|
|
79
|
-
color:
|
|
80
|
+
color: X(e),
|
|
80
81
|
shape: e.comparison ? "dashed" : "line",
|
|
81
82
|
symbol: e.symbol,
|
|
82
|
-
hidden: n.hiddenSeries.includes(e.label)
|
|
83
|
-
|
|
83
|
+
hidden: n.hiddenSeries.includes(e.label),
|
|
84
|
+
fixed: C.length < 2
|
|
85
|
+
})), Z = Math.max(1, Math.ceil(i.length / 8)), Q = i.map((e, t) => ({
|
|
84
86
|
label: e,
|
|
85
|
-
x:
|
|
87
|
+
x: E(t, i.length, W),
|
|
86
88
|
i: t
|
|
87
|
-
})).filter((e) => e.i %
|
|
88
|
-
function
|
|
89
|
+
})).filter((e) => e.i % Z === 0);
|
|
90
|
+
function $(e) {
|
|
89
91
|
let t = y.filter((t) => t.index === e);
|
|
90
92
|
return {
|
|
91
93
|
title: i[e],
|
|
92
94
|
rows: w.map((t) => ({
|
|
93
95
|
label: t.label,
|
|
94
|
-
value: t.values[e] == null ? "geen gegevens" :
|
|
95
|
-
color:
|
|
96
|
+
value: t.values[e] == null ? "geen gegevens" : u(t.values[e]),
|
|
97
|
+
color: X(t)
|
|
96
98
|
})),
|
|
97
99
|
...t.length ? { events: t } : {}
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
|
-
let le =
|
|
102
|
+
let le = re(n, i.length, (e) => {
|
|
101
103
|
let t = w.map((t) => t.values[e]).filter((e) => e != null);
|
|
102
104
|
return {
|
|
103
|
-
x:
|
|
104
|
-
y: t.length ? O(Math.max(...t),
|
|
105
|
-
content:
|
|
105
|
+
x: E(e, i.length, W),
|
|
106
|
+
y: t.length ? O(Math.max(...t), M, W) : W.top,
|
|
107
|
+
content: $(e)
|
|
106
108
|
};
|
|
107
109
|
}), ue = [
|
|
108
110
|
f > 0 ? (() => {
|
|
109
|
-
let e =
|
|
110
|
-
return
|
|
111
|
+
let e = E(Y, i.length, W), t = q ? A(W) / (i.length - 1) : W.width - W.right - e;
|
|
112
|
+
return v`<rect x=${e} y=${W.top} width=${Math.max(0, t)}
|
|
111
113
|
height=${W.height - W.top - W.bottom}
|
|
112
114
|
fill="url(#hatch-${b})" />`;
|
|
113
|
-
})() :
|
|
114
|
-
y.length ?
|
|
115
|
+
})() : l,
|
|
116
|
+
y.length ? v`<g>
|
|
115
117
|
${y.map((e, t) => {
|
|
116
|
-
let n =
|
|
117
|
-
return
|
|
118
|
-
y1=${G(t) +
|
|
118
|
+
let n = E(e.index, i.length, W);
|
|
119
|
+
return v`<line class="lintje-chart__event-line" x1=${n} x2=${n}
|
|
120
|
+
y1=${G(t) + ae} y2=${W.height - W.bottom} />`;
|
|
119
121
|
})}
|
|
120
|
-
${y.map((e, t) =>
|
|
121
|
-
<rect class="lintje-chart__event-chip" x=${
|
|
122
|
-
width=${
|
|
123
|
-
<text class="lintje-chart__event-number" x=${
|
|
122
|
+
${y.map((e, t) => v`
|
|
123
|
+
<rect class="lintje-chart__event-chip" x=${B[t] - ae / 2} y=${G(t)}
|
|
124
|
+
width=${ae} height=${ae} />
|
|
125
|
+
<text class="lintje-chart__event-number" x=${B[t]} y=${G(t) + ae / 2}
|
|
124
126
|
text-anchor="middle" dominant-baseline="central">${e.number}</text>
|
|
125
127
|
`)}
|
|
126
|
-
</g>` :
|
|
127
|
-
|
|
128
|
-
${
|
|
129
|
-
let t =
|
|
128
|
+
</g>` : l,
|
|
129
|
+
v`<g class="lintje-chart__reveal">
|
|
130
|
+
${C.map((e) => {
|
|
131
|
+
let t = X(e), n = e.comparison ? void 0 : L(t), r = [[]];
|
|
130
132
|
e.values.forEach((e, t) => {
|
|
131
|
-
e == null ||
|
|
132
|
-
x:
|
|
133
|
-
y: O(e,
|
|
133
|
+
e == null || q && t > Y ? r[r.length - 1].length && r.push([]) : r[r.length - 1].push({
|
|
134
|
+
x: E(t, i.length, W),
|
|
135
|
+
y: O(e, M, W)
|
|
134
136
|
});
|
|
135
137
|
});
|
|
136
138
|
let a = r.filter((e) => e.length > 0);
|
|
137
|
-
if (a.length === 0) return
|
|
138
|
-
let o = a[a.length - 1], s = o[o.length - 1], c = W.height - W.bottom;
|
|
139
|
-
return
|
|
140
|
-
<g>
|
|
139
|
+
if (a.length === 0) return l;
|
|
140
|
+
let o = a[a.length - 1], s = o[o.length - 1], c = W.height - W.bottom, u = !w.includes(e);
|
|
141
|
+
return v`
|
|
142
|
+
<g class="lintje-chart__series ${u ? "is-off" : ""}">
|
|
141
143
|
${a.map((r) => {
|
|
142
144
|
let i = r.map((e) => `${e.x},${e.y}`).join(" ");
|
|
143
|
-
return
|
|
144
|
-
${e.area && !e.comparison ?
|
|
145
|
-
points=${`${r[0].x},${c} ${i} ${r[r.length - 1].x},${c}`} />` :
|
|
146
|
-
${n && r.length > 1 ?
|
|
147
|
-
${r.length === 1 ?
|
|
145
|
+
return v`
|
|
146
|
+
${e.area && !e.comparison ? v`<polygon fill=${t} fill-opacity=".14"
|
|
147
|
+
points=${`${r[0].x},${c} ${i} ${r[r.length - 1].x},${c}`} />` : l}
|
|
148
|
+
${n && r.length > 1 ? v`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${i} stroke=${n} />` : l}
|
|
149
|
+
${r.length === 1 ? v`<circle cx=${r[0].x} cy=${r[0].y} r="2.5" fill=${t} />` : v`<polyline
|
|
148
150
|
class="lintje-chart__line"
|
|
149
151
|
points=${i}
|
|
150
152
|
stroke=${t}
|
|
151
|
-
stroke-dasharray=${e.comparison ? "5 4" :
|
|
153
|
+
stroke-dasharray=${e.comparison ? "5 4" : l}
|
|
152
154
|
opacity=${e.comparison ? .9 : 1} />`}
|
|
153
155
|
`;
|
|
154
156
|
})}
|
|
155
157
|
<!-- The line's own shape at its end; a 4 px point there at an early as-of time. -->
|
|
156
|
-
${e.symbol ?
|
|
158
|
+
${e.symbol ? v`<path class="lintje-chart__line-end" d=${J(e.symbol, 4.5, s.x, s.y)} fill=${t} />` : q && !e.comparison ? v`<circle cx=${s.x} cy=${s.y} r="4" fill=${t} />` : l}
|
|
157
159
|
</g>
|
|
158
160
|
`;
|
|
159
161
|
})}
|
|
160
162
|
</g>`,
|
|
161
|
-
|
|
163
|
+
q && d ? P({
|
|
162
164
|
area: W,
|
|
163
|
-
index:
|
|
165
|
+
index: Y,
|
|
164
166
|
count: i.length,
|
|
165
167
|
label: `peilmoment ${d}`,
|
|
166
168
|
pendingHours: f,
|
|
167
169
|
lastValue: (() => {
|
|
168
|
-
let e = w.find((e) => !e.comparison)?.values[
|
|
169
|
-
return e == null ? void 0 : `${
|
|
170
|
+
let e = w.find((e) => !e.comparison)?.values[Y];
|
|
171
|
+
return e == null ? void 0 : `${u(e)}${o ? ` ${o}` : ""}`;
|
|
170
172
|
})()
|
|
171
|
-
}) :
|
|
172
|
-
n.hoverIndex == null ?
|
|
173
|
+
}) : l,
|
|
174
|
+
n.hoverIndex == null ? l : w.map((e) => {
|
|
173
175
|
let t = n.hoverIndex, r = e.values[t];
|
|
174
|
-
return r == null ||
|
|
175
|
-
cx=${
|
|
176
|
-
cy=${O(r,
|
|
176
|
+
return r == null || q && t > Y ? l : v`<circle class="lintje-chart__hover-point" r="4" fill=${X(e)}
|
|
177
|
+
cx=${E(t, i.length, W)}
|
|
178
|
+
cy=${O(r, M, W)} />`;
|
|
177
179
|
}),
|
|
178
180
|
i.map((e, t) => {
|
|
179
|
-
let r =
|
|
180
|
-
return
|
|
181
|
+
let r = E(t, i.length, W), a = A(W) / Math.max(1, i.length - 1);
|
|
182
|
+
return v`
|
|
181
183
|
<rect x=${r - a / 2} y=${W.top} width=${a}
|
|
182
184
|
height=${W.height - W.top - W.bottom}
|
|
183
185
|
fill="transparent"
|
|
184
|
-
@mousemove=${(e) => n.hoverAt(t, e,
|
|
186
|
+
@mousemove=${(e) => n.hoverAt(t, e, $(t))}
|
|
185
187
|
@mouseleave=${() => n.hoverAt(null)} />
|
|
186
188
|
`;
|
|
187
189
|
})
|
|
188
190
|
];
|
|
189
|
-
return
|
|
190
|
-
<div class="lintje-chart-wrap ${
|
|
191
|
-
${s({ "--lintje-event-size": `${
|
|
192
|
-
${
|
|
191
|
+
return m`
|
|
192
|
+
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
193
|
+
${s({ "--lintje-event-size": `${ae}px` })}
|
|
194
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
193
195
|
@keydown=${(e) => n.dismiss(e)}>
|
|
194
|
-
${
|
|
195
|
-
items:
|
|
196
|
+
${F({
|
|
197
|
+
items: ne,
|
|
196
198
|
onToggle: (e) => n.toggleSeries(e)
|
|
197
199
|
})}
|
|
198
200
|
${ee({
|
|
199
201
|
fontFamily: n.fontFamily,
|
|
200
202
|
id: b,
|
|
201
|
-
ticks:
|
|
202
|
-
max:
|
|
203
|
+
ticks: N,
|
|
204
|
+
max: M,
|
|
203
205
|
area: W,
|
|
204
|
-
formatTick:
|
|
206
|
+
formatTick: I.format,
|
|
205
207
|
axisTitle: a ?? o,
|
|
206
|
-
xLabels:
|
|
208
|
+
xLabels: Q,
|
|
207
209
|
description: y.length ? `${r} ${y.map((e) => `Gebeurtenis ${e.number}, ${i[e.index]}: ${e.label}.`).join(" ")}` : r,
|
|
208
210
|
keys: le
|
|
209
211
|
}, ue)}
|
|
210
|
-
${y.length ?
|
|
211
|
-
${y.map((e) =>
|
|
212
|
+
${y.length ? m`<ol class="lintje-chart-events" aria-label="Gebeurtenissen">
|
|
213
|
+
${y.map((e) => m`<li class="lintje-chart-events__item">
|
|
212
214
|
<span class="lintje-event-chip"><span class="lintje-event-chip__number">${e.number}</span></span>
|
|
213
215
|
<span><span class="lintje-chart-events__category">${i[e.index]}</span> ·
|
|
214
216
|
${e.label}</span>
|
|
215
217
|
</li>`)}
|
|
216
|
-
</ol>` :
|
|
217
|
-
${
|
|
218
|
-
${
|
|
218
|
+
</ol>` : l}
|
|
219
|
+
${H(n)}
|
|
220
|
+
${ie(n)}
|
|
219
221
|
</div>
|
|
220
222
|
`;
|
|
221
223
|
}
|
|
222
224
|
//#endregion
|
|
223
225
|
//#region src/components/shared/charts/shared/mark-select.ts
|
|
224
|
-
var
|
|
226
|
+
var ue = {
|
|
225
227
|
clickable: !1,
|
|
226
228
|
state: "",
|
|
227
|
-
markId:
|
|
228
|
-
role:
|
|
229
|
-
tabIndex:
|
|
230
|
-
pressed:
|
|
231
|
-
label:
|
|
232
|
-
click:
|
|
233
|
-
keydown:
|
|
229
|
+
markId: l,
|
|
230
|
+
role: l,
|
|
231
|
+
tabIndex: l,
|
|
232
|
+
pressed: l,
|
|
233
|
+
label: l,
|
|
234
|
+
click: l,
|
|
235
|
+
keydown: l
|
|
234
236
|
};
|
|
235
|
-
function
|
|
237
|
+
function de(e, t) {
|
|
236
238
|
let n = /* @__PURE__ */ new Set();
|
|
237
239
|
for (let e of t) e?.href && n.add(e.id);
|
|
238
240
|
let r = e.selectedId != null && n.has(e.selectedId) ? e.selectedId : null, i = () => {
|
|
@@ -249,8 +251,8 @@ function le(e, t) {
|
|
|
249
251
|
active: r,
|
|
250
252
|
interactive: !!e.onSelect && n.size > 0,
|
|
251
253
|
of(t, n, i) {
|
|
252
|
-
if (!t?.href || !e.onSelect) return r == null ?
|
|
253
|
-
...
|
|
254
|
+
if (!t?.href || !e.onSelect) return r == null ? ue : {
|
|
255
|
+
...ue,
|
|
254
256
|
state: "is-muted"
|
|
255
257
|
};
|
|
256
258
|
let o = t.id === r;
|
|
@@ -275,96 +277,89 @@ function le(e, t) {
|
|
|
275
277
|
}
|
|
276
278
|
//#endregion
|
|
277
279
|
//#region src/components/shared/charts/bar-chart/bar-chart.ts
|
|
278
|
-
|
|
279
|
-
"var(--color-chart-
|
|
280
|
-
"var(--color-chart-tint-2)",
|
|
281
|
-
"var(--color-chart-tint-3)",
|
|
282
|
-
"var(--color-chart-tint-4)",
|
|
283
|
-
"var(--color-chart-tint-5)"
|
|
284
|
-
];
|
|
285
|
-
function de(e, t) {
|
|
286
|
-
let { controller: n, description: r } = t, { labels: i, values: a, axisTitle: o, trend: d, dataLabels: f = !0, small: h = !1, links: g } = e, y = F(e.color) ?? "var(--color-chart-default)", b = n.id, x = le(t, g ?? []);
|
|
280
|
+
function fe(e, t) {
|
|
281
|
+
let { controller: n, description: r } = t, { labels: i, values: a, axisTitle: o, trend: d, dataLabels: p = !0, small: g = !1, links: _ } = e, y = z(e.color) ?? "var(--color-chart-default)", b = n.id, x = de(t, _ ?? []);
|
|
287
282
|
n.measure({
|
|
288
283
|
width: !0,
|
|
289
|
-
height: t.height ?? (
|
|
284
|
+
height: t.height ?? (g ? "--chart-h-small" : "--chart-h-main"),
|
|
290
285
|
fit: !!t.expanded && !t.mobile
|
|
291
286
|
});
|
|
292
|
-
let S = a.filter((e) => e != null), { max: C, ticks: w } =
|
|
287
|
+
let S = a.filter((e) => e != null), { max: C, ticks: w } = T(Math.max(...S, 1)), E = k(w, n.width, { fontFamily: n.fontFamily }), D = te(t, { left: E.width }), A = D.height - D.bottom, { width: j, bandWidth: M } = q(0, i.length, D), N = p && a.every((e) => e == null || f(c(e, j), M - 4)), P = (e) => ({
|
|
293
288
|
title: i[e],
|
|
294
289
|
rows: [{
|
|
295
290
|
label: o ?? "Waarde",
|
|
296
|
-
value: a[e] == null ? "geen gegevens" :
|
|
291
|
+
value: a[e] == null ? "geen gegevens" : u(a[e]),
|
|
297
292
|
color: y
|
|
298
293
|
}]
|
|
299
|
-
}),
|
|
300
|
-
x:
|
|
301
|
-
y: a[e] == null ?
|
|
294
|
+
}), F = re(n, i.length, (e) => ({
|
|
295
|
+
x: q(e, i.length, D).center,
|
|
296
|
+
y: a[e] == null ? D.top : O(a[e], C, D),
|
|
302
297
|
content: P(e)
|
|
303
|
-
})),
|
|
304
|
-
let r =
|
|
305
|
-
if (e == null) return
|
|
306
|
-
height=${Math.max(0,
|
|
298
|
+
})), I = [a.map((e, t) => {
|
|
299
|
+
let r = q(t, i.length, D);
|
|
300
|
+
if (e == null) return v`<rect class="lintje-chart__missing" x=${r.x} y=${D.top} width=${r.width}
|
|
301
|
+
height=${Math.max(0, A - D.top)} fill="url(#hatch-${b})"
|
|
307
302
|
@mousemove=${(e) => n.showTooltip(e, P(t))}
|
|
308
303
|
@mouseleave=${() => n.hideTooltip()} />`;
|
|
309
|
-
let a = O(e, C,
|
|
310
|
-
return
|
|
304
|
+
let a = O(e, C, D), o = x.of(_?.[t], i[t], `${i[t]}: ${u(e)}`);
|
|
305
|
+
return v`
|
|
311
306
|
<g class="lintje-chart__bar-group ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
312
307
|
${s(B(t, i.length))}
|
|
313
308
|
@mousemove=${(e) => n.showTooltip(e, P(t))}
|
|
314
309
|
@mouseleave=${() => n.hideTooltip()}>
|
|
315
310
|
<rect class="lintje-chart__bar lintje-chart__mark ${o.state}"
|
|
316
|
-
x=${r.x} y=${a} width=${r.width} height=${Math.max(0,
|
|
311
|
+
x=${r.x} y=${a} width=${r.width} height=${Math.max(0, A - a)} fill=${y}
|
|
317
312
|
data-mark-id=${o.markId} role=${o.role} tabindex=${o.tabIndex}
|
|
318
313
|
aria-pressed=${o.pressed} aria-label=${o.label}
|
|
319
314
|
@click=${o.click} @keydown=${o.keydown} />
|
|
320
|
-
${
|
|
321
|
-
${
|
|
322
|
-
</text>` :
|
|
315
|
+
${N ? v`<text x=${r.center} y=${a - 5} text-anchor="middle" class="lintje-chart__data-label">
|
|
316
|
+
${c(e, r.width)}
|
|
317
|
+
</text>` : l}
|
|
323
318
|
</g>
|
|
324
319
|
`;
|
|
325
|
-
}), d ?
|
|
320
|
+
}), d ? v`<polyline
|
|
326
321
|
fill="none" stroke="var(--color-chart-emphasis)" stroke-width="1.5" stroke-dasharray="5 4"
|
|
327
|
-
points=${d.map((e, t) => e == null ? null : `${
|
|
328
|
-
return
|
|
329
|
-
<div class="lintje-chart-wrap ${
|
|
330
|
-
${
|
|
322
|
+
points=${d.map((e, t) => e == null ? null : `${q(t, i.length, D).center},${O(e, C, D)}`).filter(Boolean).join(" ")} />` : l];
|
|
323
|
+
return m`
|
|
324
|
+
<div class="lintje-chart-wrap ${g ? "lintje-chart--small" : ""}"
|
|
325
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
331
326
|
@keydown=${(e) => n.dismiss(e) || x.escape(e)}>
|
|
332
327
|
${ee({
|
|
333
328
|
fontFamily: n.fontFamily,
|
|
334
329
|
id: b,
|
|
335
330
|
ticks: w,
|
|
336
331
|
max: C,
|
|
337
|
-
area:
|
|
332
|
+
area: D,
|
|
338
333
|
axisTitle: o,
|
|
339
334
|
description: r,
|
|
340
|
-
formatTick:
|
|
335
|
+
formatTick: E.format,
|
|
341
336
|
xLabels: i.map((e, t) => ({
|
|
342
337
|
label: e,
|
|
343
|
-
x:
|
|
338
|
+
x: q(t, i.length, D).center
|
|
344
339
|
})),
|
|
345
340
|
interactive: x.interactive,
|
|
346
|
-
keys:
|
|
347
|
-
},
|
|
348
|
-
${
|
|
349
|
-
${
|
|
341
|
+
keys: F
|
|
342
|
+
}, I)}
|
|
343
|
+
${H(n)}
|
|
344
|
+
${ie(n)}
|
|
350
345
|
</div>
|
|
351
346
|
`;
|
|
352
347
|
}
|
|
353
348
|
//#endregion
|
|
354
349
|
//#region src/components/shared/charts/horizontal-bar-chart/horizontal-bar-chart.ts
|
|
355
|
-
function
|
|
350
|
+
function pe(e) {
|
|
356
351
|
return e * 26 + 24;
|
|
357
352
|
}
|
|
358
|
-
function
|
|
359
|
-
let { controller: n, description: r } = t, { rows: i, threshold: a, thresholdLabel: o, unit: c } = e, d =
|
|
353
|
+
function me(e, t) {
|
|
354
|
+
let { controller: n, description: r } = t, { rows: i, threshold: a, thresholdLabel: o, unit: c } = e, d = z(e.color) ?? "var(--color-chart-dark-yellow)", f = z(e.aboveThresholdColor) ?? "var(--color-chart-red)", p = n.id, g = i.map((e) => e.href ? {
|
|
360
355
|
id: e.id ?? e.label,
|
|
361
356
|
href: e.href
|
|
362
|
-
} : null),
|
|
357
|
+
} : null), _ = de(t, g), y = pe(i.length);
|
|
363
358
|
n.measure({
|
|
364
359
|
width: !0,
|
|
365
360
|
height: y
|
|
366
361
|
});
|
|
367
|
-
let b = n.width, x =
|
|
362
|
+
let b = n.width, x = D(i.map((e) => e.label), b, { fontFamily: n.fontFamily }), { labelEnd: S, barStart: C } = x, w = Math.max(...i.map((e) => e.value), a ?? 0) * 1.15, T = (e) => Math.max(40, b - C - 60) * e / w, E = (e) => `${u(e)}${c ? ` ${c}` : ""}`, O = (e) => {
|
|
368
363
|
let t = i[e], n = a != null && t.value > a;
|
|
369
364
|
return {
|
|
370
365
|
title: t.label,
|
|
@@ -378,175 +373,227 @@ function pe(e, t) {
|
|
|
378
373
|
color: "var(--color-chart-emphasis)"
|
|
379
374
|
}]]
|
|
380
375
|
};
|
|
381
|
-
},
|
|
376
|
+
}, k = re(n, i.length, (e) => ({
|
|
382
377
|
x: C + T(i[e].value),
|
|
383
378
|
y: e * 26 + 4,
|
|
384
|
-
content:
|
|
379
|
+
content: O(e)
|
|
385
380
|
}));
|
|
386
|
-
return
|
|
387
|
-
<figure class="lintje-chart lintje-chart--rows" ${
|
|
381
|
+
return m`
|
|
382
|
+
<figure class="lintje-chart lintje-chart--rows" ${h(n.attach)} ?data-in-view=${n.inView}
|
|
388
383
|
data-tooltip-anchor
|
|
389
|
-
@keydown=${(e) => n.dismiss(e) ||
|
|
390
|
-
<svg viewBox="0 0 ${b} ${y}" class="lintje-chart__svg" role=${
|
|
391
|
-
aria-labelledby="${
|
|
384
|
+
@keydown=${(e) => n.dismiss(e) || _.escape(e)}>
|
|
385
|
+
<svg viewBox="0 0 ${b} ${y}" class="lintje-chart__svg" role=${V(_.interactive)}
|
|
386
|
+
aria-labelledby="${p}-desc" width=${b} height=${y}
|
|
392
387
|
${s({
|
|
393
388
|
height: `${y}px`,
|
|
394
|
-
...
|
|
389
|
+
...U(p)
|
|
395
390
|
})}
|
|
396
|
-
tabindex="0" @keydown=${
|
|
397
|
-
<desc id="${
|
|
398
|
-
<defs>${
|
|
399
|
-
${a == null ?
|
|
391
|
+
tabindex="0" @keydown=${k.keydown} @focus=${k.focus} @blur=${k.blur}>
|
|
392
|
+
<desc id="${p}-desc">${r}</desc>
|
|
393
|
+
<defs>${G(p)}</defs>
|
|
394
|
+
${a == null ? l : v`
|
|
400
395
|
<line x1=${C + T(a)} x2=${C + T(a)} y1=${4} y2=${i.length * 26 + 2}
|
|
401
396
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
402
397
|
<text x=${C + T(a) + 6} y=${i.length * 26 + 16} class="lintje-chart__axis-label">
|
|
403
|
-
${o ?? `norm ${
|
|
398
|
+
${o ?? `norm ${u(a)}`}
|
|
404
399
|
</text>
|
|
405
400
|
`}
|
|
406
401
|
${i.map((e, t) => {
|
|
407
|
-
let r = t * 26 + 4, o = a != null && e.value > a,
|
|
408
|
-
return
|
|
402
|
+
let r = t * 26 + 4, o = a != null && e.value > a, l = T(e.value), p = _.of(g[t], e.label, `${e.label}: ${u(e.value)}${c ? ` ${c}` : ""}`);
|
|
403
|
+
return v`
|
|
409
404
|
<g class="lintje-chart__bar-row ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
410
|
-
@mousemove=${(e) => n.showTooltip(e,
|
|
405
|
+
@mousemove=${(e) => n.showTooltip(e, O(t))}
|
|
411
406
|
@mouseleave=${() => n.hideTooltip()}>
|
|
412
407
|
<!-- Hit area across the whole row, so the tooltip doesn't flicker between bars. -->
|
|
413
408
|
<rect x=${0} y=${r - 5} width=${b} height=${26} fill="transparent" />
|
|
414
409
|
<text x=${S} y=${r + 16 - 3} text-anchor="end" class="lintje-chart__axis-label">${x.fit(e.label)}</text>
|
|
415
410
|
<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-chart__mark ${p.state}"
|
|
416
411
|
${s(B(t, i.length))}
|
|
417
|
-
x=${C} y=${r} width=${Math.max(0,
|
|
412
|
+
x=${C} y=${r} width=${Math.max(0, l)} height=${16}
|
|
418
413
|
fill=${o ? f : d}
|
|
419
414
|
data-mark-id=${p.markId} role=${p.role} tabindex=${p.tabIndex}
|
|
420
415
|
aria-pressed=${p.pressed} aria-label=${p.label}
|
|
421
416
|
@click=${p.click} @keydown=${p.keydown} />
|
|
422
|
-
<text x=${C +
|
|
417
|
+
<text x=${C + l + 6} y=${r + 16 - 3} font-weight="700"
|
|
423
418
|
class="lintje-chart__data-label ${a == null ? "" : "lintje-chart__data-label--halo"}">
|
|
424
|
-
${
|
|
419
|
+
${u(e.value)}${c ? ` ${c}` : ""}
|
|
425
420
|
</text>
|
|
426
421
|
</g>
|
|
427
422
|
`;
|
|
428
423
|
})}
|
|
429
424
|
</svg>
|
|
430
|
-
${
|
|
431
|
-
${
|
|
425
|
+
${H(n)}
|
|
426
|
+
${ie(n)}
|
|
432
427
|
</figure>
|
|
433
428
|
`;
|
|
434
429
|
}
|
|
435
430
|
//#endregion
|
|
436
431
|
//#region src/components/shared/charts/target-progress-chart/target-progress-chart.ts
|
|
437
|
-
function
|
|
438
|
-
let { controller: n, description: r } = t, { rows: i, target: a = 100 } = e, o = n.id, c =
|
|
432
|
+
function he(e, t) {
|
|
433
|
+
let { controller: n, description: r } = t, { rows: i, target: a = 100 } = e, o = n.id, c = pe(i.length);
|
|
439
434
|
n.measure({
|
|
440
435
|
width: !0,
|
|
441
436
|
height: c
|
|
442
437
|
});
|
|
443
|
-
let l = n.width, u =
|
|
438
|
+
let l = n.width, u = D(i.map((e) => e.label), l, { fontFamily: n.fontFamily }), { labelEnd: d, barStart: f } = u, p = (e) => Math.max(40, l - f - 70) * e / 110, _ = f + p(a), y = (e) => e >= a ? "var(--color-chart-green)" : "var(--color-attention)", b = (e) => ({
|
|
444
439
|
title: i[e].label,
|
|
445
440
|
rows: [{
|
|
446
441
|
label: "Voortgang",
|
|
447
|
-
value:
|
|
442
|
+
value: g(i[e].value),
|
|
448
443
|
color: y(i[e].value)
|
|
449
444
|
}, {
|
|
450
445
|
label: "Doel",
|
|
451
|
-
value:
|
|
446
|
+
value: g(a),
|
|
452
447
|
color: "var(--color-chart-emphasis)"
|
|
453
448
|
}]
|
|
454
|
-
}), x =
|
|
455
|
-
x:
|
|
449
|
+
}), x = re(n, i.length, (e) => ({
|
|
450
|
+
x: f + p(i[e].value),
|
|
456
451
|
y: e * 26 + 4,
|
|
457
452
|
content: b(e)
|
|
458
453
|
}));
|
|
459
|
-
return
|
|
460
|
-
<figure class="lintje-chart lintje-chart--rows" ${
|
|
454
|
+
return m`
|
|
455
|
+
<figure class="lintje-chart lintje-chart--rows" ${h(n.attach)} ?data-in-view=${n.inView}
|
|
461
456
|
data-tooltip-anchor @keydown=${(e) => n.dismiss(e)}>
|
|
462
457
|
<svg viewBox="0 0 ${l} ${c}" class="lintje-chart__svg" role="img"
|
|
463
458
|
aria-labelledby="${o}-desc" width=${l} height=${c} ${s({ height: `${c}px` })}
|
|
464
459
|
tabindex="0" @keydown=${x.keydown} @focus=${x.focus} @blur=${x.blur}>
|
|
465
460
|
<desc id="${o}-desc">${r}</desc>
|
|
466
461
|
${i.map((e, t) => {
|
|
467
|
-
let r = t * 26 + 4, o =
|
|
468
|
-
return
|
|
462
|
+
let r = t * 26 + 4, o = p(e.value), c = y(e.value), m = f + o + 46 > l, h = e.value >= a ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
463
|
+
return v`
|
|
469
464
|
<g class="lintje-chart__bar-row ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
470
465
|
@mousemove=${(e) => n.showTooltip(e, b(t))}
|
|
471
466
|
@mouseleave=${() => n.hideTooltip()}>
|
|
472
467
|
<rect x=${0} y=${r - 5} width=${l} height=${26} fill="transparent" />
|
|
473
|
-
<text x=${
|
|
468
|
+
<text x=${d} y=${r + 16 - 3} text-anchor="end" class="lintje-chart__axis-label">${u.fit(e.label)}</text>
|
|
474
469
|
<rect class="lintje-chart__bar lintje-chart__bar--horizontal" ${s(B(t, i.length))}
|
|
475
|
-
x=${
|
|
476
|
-
<text x=${
|
|
477
|
-
text-anchor=${
|
|
478
|
-
class="lintje-chart__data-label ${
|
|
470
|
+
x=${f} y=${r} width=${Math.max(0, o)} height=${16} fill=${c} />
|
|
471
|
+
<text x=${m ? f + o - 6 : f + o + 6} y=${r + 16 - 3}
|
|
472
|
+
text-anchor=${m ? "end" : "start"}
|
|
473
|
+
class="lintje-chart__data-label ${m ? h : ""}" font-weight="700">${g(e.value)}</text>
|
|
479
474
|
</g>
|
|
480
475
|
`;
|
|
481
476
|
})}
|
|
482
|
-
<line x1=${
|
|
477
|
+
<line x1=${_} x2=${_} y1=${0} y2=${i.length * 26 + 2}
|
|
483
478
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
484
|
-
<text x=${
|
|
479
|
+
<text x=${_ + 6} y=${i.length * 26 + 16} class="lintje-chart__axis-label">norm ${a}</text>
|
|
485
480
|
</svg>
|
|
486
|
-
${
|
|
487
|
-
${
|
|
481
|
+
${H(n)}
|
|
482
|
+
${ie(n)}
|
|
488
483
|
</figure>
|
|
489
484
|
`;
|
|
490
485
|
}
|
|
491
486
|
//#endregion
|
|
487
|
+
//#region src/components/shared/charts/shared/layer-motion.ts
|
|
488
|
+
var ge = /* @__PURE__ */ new WeakMap();
|
|
489
|
+
function _e(e, t) {
|
|
490
|
+
return e.duration > 0 ? Math.min(1, (t - e.start) / e.duration) : 1;
|
|
491
|
+
}
|
|
492
|
+
function ve(e, t) {
|
|
493
|
+
let n = _e(e, t);
|
|
494
|
+
if (n >= 1) return e.to;
|
|
495
|
+
let r = e.ease(n);
|
|
496
|
+
return e.to.map((t, n) => e.from[n] + (t - e.from[n]) * r);
|
|
497
|
+
}
|
|
498
|
+
function ye(e, t, n) {
|
|
499
|
+
let r = performance.now(), i = ge.get(e);
|
|
500
|
+
if (!i || i.key !== t) {
|
|
501
|
+
let a = {
|
|
502
|
+
key: t,
|
|
503
|
+
from: n,
|
|
504
|
+
to: n,
|
|
505
|
+
start: r,
|
|
506
|
+
duration: 0,
|
|
507
|
+
ease: (e) => e,
|
|
508
|
+
element: i?.element,
|
|
509
|
+
attach: (e) => {
|
|
510
|
+
a.element = e;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
return ge.set(e, a), n;
|
|
514
|
+
}
|
|
515
|
+
if (i.to.some((e, t) => e !== n[t])) {
|
|
516
|
+
let t = i.element, a = !t || b();
|
|
517
|
+
if (i.from = a ? n : ve(i, r), i.to = n, i.start = r, i.duration = a ? 0 : o(t, "--dur-layer"), i.ease = t ? y(t, "--ease-in-motion") : (e) => e, i.frame == null && i.duration > 0) {
|
|
518
|
+
let t = i, n = () => {
|
|
519
|
+
t.frame = void 0;
|
|
520
|
+
let r = _e(t, performance.now()) >= 1;
|
|
521
|
+
e.requestUpdate(), r || (t.frame = requestAnimationFrame(n));
|
|
522
|
+
};
|
|
523
|
+
t.frame = requestAnimationFrame(n);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return ve(i, r);
|
|
527
|
+
}
|
|
528
|
+
function be(e) {
|
|
529
|
+
return ge.get(e);
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
492
532
|
//#region src/components/shared/charts/grouped-bar-chart/grouped-bar-chart.ts
|
|
493
|
-
function
|
|
533
|
+
function xe(e, t) {
|
|
494
534
|
let { controller: n, description: r } = t, { labels: i, axisTitle: a, small: o = !1 } = e, d = n.id;
|
|
495
535
|
n.measure({
|
|
496
536
|
width: !0,
|
|
497
537
|
height: t.height ?? (o ? "--chart-h-small" : "--chart-h-main"),
|
|
498
538
|
fit: !!t.expanded && !t.mobile
|
|
499
539
|
});
|
|
500
|
-
let
|
|
540
|
+
let p = e.series.map((e, t) => ({
|
|
501
541
|
...e,
|
|
502
|
-
color:
|
|
503
|
-
|
|
542
|
+
color: z(e.color) ?? (t === 0 ? "var(--color-chart-default)" : "var(--color-chart-secondary)"),
|
|
543
|
+
hidden: n.hiddenSeries.includes(e.label)
|
|
544
|
+
})), g = p.filter((e) => !e.hidden), _ = de(t, g.flatMap((e) => e.links ?? [])), { max: y, ticks: b } = T(Math.max(...p.flatMap((e) => e.values), 1)), x = k(b, n.width, { fontFamily: n.fontFamily }), S = te(t, { left: x.width }), C = S.height - S.bottom, w = q(0, i.length, S).width / Math.max(1, g.length), E = ye(n, p.map((e) => e.label).join("\0"), p.map((e) => +!e.hidden)), D = be(n), A = q(0, i.length, S).width / Math.max(1, E.reduce((e, t) => e + t, 0)), j = E.map((e, t) => E.slice(0, t).reduce((e, t) => e + t, 0) * A), M = g.every((e) => e.values.every((e) => f(c(e, w), w - 2))), N = p.map((e) => ({
|
|
504
545
|
label: e.label,
|
|
505
|
-
color: e.color
|
|
546
|
+
color: e.color,
|
|
506
547
|
shape: "square",
|
|
507
|
-
hidden:
|
|
508
|
-
|
|
548
|
+
hidden: e.hidden,
|
|
549
|
+
fixed: p.length < 2
|
|
550
|
+
})), P = (e) => ({
|
|
509
551
|
title: i[e],
|
|
510
|
-
rows:
|
|
552
|
+
rows: g.map((t) => ({
|
|
511
553
|
label: t.label,
|
|
512
|
-
value:
|
|
513
|
-
color:
|
|
554
|
+
value: u(t.values[e]),
|
|
555
|
+
color: t.color
|
|
514
556
|
}))
|
|
515
|
-
}),
|
|
516
|
-
x:
|
|
517
|
-
y: O(Math.max(0, ...
|
|
518
|
-
content:
|
|
519
|
-
})),
|
|
520
|
-
let r =
|
|
521
|
-
return
|
|
557
|
+
}), I = re(n, i.length, (e) => ({
|
|
558
|
+
x: q(e, i.length, S).center,
|
|
559
|
+
y: O(Math.max(0, ...g.map((t) => t.values[e])), y, S),
|
|
560
|
+
content: P(e)
|
|
561
|
+
})), L = i.map((e, t) => {
|
|
562
|
+
let r = q(t, i.length, S);
|
|
563
|
+
return v`
|
|
522
564
|
<g class="lintje-chart__bar-group ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
523
565
|
${s(B(t, i.length))}
|
|
524
|
-
@mousemove=${(e) => n.showTooltip(e,
|
|
566
|
+
@mousemove=${(e) => n.showTooltip(e, P(t))}
|
|
525
567
|
@mouseleave=${() => n.hideTooltip()}>
|
|
526
|
-
${
|
|
527
|
-
let a = n.values[t], o = O(a, y, S), s =
|
|
528
|
-
return
|
|
568
|
+
${p.map((n, i) => {
|
|
569
|
+
let a = n.values[t], o = O(a, y, S), s = r.x + j[i], d = Math.max(0, E[i] * A - 2), f = n.hidden ? void 0 : _.of(n.links?.[t], `${e} · ${n.label}`, `${e}, ${n.label}: ${u(a)}`);
|
|
570
|
+
return v`
|
|
529
571
|
<g>
|
|
530
|
-
<rect class="lintje-chart__bar lintje-chart__mark ${
|
|
531
|
-
x=${
|
|
532
|
-
height=${Math.max(0, C - o)} fill=${
|
|
533
|
-
data-mark-id=${
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
572
|
+
<rect class="lintje-chart__bar lintje-chart__mark ${f?.state ?? ""}"
|
|
573
|
+
x=${s} y=${o} width=${d}
|
|
574
|
+
height=${Math.max(0, C - o)} fill=${n.color}
|
|
575
|
+
data-mark-id=${f?.markId ?? l} role=${f?.role ?? l}
|
|
576
|
+
tabindex=${f?.tabIndex ?? l} aria-pressed=${f?.pressed ?? l}
|
|
577
|
+
aria-label=${f?.label ?? l} aria-hidden=${f ? l : "true"}
|
|
578
|
+
@click=${f?.click ?? l} @keydown=${f?.keydown ?? l} />
|
|
579
|
+
<!-- Every label keeps its node and fades, so one that fits after a switch does not
|
|
580
|
+
draw in again. -->
|
|
581
|
+
<g class="lintje-chart__series ${!n.hidden && M ? "" : "is-off"}">
|
|
582
|
+
<text x=${s + d / 2} y=${o - 4} text-anchor="middle"
|
|
583
|
+
class="lintje-chart__data-label">${c(a, w)}</text>
|
|
584
|
+
</g>
|
|
538
585
|
</g>
|
|
539
586
|
`;
|
|
540
587
|
})}
|
|
541
588
|
</g>
|
|
542
589
|
`;
|
|
543
590
|
});
|
|
544
|
-
return
|
|
591
|
+
return m`
|
|
545
592
|
<div class="lintje-chart-wrap ${o ? "lintje-chart--small" : ""}"
|
|
546
|
-
${
|
|
547
|
-
@keydown=${(e) => n.dismiss(e) ||
|
|
548
|
-
${
|
|
549
|
-
items:
|
|
593
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
594
|
+
@keydown=${(e) => n.dismiss(e) || _.escape(e)}>
|
|
595
|
+
${F({
|
|
596
|
+
items: N,
|
|
550
597
|
onToggle: (e) => n.toggleSeries(e)
|
|
551
598
|
})}
|
|
552
599
|
${ee({
|
|
@@ -560,19 +607,19 @@ function he(e, t) {
|
|
|
560
607
|
formatTick: x.format,
|
|
561
608
|
xLabels: i.map((e, t) => ({
|
|
562
609
|
label: e,
|
|
563
|
-
x:
|
|
610
|
+
x: q(t, i.length, S).center
|
|
564
611
|
})),
|
|
565
|
-
interactive:
|
|
566
|
-
keys:
|
|
567
|
-
},
|
|
568
|
-
${
|
|
569
|
-
${
|
|
612
|
+
interactive: _.interactive,
|
|
613
|
+
keys: I
|
|
614
|
+
}, v`<g ${h(D.attach)}>${L}</g>`)}
|
|
615
|
+
${H(n)}
|
|
616
|
+
${ie(n)}
|
|
570
617
|
</div>
|
|
571
618
|
`;
|
|
572
619
|
}
|
|
573
620
|
//#endregion
|
|
574
621
|
//#region src/components/shared/charts/shared/tints.ts
|
|
575
|
-
var
|
|
622
|
+
var Se = [
|
|
576
623
|
[1],
|
|
577
624
|
[1, 4],
|
|
578
625
|
[
|
|
@@ -594,14 +641,14 @@ var ge = [
|
|
|
594
641
|
5
|
|
595
642
|
]
|
|
596
643
|
];
|
|
597
|
-
function
|
|
644
|
+
function Ce(e, t) {
|
|
598
645
|
if (e < 1) return [];
|
|
599
|
-
let n =
|
|
600
|
-
return
|
|
646
|
+
let n = Se[Math.min(e, Se.length) - 1];
|
|
647
|
+
return _(t) ? n.map((e) => e === 1 ? `var(--color-chart-${t})` : `var(--color-chart-${t}-tint-${e})`) : n.map((e) => `var(--color-chart-tint-${e})`);
|
|
601
648
|
}
|
|
602
649
|
//#endregion
|
|
603
650
|
//#region src/components/shared/charts/stacked-bar-chart/stacked-bar-chart.ts
|
|
604
|
-
var
|
|
651
|
+
var we = /* @__PURE__ */ new Set([
|
|
605
652
|
"sky-blue",
|
|
606
653
|
"red",
|
|
607
654
|
"green",
|
|
@@ -614,17 +661,19 @@ var ve = /* @__PURE__ */ new Set([
|
|
|
614
661
|
"dark-blue",
|
|
615
662
|
"moss-green"
|
|
616
663
|
]);
|
|
617
|
-
function
|
|
618
|
-
let { controller: n, description: r } = t, { labels: i, axisTitle: a, normalized: o = !1, totalOnTop:
|
|
664
|
+
function Te(e, t) {
|
|
665
|
+
let { controller: n, description: r } = t, { labels: i, axisTitle: a, normalized: o = !1, totalOnTop: d = !0, small: p = !1 } = e, _ = n.id;
|
|
619
666
|
n.measure({
|
|
620
667
|
width: !0,
|
|
621
|
-
height: t.height ?? (
|
|
668
|
+
height: t.height ?? (p ? "--chart-h-small" : "--chart-h-main"),
|
|
622
669
|
fit: !!t.expanded && !t.mobile
|
|
623
670
|
});
|
|
624
|
-
let y = e.series.map((e) => ({
|
|
671
|
+
let y = e.series.map((e, t) => ({
|
|
625
672
|
...e,
|
|
626
|
-
|
|
627
|
-
|
|
673
|
+
j: t,
|
|
674
|
+
color: z(e.color),
|
|
675
|
+
hidden: n.hiddenSeries.includes(e.label)
|
|
676
|
+
})), b = y.filter((e) => !e.hidden), x = de(t, b.flatMap((e) => e.links ?? [])), S = i.map((e, t) => y.reduce((e, n) => e + n.values[t], 0)), C = i.map((e, t) => b.reduce((e, n) => e + n.values[t], 0)), w = (e, t) => e / (S[t] || 1) * 100, E = ye(n, y.map((e) => e.label).join("\0"), y.map((e) => +!e.hidden)), D = be(n), { max: A, ticks: j } = o ? {
|
|
628
677
|
max: 100,
|
|
629
678
|
ticks: [
|
|
630
679
|
0,
|
|
@@ -633,29 +682,31 @@ function ye(e, t) {
|
|
|
633
682
|
75,
|
|
634
683
|
100
|
|
635
684
|
]
|
|
636
|
-
} :
|
|
685
|
+
} : T(Math.max(...S, 1)), M = k(j, n.width, { fontFamily: n.fontFamily }), N = te(t, { left: M.width }), P = N.height - N.bottom, { width: I, bandWidth: L } = q(0, i.length, N), R = d && !o, V = R && C.every((e) => f(c(e, L), L - 4)), U = Ce(y.length), W = (e, t) => e.color ?? U[Math.min(t, U.length - 1)], G = (t) => {
|
|
637
686
|
let n = e.series[t].color;
|
|
638
|
-
return (n == null ? t === 0 :
|
|
639
|
-
},
|
|
687
|
+
return (n == null ? t === 0 : we.has(n)) ? "lintje-chart__data-label--inside" : "lintje-chart__data-label--inside-light";
|
|
688
|
+
}, K = (e) => ({
|
|
640
689
|
title: i[e],
|
|
641
|
-
rows:
|
|
690
|
+
rows: b.map((t) => ({
|
|
642
691
|
label: t.label,
|
|
643
|
-
value: o ?
|
|
644
|
-
color:
|
|
692
|
+
value: o ? g(w(t.values[e], e)) : u(t.values[e]),
|
|
693
|
+
color: W(t, t.j)
|
|
645
694
|
}))
|
|
646
|
-
}),
|
|
647
|
-
x:
|
|
648
|
-
y: O(o ?
|
|
649
|
-
content:
|
|
650
|
-
})),
|
|
695
|
+
}), J = re(n, i.length, (e) => ({
|
|
696
|
+
x: q(e, i.length, N).center,
|
|
697
|
+
y: O(o ? w(C[e], e) : C[e], A, N),
|
|
698
|
+
content: K(e)
|
|
699
|
+
})), Y = y.map((e) => ({
|
|
651
700
|
label: e.label,
|
|
652
|
-
color:
|
|
653
|
-
shape: "square"
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
let
|
|
701
|
+
color: W(e, e.j),
|
|
702
|
+
shape: "square",
|
|
703
|
+
hidden: e.hidden,
|
|
704
|
+
fixed: y.length < 2
|
|
705
|
+
})), X = i.map((e, t) => {
|
|
706
|
+
let r = q(t, i.length, N), a = 0, d = y.map((e) => {
|
|
707
|
+
let { j: n } = e, r = e.values[t], i = o ? w(r, t) : r, s = O(a, A, N);
|
|
708
|
+
a += i * E[n];
|
|
709
|
+
let c = O(a, A, N);
|
|
659
710
|
return {
|
|
660
711
|
row: e,
|
|
661
712
|
j: n,
|
|
@@ -663,139 +714,110 @@ function ye(e, t) {
|
|
|
663
714
|
y1: c,
|
|
664
715
|
height: Math.max(0, s - c)
|
|
665
716
|
};
|
|
666
|
-
});
|
|
667
|
-
return
|
|
717
|
+
}), p = O(a, A, N);
|
|
718
|
+
return v`
|
|
668
719
|
<g class="lintje-chart__bar-group ${n.hoverIndex === t ? "is-hovered" : ""}"
|
|
669
720
|
${s(B(t, i.length))}
|
|
670
|
-
@mousemove=${(e) => n.showTooltip(e,
|
|
721
|
+
@mousemove=${(e) => n.showTooltip(e, K(t))}
|
|
671
722
|
@mouseleave=${() => n.hideTooltip()}>
|
|
672
723
|
<!-- The hit area under the whole column, so the tooltip also follows the empty
|
|
673
724
|
space above the stack. It lies *under* the segments: on top it swallowed
|
|
674
725
|
every click on a segment that drills. -->
|
|
675
|
-
<rect x=${r.x} y=${
|
|
726
|
+
<rect x=${r.x} y=${N.top} width=${r.width} height=${P - N.top} fill="transparent" />
|
|
676
727
|
<!-- The segments in one group, so the column lifts on hover as a whole. -->
|
|
677
728
|
<g class="lintje-chart__bar">
|
|
678
|
-
${
|
|
679
|
-
let i =
|
|
680
|
-
return
|
|
681
|
-
<rect class="lintje-chart__mark lintje-chart__segment ${i
|
|
729
|
+
${d.map((n) => {
|
|
730
|
+
let i = n.row.hidden ? void 0 : x.of(n.row.links?.[t], `${e} · ${n.row.label}`, `${e}, ${n.row.label}: ${u(n.row.values[t])}`);
|
|
731
|
+
return v`
|
|
732
|
+
<rect class="lintje-chart__mark lintje-chart__segment ${i?.state ?? ""}"
|
|
682
733
|
x=${r.x} y=${n.y1} width=${r.width} height=${n.height}
|
|
683
|
-
fill=${
|
|
684
|
-
data-mark-id=${i
|
|
685
|
-
|
|
686
|
-
|
|
734
|
+
fill=${W(n.row, n.j)}
|
|
735
|
+
data-mark-id=${i?.markId ?? l} role=${i?.role ?? l}
|
|
736
|
+
tabindex=${i?.tabIndex ?? l} aria-pressed=${i?.pressed ?? l}
|
|
737
|
+
aria-label=${i?.label ?? l} aria-hidden=${i ? l : "true"}
|
|
738
|
+
@click=${i?.click ?? l} @keydown=${i?.keydown ?? l} />
|
|
687
739
|
`;
|
|
688
740
|
})}
|
|
689
741
|
</g>
|
|
690
|
-
<!-- Percentages inside the segments when they are >= 16 px tall and fit the width.
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
742
|
+
<!-- Percentages inside the segments when they are >= 16 px tall and fit the width. Each
|
|
743
|
+
keeps its node and fades, so a switch does not draw it in again. -->
|
|
744
|
+
${o ? d.map((e) => v`
|
|
745
|
+
<g class="lintje-chart__series ${!e.row.hidden && e.height >= 16 && f(g(e.value), I - 4) ? "" : "is-off"}">
|
|
746
|
+
<text x=${r.center} y=${e.y1 + e.height / 2 + 4} text-anchor="middle"
|
|
747
|
+
class="lintje-chart__data-label ${G(e.j)}">${g(e.value)}</text>
|
|
748
|
+
</g>`) : l}
|
|
749
|
+
${R ? v`<g class="lintje-chart__series ${V ? "" : "is-off"}">
|
|
750
|
+
<text x=${r.center} y=${p - 5} text-anchor="middle"
|
|
751
|
+
class="lintje-chart__data-label" font-weight="700">${c(C[t], r.bandWidth)}</text>
|
|
752
|
+
</g>` : l}
|
|
695
753
|
</g>
|
|
696
754
|
`;
|
|
697
755
|
});
|
|
698
|
-
return
|
|
699
|
-
<div class="lintje-chart-wrap ${
|
|
700
|
-
${
|
|
701
|
-
@keydown=${(e) => n.dismiss(e) ||
|
|
702
|
-
${
|
|
756
|
+
return m`
|
|
757
|
+
<div class="lintje-chart-wrap ${p ? "lintje-chart--small" : ""}"
|
|
758
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
759
|
+
@keydown=${(e) => n.dismiss(e) || x.escape(e)}>
|
|
760
|
+
${F({
|
|
761
|
+
items: Y,
|
|
762
|
+
onToggle: (e) => n.toggleSeries(e)
|
|
763
|
+
})}
|
|
703
764
|
${ee({
|
|
704
765
|
fontFamily: n.fontFamily,
|
|
705
|
-
id:
|
|
706
|
-
ticks:
|
|
707
|
-
max:
|
|
708
|
-
area:
|
|
766
|
+
id: _,
|
|
767
|
+
ticks: j,
|
|
768
|
+
max: A,
|
|
769
|
+
area: N,
|
|
709
770
|
axisTitle: a,
|
|
710
771
|
description: r,
|
|
711
|
-
formatTick:
|
|
772
|
+
formatTick: M.format,
|
|
712
773
|
xLabels: i.map((e, t) => ({
|
|
713
774
|
label: e,
|
|
714
|
-
x:
|
|
775
|
+
x: q(t, i.length, N).center
|
|
715
776
|
})),
|
|
716
|
-
interactive:
|
|
717
|
-
keys:
|
|
718
|
-
},
|
|
719
|
-
${
|
|
720
|
-
${
|
|
777
|
+
interactive: x.interactive,
|
|
778
|
+
keys: J
|
|
779
|
+
}, v`<g ${h(D.attach)}>${X}</g>`)}
|
|
780
|
+
${H(n)}
|
|
781
|
+
${ie(n)}
|
|
721
782
|
</div>
|
|
722
783
|
`;
|
|
723
784
|
}
|
|
724
785
|
//#endregion
|
|
725
786
|
//#region src/components/shared/charts/stacked-area-chart/stacked-area-chart.ts
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
return e.duration > 0 ? Math.min(1, (t - e.start) / e.duration) : 1;
|
|
729
|
-
}
|
|
730
|
-
function Ce(e, t) {
|
|
731
|
-
let n = Se(e, t);
|
|
732
|
-
if (n >= 1) return e.to;
|
|
733
|
-
let r = e.ease(n);
|
|
734
|
-
return e.to.map((t, n) => e.from[n] + (t - e.from[n]) * r);
|
|
735
|
-
}
|
|
736
|
-
function we(e, t, n) {
|
|
737
|
-
let r = performance.now(), i = xe.get(e);
|
|
738
|
-
if (!i || i.key !== t) {
|
|
739
|
-
let a = {
|
|
740
|
-
key: t,
|
|
741
|
-
from: n,
|
|
742
|
-
to: n,
|
|
743
|
-
start: r,
|
|
744
|
-
duration: 0,
|
|
745
|
-
ease: (e) => e,
|
|
746
|
-
element: i?.element,
|
|
747
|
-
attach: (e) => {
|
|
748
|
-
a.element = e;
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
return xe.set(e, a), n;
|
|
752
|
-
}
|
|
753
|
-
if (i.to.some((e, t) => e !== n[t])) {
|
|
754
|
-
let t = i.element, a = !t || b();
|
|
755
|
-
if (i.from = a ? n : Ce(i, r), i.to = n, i.start = r, i.duration = a ? 0 : o(t, "--dur-layer"), i.ease = t ? y(t, "--ease-in-motion") : (e) => e, i.frame == null && i.duration > 0) {
|
|
756
|
-
let t = i, n = () => {
|
|
757
|
-
t.frame = void 0;
|
|
758
|
-
let r = Se(t, performance.now()) >= 1;
|
|
759
|
-
e.requestUpdate(), r || (t.frame = requestAnimationFrame(n));
|
|
760
|
-
};
|
|
761
|
-
t.frame = requestAnimationFrame(n);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
return Ce(i, r);
|
|
765
|
-
}
|
|
766
|
-
function Te(e, t) {
|
|
787
|
+
var Ee = "geen gegevens";
|
|
788
|
+
function De(e, t) {
|
|
767
789
|
let { controller: n, description: r } = t, { labels: i, axisTitle: a, unit: o, small: s = !1 } = e, c = n.id, d = i.length;
|
|
768
790
|
n.measure({
|
|
769
791
|
width: !0,
|
|
770
792
|
height: t.height ?? (s ? "--chart-h-small" : "--chart-h-main"),
|
|
771
793
|
fit: !!t.expanded && !t.mobile
|
|
772
794
|
});
|
|
773
|
-
let f =
|
|
795
|
+
let f = Ce(e.series.length, e.color), g = e.series.map((e, t) => ({
|
|
774
796
|
...e,
|
|
775
797
|
color: f[Math.min(t, f.length - 1)],
|
|
776
798
|
hidden: n.hiddenSeries.includes(e.label)
|
|
777
|
-
})),
|
|
799
|
+
})), _ = g.filter((e) => !e.hidden), y = ye(n, g.map((e) => e.label).join("\0"), g.map((e) => +!e.hidden)), b = y.some((e, t) => e !== +!g[t].hidden), x = be(n), S = g.map(() => i.map(() => !1)), C = g.map(() => i.map(() => 0)), w = g.map(() => i.map(() => 0)), D = i.map(() => !1);
|
|
778
800
|
i.forEach((e, t) => {
|
|
779
801
|
let n = 0;
|
|
780
802
|
g.forEach((e, r) => {
|
|
781
803
|
if (y[r] === 0) return;
|
|
782
804
|
let i = e.values[t];
|
|
783
|
-
|
|
805
|
+
D[t] || i == null ? D[t] = !0 : (S[r][t] = !0, C[r][t] = n, n += i * y[r], w[r][t] = n);
|
|
784
806
|
});
|
|
785
807
|
});
|
|
786
|
-
let
|
|
808
|
+
let j = y.some((e) => e > 0), M = i.map((e, t) => g.map((e) => e.values[t]).filter((e) => e != null)).filter((e) => e.length > 0).map((e) => e.reduce((e, t) => e + t, 0)), { max: N, ticks: P } = T(Math.max(...M, 1)), I = k(P, n.width, {
|
|
787
809
|
fontFamily: n.fontFamily,
|
|
788
|
-
minimum: Math.ceil(
|
|
789
|
-
}),
|
|
810
|
+
minimum: Math.ceil(p(i[0] ?? "", n.fontFamily) / 2)
|
|
811
|
+
}), L = te(t, { left: I.width }), R = L.height - L.bottom, z = (e) => E(e, d, L), B = (e) => O(e, N, L), V = (e) => {
|
|
790
812
|
let t = [];
|
|
791
813
|
return i.forEach((n, r) => {
|
|
792
814
|
if (!e(r)) return;
|
|
793
815
|
let i = t[t.length - 1];
|
|
794
816
|
i && i[i.length - 1] === r - 1 ? i.push(r) : t.push([r]);
|
|
795
817
|
}), t;
|
|
796
|
-
},
|
|
818
|
+
}, U = i.map((e, t) => {
|
|
797
819
|
let n = 0;
|
|
798
|
-
for (let e of
|
|
820
|
+
for (let e of _) {
|
|
799
821
|
let r = e.values[t];
|
|
800
822
|
if (r == null) return {
|
|
801
823
|
level: n,
|
|
@@ -805,123 +827,124 @@ function Te(e, t) {
|
|
|
805
827
|
}
|
|
806
828
|
return {
|
|
807
829
|
level: n,
|
|
808
|
-
complete:
|
|
830
|
+
complete: _.length > 0
|
|
809
831
|
};
|
|
810
|
-
}),
|
|
832
|
+
}), W = g.map((e) => ({
|
|
811
833
|
label: e.label,
|
|
812
834
|
color: e.color,
|
|
813
835
|
shape: "square",
|
|
814
|
-
hidden: e.hidden
|
|
815
|
-
|
|
836
|
+
hidden: e.hidden,
|
|
837
|
+
fixed: g.length < 2
|
|
838
|
+
})), G = Math.max(1, Math.ceil(d / 8)), K = i.map((e, t) => ({
|
|
816
839
|
label: e,
|
|
817
|
-
x:
|
|
840
|
+
x: z(t),
|
|
818
841
|
i: t
|
|
819
|
-
})).filter((e) => e.i %
|
|
820
|
-
function
|
|
842
|
+
})).filter((e) => e.i % G === 0), q = _.length < g.length ? "Totaal getoond" : "Totaal";
|
|
843
|
+
function J(e) {
|
|
821
844
|
return {
|
|
822
845
|
title: i[e],
|
|
823
|
-
rows: [...[...
|
|
846
|
+
rows: [...[..._].reverse().map((t) => ({
|
|
824
847
|
label: t.label,
|
|
825
|
-
value: t.values[e] == null ?
|
|
848
|
+
value: t.values[e] == null ? Ee : u(t.values[e]),
|
|
826
849
|
color: t.color
|
|
827
|
-
})), ...
|
|
828
|
-
label:
|
|
829
|
-
value:
|
|
850
|
+
})), ..._.length > 0 ? [{
|
|
851
|
+
label: q,
|
|
852
|
+
value: U[e].complete ? u(U[e].level) : Ee,
|
|
830
853
|
divider: !0
|
|
831
854
|
}] : []]
|
|
832
855
|
};
|
|
833
856
|
}
|
|
834
|
-
let
|
|
835
|
-
x:
|
|
836
|
-
y:
|
|
837
|
-
content:
|
|
838
|
-
})),
|
|
857
|
+
let Y = re(n, d, (e) => ({
|
|
858
|
+
x: z(e),
|
|
859
|
+
y: U[e].level > 0 ? B(U[e].level) : L.top,
|
|
860
|
+
content: J(e)
|
|
861
|
+
})), X = (e) => {
|
|
839
862
|
let t = [0, 0];
|
|
840
863
|
return g.forEach((n, r) => {
|
|
841
864
|
S[r][e] && S[r][e + 1] && (t = [w[r][e], w[r][e + 1]]);
|
|
842
865
|
}), t;
|
|
843
|
-
},
|
|
866
|
+
}, ne = (j ? V((e) => D[e]) : []).map((e) => {
|
|
844
867
|
let t = Math.max(0, e[0] - 1), r = Math.min(d - 1, e[e.length - 1] + 1), i = Array.from({ length: r - t }, (e, n) => t + n).map((e) => {
|
|
845
|
-
let [t, n] =
|
|
868
|
+
let [t, n] = X(e);
|
|
846
869
|
return {
|
|
847
870
|
k: e,
|
|
848
|
-
left:
|
|
849
|
-
right:
|
|
871
|
+
left: B(t),
|
|
872
|
+
right: B(n)
|
|
850
873
|
};
|
|
851
|
-
}), a =
|
|
874
|
+
}), a = z(t), o = z(r) - a, s = Math.min(R, ...i.flatMap((e) => [e.left, e.right]));
|
|
852
875
|
return {
|
|
853
876
|
segments: i,
|
|
854
877
|
from: a,
|
|
855
878
|
width: o,
|
|
856
879
|
ceiling: s,
|
|
857
|
-
fits:
|
|
880
|
+
fits: p(Ee, n.fontFamily) + 8 <= o && s - L.top >= 20
|
|
858
881
|
};
|
|
859
|
-
}),
|
|
860
|
-
|
|
861
|
-
${e.segments.map((e) =>
|
|
862
|
-
points=${`${
|
|
863
|
-
${e.fits ?
|
|
882
|
+
}), Z = (e, t) => t.map((t) => `${z(t)},${B(e[t])}`), Q = [
|
|
883
|
+
ne.map((e) => v`
|
|
884
|
+
${e.segments.map((e) => v`<polygon fill="url(#hatch-${c})"
|
|
885
|
+
points=${`${z(e.k)},${L.top} ${z(e.k + 1)},${L.top} ${z(e.k + 1)},${e.right} ${z(e.k)},${e.left}`} />`)}
|
|
886
|
+
${e.fits ? v`<text x=${e.from + e.width / 2} y=${(L.top + e.ceiling) / 2 + 4}
|
|
864
887
|
text-anchor="middle"
|
|
865
|
-
class="lintje-chart__as-of-note lintje-chart__data-label--halo">${
|
|
888
|
+
class="lintje-chart__as-of-note lintje-chart__data-label--halo">${Ee}</text>` : l}
|
|
866
889
|
`),
|
|
867
|
-
|
|
890
|
+
v`<g class="lintje-chart__reveal" ${h(x.attach)}>
|
|
868
891
|
${g.map((e, t) => {
|
|
869
|
-
let n =
|
|
870
|
-
return
|
|
871
|
-
${n.map((n) => n.length === 1 ?
|
|
872
|
-
points=${[...
|
|
892
|
+
let n = V((e) => S[t][e]);
|
|
893
|
+
return v`<g>
|
|
894
|
+
${n.map((n) => n.length === 1 ? v`<circle cx=${z(n[0])} cy=${B(w[t][n[0]])} r="2.5" fill=${e.color} />` : v`<polygon fill=${e.color}
|
|
895
|
+
points=${[...Z(w[t], n), ...Z(C[t], n).reverse()].join(" ")} />`)}
|
|
873
896
|
</g>`;
|
|
874
897
|
})}
|
|
875
898
|
<!-- Between two parts a 1 px line in the surface: along each part's lower edge, not the floor. -->
|
|
876
|
-
${g.map((e, t) =>
|
|
899
|
+
${g.map((e, t) => V((e) => S[t][e] && C[t][e] > 0).filter((e) => e.length > 1).map((e) => v`<polyline class="lintje-chart__segment" fill="none" points=${Z(C[t], e).join(" ")} />`))}
|
|
877
900
|
</g>`,
|
|
878
|
-
n.hoverIndex != null && !b ? g.map((e, t) => S[t][n.hoverIndex] ?
|
|
879
|
-
cx=${
|
|
901
|
+
n.hoverIndex != null && !b ? g.map((e, t) => S[t][n.hoverIndex] ? v`<circle class="lintje-chart__hover-point" r="4" fill=${e.color}
|
|
902
|
+
cx=${z(n.hoverIndex)} cy=${B(w[t][n.hoverIndex])} />` : l) : l,
|
|
880
903
|
i.map((e, t) => {
|
|
881
|
-
let r =
|
|
882
|
-
return
|
|
883
|
-
<rect x=${
|
|
884
|
-
height=${
|
|
904
|
+
let r = A(L) / Math.max(1, d - 1);
|
|
905
|
+
return v`
|
|
906
|
+
<rect x=${z(t) - r / 2} y=${L.top} width=${r}
|
|
907
|
+
height=${R - L.top}
|
|
885
908
|
fill="transparent"
|
|
886
|
-
@mousemove=${(e) => n.hoverAt(t, e,
|
|
909
|
+
@mousemove=${(e) => n.hoverAt(t, e, J(t))}
|
|
887
910
|
@mouseleave=${() => n.hoverAt(null)} />
|
|
888
911
|
`;
|
|
889
912
|
})
|
|
890
913
|
];
|
|
891
|
-
return
|
|
914
|
+
return m`
|
|
892
915
|
<div class="lintje-chart-wrap ${s ? "lintje-chart--small" : ""}"
|
|
893
|
-
${
|
|
916
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
894
917
|
@keydown=${(e) => n.dismiss(e)}>
|
|
895
|
-
${
|
|
896
|
-
items:
|
|
918
|
+
${F({
|
|
919
|
+
items: W,
|
|
897
920
|
onToggle: (e) => n.toggleSeries(e)
|
|
898
921
|
})}
|
|
899
922
|
${ee({
|
|
900
923
|
fontFamily: n.fontFamily,
|
|
901
924
|
id: c,
|
|
902
|
-
ticks:
|
|
903
|
-
max:
|
|
904
|
-
area:
|
|
905
|
-
formatTick:
|
|
925
|
+
ticks: P,
|
|
926
|
+
max: N,
|
|
927
|
+
area: L,
|
|
928
|
+
formatTick: I.format,
|
|
906
929
|
axisTitle: a ?? o,
|
|
907
|
-
xLabels:
|
|
930
|
+
xLabels: K,
|
|
908
931
|
description: r,
|
|
909
|
-
keys:
|
|
910
|
-
},
|
|
911
|
-
${
|
|
912
|
-
${
|
|
932
|
+
keys: Y
|
|
933
|
+
}, Q)}
|
|
934
|
+
${H(n)}
|
|
935
|
+
${ie(n)}
|
|
913
936
|
</div>
|
|
914
937
|
`;
|
|
915
938
|
}
|
|
916
939
|
//#endregion
|
|
917
940
|
//#region src/components/shared/charts/pie-chart/pie-chart.ts
|
|
918
|
-
var
|
|
941
|
+
var Oe = 5, ke = (e) => {
|
|
919
942
|
let t = e.label.toLowerCase();
|
|
920
943
|
return t.startsWith("overig") || t === "rest";
|
|
921
|
-
},
|
|
922
|
-
function
|
|
923
|
-
let t = e.filter(
|
|
924
|
-
if (t.length >
|
|
944
|
+
}, Ae = (e) => !e.remainder && !ke(e);
|
|
945
|
+
function je(e) {
|
|
946
|
+
let t = e.filter(Ae).sort((e, t) => t.value - e.value), n = e.filter((e) => !e.remainder && ke(e)), r = e.filter((e) => e.remainder);
|
|
947
|
+
if (t.length > Oe) {
|
|
925
948
|
let e = t.splice(4).reduce((e, t) => e + t.value, 0);
|
|
926
949
|
if (n.length > 0) {
|
|
927
950
|
let [t] = n;
|
|
@@ -941,22 +964,22 @@ function ke(e) {
|
|
|
941
964
|
...r
|
|
942
965
|
];
|
|
943
966
|
}
|
|
944
|
-
function
|
|
945
|
-
let { controller: n, description: r } = t, { donut: i = !1, centerValue: a, centerLabel: o, legendTable: c = !0, labelHeader:
|
|
967
|
+
function Me(e, t) {
|
|
968
|
+
let { controller: n, description: r } = t, { donut: i = !1, centerValue: a, centerLabel: o, legendTable: c = !0, labelHeader: d = "Categorie" } = e, f = n.id, p = je(e.segments).map((e) => ({
|
|
946
969
|
...e,
|
|
947
|
-
color:
|
|
948
|
-
})),
|
|
970
|
+
color: z(e.color)
|
|
971
|
+
})), _ = p.map((e) => e.href ? {
|
|
949
972
|
id: e.id ?? e.label,
|
|
950
973
|
href: e.href
|
|
951
|
-
} : null), y =
|
|
952
|
-
let t = y.of(
|
|
974
|
+
} : null), y = de(t, _), b = (e) => {
|
|
975
|
+
let t = y.of(_[e], p[e].label, p[e].label).state;
|
|
953
976
|
return t.includes("is-selected") ? "is-selected" : t.includes("is-muted") ? "is-muted" : "";
|
|
954
977
|
}, x = !!t.expanded;
|
|
955
978
|
n.measure(x ? {
|
|
956
979
|
width: !0,
|
|
957
980
|
height: "--chart-h-main"
|
|
958
981
|
} : {});
|
|
959
|
-
let S = x ? Math.max(240, Math.min(560, n.height - 24)) : e.size ?? 200, C =
|
|
982
|
+
let S = x ? Math.max(240, Math.min(560, n.height - 24)) : e.size ?? 200, C = p.reduce((e, t) => e + t.value, 0), w = S / 2, T = i ? w * .62 : 0, E = Ce(p.filter(Ae).length, e.color), D = -1, O = p.map((e) => (Ae(e) && (D += 1), e.color ?? (e.remainder ? "var(--color-chart-remainder)" : ke(e) ? "var(--color-chart-other)" : E[Math.min(D, E.length - 1)]))), k = -90, A = p.map((e, t) => {
|
|
960
983
|
let n = e.value / C, r = k, a = k + n * 360;
|
|
961
984
|
k = a;
|
|
962
985
|
let o = +(n > .5), s = (e, t) => [w + t * Math.cos(e * Math.PI / 180), w + t * Math.sin(e * Math.PI / 180)], [c, l] = s(r, w), [u, d] = s(a, w);
|
|
@@ -969,20 +992,20 @@ function Ae(e, t) {
|
|
|
969
992
|
})() : `M ${w} ${w} L ${c} ${l} A ${w} ${w} 0 ${o} 1 ${u} ${d} Z`,
|
|
970
993
|
color: O[t]
|
|
971
994
|
};
|
|
972
|
-
}), j = n.hoverSegment,
|
|
995
|
+
}), j = n.hoverSegment, M = j == null ? void 0 : A[j], N = (e) => {
|
|
973
996
|
n.hoverSegment = e, n.requestUpdate();
|
|
974
997
|
};
|
|
975
|
-
return
|
|
976
|
-
<div class="lintje-pie-chart ${x ? "lintje-pie-chart--expanded" : ""}" ${
|
|
998
|
+
return m`
|
|
999
|
+
<div class="lintje-pie-chart ${x ? "lintje-pie-chart--expanded" : ""}" ${h(n.attach)}
|
|
977
1000
|
?data-in-view=${n.inView} data-tooltip-anchor
|
|
978
1001
|
@keydown=${(e) => n.dismiss(e) || y.escape(e)}>
|
|
979
|
-
<svg viewBox="0 0 ${S} ${S}" width=${S} height=${S} role=${
|
|
980
|
-
class="lintje-pie-chart__svg" aria-labelledby="${
|
|
981
|
-
<desc id="${
|
|
982
|
-
<defs>${
|
|
1002
|
+
<svg viewBox="0 0 ${S} ${S}" width=${S} height=${S} role=${V(y.interactive)}
|
|
1003
|
+
class="lintje-pie-chart__svg" aria-labelledby="${f}-desc" ${s(U(f))}>
|
|
1004
|
+
<desc id="${f}-desc">${r}</desc>
|
|
1005
|
+
<defs>${G(f)}</defs>
|
|
983
1006
|
${A.map(({ segment: e, i: t, d: r, color: i }) => {
|
|
984
|
-
let a = y.of(
|
|
985
|
-
return
|
|
1007
|
+
let a = y.of(_[t], e.label, `${e.label}: ${u(e.value)} · ${g(e.value / C * 100)}`);
|
|
1008
|
+
return v`
|
|
986
1009
|
<path d=${r} fill=${i}
|
|
987
1010
|
class="lintje-pie-chart__segment lintje-chart__mark lintje-chart__segment ${j === t ? "is-hovered" : ""} ${a.state}"
|
|
988
1011
|
${s({ "transform-origin": `${w}px ${w}px` })}
|
|
@@ -990,11 +1013,11 @@ function Ae(e, t) {
|
|
|
990
1013
|
aria-pressed=${a.pressed} aria-label=${a.label}
|
|
991
1014
|
@click=${a.click} @keydown=${a.keydown}
|
|
992
1015
|
@mousemove=${(r) => {
|
|
993
|
-
|
|
1016
|
+
N(t), n.showTooltip(r, {
|
|
994
1017
|
title: e.label,
|
|
995
1018
|
rows: [{
|
|
996
1019
|
label: "Aantal",
|
|
997
|
-
value: `${
|
|
1020
|
+
value: `${u(e.value)} · ${g(e.value / C * 100)}`,
|
|
998
1021
|
color: i
|
|
999
1022
|
}]
|
|
1000
1023
|
});
|
|
@@ -1006,112 +1029,121 @@ function Ae(e, t) {
|
|
|
1006
1029
|
})}
|
|
1007
1030
|
<!-- The hovered segment once more on top, lifted with a light shadow: in place, the
|
|
1008
1031
|
next segment would cover that shadow on one side (user test 13 Sep). -->
|
|
1009
|
-
${
|
|
1010
|
-
${s({ "transform-origin": `${w}px ${w}px` })} aria-hidden="true" />` :
|
|
1011
|
-
${i && a ?
|
|
1032
|
+
${M ? v`<path d=${M.d} fill=${M.color} class="lintje-pie-chart__lift lintje-chart__segment"
|
|
1033
|
+
${s({ "transform-origin": `${w}px ${w}px` })} aria-hidden="true" />` : l}
|
|
1034
|
+
${i && a ? v`
|
|
1012
1035
|
<text x=${w} y=${w + 2} text-anchor="middle" class="lintje-pie-chart__center">${a}</text>
|
|
1013
|
-
${o ?
|
|
1014
|
-
` :
|
|
1036
|
+
${o ? v`<text x=${w} y=${w + 20} text-anchor="middle" class="lintje-chart__axis-label">${o}</text>` : l}
|
|
1037
|
+
` : l}
|
|
1015
1038
|
</svg>
|
|
1016
1039
|
|
|
1017
|
-
${c ?
|
|
1040
|
+
${c ? m`
|
|
1018
1041
|
<table class="lintje-pie-chart__table">
|
|
1019
1042
|
<caption class="visually-hidden">Legenda: ${r}</caption>
|
|
1020
1043
|
<thead>
|
|
1021
1044
|
<tr>
|
|
1022
|
-
<th scope="col" class="lintje-pie-chart__column-label">${
|
|
1045
|
+
<th scope="col" class="lintje-pie-chart__column-label">${d}</th>
|
|
1023
1046
|
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">aantal</th>
|
|
1024
1047
|
<th scope="col" class="lintje-pie-chart__column-label lintje-pie-chart__column-label--numeric">%</th>
|
|
1025
1048
|
</tr>
|
|
1026
1049
|
</thead>
|
|
1027
1050
|
<tbody>
|
|
1028
|
-
${
|
|
1051
|
+
${p.map((e, t) => m`
|
|
1029
1052
|
<tr class="lintje-pie-chart__row ${j === t ? "is-hovered" : ""} ${b(t)}"
|
|
1030
|
-
@mouseenter=${() =>
|
|
1053
|
+
@mouseenter=${() => N(t)} @mouseleave=${() => N(null)}>
|
|
1031
1054
|
<th scope="row" class="lintje-pie-chart__label">
|
|
1032
1055
|
<span class="lintje-pie-chart__marker" ${s({ background: O[t] })}></span>${e.label}
|
|
1033
1056
|
</th>
|
|
1034
|
-
<td class="lintje-pie-chart__value">${
|
|
1035
|
-
<td class="lintje-pie-chart__value">${
|
|
1057
|
+
<td class="lintje-pie-chart__value">${u(e.value)}</td>
|
|
1058
|
+
<td class="lintje-pie-chart__value">${g(e.value / C * 100)}</td>
|
|
1036
1059
|
</tr>
|
|
1037
1060
|
`)}
|
|
1038
1061
|
</tbody>
|
|
1039
1062
|
<tfoot>
|
|
1040
1063
|
<tr>
|
|
1041
1064
|
<th scope="row" class="lintje-pie-chart__total-label">Totaal</th>
|
|
1042
|
-
<td class="lintje-pie-chart__total">${
|
|
1065
|
+
<td class="lintje-pie-chart__total">${u(C)}</td>
|
|
1043
1066
|
<td class="lintje-pie-chart__total"></td>
|
|
1044
1067
|
</tr>
|
|
1045
1068
|
</tfoot>
|
|
1046
1069
|
</table>
|
|
1047
|
-
` :
|
|
1048
|
-
${
|
|
1070
|
+
` : l}
|
|
1071
|
+
${H(n)}
|
|
1049
1072
|
</div>
|
|
1050
1073
|
`;
|
|
1051
1074
|
}
|
|
1052
1075
|
//#endregion
|
|
1053
1076
|
//#region src/components/shared/charts/dual-axis-chart/dual-axis-chart.ts
|
|
1054
|
-
function
|
|
1077
|
+
function Ne(e, t) {
|
|
1055
1078
|
let { controller: n, description: r } = t, { labels: i, threshold: a, thresholdLabel: o, small: c = !1, pendingHours: d = 0 } = e, f = {
|
|
1056
1079
|
...e.left,
|
|
1057
|
-
color:
|
|
1058
|
-
},
|
|
1080
|
+
color: z(e.left.color)
|
|
1081
|
+
}, p = {
|
|
1059
1082
|
...e.right,
|
|
1060
|
-
color:
|
|
1083
|
+
color: z(e.right.color)
|
|
1061
1084
|
}, g = n.id;
|
|
1062
1085
|
n.measure({
|
|
1063
1086
|
width: !0,
|
|
1064
1087
|
height: t.height ?? (c ? "--chart-h-small" : "--chart-h-main"),
|
|
1065
1088
|
fit: !!t.expanded && !t.mobile
|
|
1066
1089
|
});
|
|
1067
|
-
let
|
|
1090
|
+
let _ = f.color ?? "var(--color-chart-default)", y = p.color ?? "var(--color-chart-dark-yellow)", b = T(Math.max(...f.values.filter((e) => e != null), 1)), x = T(Math.max(...p.values.filter((e) => e != null), a ?? 0, 1)), S = k(b.ticks, n.width, { fontFamily: n.fontFamily }), C = k(x.ticks, n.width, { fontFamily: n.fontFamily }), w = te(t, {
|
|
1068
1091
|
left: S.width,
|
|
1069
1092
|
right: C.width
|
|
1070
|
-
}),
|
|
1093
|
+
}), E = w.height - w.bottom, D = n.hiddenSeries.includes("left"), A = n.hiddenSeries.includes("right"), j = n.hiddenSeries.includes(M), N = (e) => `lintje-chart__series ${e ? "is-off" : ""}`, P = [
|
|
1071
1094
|
{
|
|
1095
|
+
key: "left",
|
|
1072
1096
|
label: `${f.label} (linkeras)`,
|
|
1073
|
-
color:
|
|
1074
|
-
shape: "square"
|
|
1097
|
+
color: _,
|
|
1098
|
+
shape: "square",
|
|
1099
|
+
hidden: D
|
|
1075
1100
|
},
|
|
1076
1101
|
{
|
|
1077
|
-
|
|
1102
|
+
key: "right",
|
|
1103
|
+
label: `${p.label} (rechteras)`,
|
|
1078
1104
|
color: y,
|
|
1079
|
-
shape: "line"
|
|
1105
|
+
shape: "line",
|
|
1106
|
+
hidden: A
|
|
1080
1107
|
},
|
|
1081
1108
|
...a == null ? [] : [{
|
|
1109
|
+
key: M,
|
|
1082
1110
|
label: o ?? `Norm ${a}`,
|
|
1083
1111
|
color: "var(--color-chart-emphasis)",
|
|
1084
|
-
shape: "dashed"
|
|
1112
|
+
shape: "dashed",
|
|
1113
|
+
hidden: j
|
|
1085
1114
|
}]
|
|
1086
|
-
],
|
|
1087
|
-
|
|
1088
|
-
e == null ?
|
|
1115
|
+
], I = Math.max(1, Math.ceil(i.length / 8)), R = n.hoverIndex, ee = L(y), U = [[]];
|
|
1116
|
+
p.values.forEach((e, t) => {
|
|
1117
|
+
e == null ? U[U.length - 1].length && U.push([]) : U[U.length - 1].push(`${q(t, i.length, w).center},${O(e, x.max, w)}`);
|
|
1089
1118
|
});
|
|
1090
|
-
let
|
|
1119
|
+
let W = (e, t) => e == null ? "geen gegevens" : `${u(e)}${t ? ` ${t}` : ""}`, G = (e) => ({
|
|
1091
1120
|
title: i[e],
|
|
1092
|
-
rows: [{
|
|
1121
|
+
rows: [...D ? [] : [{
|
|
1093
1122
|
label: f.label,
|
|
1094
|
-
value:
|
|
1095
|
-
color:
|
|
1096
|
-
}, {
|
|
1097
|
-
label:
|
|
1098
|
-
value:
|
|
1123
|
+
value: W(f.values[e], f.unit),
|
|
1124
|
+
color: _
|
|
1125
|
+
}], ...A ? [] : [{
|
|
1126
|
+
label: p.label,
|
|
1127
|
+
value: W(p.values[e], p.unit),
|
|
1099
1128
|
color: y
|
|
1100
|
-
}]
|
|
1101
|
-
}),
|
|
1102
|
-
x:
|
|
1103
|
-
y: Math.min(f.values[e] == null ?
|
|
1104
|
-
content:
|
|
1129
|
+
}]]
|
|
1130
|
+
}), K = re(n, i.length, (e) => ({
|
|
1131
|
+
x: q(e, i.length, w).center,
|
|
1132
|
+
y: Math.min(D || f.values[e] == null ? E : O(f.values[e], b.max, w), A || p.values[e] == null ? E : O(p.values[e], x.max, w)),
|
|
1133
|
+
content: G(e)
|
|
1105
1134
|
}));
|
|
1106
|
-
return
|
|
1135
|
+
return m`
|
|
1107
1136
|
<div class="lintje-chart-wrap ${c ? "lintje-chart--small" : ""}"
|
|
1108
|
-
${
|
|
1137
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
1109
1138
|
@keydown=${(e) => n.dismiss(e)}>
|
|
1110
|
-
${
|
|
1139
|
+
${F({
|
|
1140
|
+
items: P,
|
|
1141
|
+
onToggle: (e) => n.toggleSeries(e)
|
|
1142
|
+
})}
|
|
1111
1143
|
<figure class="lintje-chart">
|
|
1112
|
-
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${
|
|
1144
|
+
<svg viewBox="0 0 ${w.width} ${w.height}" class="lintje-chart__svg" role=${V(!1)}
|
|
1113
1145
|
aria-labelledby="${g}-desc" width=${w.width} height=${w.height}
|
|
1114
|
-
tabindex="0" @keydown=${
|
|
1146
|
+
tabindex="0" @keydown=${K.keydown} @focus=${K.focus} @blur=${K.blur}>
|
|
1115
1147
|
<desc id="${g}-desc">${r}</desc>
|
|
1116
1148
|
<defs>
|
|
1117
1149
|
<pattern id="hatch-${g}" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
|
@@ -1120,112 +1152,116 @@ function je(e, t) {
|
|
|
1120
1152
|
</defs>
|
|
1121
1153
|
<!-- Incomplete hours at the end: hatched, never drawn as zero. -->
|
|
1122
1154
|
${d > 0 ? (() => {
|
|
1123
|
-
let e =
|
|
1124
|
-
return
|
|
1155
|
+
let e = q(i.length - d, i.length, w);
|
|
1156
|
+
return v`<rect x=${e.x - (e.bandWidth - e.width) / 2} y=${w.top}
|
|
1125
1157
|
width=${w.width - w.right - e.x + (e.bandWidth - e.width) / 2}
|
|
1126
|
-
height=${
|
|
1127
|
-
})() :
|
|
1158
|
+
height=${E - w.top} fill="url(#hatch-${g})" />`;
|
|
1159
|
+
})() : l}
|
|
1128
1160
|
|
|
1129
1161
|
${b.ticks.map((e) => {
|
|
1130
1162
|
let t = O(e, b.max, w), n = e === 0;
|
|
1131
|
-
return
|
|
1163
|
+
return v`
|
|
1132
1164
|
<g>
|
|
1133
1165
|
<line x1=${w.left} x2=${w.width - w.right} y1=${t} y2=${t}
|
|
1134
1166
|
stroke=${n ? "var(--color-chart-zero)" : "var(--color-chart-grid)"}
|
|
1135
1167
|
stroke-width=${n ? 1.5 : 1} />
|
|
1136
|
-
<text x=${w.left - 8} y=${t + 4} text-anchor="end" class="lintje-chart__axis-label" fill=${
|
|
1168
|
+
<text x=${w.left - 8} y=${t + 4} text-anchor="end" class="lintje-chart__axis-label" fill=${_}>
|
|
1137
1169
|
${S.format(e)}
|
|
1138
1170
|
</text>
|
|
1139
1171
|
</g>
|
|
1140
1172
|
`;
|
|
1141
1173
|
})}
|
|
1142
|
-
${x.ticks.map((e) =>
|
|
1174
|
+
${x.ticks.map((e) => v`
|
|
1143
1175
|
<text x=${w.width - w.right + 8} y=${O(e, x.max, w) + 4}
|
|
1144
1176
|
class="lintje-chart__axis-label" fill=${"var(--color-chart-dark-yellow-text)"}>${C.format(e)}</text>
|
|
1145
1177
|
`)}
|
|
1146
1178
|
|
|
1147
1179
|
<!-- 2 px axis lines in the color of their series -->
|
|
1148
|
-
<line x1=${w.left} x2=${w.left} y1=${w.top} y2=${
|
|
1149
|
-
<line x1=${w.width - w.right} x2=${w.width - w.right} y1=${w.top} y2=${
|
|
1180
|
+
<line x1=${w.left} x2=${w.left} y1=${w.top} y2=${E} stroke=${_} stroke-width="2" />
|
|
1181
|
+
<line x1=${w.width - w.right} x2=${w.width - w.right} y1=${w.top} y2=${E}
|
|
1150
1182
|
stroke=${y} stroke-width="2" />
|
|
1151
1183
|
|
|
1152
1184
|
<!-- Bars grow in one after another; the hit areas below sit on top, so hover comes
|
|
1153
1185
|
from hoverIndex rather than :hover. -->
|
|
1186
|
+
<g class=${N(D)}>
|
|
1154
1187
|
${f.values.map((e, t) => {
|
|
1155
|
-
let n =
|
|
1156
|
-
if (e == null) return
|
|
1157
|
-
height=${Math.max(0,
|
|
1188
|
+
let n = q(t, i.length, w);
|
|
1189
|
+
if (e == null) return v`<rect class="lintje-chart__missing" x=${n.x} y=${w.top} width=${n.width}
|
|
1190
|
+
height=${Math.max(0, E - w.top)} fill="url(#hatch-${g})" />`;
|
|
1158
1191
|
let r = O(e, b.max, w);
|
|
1159
|
-
return
|
|
1160
|
-
<g class="lintje-chart__bar-group ${
|
|
1192
|
+
return v`
|
|
1193
|
+
<g class="lintje-chart__bar-group ${R === t ? "is-hovered" : ""}"
|
|
1161
1194
|
${s(B(t, i.length))}>
|
|
1162
1195
|
<rect class="lintje-chart__bar" x=${n.x} y=${r} width=${n.width}
|
|
1163
|
-
height=${Math.max(0,
|
|
1196
|
+
height=${Math.max(0, E - r)} fill=${_} />
|
|
1164
1197
|
</g>
|
|
1165
1198
|
`;
|
|
1166
1199
|
})}
|
|
1200
|
+
</g>
|
|
1167
1201
|
|
|
1168
|
-
${a == null ?
|
|
1202
|
+
${a == null ? l : v`<line class=${N(j)} x1=${w.left} x2=${w.width - w.right}
|
|
1169
1203
|
y1=${O(a, x.max, w)} y2=${O(a, x.max, w)}
|
|
1170
1204
|
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="4 3" />`}
|
|
1171
1205
|
|
|
1206
|
+
<g class=${N(A)}>
|
|
1172
1207
|
<g class="lintje-chart__reveal">
|
|
1173
|
-
${
|
|
1208
|
+
${U.filter((e) => e.length > 0).map((e) => {
|
|
1174
1209
|
let t = e.join(" "), [n, r] = e[0].split(",");
|
|
1175
|
-
return
|
|
1176
|
-
${
|
|
1177
|
-
stroke=${
|
|
1178
|
-
${e.length === 1 ?
|
|
1210
|
+
return v`
|
|
1211
|
+
${ee && e.length > 1 ? v`<polyline class="lintje-chart__line lintje-chart__line--casing"
|
|
1212
|
+
stroke=${ee} points=${t} />` : l}
|
|
1213
|
+
${e.length === 1 ? v`<circle cx=${n} cy=${r} r="2.5" fill=${y} />` : v`<polyline class="lintje-chart__line" stroke=${y} points=${t} />`}
|
|
1179
1214
|
`;
|
|
1180
1215
|
})}
|
|
1181
1216
|
</g>
|
|
1217
|
+
</g>
|
|
1182
1218
|
|
|
1183
|
-
${i.filter((e, t) => t %
|
|
1184
|
-
<text x=${
|
|
1219
|
+
${i.filter((e, t) => t % I === 0).map((e, t) => v`
|
|
1220
|
+
<text x=${q(t * I, i.length, w).center} y=${w.height - 8}
|
|
1185
1221
|
text-anchor="middle" class="lintje-chart__axis-label">${e}</text>
|
|
1186
1222
|
`)}
|
|
1187
1223
|
|
|
1188
1224
|
<!-- Hover point on the right-axis line; no point for a missing value. -->
|
|
1189
|
-
${
|
|
1190
|
-
cx=${
|
|
1191
|
-
cy=${O(
|
|
1225
|
+
${R != null && !A && p.values[R] != null ? v`<circle class="lintje-chart__hover-point" r="4" fill=${y}
|
|
1226
|
+
cx=${q(R, i.length, w).center}
|
|
1227
|
+
cy=${O(p.values[R], x.max, w)} />` : l}
|
|
1192
1228
|
${i.map((e, t) => {
|
|
1193
|
-
let r =
|
|
1194
|
-
return
|
|
1195
|
-
<rect x=${r.x} y=${w.top} width=${r.bandWidth} height=${
|
|
1229
|
+
let r = q(t, i.length, w);
|
|
1230
|
+
return v`
|
|
1231
|
+
<rect x=${r.x} y=${w.top} width=${r.bandWidth} height=${E - w.top}
|
|
1196
1232
|
fill="transparent"
|
|
1197
|
-
@mousemove=${(e) => n.hoverAt(t, e,
|
|
1233
|
+
@mousemove=${(e) => n.hoverAt(t, e, G(t))}
|
|
1198
1234
|
@mouseleave=${() => n.hoverAt(null)} />
|
|
1199
1235
|
`;
|
|
1200
1236
|
})}
|
|
1201
1237
|
</svg>
|
|
1202
1238
|
</figure>
|
|
1203
|
-
${
|
|
1204
|
-
${
|
|
1239
|
+
${H(n)}
|
|
1240
|
+
${ie(n)}
|
|
1205
1241
|
</div>
|
|
1206
1242
|
`;
|
|
1207
1243
|
}
|
|
1208
1244
|
//#endregion
|
|
1209
1245
|
//#region src/components/shared/charts/scatter-chart/scatter-chart.ts
|
|
1210
|
-
var
|
|
1211
|
-
function
|
|
1246
|
+
var Pe = 4.5, Fe = 5.5, Ie = 44, Le = 8, Re = (e, t) => e.left < t.right && t.left < e.right && e.top < t.bottom && t.top < e.bottom;
|
|
1247
|
+
function ze(e, t, n, r) {
|
|
1212
1248
|
let i = 5.5, a = [];
|
|
1213
1249
|
for (let [o, s] of e.entries()) {
|
|
1214
1250
|
if (!t.includes(s.label)) continue;
|
|
1215
|
-
let c =
|
|
1251
|
+
let c = p(s.label, r, 700), l = s.y - 9, u = l - 12, d = l + 3, f = [{
|
|
1216
1252
|
anchor: "end",
|
|
1217
|
-
x: s.x -
|
|
1218
|
-
left: s.x -
|
|
1253
|
+
x: s.x - Le,
|
|
1254
|
+
left: s.x - Le - c
|
|
1219
1255
|
}, {
|
|
1220
1256
|
anchor: "start",
|
|
1221
|
-
x: s.x +
|
|
1222
|
-
left: s.x +
|
|
1257
|
+
x: s.x + Le,
|
|
1258
|
+
left: s.x + Le
|
|
1223
1259
|
}].map((e) => ({
|
|
1224
1260
|
...e,
|
|
1225
1261
|
right: e.left + c,
|
|
1226
1262
|
top: u,
|
|
1227
1263
|
bottom: d
|
|
1228
|
-
})).find((t) => t.left >= n.left && t.right <= n.width - n.right && t.top >= 0 && a.every((e) => !
|
|
1264
|
+
})).find((t) => t.left >= n.left && t.right <= n.width - n.right && t.top >= 0 && a.every((e) => !Re(t, e)) && e.every((e, n) => n === o || !Re(t, {
|
|
1229
1265
|
left: e.x - i,
|
|
1230
1266
|
right: e.x + i,
|
|
1231
1267
|
top: e.y - i,
|
|
@@ -1245,51 +1281,53 @@ function Le(e, t, n, r) {
|
|
|
1245
1281
|
anchor: r
|
|
1246
1282
|
}));
|
|
1247
1283
|
}
|
|
1248
|
-
var
|
|
1249
|
-
function
|
|
1250
|
-
let t = new Set(e.series.map((e) => e.color).filter(
|
|
1284
|
+
var Be = (e) => e.charAt(0).toUpperCase() + e.slice(1), Ve = (e, t) => `${u(e)}${t ? ` ${t}` : ""}`;
|
|
1285
|
+
function He(e) {
|
|
1286
|
+
let t = new Set(e.series.map((e) => e.color).filter(K)), n = j.filter((e) => !t.has(e)), r = 0;
|
|
1251
1287
|
return e.series.map((e) => {
|
|
1252
|
-
let t =
|
|
1288
|
+
let t = K(e.color) ? e.color : n[r++ % n.length];
|
|
1253
1289
|
return {
|
|
1254
|
-
color:
|
|
1290
|
+
color: z(e.color ?? t),
|
|
1255
1291
|
symbol: t
|
|
1256
1292
|
};
|
|
1257
1293
|
});
|
|
1258
1294
|
}
|
|
1259
|
-
function
|
|
1260
|
-
let { controller: r, description: i } = n, { axisTitle: a, unit: o, xTitle: c, xUnit:
|
|
1295
|
+
function Ue(e, n) {
|
|
1296
|
+
let { controller: r, description: i } = n, { axisTitle: a, unit: o, xTitle: c, xUnit: f, threshold: p, thresholdLabel: g, small: _ = !1 } = e, y = r.id;
|
|
1261
1297
|
r.measure({
|
|
1262
1298
|
width: !0,
|
|
1263
|
-
height: n.height ?? (
|
|
1299
|
+
height: n.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
1264
1300
|
fit: !!n.expanded && !n.mobile
|
|
1265
1301
|
});
|
|
1266
|
-
let b =
|
|
1302
|
+
let b = He(e), x = e.series.map((e, t) => ({
|
|
1267
1303
|
...e,
|
|
1268
1304
|
...b[t]
|
|
1269
1305
|
})), S = (e) => r.hiddenSeries.includes(e.label), C = x.flatMap((e, t) => e.points.map((n, r) => ({
|
|
1270
1306
|
point: n,
|
|
1271
1307
|
row: e,
|
|
1272
1308
|
key: `${t}:${r}`
|
|
1273
|
-
})).filter((e) => e.point.x != null && e.point.y != null)).sort((e, t) => e.point.x - t.point.x || e.point.y - t.point.y), w = C.filter(({ row: e }) => !S(e)),
|
|
1274
|
-
left:
|
|
1275
|
-
bottom:
|
|
1276
|
-
}),
|
|
1277
|
-
label:
|
|
1278
|
-
x:
|
|
1279
|
-
anchor: t ===
|
|
1280
|
-
})),
|
|
1309
|
+
})).filter((e) => e.point.x != null && e.point.y != null)).sort((e, t) => e.point.x - t.point.x || e.point.y - t.point.y), w = C.filter(({ row: e }) => !S(e)), E = new Map(w.map((e, t) => [e.key, t])), D = r.hiddenSeries.includes(M), j = T(Math.max(...C.map(({ point: e }) => e.x), 1), n.mobile ? 3 : 6), N = T(Math.max(...C.map(({ point: e }) => e.y), p ?? 0, 1)), P = k(N.ticks, r.width, { fontFamily: r.fontFamily }), I = te(n, {
|
|
1310
|
+
left: P.width,
|
|
1311
|
+
bottom: Ie
|
|
1312
|
+
}), R = (e) => I.left + A(I) * e / j.max, z = j.ticks.map((e, t) => ({
|
|
1313
|
+
label: u(e),
|
|
1314
|
+
x: R(e),
|
|
1315
|
+
anchor: t === j.ticks.length - 1 ? "end" : "middle"
|
|
1316
|
+
})), V = [...x.map((e) => ({
|
|
1281
1317
|
label: e.label,
|
|
1282
1318
|
color: e.color,
|
|
1283
1319
|
shape: "point",
|
|
1284
1320
|
symbol: e.symbol,
|
|
1285
|
-
hidden: S(e)
|
|
1286
|
-
|
|
1321
|
+
hidden: S(e),
|
|
1322
|
+
fixed: x.length < 2 && p == null
|
|
1323
|
+
})), ...p == null ? [] : [{
|
|
1324
|
+
key: M,
|
|
1287
1325
|
label: g ?? "Norm",
|
|
1288
1326
|
color: "var(--color-chart-emphasis)",
|
|
1289
1327
|
shape: "dashed",
|
|
1290
|
-
|
|
1328
|
+
hidden: D
|
|
1291
1329
|
}]];
|
|
1292
|
-
function
|
|
1330
|
+
function U(e) {
|
|
1293
1331
|
let { point: t, row: n } = w[e];
|
|
1294
1332
|
return {
|
|
1295
1333
|
title: t.label,
|
|
@@ -1301,131 +1339,133 @@ function Ve(e, n) {
|
|
|
1301
1339
|
symbol: n.symbol
|
|
1302
1340
|
},
|
|
1303
1341
|
{
|
|
1304
|
-
label:
|
|
1305
|
-
value:
|
|
1342
|
+
label: Be(c),
|
|
1343
|
+
value: Ve(t.x, f)
|
|
1306
1344
|
},
|
|
1307
1345
|
{
|
|
1308
|
-
label:
|
|
1309
|
-
value:
|
|
1346
|
+
label: Be(a),
|
|
1347
|
+
value: Ve(t.y, o)
|
|
1310
1348
|
}
|
|
1311
1349
|
]
|
|
1312
1350
|
};
|
|
1313
1351
|
}
|
|
1314
|
-
let
|
|
1315
|
-
x:
|
|
1316
|
-
y: O(e.y,
|
|
1317
|
-
}),
|
|
1318
|
-
...
|
|
1319
|
-
content:
|
|
1320
|
-
})),
|
|
1352
|
+
let W = (e) => ({
|
|
1353
|
+
x: R(e.x),
|
|
1354
|
+
y: O(e.y, N.max, I)
|
|
1355
|
+
}), G = (e) => W(w[e].point), K = re(r, w.length, (e) => ({
|
|
1356
|
+
...G(e),
|
|
1357
|
+
content: U(e)
|
|
1358
|
+
})), q = w.map(({ point: e, row: t }) => e.href ? {
|
|
1321
1359
|
id: e.id ?? `${t.label} · ${e.label}`,
|
|
1322
1360
|
href: e.href
|
|
1323
|
-
} : null),
|
|
1361
|
+
} : null), Y = de(n, q), X = w.map(({ point: e }, t) => Y.of(q[t], e.label, Q(U(t)))), ne = ze(w.map((e, t) => ({
|
|
1324
1362
|
label: e.point.label,
|
|
1325
|
-
...
|
|
1326
|
-
})), e.dataLabels ?? [],
|
|
1363
|
+
...G(t)
|
|
1364
|
+
})), e.dataLabels ?? [], I, r.fontFamily), Z = p == null ? 0 : O(p, N.max, I), $ = r.hoverIndex == null ? void 0 : w[r.hoverIndex], ae = (e) => {
|
|
1327
1365
|
let n = e.target.closest?.("[data-point]");
|
|
1328
1366
|
if (n) return Number(n.getAttribute("data-point"));
|
|
1329
|
-
let r = e.currentTarget, i = r.ownerSVGElement?.getBoundingClientRect(), a = i && i.width > 0 ?
|
|
1367
|
+
let r = e.currentTarget, i = r.ownerSVGElement?.getBoundingClientRect(), a = i && i.width > 0 ? I.width / i.width : 1, o = (e.clientX - (i?.left ?? 0)) * a, s = (e.clientY - (i?.top ?? 0)) * a, c = t(r, "--h-target", 48) / 2, l = null, u = c;
|
|
1330
1368
|
return w.forEach((e, t) => {
|
|
1331
|
-
let { x: n, y: r } =
|
|
1369
|
+
let { x: n, y: r } = G(t), i = Math.hypot(n - o, r - s);
|
|
1332
1370
|
i <= u && (l = t, u = i);
|
|
1333
1371
|
}), l;
|
|
1334
|
-
},
|
|
1335
|
-
let t =
|
|
1336
|
-
t == null ? (r.hoverIndex != null || r.tooltip) && r.hoverAt(null) : r.hoverAt(t, e,
|
|
1337
|
-
},
|
|
1338
|
-
let t =
|
|
1339
|
-
n?.clickable && n.click !==
|
|
1340
|
-
},
|
|
1341
|
-
<g class="lintje-
|
|
1342
|
-
<
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1372
|
+
}, oe = (e) => {
|
|
1373
|
+
let t = ae(e);
|
|
1374
|
+
t == null ? (r.hoverIndex != null || r.tooltip) && r.hoverAt(null) : r.hoverAt(t, e, U(t));
|
|
1375
|
+
}, se = (e) => {
|
|
1376
|
+
let t = ae(e), n = t == null ? null : X[t];
|
|
1377
|
+
n?.clickable && n.click !== l && n.click();
|
|
1378
|
+
}, ce = $ != null && X[r.hoverIndex]?.clickable, le = [p == null ? l : v`
|
|
1379
|
+
<g class="lintje-chart__series ${D ? "is-off" : ""}">
|
|
1380
|
+
<g class="lintje-chart__reference">
|
|
1381
|
+
<line x1=${I.left} x2=${I.width - I.right} y1=${Z} y2=${Z}
|
|
1382
|
+
stroke="var(--color-chart-emphasis)" stroke-width="1" stroke-dasharray="3 3" />
|
|
1383
|
+
<text x=${I.left + 6} y=${Z - 6}
|
|
1384
|
+
class="lintje-chart__axis-label lintje-chart__axis-label--halo">
|
|
1385
|
+
${g ?? `norm ${Ve(p, o)}`}
|
|
1386
|
+
</text>
|
|
1387
|
+
</g>
|
|
1348
1388
|
</g>
|
|
1349
|
-
`,
|
|
1350
|
-
<rect class="lintje-chart__hit ${
|
|
1351
|
-
x="0" y="0" width=${
|
|
1389
|
+
`, v`<g @mousemove=${oe} @mouseleave=${() => r.hoverAt(null)} @click=${se}>
|
|
1390
|
+
<rect class="lintje-chart__hit ${ce ? "is-clickable" : ""}"
|
|
1391
|
+
x="0" y="0" width=${I.width} height=${I.height} />
|
|
1352
1392
|
<g>
|
|
1353
|
-
${
|
|
1354
|
-
let { x: i, y: a } =
|
|
1355
|
-
return
|
|
1356
|
-
<path class="lintje-chart__point lintje-chart__mark ${o ? "" : "lintje-chart__segment"} ${
|
|
1393
|
+
${d(C, (e) => e.key, ({ point: e, row: t, key: n }, r) => {
|
|
1394
|
+
let { x: i, y: a } = W(e), o = L(t.color), c = E.get(n), u = c == null ? void 0 : X[c];
|
|
1395
|
+
return v`
|
|
1396
|
+
<path class="lintje-chart__point lintje-chart__mark ${o ? "" : "lintje-chart__segment"} ${u?.state ?? "is-off"}"
|
|
1357
1397
|
${s(B(r, C.length))}
|
|
1358
|
-
d=${
|
|
1359
|
-
stroke=${o ??
|
|
1360
|
-
data-point=${c ??
|
|
1361
|
-
data-mark-id=${
|
|
1362
|
-
tabindex=${
|
|
1363
|
-
aria-pressed=${
|
|
1364
|
-
@keydown=${
|
|
1398
|
+
d=${J(t.symbol, Pe, i, a)} fill=${t.color}
|
|
1399
|
+
stroke=${o ?? l} stroke-width=${o ? 1 : l}
|
|
1400
|
+
data-point=${c ?? l}
|
|
1401
|
+
data-mark-id=${u?.markId ?? l} role=${u?.role ?? l}
|
|
1402
|
+
tabindex=${u?.tabIndex ?? l}
|
|
1403
|
+
aria-pressed=${u?.pressed ?? l} aria-label=${u?.label ?? l}
|
|
1404
|
+
@keydown=${u?.keydown ?? l} />
|
|
1365
1405
|
`;
|
|
1366
1406
|
})}
|
|
1367
1407
|
</g>
|
|
1368
1408
|
|
|
1369
|
-
${
|
|
1409
|
+
${ne.map((e) => v`
|
|
1370
1410
|
<text x=${e.x} y=${e.y} text-anchor=${e.anchor}
|
|
1371
1411
|
class="lintje-chart__data-label lintje-chart__data-label--halo">${e.label}</text>
|
|
1372
1412
|
`)}
|
|
1373
1413
|
|
|
1374
1414
|
<!-- The point under the pointer or the keyboard, raised with a ring in the surface. -->
|
|
1375
|
-
${
|
|
1376
|
-
let { x: e, y: t } =
|
|
1377
|
-
return
|
|
1378
|
-
<path class="lintje-chart__hover-point" d=${i} fill=${
|
|
1379
|
-
${n ?
|
|
1415
|
+
${$ ? (() => {
|
|
1416
|
+
let { x: e, y: t } = G(r.hoverIndex), n = L($.row.color), i = J($.row.symbol, Fe, e, t);
|
|
1417
|
+
return v`
|
|
1418
|
+
<path class="lintje-chart__hover-point" d=${i} fill=${$.row.color} />
|
|
1419
|
+
${n ? v`<path class="lintje-chart__hover-casing" d=${i} stroke=${n} />` : l}
|
|
1380
1420
|
`;
|
|
1381
|
-
})() :
|
|
1421
|
+
})() : l}
|
|
1382
1422
|
</g>`];
|
|
1383
|
-
return
|
|
1384
|
-
<div class="lintje-chart-wrap ${
|
|
1385
|
-
${
|
|
1386
|
-
@keydown=${(e) => r.dismiss(e) ||
|
|
1387
|
-
${
|
|
1388
|
-
items:
|
|
1423
|
+
return m`
|
|
1424
|
+
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
1425
|
+
${h(r.attach)} ?data-in-view=${r.inView} data-tooltip-anchor
|
|
1426
|
+
@keydown=${(e) => r.dismiss(e) || Y.escape(e)}>
|
|
1427
|
+
${F({
|
|
1428
|
+
items: V,
|
|
1389
1429
|
onToggle: (e) => r.toggleSeries(e)
|
|
1390
1430
|
})}
|
|
1391
1431
|
${ee({
|
|
1392
1432
|
fontFamily: r.fontFamily,
|
|
1393
1433
|
id: y,
|
|
1394
|
-
ticks:
|
|
1395
|
-
max:
|
|
1396
|
-
area:
|
|
1397
|
-
formatTick:
|
|
1434
|
+
ticks: N.ticks,
|
|
1435
|
+
max: N.max,
|
|
1436
|
+
area: I,
|
|
1437
|
+
formatTick: P.format,
|
|
1398
1438
|
axisTitle: a,
|
|
1399
|
-
xLabels:
|
|
1439
|
+
xLabels: z,
|
|
1400
1440
|
xTitle: c,
|
|
1401
1441
|
description: i,
|
|
1402
|
-
interactive:
|
|
1403
|
-
keys:
|
|
1404
|
-
},
|
|
1405
|
-
${
|
|
1406
|
-
${
|
|
1442
|
+
interactive: Y.interactive,
|
|
1443
|
+
keys: K
|
|
1444
|
+
}, le)}
|
|
1445
|
+
${H(r)}
|
|
1446
|
+
${ie(r)}
|
|
1407
1447
|
</div>
|
|
1408
1448
|
`;
|
|
1409
1449
|
}
|
|
1410
1450
|
//#endregion
|
|
1411
1451
|
//#region src/components/shared/charts/heatmap-chart/heatmap-classes.ts
|
|
1412
|
-
var
|
|
1452
|
+
var We = [
|
|
1413
1453
|
"var(--color-chart-seq-1)",
|
|
1414
1454
|
"var(--color-chart-seq-2)",
|
|
1415
1455
|
"var(--color-chart-seq-3)",
|
|
1416
1456
|
"var(--color-chart-seq-4)",
|
|
1417
1457
|
"var(--color-chart-seq-5)"
|
|
1418
|
-
],
|
|
1458
|
+
], Ge = We.length, Ke = [
|
|
1419
1459
|
1,
|
|
1420
1460
|
2,
|
|
1421
1461
|
2.5,
|
|
1422
1462
|
5,
|
|
1423
1463
|
10
|
|
1424
1464
|
];
|
|
1425
|
-
function
|
|
1465
|
+
function qe(e, t) {
|
|
1426
1466
|
if (!(e > 0) || !Number.isFinite(e)) return 1;
|
|
1427
1467
|
let n = 10 ** Math.floor(Math.log10(e)), r = 0, i = Infinity;
|
|
1428
|
-
for (let a of
|
|
1468
|
+
for (let a of Ke) {
|
|
1429
1469
|
let o = a * n;
|
|
1430
1470
|
if (t && !Number.isInteger(o)) continue;
|
|
1431
1471
|
let s = Math.abs(Math.log(o / e));
|
|
@@ -1433,29 +1473,29 @@ function Ge(e, t) {
|
|
|
1433
1473
|
}
|
|
1434
1474
|
return r || (t ? 1 : n);
|
|
1435
1475
|
}
|
|
1436
|
-
function
|
|
1476
|
+
function Je(e, t) {
|
|
1437
1477
|
let n = Math.max(0, Math.min(10, -Math.floor(Math.log10(t)) + 1));
|
|
1438
1478
|
return Number(e.toFixed(n));
|
|
1439
1479
|
}
|
|
1440
|
-
function
|
|
1480
|
+
function Ye(e) {
|
|
1441
1481
|
let t = [];
|
|
1442
1482
|
for (let n of e) for (let e of n ?? []) e != null && Number.isFinite(e) && t.push(e);
|
|
1443
1483
|
if (t.length === 0) return [];
|
|
1444
1484
|
let n = Math.min(...t), r = Math.max(...t);
|
|
1445
1485
|
if (n === r) return [];
|
|
1446
|
-
let i = t.every(Number.isInteger), a =
|
|
1447
|
-
for (let e = 1; e <
|
|
1448
|
-
let t =
|
|
1486
|
+
let i = t.every(Number.isInteger), a = qe((r - n) / Ge, i), o = Math.floor(n / a) * a, s = [];
|
|
1487
|
+
for (let e = 1; e < Ge; e += 1) {
|
|
1488
|
+
let t = Je(o + e * a, a);
|
|
1449
1489
|
if (t > r) break;
|
|
1450
1490
|
s.push(t);
|
|
1451
1491
|
}
|
|
1452
1492
|
return s;
|
|
1453
1493
|
}
|
|
1454
|
-
function
|
|
1455
|
-
let r =
|
|
1494
|
+
function Xe(e, t, n = 0) {
|
|
1495
|
+
let r = u(e, n), i = t?.trim() ?? "";
|
|
1456
1496
|
return i ? i === "%" ? `${r}%` : `${r} ${i}` : r;
|
|
1457
1497
|
}
|
|
1458
|
-
function
|
|
1498
|
+
function Ze(e) {
|
|
1459
1499
|
let t = 0;
|
|
1460
1500
|
for (let n of e) {
|
|
1461
1501
|
let e = String(n), r = e.indexOf(".");
|
|
@@ -1463,13 +1503,13 @@ function Ye(e) {
|
|
|
1463
1503
|
}
|
|
1464
1504
|
return Math.min(t, 4);
|
|
1465
1505
|
}
|
|
1466
|
-
function
|
|
1467
|
-
let n = (t.bounds?.length ? t.bounds.slice(0,
|
|
1506
|
+
function Qe(e, t = {}) {
|
|
1507
|
+
let n = (t.bounds?.length ? t.bounds.slice(0, Ge - 1) : null) ?? Ye(e), r = Ze(n), i = (e) => Xe(e, t.unit, r), a = (e) => u(e, r);
|
|
1468
1508
|
if (n.length === 0) {
|
|
1469
|
-
let e =
|
|
1509
|
+
let e = We.length - 1;
|
|
1470
1510
|
return [{
|
|
1471
1511
|
limit: Infinity,
|
|
1472
|
-
color:
|
|
1512
|
+
color: We[e],
|
|
1473
1513
|
label: "alle waarden",
|
|
1474
1514
|
ramp: e
|
|
1475
1515
|
}];
|
|
@@ -1477,70 +1517,81 @@ function Xe(e, t = {}) {
|
|
|
1477
1517
|
return [
|
|
1478
1518
|
{
|
|
1479
1519
|
limit: n[0],
|
|
1480
|
-
color:
|
|
1520
|
+
color: We[0],
|
|
1481
1521
|
label: `< ${i(n[0])}`,
|
|
1482
1522
|
ramp: 0
|
|
1483
1523
|
},
|
|
1484
1524
|
...n.slice(1).map((e, t) => ({
|
|
1485
1525
|
limit: e,
|
|
1486
|
-
color:
|
|
1526
|
+
color: We[t + 1],
|
|
1487
1527
|
label: `${a(n[t])}–${i(e)}`,
|
|
1488
1528
|
ramp: t + 1
|
|
1489
1529
|
})),
|
|
1490
1530
|
{
|
|
1491
1531
|
limit: Infinity,
|
|
1492
|
-
color:
|
|
1532
|
+
color: We[n.length],
|
|
1493
1533
|
label: `≥ ${i(n[n.length - 1])}`,
|
|
1494
1534
|
ramp: n.length
|
|
1495
1535
|
}
|
|
1496
1536
|
];
|
|
1497
1537
|
}
|
|
1498
|
-
function
|
|
1538
|
+
function $e(e, t) {
|
|
1499
1539
|
let n = e.findIndex((e) => t < e.limit);
|
|
1500
1540
|
return n === -1 ? e.length - 1 : n;
|
|
1501
1541
|
}
|
|
1502
1542
|
//#endregion
|
|
1503
1543
|
//#region src/components/shared/charts/heatmap-chart/heatmap-chart.ts
|
|
1504
|
-
function
|
|
1544
|
+
function et(e, t, n) {
|
|
1505
1545
|
return Array.from({ length: n }, (n, r) => Array.from({ length: t }, (t, n) => e?.[n]?.[r]));
|
|
1506
1546
|
}
|
|
1507
|
-
function
|
|
1547
|
+
function tt(e) {
|
|
1508
1548
|
if (e.mobile) return e.mobile;
|
|
1509
1549
|
let t = e.rowLabels.length, n = e.columnLabels.length;
|
|
1510
1550
|
if (!(n <= t)) return {
|
|
1511
1551
|
columnLabels: e.rowLabels,
|
|
1512
1552
|
rowLabels: e.columnLabels,
|
|
1513
|
-
values:
|
|
1514
|
-
links: e.links ?
|
|
1553
|
+
values: et(e.values, t, n),
|
|
1554
|
+
links: e.links ? et(e.links, t, n) : void 0
|
|
1515
1555
|
};
|
|
1516
1556
|
}
|
|
1517
|
-
function
|
|
1518
|
-
let { controller: n, description: r, mobile: i = !1 } = t, a = i ?
|
|
1557
|
+
function nt(e, t) {
|
|
1558
|
+
let { controller: n, description: r, mobile: i = !1 } = t, a = i ? tt(e) : void 0, o = a?.columnLabels ?? e.columnLabels, c = a?.rowLabels ?? e.rowLabels, d = a?.values ?? e.values, f = a ? a.links : e.links, p = a ? !0 : e.compact ?? !1, { unit: g } = e, _ = de(t, (f ?? []).flat()), v = Qe(d, {
|
|
1519
1559
|
bounds: e.bounds,
|
|
1520
1560
|
unit: g
|
|
1521
|
-
}), y = (e) =>
|
|
1561
|
+
}), y = (e) => $e(v, e);
|
|
1522
1562
|
n.measure({});
|
|
1523
|
-
let b = n.selectedCell, x = n.
|
|
1524
|
-
return
|
|
1525
|
-
<div class="lintje-heatmap" ${
|
|
1563
|
+
let b = n.selectedCell, x = (e) => `class-${e}`, S = (e) => n.hiddenSeries.includes(x(v[e].ramp));
|
|
1564
|
+
return m`
|
|
1565
|
+
<div class="lintje-heatmap" ${h(n.attach)} ?data-in-view=${n.inView}
|
|
1526
1566
|
data-tooltip-anchor @keydown=${_.escape}>
|
|
1527
|
-
|
|
1567
|
+
${F({
|
|
1568
|
+
items: v.map((e) => ({
|
|
1569
|
+
key: x(e.ramp),
|
|
1570
|
+
label: e.label,
|
|
1571
|
+
color: e.color,
|
|
1572
|
+
shape: "square",
|
|
1573
|
+
hidden: n.hiddenSeries.includes(x(e.ramp)),
|
|
1574
|
+
fixed: v.length < 2
|
|
1575
|
+
})),
|
|
1576
|
+
onToggle: (e) => n.toggleSeries(e)
|
|
1577
|
+
})}
|
|
1578
|
+
<table class="lintje-heatmap__grid ${p ? "is-compact" : ""}">
|
|
1528
1579
|
<caption class="visually-hidden">${r}</caption>
|
|
1529
1580
|
<thead>
|
|
1530
1581
|
<tr>
|
|
1531
1582
|
<td></td>
|
|
1532
|
-
${o.map((e) =>
|
|
1583
|
+
${o.map((e) => m`<th scope="col" class="lintje-heatmap__column-label">${e}</th>`)}
|
|
1533
1584
|
</tr>
|
|
1534
1585
|
</thead>
|
|
1535
1586
|
<tbody>
|
|
1536
|
-
${c.map((e, t) =>
|
|
1587
|
+
${c.map((e, t) => m`
|
|
1537
1588
|
<tr>
|
|
1538
1589
|
<th scope="row" class="lintje-heatmap__row-label" title=${e}>
|
|
1539
1590
|
<span class="lintje-heatmap__row-label-text">${e}</span>
|
|
1540
1591
|
</th>
|
|
1541
1592
|
${o.map((r, i) => {
|
|
1542
1593
|
let a = d[t]?.[i];
|
|
1543
|
-
if (a == null) return
|
|
1594
|
+
if (a == null) return m`
|
|
1544
1595
|
<td class="lintje-heatmap__slot">
|
|
1545
1596
|
<div class="lintje-heatmap__cell is-empty"
|
|
1546
1597
|
title="${e} · ${o[i]}: geen meting">
|
|
@@ -1548,35 +1599,35 @@ function et(e, t) {
|
|
|
1548
1599
|
</div>
|
|
1549
1600
|
</td>
|
|
1550
1601
|
`;
|
|
1551
|
-
let
|
|
1552
|
-
return
|
|
1602
|
+
let l = y(a), h = _.of(f?.[t]?.[i], `${e} · ${o[i]}`), x = !h.clickable && b?.row === t && b?.column === i;
|
|
1603
|
+
return m`
|
|
1553
1604
|
<td class="lintje-heatmap__slot">
|
|
1554
1605
|
<button
|
|
1555
1606
|
type="button"
|
|
1556
|
-
class="lintje-heatmap__cell lintje-heatmap__cell--class-${v[
|
|
1557
|
-
data-mark-id=${
|
|
1607
|
+
class="lintje-heatmap__cell lintje-heatmap__cell--class-${v[l].ramp} ${x ? "is-selected" : ""} ${S(l) ? "is-dimmed" : ""} ${h.state}"
|
|
1608
|
+
data-mark-id=${h.markId}
|
|
1558
1609
|
${s({
|
|
1559
|
-
"--lintje-cell": v[
|
|
1560
|
-
...
|
|
1610
|
+
"--lintje-cell": v[l].color,
|
|
1611
|
+
...W(i, t, o.length, c.length)
|
|
1561
1612
|
})}
|
|
1562
|
-
@click=${
|
|
1563
|
-
n.selectedCell =
|
|
1613
|
+
@click=${h.clickable ? h.click : () => {
|
|
1614
|
+
n.selectedCell = x ? null : {
|
|
1564
1615
|
row: t,
|
|
1565
1616
|
column: i
|
|
1566
1617
|
}, n.requestUpdate();
|
|
1567
1618
|
}}
|
|
1568
|
-
@mousemove=${
|
|
1619
|
+
@mousemove=${p ? void 0 : (t) => n.showTooltip(t, {
|
|
1569
1620
|
title: `${e} · ${o[i]}`,
|
|
1570
1621
|
rows: [{
|
|
1571
|
-
label: `klasse ${v[
|
|
1572
|
-
value:
|
|
1573
|
-
color: v[
|
|
1622
|
+
label: `klasse ${v[l].label}`,
|
|
1623
|
+
value: Xe(a, g),
|
|
1624
|
+
color: v[l].color
|
|
1574
1625
|
}]
|
|
1575
1626
|
})}
|
|
1576
|
-
@mouseleave=${
|
|
1577
|
-
aria-pressed=${
|
|
1578
|
-
aria-label="${e} ${o[i]}: ${
|
|
1579
|
-
>${
|
|
1627
|
+
@mouseleave=${p ? void 0 : () => n.hideTooltip()}
|
|
1628
|
+
aria-pressed=${h.clickable ? h.pressed : x}
|
|
1629
|
+
aria-label="${e} ${o[i]}: ${Xe(a, g)}, klasse ${v[l].label}"
|
|
1630
|
+
>${u(a)}</button>
|
|
1580
1631
|
</td>
|
|
1581
1632
|
`;
|
|
1582
1633
|
})}
|
|
@@ -1586,196 +1637,194 @@ function et(e, t) {
|
|
|
1586
1637
|
</table>
|
|
1587
1638
|
|
|
1588
1639
|
<!-- Selected cell: a 48 px line with day, block, value, class. -->
|
|
1589
|
-
${b && d[b.row]?.[b.column] != null ?
|
|
1640
|
+
${b && d[b.row]?.[b.column] != null ? m`
|
|
1590
1641
|
<p class="lintje-heatmap__selection">
|
|
1591
1642
|
<b>${c[b.row]} ${o[b.column]}</b> ·
|
|
1592
|
-
${
|
|
1643
|
+
${Xe(d[b.row][b.column], g)} · klasse
|
|
1593
1644
|
${v[y(d[b.row][b.column])].label}
|
|
1594
1645
|
</p>
|
|
1595
|
-
` :
|
|
1646
|
+
` : l}
|
|
1596
1647
|
|
|
1597
|
-
|
|
1598
|
-
<ul class="lintje-heatmap__legend">
|
|
1599
|
-
${v.map((e, t) => p`
|
|
1600
|
-
<li>
|
|
1601
|
-
<button type="button" class="lintje-heatmap__legend-item ${x != null && x !== t ? "is-dimmed" : ""}"
|
|
1602
|
-
@click=${() => {
|
|
1603
|
-
n.dimmedClass = x === t ? null : t, n.requestUpdate();
|
|
1604
|
-
}}
|
|
1605
|
-
aria-pressed=${x === t}>
|
|
1606
|
-
<span class="lintje-heatmap__swatch lintje-heatmap__swatch--class-${e.ramp}" ${s({ background: e.color })}></span>
|
|
1607
|
-
<span>${e.label}</span>
|
|
1608
|
-
</button>
|
|
1609
|
-
</li>
|
|
1610
|
-
`)}
|
|
1611
|
-
</ul>
|
|
1612
|
-
${U(n)}
|
|
1648
|
+
${H(n)}
|
|
1613
1649
|
</div>
|
|
1614
1650
|
`;
|
|
1615
1651
|
}
|
|
1616
1652
|
//#endregion
|
|
1617
1653
|
//#region src/components/shared/charts/histogram-chart/histogram-chart.ts
|
|
1618
|
-
var
|
|
1619
|
-
function
|
|
1620
|
-
return
|
|
1654
|
+
var rt = 16, it = 56, at = 8, ot = 18;
|
|
1655
|
+
function st(e) {
|
|
1656
|
+
return u(e, +!Number.isInteger(e));
|
|
1621
1657
|
}
|
|
1622
|
-
function
|
|
1658
|
+
function ct(e, t) {
|
|
1623
1659
|
let n = t ? ` ${t}` : "";
|
|
1624
|
-
return e.to == null ? `${
|
|
1660
|
+
return e.to == null ? `${st(e.from)}${n} of meer` : `${st(e.from)} tot ${st(e.to)}${n}`;
|
|
1625
1661
|
}
|
|
1626
|
-
function
|
|
1662
|
+
function lt(e, t, n = "") {
|
|
1627
1663
|
let r = t.width, i = e.map((e) => {
|
|
1628
|
-
let t =
|
|
1664
|
+
let t = p(e.text, n, e.bold ? 700 : 400), i = e.x + 6 + t <= r;
|
|
1629
1665
|
return {
|
|
1630
1666
|
x: i ? e.x + 6 : e.x - 6,
|
|
1631
1667
|
anchor: i ? "start" : "end",
|
|
1632
1668
|
left: i ? e.x + 6 : e.x - 6 - t,
|
|
1633
1669
|
right: i ? e.x + 6 + t : e.x - 6
|
|
1634
1670
|
};
|
|
1635
|
-
}), a = i.length === 2 ? +(e[1].x >= e[0].x) : -1, o = i.length === 2 && i[0].left < i[1].right +
|
|
1671
|
+
}), a = i.length === 2 ? +(e[1].x >= e[0].x) : -1, o = i.length === 2 && i[0].left < i[1].right + at && i[1].left < i[0].right + at;
|
|
1636
1672
|
return i.map((e, n) => ({
|
|
1637
1673
|
x: e.x,
|
|
1638
|
-
y: t.top + 12 + (o && n === a ?
|
|
1674
|
+
y: t.top + 12 + (o && n === a ? ot : 0),
|
|
1639
1675
|
anchor: e.anchor
|
|
1640
1676
|
}));
|
|
1641
1677
|
}
|
|
1642
|
-
function
|
|
1643
|
-
let { controller: n, description: r } = t, { bins: i, axisTitle: a, xTitle: o, unit: c, median:
|
|
1678
|
+
function ut(e, t) {
|
|
1679
|
+
let { controller: n, description: r } = t, { bins: i, axisTitle: a, xTitle: o, unit: c, median: d, threshold: f, small: _ = !1 } = e, y = e.label ?? "Aantal", b = z(e.color) ?? "var(--color-chart-default)", x = n.id, S = (e) => c ? `${e} ${c}` : e;
|
|
1644
1680
|
n.measure({
|
|
1645
1681
|
width: !0,
|
|
1646
|
-
height: t.height ?? (
|
|
1682
|
+
height: t.height ?? (_ ? "--chart-h-small" : "--chart-h-main"),
|
|
1647
1683
|
fit: !!t.expanded && !t.mobile
|
|
1648
1684
|
});
|
|
1649
|
-
let C = i.map((e) => e.count).filter((e) => e != null), w = C.length === i.length ? C.reduce((e, t) => e + t, 0) : null, { max:
|
|
1650
|
-
left:
|
|
1651
|
-
bottom:
|
|
1652
|
-
}),
|
|
1653
|
-
let t =
|
|
1685
|
+
let C = i.map((e) => e.count).filter((e) => e != null), w = C.length === i.length ? C.reduce((e, t) => e + t, 0) : null, { max: E, ticks: D } = T(Math.max(...C, 1)), A = k(D, n.width, { fontFamily: n.fontFamily }), j = te(t), N = te(t, {
|
|
1686
|
+
left: A.width,
|
|
1687
|
+
bottom: j.bottom + (o ? rt : 0)
|
|
1688
|
+
}), P = N.height - N.bottom, L = N.width - N.right, V = i[0]?.from ?? 0, U = i[i.length - 1], W = i.length > 1 ? i[i.length - 1].from - i[i.length - 2].from : 1, G = U ? U.to ?? U.from + W : 1, K = (e) => N.left + (e - V) / Math.max(G - V, 2 ** -52) * (L - N.left), q = i.map((e) => {
|
|
1689
|
+
let t = K(e.from), n = K(e.to ?? G) - t;
|
|
1654
1690
|
return {
|
|
1655
1691
|
x: t,
|
|
1656
1692
|
width: n,
|
|
1657
1693
|
center: t + n / 2
|
|
1658
1694
|
};
|
|
1659
|
-
}),
|
|
1695
|
+
}), J = (e) => n.hiddenSeries.includes(e), Y = J(y), X = (e) => {
|
|
1660
1696
|
let t = i[e].count;
|
|
1661
1697
|
return {
|
|
1662
|
-
title:
|
|
1663
|
-
rows: [{
|
|
1698
|
+
title: ct(i[e], c),
|
|
1699
|
+
rows: Y ? [] : [{
|
|
1664
1700
|
label: y,
|
|
1665
|
-
value: t == null ? "geen gegevens" :
|
|
1701
|
+
value: t == null ? "geen gegevens" : u(t),
|
|
1666
1702
|
color: b
|
|
1667
1703
|
}, ...t != null && w != null && w > 0 ? [{
|
|
1668
1704
|
label: "Aandeel",
|
|
1669
|
-
value:
|
|
1705
|
+
value: g(t / w * 100, 1),
|
|
1670
1706
|
color: b
|
|
1671
1707
|
}] : []]
|
|
1672
1708
|
};
|
|
1673
|
-
},
|
|
1674
|
-
x:
|
|
1675
|
-
y: i[e].count == null ?
|
|
1676
|
-
content:
|
|
1677
|
-
})),
|
|
1678
|
-
label:
|
|
1679
|
-
x:
|
|
1680
|
-
})),
|
|
1681
|
-
label: `${
|
|
1682
|
-
x:
|
|
1683
|
-
} : null,
|
|
1684
|
-
|
|
1685
|
-
let
|
|
1686
|
-
|
|
1687
|
-
|
|
1709
|
+
}, ne = re(n, i.length, (e) => ({
|
|
1710
|
+
x: q[e].center,
|
|
1711
|
+
y: i[e].count == null ? N.top : O(i[e].count, E, N),
|
|
1712
|
+
content: X(e)
|
|
1713
|
+
})), Z = U?.to == null && i.length > 0, Q = [...i.slice(0, Z ? -1 : void 0).map((e) => e.from), ...Z ? [] : U ? [U.to] : []].map((e) => ({
|
|
1714
|
+
label: st(e),
|
|
1715
|
+
x: K(e)
|
|
1716
|
+
})), $ = Z ? {
|
|
1717
|
+
label: `${st(U.from)}+`,
|
|
1718
|
+
x: q[q.length - 1].center
|
|
1719
|
+
} : null, ae = Q.length > 1 ? (Q[Q.length - 1].x - Q[0].x) / (Q.length - 1) : 1, oe = Math.max(1, Math.ceil(it / ae)), se = I(Q.filter((e, t) => t % oe === 0), n.fontFamily), ce = (e, t) => Math.abs(t.x - e.x) < (p(e.label, n.fontFamily) + p(t.label, n.fontFamily)) / 2 + at, le = Z ? $ : Q[Q.length - 1];
|
|
1720
|
+
le && !se.includes(le) && (se.length && ce(se[se.length - 1], le) && (se = se.slice(0, -1)), Z || (se = [...se, le]));
|
|
1721
|
+
let ue = Z ? U.from : G, de = (e) => e != null && e >= V && e <= ue, fe = [...de(d) ? [{
|
|
1722
|
+
key: R,
|
|
1723
|
+
x: K(d),
|
|
1724
|
+
text: e.medianLabel ?? S(`mediaan ${st(d)}`),
|
|
1688
1725
|
bold: !0,
|
|
1689
1726
|
dashed: !1
|
|
1690
|
-
}] : [], ...
|
|
1691
|
-
|
|
1692
|
-
|
|
1727
|
+
}] : [], ...de(f) ? [{
|
|
1728
|
+
key: M,
|
|
1729
|
+
x: K(f),
|
|
1730
|
+
text: e.thresholdLabel ?? S(`norm ${st(f)}`),
|
|
1693
1731
|
bold: !1,
|
|
1694
1732
|
dashed: !0
|
|
1695
|
-
}] : []],
|
|
1733
|
+
}] : []], pe = lt(fe, N, n.fontFamily), me = (e) => e.charAt(0).toUpperCase() + e.slice(1), he = [
|
|
1696
1734
|
{
|
|
1697
1735
|
label: y,
|
|
1698
1736
|
color: b,
|
|
1699
|
-
shape: "square"
|
|
1737
|
+
shape: "square",
|
|
1738
|
+
fixed: fe.length === 0,
|
|
1739
|
+
hidden: Y
|
|
1700
1740
|
},
|
|
1701
|
-
...
|
|
1702
|
-
label:
|
|
1741
|
+
...de(d) ? [{
|
|
1742
|
+
label: me(e.medianLabel ?? "Mediaan"),
|
|
1703
1743
|
color: "var(--color-chart-emphasis)",
|
|
1704
|
-
shape: "line"
|
|
1744
|
+
shape: "line",
|
|
1745
|
+
key: R,
|
|
1746
|
+
hidden: J(R)
|
|
1705
1747
|
}] : [],
|
|
1706
|
-
...
|
|
1707
|
-
label:
|
|
1748
|
+
...de(f) ? [{
|
|
1749
|
+
label: me(e.thresholdLabel ?? "Norm"),
|
|
1708
1750
|
color: "var(--color-chart-emphasis)",
|
|
1709
|
-
shape: "dashed"
|
|
1751
|
+
shape: "dashed",
|
|
1752
|
+
key: M,
|
|
1753
|
+
hidden: J(M)
|
|
1710
1754
|
}] : []
|
|
1711
|
-
],
|
|
1712
|
-
let t =
|
|
1713
|
-
if (n == null) return
|
|
1714
|
-
height=${Math.max(0,
|
|
1715
|
-
let r = O(n,
|
|
1716
|
-
return
|
|
1755
|
+
], ge = (e) => {
|
|
1756
|
+
let t = q[e], n = i[e].count;
|
|
1757
|
+
if (n == null) return v`<rect class="lintje-chart__missing" x=${t.x} y=${N.top} width=${t.width}
|
|
1758
|
+
height=${Math.max(0, P - N.top)} fill="url(#hatch-${x})" />`;
|
|
1759
|
+
let r = O(n, E, N);
|
|
1760
|
+
return v`
|
|
1717
1761
|
<g class="lintje-chart__bar-group" ${s(B(e, i.length))}>
|
|
1718
1762
|
<rect class="lintje-chart__bar lintje-chart__segment" x=${t.x} y=${r} width=${t.width}
|
|
1719
|
-
height=${Math.max(0,
|
|
1763
|
+
height=${Math.max(0, P - r)} fill=${b} />
|
|
1720
1764
|
</g>
|
|
1721
1765
|
`;
|
|
1722
|
-
},
|
|
1723
|
-
i.map((e, t) =>
|
|
1724
|
-
|
|
1725
|
-
x=${
|
|
1726
|
-
height=${Math.max(0,
|
|
1727
|
-
|
|
1728
|
-
<line x1=${e.x} x2=${e.x} y1=${
|
|
1766
|
+
}, _e = n.hoverIndex, ve = _e == null ? null : i[_e]?.count, ye = [
|
|
1767
|
+
v`<g class="lintje-chart__series ${Y ? "is-off" : ""}">${i.map((e, t) => ge(t))}</g>`,
|
|
1768
|
+
_e != null && ve != null && !Y ? v`<rect class="lintje-chart__bar lintje-chart__bar--lifted lintje-chart__segment"
|
|
1769
|
+
x=${q[_e].x} y=${O(ve, E, N)} width=${q[_e].width}
|
|
1770
|
+
height=${Math.max(0, P - O(ve, E, N))} fill=${b} />` : l,
|
|
1771
|
+
se.map((e) => v`
|
|
1772
|
+
<line x1=${e.x} x2=${e.x} y1=${P} y2=${P + 4}
|
|
1729
1773
|
stroke="var(--color-chart-zero)" stroke-width="1" />
|
|
1730
|
-
<text x=${e.x} y=${
|
|
1774
|
+
<text x=${e.x} y=${P + 20} text-anchor="middle" class="lintje-chart__axis-label">${e.label}</text>
|
|
1731
1775
|
`),
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
let n =
|
|
1735
|
-
return
|
|
1736
|
-
<g class="lintje-
|
|
1737
|
-
<
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1776
|
+
$ ? v`<text x=${$.x} y=${P + 20} text-anchor="middle" class="lintje-chart__axis-label">${$.label}</text>` : l,
|
|
1777
|
+
fe.map((e, t) => {
|
|
1778
|
+
let n = pe[t];
|
|
1779
|
+
return v`
|
|
1780
|
+
<g class="lintje-chart__series ${J(e.key) ? "is-off" : ""}">
|
|
1781
|
+
<g class="lintje-chart__reference">
|
|
1782
|
+
<line x1=${e.x} x2=${e.x} y1=${N.top} y2=${P}
|
|
1783
|
+
stroke="var(--color-chart-emphasis)" stroke-width=${e.dashed ? 1 : 1.5}
|
|
1784
|
+
stroke-dasharray=${e.dashed ? "3 3" : l} />
|
|
1785
|
+
<text x=${n.x} y=${n.y} text-anchor=${n.anchor}
|
|
1786
|
+
class=${e.bold ? "lintje-chart__data-label lintje-chart__data-label--halo" : "lintje-chart__axis-label lintje-chart__axis-label--halo"}>${e.text}</text>
|
|
1787
|
+
</g>
|
|
1742
1788
|
</g>
|
|
1743
1789
|
`;
|
|
1744
1790
|
}),
|
|
1745
|
-
|
|
1746
|
-
<rect x=${e.x} y=${
|
|
1791
|
+
q.map((e, t) => v`
|
|
1792
|
+
<rect x=${e.x} y=${N.top} width=${e.width} height=${Math.max(0, P - N.top)}
|
|
1747
1793
|
fill="transparent"
|
|
1748
|
-
@mousemove=${(e) => n.hoverAt(t, e,
|
|
1794
|
+
@mousemove=${(e) => n.hoverAt(t, e, X(t))}
|
|
1749
1795
|
@mouseleave=${() => n.hoverAt(null)} />
|
|
1750
1796
|
`)
|
|
1751
1797
|
];
|
|
1752
|
-
return
|
|
1753
|
-
<div class="lintje-chart-wrap ${
|
|
1754
|
-
${
|
|
1798
|
+
return m`
|
|
1799
|
+
<div class="lintje-chart-wrap ${_ ? "lintje-chart--small" : ""}"
|
|
1800
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
1755
1801
|
@keydown=${(e) => n.dismiss(e)}>
|
|
1756
|
-
${
|
|
1802
|
+
${F({
|
|
1803
|
+
items: he,
|
|
1804
|
+
onToggle: (e) => n.toggleSeries(e)
|
|
1805
|
+
})}
|
|
1757
1806
|
${ee({
|
|
1758
1807
|
fontFamily: n.fontFamily,
|
|
1759
1808
|
id: x,
|
|
1760
|
-
ticks:
|
|
1761
|
-
max:
|
|
1762
|
-
area:
|
|
1809
|
+
ticks: D,
|
|
1810
|
+
max: E,
|
|
1811
|
+
area: N,
|
|
1763
1812
|
axisTitle: a,
|
|
1764
1813
|
xTitle: o,
|
|
1765
1814
|
description: r,
|
|
1766
|
-
formatTick:
|
|
1767
|
-
keys:
|
|
1768
|
-
},
|
|
1769
|
-
${
|
|
1770
|
-
${
|
|
1815
|
+
formatTick: A.format,
|
|
1816
|
+
keys: ne
|
|
1817
|
+
}, ye)}
|
|
1818
|
+
${H(n)}
|
|
1819
|
+
${ie(n)}
|
|
1771
1820
|
</div>
|
|
1772
1821
|
`;
|
|
1773
1822
|
}
|
|
1774
1823
|
//#endregion
|
|
1775
1824
|
//#region src/components/shared/charts/radar-chart/radar-chart.ts
|
|
1776
|
-
var
|
|
1777
|
-
function
|
|
1778
|
-
let t = new Set(e.series.map((e) => e.color).filter(
|
|
1825
|
+
var dt = 16, ft = 6, pt = 18, mt = 16, ht = 3, gt = 4, _t = 8, vt = 40, yt = .7, bt = 420, xt = 12, St = 2;
|
|
1826
|
+
function Ct(e) {
|
|
1827
|
+
let t = new Set(e.series.map((e) => e.color).filter(K)), n = j.filter((e) => !t.has(e)), r = 0;
|
|
1779
1828
|
return e.series.map((t) => {
|
|
1780
1829
|
let i = e.axes.map((e, n) => t.values[n] ?? null);
|
|
1781
1830
|
if (t.comparison) return {
|
|
@@ -1784,17 +1833,17 @@ function xt(e) {
|
|
|
1784
1833
|
comparison: !0,
|
|
1785
1834
|
color: "var(--color-chart-secondary)"
|
|
1786
1835
|
};
|
|
1787
|
-
let a =
|
|
1836
|
+
let a = K(t.color) ? t.color : n[r++ % n.length];
|
|
1788
1837
|
return {
|
|
1789
1838
|
label: t.label,
|
|
1790
1839
|
values: i,
|
|
1791
1840
|
comparison: !1,
|
|
1792
|
-
color:
|
|
1841
|
+
color: z(t.color ?? a),
|
|
1793
1842
|
symbol: a
|
|
1794
1843
|
};
|
|
1795
1844
|
});
|
|
1796
1845
|
}
|
|
1797
|
-
function
|
|
1846
|
+
function wt(e) {
|
|
1798
1847
|
let t = e.length, n = e.findIndex((e) => e == null);
|
|
1799
1848
|
if (n === -1) return {
|
|
1800
1849
|
closed: !0,
|
|
@@ -1810,75 +1859,78 @@ function St(e) {
|
|
|
1810
1859
|
runs: r
|
|
1811
1860
|
};
|
|
1812
1861
|
}
|
|
1813
|
-
function
|
|
1862
|
+
function Tt(e, t = e / 5) {
|
|
1814
1863
|
let n = [];
|
|
1815
1864
|
for (let r = 1; r * t < e - t * 1e-6; r++) n.push(Math.round(r * t * 1e6) / 1e6);
|
|
1816
1865
|
return [...n, e];
|
|
1817
1866
|
}
|
|
1818
|
-
var
|
|
1819
|
-
function
|
|
1867
|
+
var Et = (e) => Number.isInteger(e) ? 0 : String(e).split(".")[1]?.length ?? 0;
|
|
1868
|
+
function Dt(e, t, n) {
|
|
1820
1869
|
let r = e.area ?? "emphasis", i = t.filter((e) => !e.comparison);
|
|
1821
1870
|
return new Set(i.filter((e) => e.complete && r !== "never" && (r === "always" || i.length === 1 || e.label === n)).map((e) => e.label));
|
|
1822
1871
|
}
|
|
1823
|
-
function
|
|
1824
|
-
let { controller: n, description: r, mobile: i = !1 } = t, { axes: a, unit: o, threshold: c, small:
|
|
1825
|
-
let t = Math.round(e * 10 **
|
|
1826
|
-
return t === 0 ?
|
|
1827
|
-
},
|
|
1872
|
+
function Ot(e, t) {
|
|
1873
|
+
let { controller: n, description: r, mobile: i = !1 } = t, { axes: a, unit: o, threshold: c, small: l = !1 } = e, d = a.length, f = Ct(e), p = (e) => n.hiddenSeries.includes(e.label), g = n.hiddenSeries.includes(M), _ = f.length < 2 && c == null, v = f.filter((e) => !p(e)), y = f.filter((e) => !e.comparison), b = v.filter((e) => !e.comparison), x = Math.min(2, Math.max(0, ...f.flatMap((e) => e.values.filter((e) => e != null)).map(Et), ...c == null ? [] : [Et(c)])), S = (e) => u(e, x), C = (e) => `${S(e)}${o ? ` ${o}` : ""}`, w = (e) => {
|
|
1874
|
+
let t = Math.round(e * 10 ** x) / 10 ** x;
|
|
1875
|
+
return t === 0 ? S(0) : `${t > 0 ? "+" : "−"}${S(Math.abs(t))}`;
|
|
1876
|
+
}, T = b.length > 1 && b.some((e) => e.label === n.emphasis) ? n.emphasis : null, E = Dt(e, v.map((e) => ({
|
|
1828
1877
|
...e,
|
|
1829
1878
|
complete: e.values.every((e) => e != null)
|
|
1830
|
-
})),
|
|
1879
|
+
})), T), D = a.map((e, t) => f.some((e) => e.values[t] == null)), O = e.dataLabels !== !1 && y.length === 1, k = O && !p(y[0]), A = [
|
|
1831
1880
|
...f.map((e) => e.comparison ? {
|
|
1832
1881
|
label: e.label,
|
|
1833
1882
|
color: e.color,
|
|
1834
1883
|
shape: "line",
|
|
1835
|
-
hidden:
|
|
1884
|
+
hidden: p(e),
|
|
1885
|
+
fixed: _
|
|
1836
1886
|
} : {
|
|
1837
1887
|
label: e.label,
|
|
1838
1888
|
color: e.color,
|
|
1839
1889
|
shape: "line",
|
|
1840
1890
|
symbol: e.symbol,
|
|
1841
|
-
hidden:
|
|
1891
|
+
hidden: p(e),
|
|
1892
|
+
fixed: _
|
|
1842
1893
|
}),
|
|
1843
1894
|
...c == null ? [] : [{
|
|
1844
|
-
|
|
1895
|
+
key: M,
|
|
1896
|
+
label: e.thresholdLabel ?? `Norm ${C(c)}`,
|
|
1845
1897
|
color: "var(--color-chart-emphasis)",
|
|
1846
1898
|
shape: "dashed",
|
|
1847
|
-
|
|
1899
|
+
hidden: g
|
|
1848
1900
|
}],
|
|
1849
|
-
...
|
|
1901
|
+
...D.some(Boolean) ? [{
|
|
1850
1902
|
label: "Geen gegevens",
|
|
1851
1903
|
shape: "hatch",
|
|
1852
1904
|
fixed: !0
|
|
1853
1905
|
}] : []
|
|
1854
1906
|
];
|
|
1855
|
-
function
|
|
1856
|
-
let n =
|
|
1907
|
+
function j(t) {
|
|
1908
|
+
let n = v.map((e) => {
|
|
1857
1909
|
let n = e.values[t];
|
|
1858
1910
|
return {
|
|
1859
1911
|
label: e.label,
|
|
1860
|
-
value: n == null ? "geen gegevens" :
|
|
1912
|
+
value: n == null ? "geen gegevens" : C(n),
|
|
1861
1913
|
color: e.color,
|
|
1862
1914
|
symbol: e.symbol,
|
|
1863
1915
|
marker: e.comparison ? "line" : void 0
|
|
1864
1916
|
};
|
|
1865
1917
|
});
|
|
1866
|
-
c != null && n.push({
|
|
1918
|
+
c != null && !g && n.push({
|
|
1867
1919
|
label: e.thresholdLabel ?? "Norm",
|
|
1868
|
-
value:
|
|
1920
|
+
value: C(c),
|
|
1869
1921
|
color: "var(--color-chart-emphasis)",
|
|
1870
1922
|
marker: "dashed"
|
|
1871
1923
|
});
|
|
1872
|
-
let [r] =
|
|
1924
|
+
let [r] = b, i = b.length === 1 ? r.values[t] : null;
|
|
1873
1925
|
if (i != null) {
|
|
1874
|
-
let e =
|
|
1926
|
+
let e = v.find((e) => e.comparison), r = e?.values[t];
|
|
1875
1927
|
e && r != null && n.push({
|
|
1876
1928
|
label: `t.o.v. ${e.label}`,
|
|
1877
|
-
value:
|
|
1929
|
+
value: w(i - r),
|
|
1878
1930
|
divider: !0
|
|
1879
|
-
}), c != null && n.push({
|
|
1931
|
+
}), c != null && !g && n.push({
|
|
1880
1932
|
label: "t.o.v. norm",
|
|
1881
|
-
value:
|
|
1933
|
+
value: w(i - c),
|
|
1882
1934
|
divider: !(e && r != null)
|
|
1883
1935
|
});
|
|
1884
1936
|
}
|
|
@@ -1887,39 +1939,40 @@ function Et(e, t) {
|
|
|
1887
1939
|
rows: n
|
|
1888
1940
|
};
|
|
1889
1941
|
}
|
|
1890
|
-
let { width:
|
|
1942
|
+
let { width: N, height: P, body: I, at: L } = (i ? At : kt)({
|
|
1891
1943
|
spec: e,
|
|
1892
1944
|
controller: n,
|
|
1893
1945
|
options: t,
|
|
1894
1946
|
layers: f,
|
|
1895
|
-
shown:
|
|
1896
|
-
fills:
|
|
1897
|
-
emphasis:
|
|
1898
|
-
missing:
|
|
1899
|
-
reserve:
|
|
1900
|
-
labelled:
|
|
1901
|
-
hidden:
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1947
|
+
shown: v,
|
|
1948
|
+
fills: E,
|
|
1949
|
+
emphasis: T,
|
|
1950
|
+
missing: D,
|
|
1951
|
+
reserve: O,
|
|
1952
|
+
labelled: k,
|
|
1953
|
+
hidden: p,
|
|
1954
|
+
normOff: g,
|
|
1955
|
+
format: S,
|
|
1956
|
+
contentAt: j
|
|
1957
|
+
}), R = re(n, d, (e) => ({
|
|
1958
|
+
...L(e),
|
|
1959
|
+
content: j(e)
|
|
1907
1960
|
}));
|
|
1908
|
-
return
|
|
1909
|
-
<div class="lintje-chart-wrap ${
|
|
1910
|
-
${
|
|
1961
|
+
return m`
|
|
1962
|
+
<div class="lintje-chart-wrap ${l ? "lintje-chart--small" : ""}"
|
|
1963
|
+
${h(n.attach)} ?data-in-view=${n.inView} data-tooltip-anchor
|
|
1911
1964
|
@keydown=${(e) => n.dismiss(e)}>
|
|
1912
|
-
${
|
|
1913
|
-
items:
|
|
1965
|
+
${F({
|
|
1966
|
+
items: A,
|
|
1914
1967
|
onToggle: (e) => n.toggleSeries(e),
|
|
1915
|
-
onEmphasis:
|
|
1968
|
+
onEmphasis: y.length > 1 ? (e) => n.emphasise(e) : void 0
|
|
1916
1969
|
})}
|
|
1917
1970
|
<figure class="lintje-chart">
|
|
1918
|
-
<svg viewBox="0 0 ${
|
|
1971
|
+
<svg viewBox="0 0 ${N} ${P}" width=${N} height=${P}
|
|
1919
1972
|
class="lintje-chart__svg lintje-radar ${i ? "lintje-radar--rows" : ""}"
|
|
1920
|
-
${s({ height: `${
|
|
1921
|
-
role=${
|
|
1922
|
-
@keydown=${
|
|
1973
|
+
${s({ height: `${P}px` })}
|
|
1974
|
+
role=${V(!1)} aria-labelledby="${n.id}-desc" tabindex="0"
|
|
1975
|
+
@keydown=${R.keydown} @focus=${R.focus} @blur=${R.blur}>
|
|
1923
1976
|
<desc id="${n.id}-desc">${r}</desc>
|
|
1924
1977
|
<defs>
|
|
1925
1978
|
<pattern id="hatch-${n.id}" width="6" height="6" patternUnits="userSpaceOnUse"
|
|
@@ -1927,183 +1980,189 @@ function Et(e, t) {
|
|
|
1927
1980
|
<line x1="0" y1="0" x2="0" y2="6" stroke="var(--color-chart-hatch)" stroke-width="2" />
|
|
1928
1981
|
</pattern>
|
|
1929
1982
|
</defs>
|
|
1930
|
-
${
|
|
1983
|
+
${I}
|
|
1931
1984
|
</svg>
|
|
1932
1985
|
</figure>
|
|
1933
|
-
${
|
|
1934
|
-
${
|
|
1986
|
+
${H(n)}
|
|
1987
|
+
${ie(n)}
|
|
1935
1988
|
</div>
|
|
1936
1989
|
`;
|
|
1937
1990
|
}
|
|
1938
|
-
function
|
|
1939
|
-
let { axes:
|
|
1991
|
+
function kt({ spec: e, controller: t, options: n, layers: r, shown: i, fills: a, emphasis: o, missing: c, reserve: d, labelled: f, hidden: m, normOff: h, format: g, contentAt: _ }) {
|
|
1992
|
+
let { axes: y, max: b, threshold: x, small: S = !1 } = e, C = y.length, w = S ? "--chart-h-small" : "--chart-h-main";
|
|
1940
1993
|
t.measure({
|
|
1941
1994
|
width: !0,
|
|
1942
|
-
height: n.height ??
|
|
1995
|
+
height: n.height ?? w,
|
|
1943
1996
|
fit: !!n.expanded
|
|
1944
1997
|
});
|
|
1945
|
-
let
|
|
1946
|
-
x: N + t * Math.cos(
|
|
1947
|
-
y: P + t * Math.sin(
|
|
1948
|
-
}), I = (e) => Math.max(0, Math.min(e,
|
|
1998
|
+
let T = t.width, E = n.height ?? (n.expanded || S ? t.height : Math.max(t.height, Math.min(bt, Math.round(T * yt)))), D = (e) => -Math.PI / 2 + 2 * Math.PI * e / C, O = t.fontFamily, k = (e) => p(e, O) * 14 / 12, A = Math.max(0, ...y.map((e, t) => Math.abs(Math.cos(D(t))) < .1 ? 0 : k(e) + ft + 2)), j = 24 + (d ? mt : 0), M = Math.max(vt, Math.min(T / 2 - A - dt, E / 2 - j - dt)), N = T / 2, P = E / 2, F = (e, t) => ({
|
|
1999
|
+
x: N + t * Math.cos(D(e)),
|
|
2000
|
+
y: P + t * Math.sin(D(e))
|
|
2001
|
+
}), I = (e) => Math.max(0, Math.min(e, b)) / b * M, R = (e) => e.map((e) => `${e.x},${e.y}`).join(" "), ee = (e) => R(y.map((t, n) => F(n, I(e)))), z = Tt(b, e.step), B = Math.max(0, ...z.map(Et)), V = t.hoverIndex, H = (e) => {
|
|
1949
2002
|
let t = i.map((t) => t.values[e]).filter((e) => e != null);
|
|
1950
2003
|
return F(e, t.length ? I(Math.max(...t)) : M / 2);
|
|
1951
|
-
},
|
|
1952
|
-
let n = Math.cos(
|
|
1953
|
-
c = o && i < 0 ? a.y - 4 - (d ?
|
|
1954
|
-
let
|
|
1955
|
-
return
|
|
2004
|
+
}, U = [...r.filter((e) => e.comparison), ...r.filter((e) => !e.comparison)], W = (e) => o != null && e.label !== o, G = s({ "transform-origin": `${N}px ${P}px` }), K = y.map((e, t) => {
|
|
2005
|
+
let n = Math.cos(D(t)), i = Math.sin(D(t)), a = F(t, M + dt + ft), o = Math.abs(n) < .1, s = o ? "middle" : n > 0 ? "start" : "end", c;
|
|
2006
|
+
c = o && i < 0 ? a.y - 4 - (d ? mt : 0) : o ? a.y + 12 : d ? a.y - 2 : a.y + 5;
|
|
2007
|
+
let u = d ? r.find((e) => !e.comparison)?.values[t] : void 0;
|
|
2008
|
+
return v`
|
|
1956
2009
|
<text x=${a.x} y=${c} text-anchor=${s} class="lintje-radar__name">${e}</text>
|
|
1957
|
-
${d ?
|
|
1958
|
-
|
|
1959
|
-
|
|
2010
|
+
${d ? v`<g class="lintje-chart__series ${f ? "" : "is-off"}">
|
|
2011
|
+
<text x=${a.x} y=${c + mt} text-anchor=${s}
|
|
2012
|
+
class="lintje-chart__data-label lintje-radar__value ${u == null ? "lintje-radar__no-value" : ""}">
|
|
2013
|
+
${u == null ? "geen gegevens" : g(u)}</text>
|
|
2014
|
+
</g>` : l}
|
|
1960
2015
|
`;
|
|
1961
|
-
}),
|
|
1962
|
-
let n =
|
|
1963
|
-
if (t === "area") return e.comparison || r.some((e) => e == null) ?
|
|
2016
|
+
}), q = (e, t) => {
|
|
2017
|
+
let n = `lintje-chart__series ${m(e) ? "is-off" : ""}`, r = e.values.map((e, t) => e == null ? null : F(t, I(e)));
|
|
2018
|
+
if (t === "area") return e.comparison || r.some((e) => e == null) ? l : v`<g class=${n}><g class="lintje-radar__layer" ${G}>
|
|
1964
2019
|
<polygon class="lintje-radar__area ${a.has(e.label) ? "is-filled" : ""}"
|
|
1965
|
-
points=${
|
|
1966
|
-
</g>`;
|
|
1967
|
-
let { closed: i, runs: o } =
|
|
1968
|
-
let n = t.map((e) => r[e]), a =
|
|
1969
|
-
return n.length === 1 ? e.comparison ?
|
|
1970
|
-
${s ?
|
|
2020
|
+
points=${R(r)} fill=${e.color} />
|
|
2021
|
+
</g></g>`;
|
|
2022
|
+
let { closed: i, runs: o } = wt(e.values), s = e.comparison ? void 0 : L(e.color), c = o.map((t) => {
|
|
2023
|
+
let n = t.map((e) => r[e]), a = R(i ? [...n, n[0]] : n);
|
|
2024
|
+
return n.length === 1 ? e.comparison ? v`<circle cx=${n[0].x} cy=${n[0].y} r="2.5" fill=${e.color} />` : l : v`
|
|
2025
|
+
${s ? v`<polyline class="lintje-chart__line lintje-chart__line--casing" points=${a} stroke=${s} />` : l}
|
|
1971
2026
|
<polyline class="lintje-chart__line" points=${a} stroke=${e.color} />
|
|
1972
2027
|
`;
|
|
1973
|
-
}),
|
|
1974
|
-
stroke=${s ??
|
|
1975
|
-
return t === "lift" ?
|
|
1976
|
-
${c}${
|
|
1977
|
-
</g>`;
|
|
1978
|
-
},
|
|
1979
|
-
let t = M +
|
|
1980
|
-
return `${N},${P} ${r(
|
|
2028
|
+
}), u = e.symbol ? r.map((t) => t ? v`<path d=${J(e.symbol, ht, t.x, t.y)} fill=${e.color}
|
|
2029
|
+
stroke=${s ?? l} stroke-width=${s ? 1 : l} />` : l) : l;
|
|
2030
|
+
return t === "lift" ? v`<g class="lintje-radar__lift" aria-hidden="true">${c}${u}</g>` : v`<g class=${n}><g class="lintje-radar__layer ${W(e) ? "is-muted" : ""}" ${G}>
|
|
2031
|
+
${c}${u}
|
|
2032
|
+
</g></g>`;
|
|
2033
|
+
}, te = (e) => {
|
|
2034
|
+
let t = M + dt, n = Math.PI / C, r = (e) => `${N + t * Math.cos(e)},${P + t * Math.sin(e)}`;
|
|
2035
|
+
return `${N},${P} ${r(D(e) - n)} ${r(D(e))} ${r(D(e) + n)}`;
|
|
1981
2036
|
};
|
|
1982
2037
|
return {
|
|
1983
|
-
width:
|
|
1984
|
-
height:
|
|
2038
|
+
width: T,
|
|
2039
|
+
height: E,
|
|
1985
2040
|
body: [
|
|
1986
|
-
z.map((e) =>
|
|
2041
|
+
z.map((e) => v`<polygon class="lintje-radar__ring" points=${ee(e)} />`),
|
|
1987
2042
|
c.map((e, n) => {
|
|
1988
|
-
if (!e) return
|
|
1989
|
-
let r =
|
|
1990
|
-
return
|
|
2043
|
+
if (!e) return l;
|
|
2044
|
+
let r = D(n), i = -Math.sin(r) * 5, a = Math.cos(r) * 5, o = F(n, M);
|
|
2045
|
+
return v`<polygon class="lintje-radar__gap" fill="url(#hatch-${t.id})"
|
|
1991
2046
|
points=${`${N + i},${P + a} ${o.x + i},${o.y + a} ${o.x - i},${o.y - a} ${N - i},${P - a}`} />`;
|
|
1992
2047
|
}),
|
|
1993
|
-
|
|
1994
|
-
let n = F(t, M +
|
|
1995
|
-
return
|
|
2048
|
+
y.map((e, t) => {
|
|
2049
|
+
let n = F(t, M + dt);
|
|
2050
|
+
return v`<line class="lintje-radar__spoke ${V === t ? "is-active" : ""}"
|
|
1996
2051
|
x1=${N} y1=${P} x2=${n.x} y2=${n.y} />`;
|
|
1997
2052
|
}),
|
|
1998
2053
|
z.map((e) => {
|
|
1999
2054
|
let t = F(0, I(e));
|
|
2000
|
-
return
|
|
2001
|
-
class="lintje-chart__axis-label lintje-chart__axis-label--halo">${
|
|
2055
|
+
return v`<text x=${t.x + _t / 2} y=${t.y + 4}
|
|
2056
|
+
class="lintje-chart__axis-label lintje-chart__axis-label--halo">${u(e, B)}</text>`;
|
|
2002
2057
|
}),
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2058
|
+
x == null ? l : v`<g class="lintje-chart__series ${h ? "is-off" : ""}">
|
|
2059
|
+
<polygon class="lintje-chart__reference lintje-radar__norm" points=${ee(x)} />
|
|
2060
|
+
</g>`,
|
|
2061
|
+
U.map((e) => q(e, "area")),
|
|
2062
|
+
U.map((e) => q(e, "line")),
|
|
2063
|
+
o == null ? l : q(r.find((e) => e.label === o), "lift"),
|
|
2064
|
+
K,
|
|
2065
|
+
V == null ? l : i.map((e) => {
|
|
2009
2066
|
let t = e.values[V];
|
|
2010
|
-
if (t == null) return
|
|
2011
|
-
let n = F(V, I(t)), r = e.comparison ? void 0 :
|
|
2012
|
-
return
|
|
2067
|
+
if (t == null) return l;
|
|
2068
|
+
let n = F(V, I(t)), r = e.comparison ? void 0 : L(e.color), i = J(e.symbol, gt, n.x, n.y);
|
|
2069
|
+
return v`
|
|
2013
2070
|
<path class="lintje-chart__hover-point" d=${i} fill=${e.color} />
|
|
2014
|
-
${r ?
|
|
2071
|
+
${r ? v`<path class="lintje-chart__hover-casing" d=${i} stroke=${r} />` : l}
|
|
2015
2072
|
`;
|
|
2016
2073
|
}),
|
|
2017
|
-
|
|
2018
|
-
${
|
|
2019
|
-
@mousemove=${(e) => t.hoverAt(n, e,
|
|
2074
|
+
v`<g @mouseleave=${() => t.hoverAt(null)}>
|
|
2075
|
+
${y.map((e, n) => v`<polygon class="lintje-chart__hit" points=${te(n)}
|
|
2076
|
+
@mousemove=${(e) => t.hoverAt(n, e, _(n))} />`)}
|
|
2020
2077
|
</g>`
|
|
2021
2078
|
],
|
|
2022
|
-
at:
|
|
2079
|
+
at: H
|
|
2023
2080
|
};
|
|
2024
2081
|
}
|
|
2025
|
-
function
|
|
2026
|
-
let { axes:
|
|
2082
|
+
function At({ spec: e, controller: t, layers: n, shown: r, reserve: i, labelled: a, hidden: o, normOff: c, format: d, contentAt: f }) {
|
|
2083
|
+
let { axes: m, max: h, threshold: g } = e;
|
|
2027
2084
|
t.measure({ width: !0 });
|
|
2028
|
-
let
|
|
2085
|
+
let _ = t.width, y = _ - 1, b = n.filter((e) => !e.comparison), x = [...b.map((e) => ({
|
|
2029
2086
|
layer: e,
|
|
2030
|
-
size:
|
|
2087
|
+
size: b.length === 1 ? 8 : 6
|
|
2031
2088
|
})), ...n.filter((e) => e.comparison).map((e) => ({
|
|
2032
2089
|
layer: e,
|
|
2033
2090
|
size: 4
|
|
2034
|
-
}))],
|
|
2035
|
-
let t =
|
|
2091
|
+
}))], S = x.reduce((e, t) => e + t.size, 0) + St * Math.max(0, x.length - 1), C = 22 + S + xt, w = m.length * C, T = w + 16, E = (e) => .5 + Math.max(0, Math.min(e, h)) / h * y, D = t.fontFamily, O = n.find((e) => !e.comparison), k = r.find((e) => !e.comparison), A = t.hoverIndex, j = (e) => {
|
|
2092
|
+
let t = k?.values[e];
|
|
2036
2093
|
return {
|
|
2037
|
-
x: t == null ?
|
|
2038
|
-
y: e *
|
|
2094
|
+
x: t == null ? _ / 2 : E(t),
|
|
2095
|
+
y: e * C + pt + 4
|
|
2039
2096
|
};
|
|
2040
|
-
},
|
|
2041
|
-
let r = n *
|
|
2042
|
-
return
|
|
2043
|
-
<g class="lintje-radar__row ${
|
|
2097
|
+
}, M = m.map((e, n) => {
|
|
2098
|
+
let r = n * C, u = r + pt + 4, h = i ? O?.values[n] : void 0, b = i ? h == null ? "geen gegevens" : d(h) : "", w = i && h != null && g != null && h < g, T = `lintje-chart__series ${a ? "" : "is-off"}`, k = u;
|
|
2099
|
+
return v`
|
|
2100
|
+
<g class="lintje-radar__row ${A === n ? "is-active" : ""}">
|
|
2044
2101
|
<text x="0" y=${r + 14} class="lintje-radar__name">${e}</text>
|
|
2045
|
-
${i ?
|
|
2046
|
-
class="lintje-chart__data-label lintje-radar__value ${
|
|
2047
|
-
${
|
|
2048
|
-
class="lintje-chart__axis-label lintje-radar__value
|
|
2049
|
-
${
|
|
2050
|
-
let i =
|
|
2051
|
-
|
|
2052
|
-
let a = e.values[n], c = o(e) ? "is-
|
|
2053
|
-
return a == null ?
|
|
2054
|
-
fill="url(#hatch-${t.id})" />` :
|
|
2055
|
-
width=${Math.max(0,
|
|
2056
|
-
${s(B(n,
|
|
2102
|
+
${i ? v`<g class=${T}><text x=${_} y=${r + 14} text-anchor="end"
|
|
2103
|
+
class="lintje-chart__data-label lintje-radar__value ${h == null ? "lintje-radar__no-value" : ""}">${b}</text></g>` : l}
|
|
2104
|
+
${w ? v`<g class=${T}><text x=${_ - p(b, D, 700) - 6} y=${r + 14} text-anchor="end"
|
|
2105
|
+
class="lintje-chart__axis-label lintje-radar__value">onder norm</text></g>` : l}
|
|
2106
|
+
${x.map(({ layer: e, size: r }) => {
|
|
2107
|
+
let i = k;
|
|
2108
|
+
k += r + St;
|
|
2109
|
+
let a = e.values[n], c = o(e) ? "is-off" : "";
|
|
2110
|
+
return a == null ? v`<rect class="lintje-radar__bar lintje-chart__series ${c}" x="0.5" y=${i} width=${y} height=${r}
|
|
2111
|
+
fill="url(#hatch-${t.id})" />` : v`<rect class="lintje-chart__bar lintje-chart__bar--horizontal lintje-radar__bar lintje-chart__series ${c}" x="0.5" y=${i}
|
|
2112
|
+
width=${Math.max(0, E(a) - .5)} height=${r} fill=${e.color}
|
|
2113
|
+
${s(B(n, m.length))} />`;
|
|
2057
2114
|
})}
|
|
2058
|
-
<line class="lintje-radar__zero" x1="0.5" x2="0.5" y1=${
|
|
2059
|
-
${
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2115
|
+
<line class="lintje-radar__zero" x1="0.5" x2="0.5" y1=${u - 2} y2=${u + S + 2} />
|
|
2116
|
+
${g == null ? l : v`<g class="lintje-chart__series ${c ? "is-off" : ""}">
|
|
2117
|
+
<line class="lintje-chart__reference lintje-radar__norm" x1=${E(g)} x2=${E(g)}
|
|
2118
|
+
y1=${u - 3} y2=${u + S + 3} />
|
|
2119
|
+
</g>`}
|
|
2120
|
+
<rect class="lintje-chart__hit" x="0" y=${r} width=${_} height=${C}
|
|
2121
|
+
@mousemove=${(e) => t.hoverAt(n, e, f(n))} />
|
|
2063
2122
|
</g>
|
|
2064
2123
|
`;
|
|
2065
|
-
}),
|
|
2066
|
-
text-anchor=${t === 0 ? "start" : t ===
|
|
2067
|
-
class="lintje-chart__axis-label">${
|
|
2124
|
+
}), N = [0, ...Tt(h, e.step)], P = Math.max(0, ...N.map(Et)), F = N.map((e, t) => v`<text x=${E(e)} y=${w + 12}
|
|
2125
|
+
text-anchor=${t === 0 ? "start" : t === N.length - 1 ? "end" : "middle"}
|
|
2126
|
+
class="lintje-chart__axis-label">${u(e, P)}</text>`);
|
|
2068
2127
|
return {
|
|
2069
|
-
width:
|
|
2070
|
-
height:
|
|
2071
|
-
body:
|
|
2072
|
-
at:
|
|
2128
|
+
width: _,
|
|
2129
|
+
height: T,
|
|
2130
|
+
body: v`<g @mouseleave=${() => t.hoverAt(null)}>${M}</g>${F}`,
|
|
2131
|
+
at: j
|
|
2073
2132
|
};
|
|
2074
2133
|
}
|
|
2075
2134
|
//#endregion
|
|
2076
2135
|
//#region src/components/shared/charts/shared/render-chart.ts
|
|
2077
|
-
function
|
|
2136
|
+
function jt(e, t) {
|
|
2078
2137
|
switch (e.kind) {
|
|
2079
|
-
case "line": return
|
|
2080
|
-
case "bar": return
|
|
2081
|
-
case "horizontal-bar": return
|
|
2082
|
-
case "target-progress": return
|
|
2083
|
-
case "grouped-bar": return
|
|
2084
|
-
case "stacked-bar": return
|
|
2085
|
-
case "stacked-area": return
|
|
2086
|
-
case "pie": return
|
|
2087
|
-
case "dual-axis": return
|
|
2088
|
-
case "scatter": return
|
|
2089
|
-
case "heatmap": return
|
|
2090
|
-
case "histogram": return
|
|
2091
|
-
case "radar": return
|
|
2138
|
+
case "line": return le(e, t);
|
|
2139
|
+
case "bar": return fe(e, t);
|
|
2140
|
+
case "horizontal-bar": return me(e, t);
|
|
2141
|
+
case "target-progress": return he(e, t);
|
|
2142
|
+
case "grouped-bar": return xe(e, t);
|
|
2143
|
+
case "stacked-bar": return Te(e, t);
|
|
2144
|
+
case "stacked-area": return De(e, t);
|
|
2145
|
+
case "pie": return Me(e, t);
|
|
2146
|
+
case "dual-axis": return Ne(e, t);
|
|
2147
|
+
case "scatter": return Ue(e, t);
|
|
2148
|
+
case "heatmap": return nt(e, t);
|
|
2149
|
+
case "histogram": return ut(e, t);
|
|
2150
|
+
case "radar": return Ot(e, t);
|
|
2092
2151
|
}
|
|
2093
2152
|
}
|
|
2094
2153
|
//#endregion
|
|
2095
2154
|
//#region src/components/charts/chart/chart.css?inline
|
|
2096
|
-
var
|
|
2155
|
+
var Mt = "/* ------------------------------------------------------------------------ */\n\n.lintje-chart__view { flex: none; }\n\n/* Below 768 px it is a row of its own at the touch height. */\n@media screen and (max-width: 767px) {\n .lintje-chart__view { --h-control: var(--h-touch); width: 100%; }\n}\n", Nt = ".lintje-chart__svg, .lintje-pie-chart__svg", Pt = [{
|
|
2097
2156
|
value: "chart",
|
|
2098
2157
|
label: "Grafiek"
|
|
2099
2158
|
}, {
|
|
2100
2159
|
value: "table",
|
|
2101
2160
|
label: "Tabel"
|
|
2102
2161
|
}];
|
|
2103
|
-
function
|
|
2162
|
+
function Ft(e) {
|
|
2104
2163
|
return (e ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "grafiek";
|
|
2105
2164
|
}
|
|
2106
|
-
function
|
|
2165
|
+
function It(e) {
|
|
2107
2166
|
switch (e.kind) {
|
|
2108
2167
|
case "line":
|
|
2109
2168
|
case "stacked-area":
|
|
@@ -2115,16 +2174,16 @@ function Pt(e) {
|
|
|
2115
2174
|
default: return "bar";
|
|
2116
2175
|
}
|
|
2117
2176
|
}
|
|
2118
|
-
function
|
|
2177
|
+
function Lt(e) {
|
|
2119
2178
|
switch (e.kind) {
|
|
2120
2179
|
case "horizontal-bar":
|
|
2121
|
-
case "target-progress": return e.rows.length ? `${
|
|
2180
|
+
case "target-progress": return e.rows.length ? `${pe(e.rows.length)}px` : void 0;
|
|
2122
2181
|
case "pie":
|
|
2123
2182
|
case "heatmap": return;
|
|
2124
2183
|
default: return e.small ? "var(--chart-h-small)" : void 0;
|
|
2125
2184
|
}
|
|
2126
2185
|
}
|
|
2127
|
-
function
|
|
2186
|
+
function Rt(e) {
|
|
2128
2187
|
switch (e.kind) {
|
|
2129
2188
|
case "line": {
|
|
2130
2189
|
let t = e.events ?? [], n = (e) => t.filter((t) => t.index === e).map((e) => e.label).join("; ");
|
|
@@ -2164,7 +2223,7 @@ function It(e) {
|
|
|
2164
2223
|
...e.series.map((e) => e.label),
|
|
2165
2224
|
"Totaal"
|
|
2166
2225
|
], ...e.labels.map((t, n) => {
|
|
2167
|
-
let r = e.series.map((e) => e.values[n]), i = r.some((e) => e == null) ? null : Number(r.reduce((e, t) => e + t, 0).toFixed(
|
|
2226
|
+
let r = e.series.map((e) => e.values[n]), i = r.some((e) => e == null) ? null : Number(r.reduce((e, t) => e + t, 0).toFixed(zt(r)));
|
|
2168
2227
|
return [
|
|
2169
2228
|
t,
|
|
2170
2229
|
...r,
|
|
@@ -2222,7 +2281,7 @@ function It(e) {
|
|
|
2222
2281
|
t("Tot"),
|
|
2223
2282
|
"Aantal"
|
|
2224
2283
|
], ...e.bins.map((t) => [
|
|
2225
|
-
|
|
2284
|
+
ct(t, e.unit),
|
|
2226
2285
|
t.from,
|
|
2227
2286
|
t.to ?? "",
|
|
2228
2287
|
t.count
|
|
@@ -2230,15 +2289,15 @@ function It(e) {
|
|
|
2230
2289
|
}
|
|
2231
2290
|
}
|
|
2232
2291
|
}
|
|
2233
|
-
function
|
|
2292
|
+
function zt(e) {
|
|
2234
2293
|
return e.reduce((e, t) => {
|
|
2235
2294
|
if (typeof t != "number" || Number.isInteger(t)) return e;
|
|
2236
2295
|
let n = String(t).split(".")[1] ?? "";
|
|
2237
2296
|
return Math.max(e, n.length);
|
|
2238
2297
|
}, 0);
|
|
2239
2298
|
}
|
|
2240
|
-
function
|
|
2241
|
-
let [n = [], ...r] =
|
|
2299
|
+
function Bt(e, t) {
|
|
2300
|
+
let [n = [], ...r] = Rt(e), i = n.map((e, t) => {
|
|
2242
2301
|
let n = r.map((e) => e[t] ?? null);
|
|
2243
2302
|
return t === 0 || n.some((e) => typeof e == "string" && e !== "") ? {
|
|
2244
2303
|
key: `c${t}`,
|
|
@@ -2249,7 +2308,7 @@ function Rt(e, t) {
|
|
|
2249
2308
|
key: `c${t}`,
|
|
2250
2309
|
header: String(e ?? ""),
|
|
2251
2310
|
format: "decimal",
|
|
2252
|
-
decimals:
|
|
2311
|
+
decimals: zt(n),
|
|
2253
2312
|
align: "right",
|
|
2254
2313
|
sortable: !1
|
|
2255
2314
|
};
|
|
@@ -2269,17 +2328,17 @@ function Rt(e, t) {
|
|
|
2269
2328
|
pageSize: Math.max(r.length, 1)
|
|
2270
2329
|
};
|
|
2271
2330
|
}
|
|
2272
|
-
var
|
|
2331
|
+
var Vt = class extends S {
|
|
2273
2332
|
constructor(...e) {
|
|
2274
|
-
super(...e), this.view = "chart", this.#e = new
|
|
2333
|
+
super(...e), this.view = "chart", this.#e = new N(() => this.requestUpdate()), this.#t = null, this.#n = new n(this);
|
|
2275
2334
|
}
|
|
2276
2335
|
static {
|
|
2277
2336
|
this.styles = [
|
|
2278
2337
|
e,
|
|
2279
2338
|
a(x),
|
|
2280
2339
|
a(r),
|
|
2281
|
-
...
|
|
2282
|
-
a(
|
|
2340
|
+
...Y,
|
|
2341
|
+
a(Mt)
|
|
2283
2342
|
];
|
|
2284
2343
|
}
|
|
2285
2344
|
static {
|
|
@@ -2308,40 +2367,40 @@ var zt = class extends C {
|
|
|
2308
2367
|
}
|
|
2309
2368
|
get downloadName() {
|
|
2310
2369
|
let e = this.data?.download;
|
|
2311
|
-
return e === !1 ? null : e?.filename ??
|
|
2370
|
+
return e === !1 ? null : e?.filename ?? Ft(this.data?.title);
|
|
2312
2371
|
}
|
|
2313
2372
|
csv() {
|
|
2314
2373
|
let e = this.data, t = this.downloadName;
|
|
2315
|
-
e && t !== null &&
|
|
2374
|
+
e && t !== null && w(t, Rt(e.chart));
|
|
2316
2375
|
}
|
|
2317
2376
|
png() {
|
|
2318
2377
|
let e = this.data;
|
|
2319
2378
|
if (!e) return;
|
|
2320
|
-
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile")?.querySelector(
|
|
2321
|
-
t &&
|
|
2379
|
+
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile")?.querySelector(Nt);
|
|
2380
|
+
t && C(this.downloadName ?? Ft(e.title), t);
|
|
2322
2381
|
}
|
|
2323
2382
|
expandChanged(e) {
|
|
2324
|
-
e ? this.#t ??= new
|
|
2383
|
+
e ? this.#t ??= new N(() => this.requestUpdate()) : (this.#t?.detach(), this.#t = null);
|
|
2325
2384
|
}
|
|
2326
2385
|
render() {
|
|
2327
2386
|
let e = this.data;
|
|
2328
|
-
if (!e) return
|
|
2329
|
-
let t = this.ready, n = this.#n.matches && e.mobileSubtitle ? e.mobileSubtitle : e.subtitle, r = this.id ? `${this.id}-tile` : void 0, i = e.tableSwitch && t ? this.viewSwitch() :
|
|
2330
|
-
return
|
|
2331
|
-
id=${r ??
|
|
2332
|
-
span=${e.span ??
|
|
2333
|
-
heading=${e.title ??
|
|
2334
|
-
icon=${e.icon ??
|
|
2335
|
-
subtitle=${n ??
|
|
2336
|
-
intro=${e.intro ??
|
|
2337
|
-
footnote=${e.footnote ??
|
|
2387
|
+
if (!e) return l;
|
|
2388
|
+
let t = this.ready, n = this.#n.matches && e.mobileSubtitle ? e.mobileSubtitle : e.subtitle, r = this.id ? `${this.id}-tile` : void 0, i = e.tableSwitch && t ? this.viewSwitch() : l, a = this.showsTable;
|
|
2389
|
+
return m`<lintje-tile
|
|
2390
|
+
id=${r ?? l}
|
|
2391
|
+
span=${e.span ?? l}
|
|
2392
|
+
heading=${e.title ?? l}
|
|
2393
|
+
icon=${e.icon ?? l}
|
|
2394
|
+
subtitle=${n ?? l}
|
|
2395
|
+
intro=${e.intro ?? l}
|
|
2396
|
+
footnote=${e.footnote ?? l}
|
|
2338
2397
|
?legend-below=${!!e.legendBelow}
|
|
2339
2398
|
?expandable=${this.expandable && t}
|
|
2340
2399
|
?download=${this.downloadName !== null && t}
|
|
2341
2400
|
state=${e.state ?? "ready"}
|
|
2342
|
-
message=${e.message ??
|
|
2343
|
-
last-known=${e.lastKnown ??
|
|
2344
|
-
content-height=${
|
|
2401
|
+
message=${e.message ?? l}
|
|
2402
|
+
last-known=${e.lastKnown ?? l}
|
|
2403
|
+
content-height=${Lt(e.chart) ?? l}
|
|
2345
2404
|
@lintje-tile-expand=${(e) => {
|
|
2346
2405
|
e.stopPropagation(), this.expand(!0);
|
|
2347
2406
|
}}
|
|
@@ -2350,18 +2409,18 @@ var zt = class extends C {
|
|
|
2350
2409
|
}}
|
|
2351
2410
|
>
|
|
2352
2411
|
${i}
|
|
2353
|
-
${e.notice ?
|
|
2412
|
+
${e.notice ? m`<lintje-announcement
|
|
2354
2413
|
slot="notice"
|
|
2355
2414
|
compact
|
|
2356
2415
|
.data=${e.notice}
|
|
2357
|
-
></lintje-announcement>` :
|
|
2416
|
+
></lintje-announcement>` : l}
|
|
2358
2417
|
${this.content()}
|
|
2359
2418
|
</lintje-tile>
|
|
2360
2419
|
|
|
2361
|
-
${this.renderExpandModal(this.expanded ? a ? this.table() : this.#t ?
|
|
2420
|
+
${this.renderExpandModal(this.expanded ? a ? this.table() : this.#t ? jt(e.chart, {
|
|
2362
2421
|
...this.chartOptions(this.#t),
|
|
2363
2422
|
expanded: !0
|
|
2364
|
-
}) :
|
|
2423
|
+
}) : l : l, {
|
|
2365
2424
|
heading: e.title,
|
|
2366
2425
|
subtitle: n,
|
|
2367
2426
|
footnote: e.footnote,
|
|
@@ -2372,28 +2431,28 @@ var zt = class extends C {
|
|
|
2372
2431
|
content() {
|
|
2373
2432
|
let e = this.data;
|
|
2374
2433
|
switch (e.state ?? "ready") {
|
|
2375
|
-
case "loading": return
|
|
2376
|
-
${
|
|
2377
|
-
kind:
|
|
2378
|
-
height:
|
|
2434
|
+
case "loading": return m`<div slot="loading">
|
|
2435
|
+
${X({
|
|
2436
|
+
kind: It(e.chart),
|
|
2437
|
+
height: Lt(e.chart),
|
|
2379
2438
|
status: !1
|
|
2380
2439
|
})}
|
|
2381
2440
|
</div>`;
|
|
2382
2441
|
case "empty":
|
|
2383
|
-
case "error": return
|
|
2384
|
-
default: return this.showsTable ? this.table() :
|
|
2442
|
+
case "error": return l;
|
|
2443
|
+
default: return this.showsTable ? this.table() : jt(e.chart, this.chartOptions(this.#e));
|
|
2385
2444
|
}
|
|
2386
2445
|
}
|
|
2387
2446
|
viewSwitch() {
|
|
2388
2447
|
let e = this.#n.matches;
|
|
2389
|
-
return
|
|
2448
|
+
return m`<lintje-segmented
|
|
2390
2449
|
class="lintje-chart__view"
|
|
2391
2450
|
slot=${e ? "notice" : "actions"}
|
|
2392
2451
|
label="Weergave"
|
|
2393
2452
|
hide-label
|
|
2394
2453
|
?stacked=${e}
|
|
2395
2454
|
.value=${this.view}
|
|
2396
|
-
.options=${
|
|
2455
|
+
.options=${Pt}
|
|
2397
2456
|
@lintje-change=${(e) => {
|
|
2398
2457
|
e.stopPropagation(), this.view = e.detail === "table" ? "table" : "chart";
|
|
2399
2458
|
}}
|
|
@@ -2401,15 +2460,15 @@ var zt = class extends C {
|
|
|
2401
2460
|
}
|
|
2402
2461
|
table() {
|
|
2403
2462
|
let e = this.data, t = e.title ? `${e.title}, als tabel` : "Grafiek als tabel";
|
|
2404
|
-
return
|
|
2463
|
+
return m`<lintje-data-table
|
|
2405
2464
|
class="lintje-chart__table"
|
|
2406
2465
|
bare
|
|
2407
|
-
.data=${
|
|
2466
|
+
.data=${Bt(e.chart, t)}
|
|
2408
2467
|
></lintje-data-table>`;
|
|
2409
2468
|
}
|
|
2410
2469
|
async focusMark(e) {
|
|
2411
2470
|
await this.updateComplete;
|
|
2412
|
-
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile"), n = t?.querySelector(`[data-mark-id="${CSS.escape(e)}"]`) ?? t?.querySelector(`${
|
|
2471
|
+
let t = this.renderRoot.querySelector(this.expanded ? "lintje-modal" : "lintje-tile"), n = t?.querySelector(`[data-mark-id="${CSS.escape(e)}"]`) ?? t?.querySelector(`${Nt}, .lintje-heatmap`);
|
|
2413
2472
|
n && !n.hasAttribute("tabindex") && n.setAttribute("tabindex", "-1"), n?.focus();
|
|
2414
2473
|
}
|
|
2415
2474
|
chartOptions(e) {
|
|
@@ -2433,6 +2492,6 @@ var zt = class extends C {
|
|
|
2433
2492
|
};
|
|
2434
2493
|
}
|
|
2435
2494
|
};
|
|
2436
|
-
i("lintje-chart",
|
|
2495
|
+
i("lintje-chart", Vt);
|
|
2437
2496
|
//#endregion
|
|
2438
|
-
export {
|
|
2497
|
+
export { Vt as LintjeChart };
|