@communitiesuk/svelte-component-library 0.1.19-beta.2 → 0.1.19-beta.21
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 +7 -0
- package/dist/components/data-vis/Histogram.svelte +282 -0
- package/dist/components/data-vis/Histogram.svelte.d.ts +75 -0
- package/dist/components/data-vis/axis/Axis.svelte +145 -34
- package/dist/components/data-vis/axis/Axis.svelte.d.ts +34 -30
- package/dist/components/data-vis/axis/Ticks.svelte +163 -60
- package/dist/components/data-vis/axis/Ticks.svelte.d.ts +26 -30
- package/dist/components/data-vis/line-chart/LineChart.svelte +51 -21
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +14 -6
- package/dist/components/data-vis/position-chart/PositionChart.svelte +255 -117
- package/dist/components/data-vis/position-chart/PositionChart.svelte.d.ts +28 -4
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte +39 -34
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte.d.ts +6 -2
- package/dist/components/layout/Footer.svelte +9 -0
- package/dist/components/layout/Footer.svelte.d.ts +1 -0
- package/dist/components/layout/PhaseBanner.svelte +10 -1
- package/dist/components/layout/PhaseBanner.svelte.d.ts +1 -0
- package/dist/components/layout/ServiceNavigation.svelte +19 -1
- package/dist/components/layout/ServiceNavigation.svelte.d.ts +2 -0
- package/dist/components/ui/BasicMultiSelect.svelte +185 -0
- package/dist/components/ui/BasicMultiSelect.svelte.d.ts +8 -0
- package/dist/components/ui/Button.svelte +1 -0
- package/dist/components/ui/Card.svelte +48 -60
- package/dist/components/ui/Card.svelte.d.ts +26 -12
- package/dist/components/ui/CardHeader.svelte +46 -0
- package/dist/components/ui/CardHeader.svelte.d.ts +21 -0
- package/dist/components/ui/ChartExporter.svelte +142 -0
- package/dist/components/ui/ChartExporter.svelte.d.ts +16 -0
- package/dist/components/ui/Details.svelte +10 -2
- package/dist/components/ui/Details.svelte.d.ts +2 -0
- package/dist/components/ui/Masthead.svelte +36 -6
- package/dist/components/ui/Masthead.svelte.d.ts +4 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte +12 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte.d.ts +4 -0
- package/dist/components/ui/RelatedContent.svelte +4 -1
- package/dist/components/ui/RelatedContent.svelte.d.ts +1 -0
- package/dist/components/ui/SearchAutocomplete.svelte +185 -34
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +5 -0
- package/dist/components/ui/Tabs.svelte +190 -18
- package/dist/components/ui/Tabs.svelte.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +4 -1
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { scaleLinear } from "d3-scale";
|
|
3
|
+
import { bin, range as d3range } from "d3-array";
|
|
4
|
+
import chroma from "chroma-js";
|
|
3
5
|
import PositionChartAxis from "./PositionChartAxis.svelte";
|
|
4
6
|
import ValueLabel from "../line-chart/ValueLabel.svelte";
|
|
5
7
|
import Button from "../../ui/Button.svelte";
|
|
6
8
|
import InsetText from "../../content/InsetText.svelte";
|
|
9
|
+
import Axis from "../axis/Axis.svelte";
|
|
7
10
|
let {
|
|
8
11
|
value = undefined,
|
|
9
12
|
min = undefined,
|
|
10
13
|
max = undefined,
|
|
11
14
|
label = undefined,
|
|
12
15
|
showAxis = true,
|
|
16
|
+
showArrows = false,
|
|
17
|
+
showAverage = false,
|
|
13
18
|
chartWidth = $bindable(500), // the 'chart' is the bar and the marker
|
|
14
19
|
chartHeight = 24,
|
|
15
|
-
|
|
20
|
+
color = "#CA357C",
|
|
16
21
|
nSegments = 10,
|
|
17
22
|
startColor = "#8EB8DC",
|
|
18
23
|
endColor = "#0F385C",
|
|
19
24
|
midColor = undefined,
|
|
20
|
-
|
|
25
|
+
customColorScale = undefined,
|
|
21
26
|
opacity = 1,
|
|
22
27
|
annotation = undefined,
|
|
23
28
|
showIcon = false,
|
|
24
29
|
moreInfo = undefined,
|
|
25
30
|
markerRadius = chartHeight / 2,
|
|
31
|
+
numberOfTicks = undefined,
|
|
26
32
|
options = [],
|
|
27
33
|
rowData = [
|
|
28
34
|
{
|
|
29
35
|
value: value,
|
|
30
|
-
|
|
36
|
+
color: color,
|
|
31
37
|
opacity: opacity,
|
|
32
38
|
annotation: annotation,
|
|
33
39
|
},
|
|
@@ -79,10 +85,54 @@
|
|
|
79
85
|
activeMarkerId = null;
|
|
80
86
|
},
|
|
81
87
|
activeMarkerId = undefined,
|
|
88
|
+
distribution = [],
|
|
89
|
+
floor = undefined,
|
|
90
|
+
ceiling = undefined,
|
|
91
|
+
averageValue = undefined,
|
|
92
|
+
polarity = "standard",
|
|
93
|
+
skew = false,
|
|
94
|
+
showTickMarks = true,
|
|
95
|
+
showGridlines = false,
|
|
96
|
+
labelFormatter = (tick, index, ticksArrayLength) => {
|
|
97
|
+
return tick;
|
|
98
|
+
},
|
|
82
99
|
} = $props();
|
|
83
100
|
|
|
101
|
+
let xTicks = $state([]);
|
|
102
|
+
|
|
103
|
+
let xTickFirst = $derived(xTicks.length ? xTicks[0] : 0);
|
|
104
|
+
let xTickLast = $derived(xTicks.length ? xTicks.at(-1) : 1);
|
|
105
|
+
|
|
106
|
+
let domainMin = $derived(Math.min(xTickFirst, xTickLast));
|
|
107
|
+
let domainMax = $derived(Math.max(xTickFirst, xTickLast));
|
|
108
|
+
|
|
109
|
+
const segmentScale = $derived(
|
|
110
|
+
scaleLinear().domain([0, nSegments]).range([domainMin, domainMax]),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const binThresholds = $derived(d3range(1, nSegments).map(segmentScale));
|
|
114
|
+
|
|
115
|
+
const binner = $derived(
|
|
116
|
+
bin().domain([domainMin, domainMax]).thresholds(binThresholds),
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const bins = $derived(
|
|
120
|
+
polarity === "reverse"
|
|
121
|
+
? binner(distribution).toReversed()
|
|
122
|
+
: binner(distribution),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const proportionsInBins = $derived(
|
|
126
|
+
bins.map((b) => b.length / distribution.length),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
let proportionInExtremeBins = $derived([
|
|
130
|
+
proportionsInBins[0],
|
|
131
|
+
proportionsInBins.at(-1),
|
|
132
|
+
]);
|
|
133
|
+
|
|
84
134
|
// base defaults that apply to every row
|
|
85
|
-
const baseRow = { value,
|
|
135
|
+
const baseRow = { value, color, opacity, annotation, markerRadius };
|
|
86
136
|
|
|
87
137
|
// base defaults that apply to every chart
|
|
88
138
|
const baseChart = { label, chartHeight, min, max, showAxis };
|
|
@@ -147,89 +197,51 @@
|
|
|
147
197
|
allDataNormalized.some((obj) => obj.divider !== undefined),
|
|
148
198
|
);
|
|
149
199
|
|
|
150
|
-
let gridTemplateRows = $derived(() => {
|
|
151
|
-
let rows = showAxis ? numberOfPositionCharts + 2 : numberOfPositionCharts;
|
|
152
|
-
if (open) rows += 1;
|
|
153
|
-
if (divider) rows += 1;
|
|
154
|
-
return `repeat(${rows}, auto)`;
|
|
155
|
-
});
|
|
156
200
|
const range = $derived(Array.from({ length: nSegments }, (_, i) => i));
|
|
157
201
|
|
|
158
|
-
function interpolateColors(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return {
|
|
170
|
-
r: (bigint >> 16) & 255,
|
|
171
|
-
g: (bigint >> 8) & 255,
|
|
172
|
-
b: bigint & 255,
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
// Convert RGB to hex
|
|
176
|
-
const rgbToHex = ({ r, g, b }) =>
|
|
177
|
-
"#" +
|
|
178
|
-
[r, g, b]
|
|
179
|
-
.map((x) => {
|
|
180
|
-
const hex = x.toString(16);
|
|
181
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
182
|
-
})
|
|
183
|
-
.join("");
|
|
184
|
-
// Helper: interpolate between two colors
|
|
185
|
-
const interpolate = (start, end, count) => {
|
|
186
|
-
const arr = [];
|
|
187
|
-
for (let i = 0; i < count; i++) {
|
|
188
|
-
const t = i / (count - 1);
|
|
189
|
-
const r = Math.round(start.r + (end.r - start.r) * t);
|
|
190
|
-
const g = Math.round(start.g + (end.g - start.g) * t);
|
|
191
|
-
const b = Math.round(start.b + (end.b - start.b) * t);
|
|
192
|
-
arr.push({ r, g, b });
|
|
193
|
-
}
|
|
194
|
-
return arr;
|
|
195
|
-
};
|
|
196
|
-
const start = hexToRgb(hex1);
|
|
197
|
-
const end = hexToRgb(hex2);
|
|
198
|
-
// Case 1: just two colors
|
|
199
|
-
if (!hexMid) {
|
|
200
|
-
return interpolate(start, end, steps).map(rgbToHex);
|
|
201
|
-
}
|
|
202
|
-
// Case 2: three colors
|
|
203
|
-
const mid = hexToRgb(hexMid);
|
|
204
|
-
const result = [];
|
|
205
|
-
if (steps % 2 === 1) {
|
|
206
|
-
// Odd steps → midpoint included
|
|
207
|
-
const half = (steps - 1) / 2;
|
|
208
|
-
const firstHalf = interpolate(start, mid, half + 1); // includes mid
|
|
209
|
-
const secondHalf = interpolate(mid, end, half + 1); // includes mid again
|
|
210
|
-
result.push(
|
|
211
|
-
...firstHalf.slice(0, -1).map(rgbToHex), // drop duplicate mid
|
|
212
|
-
...secondHalf.map(rgbToHex),
|
|
213
|
-
);
|
|
202
|
+
function interpolateColors(
|
|
203
|
+
startColor,
|
|
204
|
+
endColor,
|
|
205
|
+
nSegments,
|
|
206
|
+
midColor = null,
|
|
207
|
+
skew,
|
|
208
|
+
) {
|
|
209
|
+
const colorArray = [startColor, midColor, endColor].filter(Boolean);
|
|
210
|
+
|
|
211
|
+
if (!skew) {
|
|
212
|
+
return chroma.scale(colorArray).colors(nSegments);
|
|
214
213
|
} else {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
const extremeColors = chroma
|
|
215
|
+
.scale([startColor, midColor, endColor])
|
|
216
|
+
.padding([
|
|
217
|
+
proportionInExtremeBins[0] / 2,
|
|
218
|
+
proportionInExtremeBins[1] / 2,
|
|
219
|
+
])
|
|
220
|
+
.colors(2);
|
|
221
|
+
|
|
222
|
+
const averageNormalised =
|
|
223
|
+
(averageValue - xTickFirst) / (xTickLast - xTickFirst);
|
|
224
|
+
|
|
225
|
+
const binColors = chroma
|
|
226
|
+
.scale([extremeColors[0], midColor, extremeColors[1]])
|
|
227
|
+
.domain([0, averageNormalised, 1])
|
|
228
|
+
.colors(10);
|
|
229
|
+
|
|
230
|
+
return binColors;
|
|
223
231
|
}
|
|
224
|
-
return result;
|
|
225
232
|
}
|
|
226
233
|
|
|
234
|
+
let colorScale = $derived(
|
|
235
|
+
customColorScale ??
|
|
236
|
+
interpolateColors(startColor, endColor, nSegments, midColor, skew),
|
|
237
|
+
);
|
|
238
|
+
|
|
227
239
|
// the 'bar' is the 10 rectangles side by side
|
|
228
240
|
let barWidth = $derived(chartWidth - markerRadius * 2);
|
|
229
241
|
let barHeight = $derived((chartHeight * 5) / 6);
|
|
230
242
|
|
|
231
243
|
function xFunction(min, max) {
|
|
232
|
-
return scaleLinear().domain([min, max]).range([0, barWidth]);
|
|
244
|
+
return scaleLinear().domain([min, max]).range([0, barWidth]).clamp(true);
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
let annotations = $derived(
|
|
@@ -239,6 +251,41 @@
|
|
|
239
251
|
(d) => typeof d.annotation === "string" && d.annotation.length > 0,
|
|
240
252
|
),
|
|
241
253
|
);
|
|
254
|
+
|
|
255
|
+
let gridTemplateRows = $derived(
|
|
256
|
+
allDataNormalized
|
|
257
|
+
.map((item, i) => {
|
|
258
|
+
const sizes = ["minmax(0,1fr)"];
|
|
259
|
+
if (moreInfoTogglesArray[i]) sizes.push("minmax(0,auto)");
|
|
260
|
+
if (item.divider === "true") sizes.push("minmax(0,auto)");
|
|
261
|
+
return sizes.join(" "); // still fine because number of rows matches
|
|
262
|
+
})
|
|
263
|
+
.concat(showAxis ? ["minmax(0,auto)"] : [])
|
|
264
|
+
.join(" "),
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
function segmentIndex(value) {
|
|
268
|
+
return Math.max(
|
|
269
|
+
0,
|
|
270
|
+
Math.min(
|
|
271
|
+
nSegments - 1,
|
|
272
|
+
Math.floor(
|
|
273
|
+
(nSegments * (value - xTickFirst)) / (xTickLast - xTickFirst),
|
|
274
|
+
),
|
|
275
|
+
),
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
let totalHeight = $derived(
|
|
280
|
+
chartHeight +
|
|
281
|
+
(showAxis ? 25 : 0) +
|
|
282
|
+
(showAverage ? 35 : 0) +
|
|
283
|
+
(showArrows ? 25 : 0),
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
let svgHeight = $derived(
|
|
287
|
+
chartHeight + (showAxis ? 25 : 0) + (showAverage ? 35 : 0),
|
|
288
|
+
);
|
|
242
289
|
</script>
|
|
243
290
|
|
|
244
291
|
{#if annotations.length}
|
|
@@ -251,7 +298,7 @@
|
|
|
251
298
|
id="label"
|
|
252
299
|
x={d.value}
|
|
253
300
|
y="20"
|
|
254
|
-
fill={d.
|
|
301
|
+
fill={d.color}
|
|
255
302
|
font-size="18"
|
|
256
303
|
opacity={typeof activeMarkerId !== "undefined" && activeMarkerId
|
|
257
304
|
? 0.2
|
|
@@ -273,7 +320,7 @@
|
|
|
273
320
|
? 0.2
|
|
274
321
|
: 1}
|
|
275
322
|
>
|
|
276
|
-
<path d="M 0 0 L 6 3 L 0 6 z" fill={d.
|
|
323
|
+
<path d="M 0 0 L 6 3 L 0 6 z" fill={d.color}></path>
|
|
277
324
|
</marker>
|
|
278
325
|
</defs>
|
|
279
326
|
<path
|
|
@@ -282,7 +329,7 @@
|
|
|
282
329
|
4 +
|
|
283
330
|
(topWidth - chartWidth)} v 15"
|
|
284
331
|
fill="none"
|
|
285
|
-
stroke={d.
|
|
332
|
+
stroke={d.color}
|
|
286
333
|
stroke-width="1.5"
|
|
287
334
|
marker-end="url(#arrow-down)"
|
|
288
335
|
opacity={typeof activeMarkerId !== "undefined" && activeMarkerId
|
|
@@ -298,9 +345,10 @@
|
|
|
298
345
|
class="grid-container"
|
|
299
346
|
bind:this={container}
|
|
300
347
|
style="
|
|
301
|
-
|
|
348
|
+
position: relative;
|
|
302
349
|
grid-template-columns: {gridTemplateColumns};
|
|
303
350
|
grid-template-rows: {gridTemplateRows};
|
|
351
|
+
height: {totalHeight}px;
|
|
304
352
|
"
|
|
305
353
|
>
|
|
306
354
|
{#each allDataNormalized as positionChart, i}
|
|
@@ -315,19 +363,17 @@
|
|
|
315
363
|
</p>
|
|
316
364
|
{/if}
|
|
317
365
|
{#if showIcon}
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
366
|
+
<div class="button-container">
|
|
367
|
+
<Button
|
|
368
|
+
textContent="i"
|
|
369
|
+
buttonType="moreInfo"
|
|
370
|
+
noPadding={true}
|
|
371
|
+
onClickFunction={() => updateMoreInfoTogglesArray(i)}
|
|
372
|
+
></Button>
|
|
373
|
+
</div>
|
|
324
374
|
{/if}
|
|
325
|
-
<div
|
|
326
|
-
|
|
327
|
-
style="height: {positionChart.chartHeight}px"
|
|
328
|
-
bind:clientWidth={chartWidth}
|
|
329
|
-
>
|
|
330
|
-
<svg width={chartWidth} height={positionChart.chartHeight}>
|
|
375
|
+
<div class="chart" bind:clientWidth={chartWidth}>
|
|
376
|
+
<svg width={chartWidth} height={svgHeight} overflow="visible">
|
|
331
377
|
{#each range as number}
|
|
332
378
|
<g
|
|
333
379
|
transform="translate({markerRadius +
|
|
@@ -337,11 +383,7 @@
|
|
|
337
383
|
><rect
|
|
338
384
|
width={barWidth / nSegments}
|
|
339
385
|
height={barHeight}
|
|
340
|
-
fill={colorScale
|
|
341
|
-
? colorScale[number]
|
|
342
|
-
: interpolateColors(startColor, endColor, nSegments, midColor)[
|
|
343
|
-
number
|
|
344
|
-
]}
|
|
386
|
+
fill={colorScale[number]}
|
|
345
387
|
></rect></g
|
|
346
388
|
>{/each}
|
|
347
389
|
{#each Object.entries(positionChart.rowData) as [tier, points]}
|
|
@@ -372,30 +414,107 @@
|
|
|
372
414
|
: null}
|
|
373
415
|
pointer-events={interactiveMarkers ? null : "none"}
|
|
374
416
|
transform="translate({xFunction(
|
|
375
|
-
|
|
376
|
-
|
|
417
|
+
xTickFirst,
|
|
418
|
+
xTickLast,
|
|
377
419
|
)(rowValue.value) + markerRadius},{positionChart.chartHeight /
|
|
378
420
|
2})"
|
|
379
421
|
>
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
422
|
+
{#if rowValue.shape === "line"}
|
|
423
|
+
<line
|
|
424
|
+
x1={0}
|
|
425
|
+
x2={0}
|
|
426
|
+
y1={chartHeight / 2.4}
|
|
427
|
+
y2={-chartHeight / 2.4}
|
|
428
|
+
stroke={rowValue.color === "inherit"
|
|
429
|
+
? colorScale[segmentIndex(rowValue.value)]
|
|
430
|
+
: rowValue.color}
|
|
431
|
+
stroke-width={rowValue.markerRadius}
|
|
432
|
+
opacity={rowValue.opacity}
|
|
433
|
+
pointer-events={rowValue.pointerEvents}
|
|
434
|
+
></line>
|
|
435
|
+
{:else}
|
|
436
|
+
<circle
|
|
437
|
+
r={rowValue.markerRadius}
|
|
438
|
+
cx="0"
|
|
439
|
+
cy="0"
|
|
440
|
+
stroke="white"
|
|
441
|
+
fill={rowValue.color === "inherit"
|
|
442
|
+
? colorScale[segmentIndex(rowValue.value)]
|
|
443
|
+
: rowValue.color}
|
|
444
|
+
stroke-width={3}
|
|
445
|
+
opacity={rowValue.opacity}
|
|
446
|
+
></circle>
|
|
447
|
+
<circle
|
|
448
|
+
r={rowValue.markerRadius * 0.9}
|
|
449
|
+
cx="0"
|
|
450
|
+
cy="0"
|
|
451
|
+
fill={rowValue.color === "inherit"
|
|
452
|
+
? colorScale[segmentIndex(rowValue.value)]
|
|
453
|
+
: rowValue.color}
|
|
454
|
+
stroke="black"
|
|
455
|
+
stroke-width={1.5}
|
|
456
|
+
opacity={rowValue.opacity}
|
|
457
|
+
></circle>
|
|
458
|
+
{/if}
|
|
388
459
|
</g>
|
|
389
460
|
{/if}
|
|
390
461
|
{/each}
|
|
391
462
|
{/each}
|
|
463
|
+
{#if showAxis}
|
|
464
|
+
<Axis
|
|
465
|
+
bind:ticksArray={xTicks}
|
|
466
|
+
{chartHeight}
|
|
467
|
+
chartWidth={chartWidth - markerRadius * 2}
|
|
468
|
+
orientation={{ axis: "x", position: "bottom" }}
|
|
469
|
+
range={[markerRadius, chartWidth - markerRadius]}
|
|
470
|
+
domain={[xTickFirst, xTickLast]}
|
|
471
|
+
{min}
|
|
472
|
+
{max}
|
|
473
|
+
fontSize={14}
|
|
474
|
+
{floor}
|
|
475
|
+
{ceiling}
|
|
476
|
+
{numberOfTicks}
|
|
477
|
+
{polarity}
|
|
478
|
+
{showTickMarks}
|
|
479
|
+
{showGridlines}
|
|
480
|
+
{labelFormatter}
|
|
481
|
+
></Axis>
|
|
482
|
+
{/if}
|
|
483
|
+
{#if showAverage}
|
|
484
|
+
<g
|
|
485
|
+
transform="translate({xFunction(
|
|
486
|
+
xTickFirst,
|
|
487
|
+
xTickLast,
|
|
488
|
+
)(averageValue) + markerRadius}, {chartHeight +
|
|
489
|
+
(showAxis ? 20 : 0)})"
|
|
490
|
+
>
|
|
491
|
+
<text
|
|
492
|
+
fill="#444"
|
|
493
|
+
font-size={15}
|
|
494
|
+
text-anchor="middle"
|
|
495
|
+
font-weight="bold"
|
|
496
|
+
>
|
|
497
|
+
<tspan x="1" dy="15">▲</tspan>
|
|
498
|
+
<tspan x="1" dy="4">|</tspan>
|
|
499
|
+
<tspan font-family="GDS Transport" x="1" dy="13">Average</tspan>
|
|
500
|
+
</text>
|
|
501
|
+
</g>
|
|
502
|
+
{/if}
|
|
392
503
|
</svg>
|
|
504
|
+
{#if showArrows}
|
|
505
|
+
<PositionChartAxis
|
|
506
|
+
markerRadius={10}
|
|
507
|
+
barWidth={chartWidth}
|
|
508
|
+
textSize="xs"
|
|
509
|
+
{chartWidth}
|
|
510
|
+
axisLabels={["Worse than average", "Better than average"]}
|
|
511
|
+
></PositionChartAxis>
|
|
512
|
+
{/if}
|
|
393
513
|
</div>
|
|
394
514
|
{#if moreInfoTogglesArray[i]}
|
|
395
|
-
<div class="accordion" style="grid-column:1 / -1
|
|
396
|
-
<
|
|
397
|
-
|
|
398
|
-
></InsetText> -->
|
|
515
|
+
<div class="accordion" style="grid-column:1 / -1">
|
|
516
|
+
<InsetText content={positionChart.moreInfo} renderStringAsHTML={true}
|
|
517
|
+
></InsetText>
|
|
399
518
|
</div>
|
|
400
519
|
{/if}
|
|
401
520
|
{#if positionChart.divider}
|
|
@@ -420,9 +539,6 @@
|
|
|
420
539
|
{#if showLabel}
|
|
421
540
|
<div class="empty"></div>
|
|
422
541
|
{/if}
|
|
423
|
-
<div class="axis">
|
|
424
|
-
<PositionChartAxis {markerRadius} {barWidth}></PositionChartAxis>
|
|
425
|
-
</div>
|
|
426
542
|
{/if}
|
|
427
543
|
{#if activeMarkerId}
|
|
428
544
|
<ValueLabel
|
|
@@ -441,6 +557,29 @@
|
|
|
441
557
|
{/if}
|
|
442
558
|
</div>
|
|
443
559
|
|
|
560
|
+
<div style="content-visibility: hidden;">
|
|
561
|
+
{#if !showAxis}
|
|
562
|
+
<Axis
|
|
563
|
+
bind:ticksArray={xTicks}
|
|
564
|
+
{chartHeight}
|
|
565
|
+
chartWidth={chartWidth - markerRadius * 2}
|
|
566
|
+
orientation={{ axis: "x", position: "bottom" }}
|
|
567
|
+
range={[markerRadius, chartWidth - markerRadius]}
|
|
568
|
+
domain={[xTickFirst, xTickLast]}
|
|
569
|
+
{min}
|
|
570
|
+
{max}
|
|
571
|
+
fontSize={14}
|
|
572
|
+
{floor}
|
|
573
|
+
{ceiling}
|
|
574
|
+
{numberOfTicks}
|
|
575
|
+
{polarity}
|
|
576
|
+
{showTickMarks}
|
|
577
|
+
{showGridlines}
|
|
578
|
+
{labelFormatter}
|
|
579
|
+
></Axis>
|
|
580
|
+
{/if}
|
|
581
|
+
</div>
|
|
582
|
+
|
|
444
583
|
<style>
|
|
445
584
|
.grid-container {
|
|
446
585
|
display: grid;
|
|
@@ -448,14 +587,13 @@
|
|
|
448
587
|
-moz-column-gap: 2%;
|
|
449
588
|
column-gap: 2%;
|
|
450
589
|
row-gap: 2%;
|
|
590
|
+
overflow: visible;
|
|
451
591
|
}
|
|
452
592
|
.chart {
|
|
453
593
|
display: flex;
|
|
454
594
|
flex-direction: column;
|
|
455
595
|
justify-content: flex-end;
|
|
456
596
|
min-width: 0;
|
|
457
|
-
|
|
458
|
-
.accordion {
|
|
459
|
-
max-height: 500px !important; /* large enough to fit content */
|
|
597
|
+
overflow: visible;
|
|
460
598
|
}
|
|
461
599
|
</style>
|
|
@@ -9,19 +9,22 @@ declare const PositionChart: import("svelte").Component<{
|
|
|
9
9
|
max?: any;
|
|
10
10
|
label?: any;
|
|
11
11
|
showAxis?: boolean;
|
|
12
|
+
showArrows?: boolean;
|
|
13
|
+
showAverage?: boolean;
|
|
12
14
|
chartWidth?: number;
|
|
13
15
|
chartHeight?: number;
|
|
14
|
-
|
|
16
|
+
color?: string;
|
|
15
17
|
nSegments?: number;
|
|
16
18
|
startColor?: string;
|
|
17
19
|
endColor?: string;
|
|
18
20
|
midColor?: any;
|
|
19
|
-
|
|
21
|
+
customColorScale?: any;
|
|
20
22
|
opacity?: number;
|
|
21
23
|
annotation?: any;
|
|
22
24
|
showIcon?: boolean;
|
|
23
25
|
moreInfo?: any;
|
|
24
26
|
markerRadius?: any;
|
|
27
|
+
numberOfTicks?: any;
|
|
25
28
|
options?: any[];
|
|
26
29
|
rowData?: any[];
|
|
27
30
|
allData?: any[];
|
|
@@ -42,6 +45,15 @@ declare const PositionChart: import("svelte").Component<{
|
|
|
42
45
|
onMouseEnterMarker?: Function;
|
|
43
46
|
onMouseLeaveMarker?: Function;
|
|
44
47
|
activeMarkerId?: any;
|
|
48
|
+
distribution?: any[];
|
|
49
|
+
floor?: any;
|
|
50
|
+
ceiling?: any;
|
|
51
|
+
averageValue?: any;
|
|
52
|
+
polarity?: string;
|
|
53
|
+
skew?: boolean;
|
|
54
|
+
showTickMarks?: boolean;
|
|
55
|
+
showGridlines?: boolean;
|
|
56
|
+
labelFormatter?: Function;
|
|
45
57
|
}, {}, "chartWidth">;
|
|
46
58
|
type $$ComponentProps = {
|
|
47
59
|
value?: any;
|
|
@@ -49,19 +61,22 @@ type $$ComponentProps = {
|
|
|
49
61
|
max?: any;
|
|
50
62
|
label?: any;
|
|
51
63
|
showAxis?: boolean;
|
|
64
|
+
showArrows?: boolean;
|
|
65
|
+
showAverage?: boolean;
|
|
52
66
|
chartWidth?: number;
|
|
53
67
|
chartHeight?: number;
|
|
54
|
-
|
|
68
|
+
color?: string;
|
|
55
69
|
nSegments?: number;
|
|
56
70
|
startColor?: string;
|
|
57
71
|
endColor?: string;
|
|
58
72
|
midColor?: any;
|
|
59
|
-
|
|
73
|
+
customColorScale?: any;
|
|
60
74
|
opacity?: number;
|
|
61
75
|
annotation?: any;
|
|
62
76
|
showIcon?: boolean;
|
|
63
77
|
moreInfo?: any;
|
|
64
78
|
markerRadius?: any;
|
|
79
|
+
numberOfTicks?: any;
|
|
65
80
|
options?: any[];
|
|
66
81
|
rowData?: any[];
|
|
67
82
|
allData?: any[];
|
|
@@ -82,4 +97,13 @@ type $$ComponentProps = {
|
|
|
82
97
|
onMouseEnterMarker?: Function;
|
|
83
98
|
onMouseLeaveMarker?: Function;
|
|
84
99
|
activeMarkerId?: any;
|
|
100
|
+
distribution?: any[];
|
|
101
|
+
floor?: any;
|
|
102
|
+
ceiling?: any;
|
|
103
|
+
averageValue?: any;
|
|
104
|
+
polarity?: string;
|
|
105
|
+
skew?: boolean;
|
|
106
|
+
showTickMarks?: boolean;
|
|
107
|
+
showGridlines?: boolean;
|
|
108
|
+
labelFormatter?: Function;
|
|
85
109
|
};
|