@communitiesuk/svelte-component-library 0.1.19-beta.34 → 0.1.19-beta.36
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.
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
onMouseLeaveMarker = (event, marker, dataId) => {
|
|
86
86
|
activeMarkerId = null;
|
|
87
87
|
},
|
|
88
|
-
activeMarkerId = undefined,
|
|
88
|
+
activeMarkerId = $bindable(undefined),
|
|
89
89
|
distribution = [],
|
|
90
90
|
floor = undefined,
|
|
91
91
|
ceiling = undefined,
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
niceTicks = true,
|
|
101
101
|
ticksDomain = $bindable([[]]),
|
|
102
102
|
axisDomain = $bindable([[]]),
|
|
103
|
+
getChartDomain = undefined,
|
|
103
104
|
} = $props();
|
|
104
105
|
|
|
105
106
|
let xTickFirst = $derived(ticksDomain.length ? ticksDomain[0] : 0);
|
|
@@ -111,6 +112,10 @@
|
|
|
111
112
|
polarity === "standard" ? [domainMin, domainMax] : [domainMax, domainMin],
|
|
112
113
|
);
|
|
113
114
|
|
|
115
|
+
$effect(() => {
|
|
116
|
+
getChartDomain?.(chartDomain);
|
|
117
|
+
});
|
|
118
|
+
|
|
114
119
|
const segmentScale = $derived(
|
|
115
120
|
scaleLinear().domain([0, nSegments]).range([domainMin, domainMax]),
|
|
116
121
|
);
|
|
@@ -225,7 +230,7 @@
|
|
|
225
230
|
.colors(2);
|
|
226
231
|
|
|
227
232
|
const averageNormalised =
|
|
228
|
-
(averageValue -
|
|
233
|
+
(averageValue - chartDomain[0]) / (chartDomain[1] - chartDomain[0]);
|
|
229
234
|
|
|
230
235
|
const binColors = chroma
|
|
231
236
|
.scale([extremeColors[0], midColor, extremeColors[1]])
|
|
@@ -275,7 +280,8 @@
|
|
|
275
280
|
Math.min(
|
|
276
281
|
nSegments - 1,
|
|
277
282
|
Math.floor(
|
|
278
|
-
(nSegments * (value -
|
|
283
|
+
(nSegments * (value - chartDomain[0])) /
|
|
284
|
+
(chartDomain[1] - chartDomain[0]),
|
|
279
285
|
),
|
|
280
286
|
),
|
|
281
287
|
);
|
|
@@ -446,6 +452,7 @@
|
|
|
446
452
|
markerRadius},{positionChart.chartHeight / 2})"
|
|
447
453
|
>
|
|
448
454
|
{#if rowValue.shape === "line"}
|
|
455
|
+
{console.log("seg", segmentIndex(rowValue.value))}
|
|
449
456
|
<line
|
|
450
457
|
x1={0}
|
|
451
458
|
x2={0}
|
|
@@ -512,7 +519,8 @@
|
|
|
512
519
|
>
|
|
513
520
|
<tspan x="1" dy="15">▲</tspan>
|
|
514
521
|
<tspan x="1" dy="4">|</tspan>
|
|
515
|
-
|
|
522
|
+
|
|
523
|
+
<tspan font-family="GDS Transport" x="1" dy="15">Average</tspan>
|
|
516
524
|
</text>
|
|
517
525
|
</g>
|
|
518
526
|
{/if}
|
|
@@ -58,7 +58,8 @@ declare const PositionChart: import("svelte").Component<{
|
|
|
58
58
|
niceTicks?: boolean;
|
|
59
59
|
ticksDomain?: any[];
|
|
60
60
|
axisDomain?: any[];
|
|
61
|
-
|
|
61
|
+
getChartDomain?: any;
|
|
62
|
+
}, {}, "chartWidth" | "axisDomain" | "activeMarkerId" | "ticksDomain">;
|
|
62
63
|
type $$ComponentProps = {
|
|
63
64
|
value?: any;
|
|
64
65
|
min?: any;
|
|
@@ -114,4 +115,5 @@ type $$ComponentProps = {
|
|
|
114
115
|
niceTicks?: boolean;
|
|
115
116
|
ticksDomain?: any[];
|
|
116
117
|
axisDomain?: any[];
|
|
118
|
+
getChartDomain?: any;
|
|
117
119
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import Button from "
|
|
2
|
+
import { Button } from "@communitiesuk/svelte-component-library";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
data = [],
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
key: column,
|
|
44
44
|
isUnique: keyIsUnique,
|
|
45
45
|
dataType: columnDataType,
|
|
46
|
-
id: metadata[column]
|
|
46
|
+
id: metadata?.[column]?.order ?? 0,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
<th
|
|
185
185
|
scope="col"
|
|
186
186
|
class={`govuk-table__header ${column.dataType === "number" ? "govuk-table__header--numeric" : ""}`}
|
|
187
|
-
title={metadata[column.key]?.explainer}
|
|
188
|
-
style={metadata[column.key]?.width
|
|
187
|
+
title={metadata?.[column.key]?.explainer}
|
|
188
|
+
style={metadata?.[column.key]?.width
|
|
189
189
|
? `min-width: ${metadata[column.key].width}`
|
|
190
190
|
: undefined}
|
|
191
191
|
aria-sort={sortState.column !== column.key ||
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
>
|
|
198
198
|
<div class="header">
|
|
199
199
|
<Button
|
|
200
|
-
textContent={metadata[column.key]?.shortLabel ?? column.key}
|
|
200
|
+
textContent={metadata?.[column.key]?.shortLabel ?? column.key}
|
|
201
201
|
buttonType={"table header"}
|
|
202
202
|
direction={sortState.column === column.key
|
|
203
203
|
? sortState.order
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
<td
|
|
220
220
|
class="govuk-table__cell govuk-table__cell--numeric"
|
|
221
221
|
style={`background-color: ${
|
|
222
|
-
metadata[column.key]?.direction === "Higher is better"
|
|
222
|
+
metadata?.[column.key]?.direction === "Higher is better"
|
|
223
223
|
? normToColor(row[column.key + "__normalised"])
|
|
224
224
|
: normToColorReverse(row[column.key + "__normalised"])
|
|
225
225
|
}`}
|