svelteplot 0.10.3 → 0.11.0
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/dist/Mark.svelte +42 -25
- package/dist/Mark.svelte.d.ts +111 -32
- package/dist/Plot.svelte +21 -15
- package/dist/core/Facet.svelte +1 -1
- package/dist/core/FacetAxes.svelte +13 -8
- package/dist/core/FacetGrid.svelte +4 -4
- package/dist/core/Plot.svelte +41 -35
- package/dist/helpers/autoScales.d.ts +3 -3
- package/dist/helpers/autoScales.js +28 -18
- package/dist/helpers/autoTicks.js +2 -0
- package/dist/helpers/callWithProps.d.ts +1 -2
- package/dist/helpers/facets.js +0 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/mergeDeep.d.ts +1 -3
- package/dist/helpers/mergeDeep.js +15 -16
- package/dist/helpers/projection.d.ts +4 -3
- package/dist/helpers/projection.js +17 -5
- package/dist/helpers/reduce.d.ts +4 -4
- package/dist/helpers/reduce.js +6 -4
- package/dist/helpers/regressionLoess.js +2 -1
- package/dist/helpers/resolve.d.ts +6 -3
- package/dist/helpers/resolve.js +25 -16
- package/dist/helpers/scales.d.ts +10 -10
- package/dist/helpers/scales.js +43 -13
- package/dist/helpers/time.d.ts +10 -3
- package/dist/helpers/time.js +2 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/plotDefaults.d.ts +3 -1
- package/dist/hooks/plotDefaults.js +33 -1
- package/dist/hooks/usePlot.svelte.d.ts +10 -25
- package/dist/hooks/usePlot.svelte.js +8 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/marks/Area.svelte +24 -13
- package/dist/marks/Area.svelte.d.ts +118 -34
- package/dist/marks/AreaX.svelte +42 -8
- package/dist/marks/AreaX.svelte.d.ts +154 -71
- package/dist/marks/AreaY.svelte +42 -8
- package/dist/marks/AreaY.svelte.d.ts +154 -71
- package/dist/marks/Arrow.svelte +42 -23
- package/dist/marks/Arrow.svelte.d.ts +114 -35
- package/dist/marks/AxisX.svelte +43 -28
- package/dist/marks/AxisX.svelte.d.ts +125 -40
- package/dist/marks/AxisY.svelte +43 -26
- package/dist/marks/AxisY.svelte.d.ts +127 -40
- package/dist/marks/BarX.svelte +12 -10
- package/dist/marks/BarX.svelte.d.ts +104 -32
- package/dist/marks/BarY.svelte +11 -10
- package/dist/marks/BarY.svelte.d.ts +106 -34
- package/dist/marks/BollingerX.svelte +4 -7
- package/dist/marks/BollingerX.svelte.d.ts +105 -30
- package/dist/marks/BollingerY.svelte +3 -0
- package/dist/marks/BollingerY.svelte.d.ts +105 -30
- package/dist/marks/BoxX.svelte +3 -3
- package/dist/marks/BoxY.svelte +12 -9
- package/dist/marks/BoxY.svelte.d.ts +128 -53
- package/dist/marks/Brush.svelte +26 -21
- package/dist/marks/Brush.svelte.d.ts +119 -60
- package/dist/marks/Cell.svelte +13 -9
- package/dist/marks/Cell.svelte.d.ts +105 -30
- package/dist/marks/CellX.svelte +2 -1
- package/dist/marks/CellX.svelte.d.ts +105 -32
- package/dist/marks/CellY.svelte +2 -1
- package/dist/marks/CellY.svelte.d.ts +105 -32
- package/dist/marks/ColorLegend.svelte +24 -13
- package/dist/marks/ColorLegend.svelte.d.ts +1 -0
- package/dist/marks/CustomMark.svelte +16 -10
- package/dist/marks/CustomMark.svelte.d.ts +112 -31
- package/dist/marks/CustomMarkHTML.svelte +8 -2
- package/dist/marks/CustomMarkHTML.svelte.d.ts +8 -2
- package/dist/marks/DifferenceY.svelte +31 -20
- package/dist/marks/DifferenceY.svelte.d.ts +134 -55
- package/dist/marks/Dot.svelte +21 -11
- package/dist/marks/Dot.svelte.d.ts +117 -38
- package/dist/marks/DotX.svelte +2 -0
- package/dist/marks/DotX.svelte.d.ts +136 -62
- package/dist/marks/DotY.svelte +1 -0
- package/dist/marks/DotY.svelte.d.ts +135 -62
- package/dist/marks/Frame.svelte +47 -9
- package/dist/marks/Frame.svelte.d.ts +124 -41
- package/dist/marks/Geo.svelte +21 -12
- package/dist/marks/Geo.svelte.d.ts +105 -30
- package/dist/marks/Graticule.svelte +3 -0
- package/dist/marks/Graticule.svelte.d.ts +3 -0
- package/dist/marks/GridX.svelte +31 -16
- package/dist/marks/GridX.svelte.d.ts +108 -32
- package/dist/marks/GridY.svelte +30 -15
- package/dist/marks/GridY.svelte.d.ts +108 -32
- package/dist/marks/HTMLTooltip.svelte +14 -7
- package/dist/marks/HTMLTooltip.svelte.d.ts +7 -0
- package/dist/marks/Image.svelte +50 -25
- package/dist/marks/Image.svelte.d.ts +117 -35
- package/dist/marks/Line.svelte +67 -44
- package/dist/marks/Line.svelte.d.ts +119 -30
- package/dist/marks/LineX.svelte +2 -1
- package/dist/marks/LineX.svelte.d.ts +142 -69
- package/dist/marks/LineY.svelte +2 -1
- package/dist/marks/LineY.svelte.d.ts +142 -69
- package/dist/marks/Link.svelte +70 -46
- package/dist/marks/Link.svelte.d.ts +126 -41
- package/dist/marks/Pointer.svelte +24 -15
- package/dist/marks/Pointer.svelte.d.ts +7 -0
- package/dist/marks/Rect.svelte +13 -5
- package/dist/marks/Rect.svelte.d.ts +116 -35
- package/dist/marks/RectX.svelte +6 -3
- package/dist/marks/RectX.svelte.d.ts +158 -12
- package/dist/marks/RectY.svelte +6 -3
- package/dist/marks/RectY.svelte.d.ts +158 -12
- package/dist/marks/RegressionX.svelte +13 -6
- package/dist/marks/RegressionX.svelte.d.ts +8 -3
- package/dist/marks/RegressionY.svelte +13 -6
- package/dist/marks/RegressionY.svelte.d.ts +8 -3
- package/dist/marks/RuleX.svelte +18 -11
- package/dist/marks/RuleX.svelte.d.ts +112 -32
- package/dist/marks/RuleY.svelte +19 -12
- package/dist/marks/RuleY.svelte.d.ts +114 -34
- package/dist/marks/Spike.svelte +11 -5
- package/dist/marks/Spike.svelte.d.ts +146 -68
- package/dist/marks/Text.svelte +24 -7
- package/dist/marks/Text.svelte.d.ts +253 -75
- package/dist/marks/TickX.svelte +56 -48
- package/dist/marks/TickX.svelte.d.ts +114 -40
- package/dist/marks/TickY.svelte +59 -51
- package/dist/marks/TickY.svelte.d.ts +117 -43
- package/dist/marks/Trail.svelte +25 -13
- package/dist/marks/Trail.svelte.d.ts +116 -33
- package/dist/marks/Vector.svelte +20 -11
- package/dist/marks/Vector.svelte.d.ts +116 -35
- package/dist/marks/WaffleX.svelte +18 -16
- package/dist/marks/WaffleX.svelte.d.ts +131 -57
- package/dist/marks/WaffleY.svelte +16 -15
- package/dist/marks/WaffleY.svelte.d.ts +129 -56
- package/dist/marks/helpers/Anchor.svelte +17 -2
- package/dist/marks/helpers/Anchor.svelte.d.ts +16 -1
- package/dist/marks/helpers/AreaCanvas.svelte +8 -8
- package/dist/marks/helpers/BaseAxisX.svelte +38 -41
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +11 -17
- package/dist/marks/helpers/BaseAxisY.svelte +35 -35
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +12 -15
- package/dist/marks/helpers/Box.svelte +35 -28
- package/dist/marks/helpers/Box.svelte.d.ts +122 -50
- package/dist/marks/helpers/DotCanvas.svelte +11 -9
- package/dist/marks/helpers/GeoCanvas.svelte +7 -6
- package/dist/marks/helpers/LineCanvas.svelte +7 -7
- package/dist/marks/helpers/LinearGradientX.svelte +2 -2
- package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte +2 -2
- package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
- package/dist/marks/helpers/Marker.svelte +2 -2
- package/dist/marks/helpers/MarkerPath.svelte +15 -12
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +105 -32
- package/dist/marks/helpers/MultilineText.svelte +24 -17
- package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
- package/dist/marks/helpers/RectCanvas.svelte +31 -26
- package/dist/marks/helpers/RectPath.svelte +2 -2
- package/dist/marks/helpers/Regression.svelte +176 -86
- package/dist/marks/helpers/Regression.svelte.d.ts +20 -8
- package/dist/marks/helpers/RuleCanvas.svelte +9 -6
- package/dist/marks/helpers/TextCanvas.svelte +13 -9
- package/dist/marks/helpers/TextCanvas.svelte.d.ts +6 -6
- package/dist/marks/helpers/TickCanvas.svelte +6 -5
- package/dist/marks/helpers/TrailCanvas.svelte +16 -18
- package/dist/marks/helpers/TrailCanvas.svelte.d.ts +3 -5
- package/dist/marks/helpers/canvas.js +16 -9
- package/dist/marks/helpers/events.d.ts +2 -2
- package/dist/marks/helpers/events.js +14 -7
- package/dist/marks/helpers/waffle.d.ts +3 -3
- package/dist/marks/helpers/waffle.js +6 -4
- package/dist/regression/polynomial.d.ts +1 -1
- package/dist/regression/polynomial.js +5 -5
- package/dist/regression/utils/determination.d.ts +1 -1
- package/dist/regression/utils/determination.js +1 -1
- package/dist/regression/utils/geometry.d.ts +1 -1
- package/dist/regression/utils/interpose.d.ts +1 -1
- package/dist/regression/utils/interpose.js +1 -1
- package/dist/regression/utils/points.d.ts +1 -1
- package/dist/transforms/bin.d.ts +3 -3
- package/dist/transforms/bin.js +29 -20
- package/dist/transforms/bollinger.d.ts +8 -0
- package/dist/transforms/bollinger.js +9 -1
- package/dist/transforms/centroid.d.ts +4 -0
- package/dist/transforms/centroid.js +4 -0
- package/dist/transforms/density.d.ts +4 -4
- package/dist/transforms/density.js +20 -13
- package/dist/transforms/dodge.d.ts +12 -1
- package/dist/transforms/dodge.js +15 -6
- package/dist/transforms/group.d.ts +141 -4
- package/dist/transforms/group.js +4 -1
- package/dist/transforms/interval.d.ts +204 -60
- package/dist/transforms/jitter.d.ts +421 -4
- package/dist/transforms/jitter.js +10 -1
- package/dist/transforms/map.d.ts +412 -4
- package/dist/transforms/map.js +3 -3
- package/dist/transforms/normalize.d.ts +276 -5
- package/dist/transforms/normalize.js +5 -3
- package/dist/transforms/recordize.d.ts +17 -5
- package/dist/transforms/recordize.js +13 -9
- package/dist/transforms/rename.d.ts +11 -4
- package/dist/transforms/rename.js +7 -2
- package/dist/transforms/select.d.ts +722 -210
- package/dist/transforms/select.js +13 -1
- package/dist/transforms/shift.d.ts +8 -0
- package/dist/transforms/shift.js +20 -6
- package/dist/transforms/sort.d.ts +13 -258
- package/dist/transforms/sort.js +13 -10
- package/dist/transforms/stack.d.ts +58 -9
- package/dist/transforms/stack.js +27 -11
- package/dist/transforms/window.d.ts +221 -66
- package/dist/transforms/window.js +8 -2
- package/dist/types/axes.d.ts +43 -0
- package/dist/types/axes.js +1 -0
- package/dist/types/channel.d.ts +30 -2
- package/dist/types/data.d.ts +14 -1
- package/dist/types/facet.d.ts +5 -0
- package/dist/types/index.d.ts +33 -8
- package/dist/types/index.js +11 -7
- package/dist/types/mark.d.ts +124 -35
- package/dist/types/plot.d.ts +118 -16
- package/dist/types/scale.d.ts +125 -8
- package/package.json +178 -175
- package/dist/helpers/autoTicks.d.ts +0 -12
|
@@ -6,36 +6,35 @@
|
|
|
6
6
|
import type {
|
|
7
7
|
AutoMarginStores,
|
|
8
8
|
ConstantAccessor,
|
|
9
|
-
DataRecord,
|
|
10
9
|
PlotState,
|
|
10
|
+
PlotScaleFunction,
|
|
11
11
|
RawValue,
|
|
12
12
|
ScaledDataRecord,
|
|
13
13
|
ScaleType
|
|
14
14
|
} from '../../types/index.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import type { AxisTickDatum, AxisYTick, BaseAxisYOptions } from '../../types/axes.js';
|
|
16
|
+
import { RAW_VALUE } from '../../transforms/recordize.js';
|
|
17
|
+
import { INDEX } from '../../constants.js';
|
|
18
|
+
type AxisDatum = AxisTickDatum<typeof RAW_VALUE, typeof INDEX>;
|
|
19
|
+
type AxisTick = AxisYTick<AxisDatum>;
|
|
17
20
|
|
|
18
21
|
type BaseAxisYProps = {
|
|
19
|
-
scaleFn:
|
|
22
|
+
scaleFn: PlotScaleFunction;
|
|
20
23
|
scaleType: ScaleType;
|
|
21
24
|
ticks: RawValue[];
|
|
22
25
|
tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
|
|
23
|
-
anchor
|
|
24
|
-
lineAnchor
|
|
25
|
-
tickSize
|
|
26
|
-
tickPadding
|
|
27
|
-
tickFontSize
|
|
28
|
-
tickClass
|
|
26
|
+
anchor?: 'left' | 'right';
|
|
27
|
+
lineAnchor?: 'top' | 'center' | 'bottom';
|
|
28
|
+
tickSize?: number;
|
|
29
|
+
tickPadding?: number;
|
|
30
|
+
tickFontSize?: ConstantAccessor<number>;
|
|
31
|
+
tickClass?: ConstantAccessor<string>;
|
|
29
32
|
marginLeft: number;
|
|
30
33
|
width: number;
|
|
31
|
-
title
|
|
32
|
-
options:
|
|
33
|
-
dx: ConstantAccessor<number>;
|
|
34
|
-
dy: ConstantAccessor<number>;
|
|
35
|
-
textAnchor: 'start' | 'middle' | 'end';
|
|
36
|
-
};
|
|
34
|
+
title?: string | null;
|
|
35
|
+
options: BaseAxisYOptions;
|
|
37
36
|
plot: PlotState;
|
|
38
|
-
text
|
|
37
|
+
text?: boolean | null;
|
|
39
38
|
class: string | undefined;
|
|
40
39
|
};
|
|
41
40
|
|
|
@@ -44,15 +43,15 @@
|
|
|
44
43
|
scaleType,
|
|
45
44
|
ticks,
|
|
46
45
|
tickFormat,
|
|
47
|
-
anchor,
|
|
48
|
-
lineAnchor,
|
|
49
|
-
tickSize,
|
|
50
|
-
tickPadding,
|
|
51
|
-
tickFontSize,
|
|
52
|
-
tickClass,
|
|
46
|
+
anchor = 'left',
|
|
47
|
+
lineAnchor = 'center',
|
|
48
|
+
tickSize = 6,
|
|
49
|
+
tickPadding = 3,
|
|
50
|
+
tickFontSize = 11,
|
|
51
|
+
tickClass = null,
|
|
53
52
|
marginLeft,
|
|
54
53
|
width,
|
|
55
|
-
title,
|
|
54
|
+
title = null,
|
|
56
55
|
plot,
|
|
57
56
|
options,
|
|
58
57
|
text = true,
|
|
@@ -63,16 +62,17 @@
|
|
|
63
62
|
top: 'hanging',
|
|
64
63
|
center: 'middle',
|
|
65
64
|
bottom: 'auto'
|
|
66
|
-
};
|
|
65
|
+
} as const;
|
|
66
|
+
const toScaledDatum = (tick: AxisTick) => ({ datum: tick }) as unknown as ScaledDataRecord;
|
|
67
67
|
|
|
68
68
|
const positionedTicks = $derived.by(() => {
|
|
69
|
-
let tickObjects = ticks.map((tick, i) => {
|
|
70
|
-
const datum = { [RAW_VALUE]: tick, [INDEX]: i };
|
|
69
|
+
let tickObjects: AxisTick[] = ticks.map((tick, i) => {
|
|
70
|
+
const datum: AxisDatum = { [RAW_VALUE]: tick, [INDEX]: i };
|
|
71
71
|
return {
|
|
72
72
|
...datum,
|
|
73
73
|
hidden: false,
|
|
74
|
-
dx:
|
|
75
|
-
dy:
|
|
74
|
+
dx: Number(resolveProp(options.dx, datum, 0) ?? 0),
|
|
75
|
+
dy: Number(resolveProp(options.dy, datum, 0) ?? 0),
|
|
76
76
|
y: scaleFn(tick) + (scaleType === 'band' ? scaleFn.bandwidth() * 0.5 : 0),
|
|
77
77
|
text: tickFormat(tick, i, ticks),
|
|
78
78
|
element: null as SVGTextElement | null
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
return tickObjects;
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
let tickTexts = $state([] as SVGTextElement[]);
|
|
98
|
+
let tickTexts = $state([] as (SVGTextElement | undefined)[]);
|
|
99
99
|
|
|
100
100
|
const isQuantitative = $derived(scaleType !== 'point' && scaleType !== 'band');
|
|
101
101
|
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
if (tickTexts[i]) return tickTexts[i].getBoundingClientRect().width;
|
|
123
123
|
return 0;
|
|
124
124
|
}) as number[]
|
|
125
|
-
)
|
|
125
|
+
) ?? 0
|
|
126
126
|
) + Math.max(0, tickPadding + tickSize);
|
|
127
127
|
|
|
128
128
|
if (!isNaN(maxLabelWidth)) {
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
{@const tickClass_ = resolveProp(tickClass, tick)}
|
|
162
162
|
{@const [textStyle, textClass] = resolveStyles(
|
|
163
163
|
plot,
|
|
164
|
-
|
|
164
|
+
toScaledDatum(tick),
|
|
165
165
|
{
|
|
166
166
|
fontVariant: isQuantitative ? 'tabular-nums' : 'normal',
|
|
167
167
|
...options,
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
stroke: null
|
|
170
170
|
},
|
|
171
171
|
'fill',
|
|
172
|
-
{ y: true },
|
|
172
|
+
{ y: true } as any,
|
|
173
173
|
true
|
|
174
174
|
)}
|
|
175
175
|
<g
|
|
@@ -180,10 +180,10 @@
|
|
|
180
180
|
{#if tickSize}
|
|
181
181
|
{@const [tickLineStyle, tickLineClass] = resolveStyles(
|
|
182
182
|
plot,
|
|
183
|
-
|
|
183
|
+
toScaledDatum(tick),
|
|
184
184
|
options,
|
|
185
185
|
'stroke',
|
|
186
|
-
{ y: true },
|
|
186
|
+
{ y: true } as any,
|
|
187
187
|
true
|
|
188
188
|
)}
|
|
189
189
|
<line
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import type { ConstantAccessor, PlotState, RawValue, ScaleType } from '../../types/index.js';
|
|
1
|
+
import type { ConstantAccessor, PlotState, PlotScaleFunction, RawValue, ScaleType } from '../../types/index.js';
|
|
2
|
+
import type { BaseAxisYOptions } from '../../types/axes.js';
|
|
2
3
|
type BaseAxisYProps = {
|
|
3
|
-
scaleFn:
|
|
4
|
+
scaleFn: PlotScaleFunction;
|
|
4
5
|
scaleType: ScaleType;
|
|
5
6
|
ticks: RawValue[];
|
|
6
7
|
tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
|
|
7
|
-
anchor
|
|
8
|
-
lineAnchor
|
|
9
|
-
tickSize
|
|
10
|
-
tickPadding
|
|
11
|
-
tickFontSize
|
|
12
|
-
tickClass
|
|
8
|
+
anchor?: 'left' | 'right';
|
|
9
|
+
lineAnchor?: 'top' | 'center' | 'bottom';
|
|
10
|
+
tickSize?: number;
|
|
11
|
+
tickPadding?: number;
|
|
12
|
+
tickFontSize?: ConstantAccessor<number>;
|
|
13
|
+
tickClass?: ConstantAccessor<string>;
|
|
13
14
|
marginLeft: number;
|
|
14
15
|
width: number;
|
|
15
|
-
title
|
|
16
|
-
options:
|
|
17
|
-
dx: ConstantAccessor<number>;
|
|
18
|
-
dy: ConstantAccessor<number>;
|
|
19
|
-
textAnchor: 'start' | 'middle' | 'end';
|
|
20
|
-
};
|
|
16
|
+
title?: string | null;
|
|
17
|
+
options: BaseAxisYOptions;
|
|
21
18
|
plot: PlotState;
|
|
22
|
-
text
|
|
19
|
+
text?: boolean | null;
|
|
23
20
|
class: string | undefined;
|
|
24
21
|
};
|
|
25
22
|
declare const BaseAxisY: import("svelte").Component<BaseAxisYProps, {}, "">;
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
import GroupMultiple from './GroupMultiple.svelte';
|
|
42
42
|
import { groupX, groupY, BarY, TickY, RuleX, BarX, TickX, RuleY, Dot } from '../../index.js';
|
|
43
43
|
import { resolveChannel } from '../../helpers/resolve.js';
|
|
44
|
-
import type { BaseMarkProps, ChannelAccessor, DataRecord, RawValue } from '../../types';
|
|
45
|
-
import { IS_SORTED } from '../../transforms/sort';
|
|
44
|
+
import type { BaseMarkProps, ChannelAccessor, DataRecord, RawValue } from '../../types/index.js';
|
|
45
|
+
import { IS_SORTED } from '../../transforms/sort.js';
|
|
46
46
|
|
|
47
47
|
let markProps: BoxMarkProps = $props();
|
|
48
48
|
|
|
49
49
|
const {
|
|
50
|
-
data = [
|
|
50
|
+
data = [] as Datum[],
|
|
51
51
|
bar,
|
|
52
52
|
rule,
|
|
53
53
|
tickMedian,
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
fy
|
|
90
90
|
},
|
|
91
91
|
{ [xProp]: 'median', [x1Prop]: 'p25', [x2Prop]: 'p75', fill: (rows) => rows }
|
|
92
|
-
)
|
|
92
|
+
) as { data: any[]; [key: string]: any }
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
const X = Symbol('x'),
|
|
@@ -112,13 +112,15 @@
|
|
|
112
112
|
const sortProps = { [IS_SORTED]: true };
|
|
113
113
|
|
|
114
114
|
const compareValues = (a: RawValue, b: RawValue) =>
|
|
115
|
-
(typeof a === '
|
|
116
|
-
?
|
|
117
|
-
: a
|
|
118
|
-
?
|
|
119
|
-
: a
|
|
120
|
-
?
|
|
121
|
-
:
|
|
115
|
+
(typeof a === 'symbol' || typeof b === 'symbol'
|
|
116
|
+
? 0
|
|
117
|
+
: typeof a === 'string' && typeof b === 'string'
|
|
118
|
+
? a.localeCompare(b)
|
|
119
|
+
: (a as number) > (b as number)
|
|
120
|
+
? 1
|
|
121
|
+
: (a as number) < (b as number)
|
|
122
|
+
? -1
|
|
123
|
+
: 0) || 0;
|
|
122
124
|
|
|
123
125
|
const boxData = $derived.by(() => {
|
|
124
126
|
const boxes = grouped
|
|
@@ -128,11 +130,11 @@
|
|
|
128
130
|
const p75Key = groupChannels[x2Prop];
|
|
129
131
|
const groupKey = groupChannels[yProp];
|
|
130
132
|
|
|
131
|
-
const iqr = row[p75Key] - row[p25Key];
|
|
133
|
+
const iqr = (row[p75Key] as number) - (row[p25Key] as number);
|
|
132
134
|
const whisker = iqr * 1.5;
|
|
133
|
-
const lower = row[p25Key] - whisker;
|
|
134
|
-
const upper = row[p75Key] + whisker;
|
|
135
|
-
const data = row[groupChannels.fill].map((d) => ({
|
|
135
|
+
const lower = (row[p25Key] as number) - whisker;
|
|
136
|
+
const upper = (row[p75Key] as number) + whisker;
|
|
137
|
+
const data = (row[groupChannels.fill] as any[]).map((d) => ({
|
|
136
138
|
...d,
|
|
137
139
|
[orientation === 'y' ? Y : X]: resolveChannel(xProp, d, {
|
|
138
140
|
x,
|
|
@@ -141,10 +143,12 @@
|
|
|
141
143
|
}));
|
|
142
144
|
const valueSym = orientation === 'y' ? Y : X;
|
|
143
145
|
const groupSym = orientation === 'y' ? X : Y;
|
|
144
|
-
const outliers = data.filter(
|
|
146
|
+
const outliers = data.filter(
|
|
147
|
+
(d: any) => d[valueSym] < lower || d[valueSym] > upper
|
|
148
|
+
);
|
|
145
149
|
const inside = data
|
|
146
|
-
.filter((d) => d[valueSym] >= lower && d[valueSym] <= upper)
|
|
147
|
-
.sort((a, b) => a[valueSym] - b[valueSym]);
|
|
150
|
+
.filter((d: any) => d[valueSym] >= lower && d[valueSym] <= upper)
|
|
151
|
+
.sort((a: any, b: any) => a[valueSym] - b[valueSym]);
|
|
148
152
|
|
|
149
153
|
return {
|
|
150
154
|
...data[0],
|
|
@@ -154,15 +158,18 @@
|
|
|
154
158
|
[MEDIAN]: row[medianKey],
|
|
155
159
|
[P75]: row[p75Key],
|
|
156
160
|
[MIN]: inside.length ? inside[0][valueSym] : null,
|
|
157
|
-
[MAX]: inside.length ? inside.at(-1)[valueSym] : null,
|
|
158
|
-
[FX]: resolveChannel('fx', data[0], { fx }
|
|
159
|
-
[FY]: resolveChannel('fy', data[0], { fy }
|
|
161
|
+
[MAX]: inside.length ? (inside.at(-1) as any)[valueSym] : null,
|
|
162
|
+
[FX]: resolveChannel('fx', data[0], { fx }),
|
|
163
|
+
[FY]: resolveChannel('fy', data[0], { fy }),
|
|
160
164
|
[OUTLIERS]: outliers
|
|
161
165
|
};
|
|
162
166
|
})
|
|
163
167
|
.filter(Boolean);
|
|
164
168
|
|
|
165
|
-
const stripSortRef = (
|
|
169
|
+
const stripSortRef = (obj: any) => {
|
|
170
|
+
const { [SORT_REF]: _unused, ...rest } = obj;
|
|
171
|
+
return rest;
|
|
172
|
+
};
|
|
166
173
|
|
|
167
174
|
if (!sort) return boxes.map(stripSortRef);
|
|
168
175
|
|
|
@@ -170,8 +177,8 @@
|
|
|
170
177
|
|
|
171
178
|
const sortAccessor =
|
|
172
179
|
typeof sort === 'function'
|
|
173
|
-
? (d) => sort(d[SORT_REF])
|
|
174
|
-
: (d) => {
|
|
180
|
+
? (d: any) => sort(d[SORT_REF])
|
|
181
|
+
: (d: any) => {
|
|
175
182
|
switch (sort_) {
|
|
176
183
|
case 'min':
|
|
177
184
|
return d[MIN];
|
|
@@ -200,7 +207,7 @@
|
|
|
200
207
|
function maybeSort(
|
|
201
208
|
sort: string | ((d: Datum) => RawValue) | undefined
|
|
202
209
|
): [string | ((d: Datum) => RawValue), 1 | -1] {
|
|
203
|
-
if (typeof sort !== 'string') return [sort, 1];
|
|
210
|
+
if (typeof sort !== 'string') return [sort as (d: Datum) => RawValue, 1];
|
|
204
211
|
if (sort.startsWith('-')) {
|
|
205
212
|
return [sort.slice(1), -1];
|
|
206
213
|
}
|
|
@@ -249,18 +256,18 @@
|
|
|
249
256
|
{...{ [yProp]: groupSymbol, [xProp]: MIN }}
|
|
250
257
|
{stroke}
|
|
251
258
|
{...facets}
|
|
252
|
-
inset
|
|
259
|
+
{...{ inset: '20%' } as any}
|
|
253
260
|
{...typeof tickMinMax === 'object' ? tickMinMax : {}} />
|
|
254
261
|
<TickMark
|
|
255
262
|
data={boxData}
|
|
256
263
|
{...{ [yProp]: groupSymbol, [xProp]: MAX }}
|
|
257
264
|
{stroke}
|
|
258
265
|
{...facets}
|
|
259
|
-
inset
|
|
266
|
+
{...{ inset: '20%' } as any}
|
|
260
267
|
{...typeof tickMinMax === 'object' ? tickMinMax : {}} />
|
|
261
268
|
{/if}
|
|
262
269
|
<Dot
|
|
263
|
-
data={boxData.map((d) => d[OUTLIERS]).flat()}
|
|
270
|
+
data={boxData.map((d) => (d as any)[OUTLIERS]).flat()}
|
|
264
271
|
{x}
|
|
265
272
|
{y}
|
|
266
273
|
{fx}
|
|
@@ -1,68 +1,140 @@
|
|
|
1
|
-
import type { ChannelAccessor, DataRecord, RawValue } from '../../types';
|
|
1
|
+
import type { ChannelAccessor, DataRecord, RawValue } from '../../types/index.js';
|
|
2
2
|
declare function $$render<Datum extends DataRecord>(): {
|
|
3
3
|
props: Pick<Partial<{
|
|
4
|
-
filter: import("../../types").ConstantAccessor<boolean, Datum>;
|
|
4
|
+
filter: import("../../types/index.js").ConstantAccessor<boolean, Datum>;
|
|
5
5
|
facet: "auto" | "include" | "exclude";
|
|
6
6
|
fx: ChannelAccessor<Datum>;
|
|
7
7
|
fy: ChannelAccessor<Datum>;
|
|
8
|
-
dx: import("../../types").ConstantAccessor<number, Datum>;
|
|
9
|
-
dy: import("../../types").ConstantAccessor<number, Datum>;
|
|
10
|
-
dodgeX: import("../../transforms/dodge").DodgeXOptions;
|
|
11
|
-
dodgeY: import("../../transforms/dodge").DodgeYOptions;
|
|
8
|
+
dx: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
9
|
+
dy: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
10
|
+
dodgeX: import("../../transforms/dodge.js").DodgeXOptions;
|
|
11
|
+
dodgeY: import("../../transforms/dodge.js").DodgeYOptions;
|
|
12
12
|
fill: ChannelAccessor<Datum>;
|
|
13
|
-
fillOpacity: import("../../types").ConstantAccessor<number, Datum>;
|
|
13
|
+
fillOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
14
|
+
fontFamily: import("../../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, Datum>;
|
|
15
|
+
fontSize: import("../../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", Datum>;
|
|
16
|
+
fontStyle: import("../../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, Datum>;
|
|
17
|
+
fontVariant: import("../../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, Datum>;
|
|
18
|
+
fontWeight: import("../../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, Datum>;
|
|
19
|
+
letterSpacing: import("../../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, Datum>;
|
|
20
|
+
wordSpacing: import("../../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, Datum>;
|
|
21
|
+
textAnchor: import("../../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, Datum>;
|
|
22
|
+
textTransform: import("../../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, Datum>;
|
|
23
|
+
textDecoration: import("../../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, Datum>;
|
|
14
24
|
sort: ((a: RawValue, b: RawValue) => number) | {
|
|
15
25
|
channel: string;
|
|
16
26
|
order?: "ascending" | "descending";
|
|
17
|
-
} | import("../../types").ConstantAccessor<RawValue, Datum>;
|
|
27
|
+
} | import("../../types/index.js").ConstantAccessor<RawValue, Datum>;
|
|
18
28
|
stroke: ChannelAccessor<Datum>;
|
|
19
|
-
strokeWidth: import("../../types").ConstantAccessor<number, Datum>;
|
|
20
|
-
strokeOpacity: import("../../types").ConstantAccessor<number, Datum>;
|
|
21
|
-
strokeLinejoin: import("../../types").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
22
|
-
strokeLinecap: import("../../types").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
23
|
-
strokeMiterlimit: import("../../types").ConstantAccessor<number, Datum>;
|
|
29
|
+
strokeWidth: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
30
|
+
strokeOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
31
|
+
strokeLinejoin: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
32
|
+
strokeLinecap: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
33
|
+
strokeMiterlimit: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
24
34
|
opacity: ChannelAccessor<Datum>;
|
|
25
|
-
strokeDasharray: import("../../types").ConstantAccessor<string, Datum>;
|
|
26
|
-
strokeDashoffset: import("../../types").ConstantAccessor<number, Datum>;
|
|
27
|
-
|
|
35
|
+
strokeDasharray: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
36
|
+
strokeDashoffset: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
37
|
+
blend: import("../../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
38
|
+
mixBlendMode: import("../../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
28
39
|
clipPath: string;
|
|
29
40
|
mask: string;
|
|
30
|
-
imageFilter: import("../../types").ConstantAccessor<string, Datum>;
|
|
31
|
-
shapeRendering: import("../../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
32
|
-
paintOrder: import("../../types").ConstantAccessor<string, Datum>;
|
|
33
|
-
onclick:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
imageFilter: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
42
|
+
shapeRendering: import("../../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
43
|
+
paintOrder: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
44
|
+
onclick: (event: Event & {
|
|
45
|
+
currentTarget: SVGPathElement;
|
|
46
|
+
}, datum: Datum, index: number) => void;
|
|
47
|
+
ondblclick: (event: Event & {
|
|
48
|
+
currentTarget: SVGPathElement;
|
|
49
|
+
}, datum: Datum, index: number) => void;
|
|
50
|
+
onmouseup: (event: Event & {
|
|
51
|
+
currentTarget: SVGPathElement;
|
|
52
|
+
}, datum: Datum, index: number) => void;
|
|
53
|
+
onmousedown: (event: Event & {
|
|
54
|
+
currentTarget: SVGPathElement;
|
|
55
|
+
}, datum: Datum, index: number) => void;
|
|
56
|
+
onmouseenter: (event: Event & {
|
|
57
|
+
currentTarget: SVGPathElement;
|
|
58
|
+
}, datum: Datum, index: number) => void;
|
|
59
|
+
onmousemove: (event: Event & {
|
|
60
|
+
currentTarget: SVGPathElement;
|
|
61
|
+
}, datum: Datum, index: number) => void;
|
|
62
|
+
onmouseleave: (event: Event & {
|
|
63
|
+
currentTarget: SVGPathElement;
|
|
64
|
+
}, datum: Datum, index: number) => void;
|
|
65
|
+
onmouseout: (event: Event & {
|
|
66
|
+
currentTarget: SVGPathElement;
|
|
67
|
+
}, datum: Datum, index: number) => void;
|
|
68
|
+
onmouseover: (event: Event & {
|
|
69
|
+
currentTarget: SVGPathElement;
|
|
70
|
+
}, datum: Datum, index: number) => void;
|
|
71
|
+
onpointercancel: (event: Event & {
|
|
72
|
+
currentTarget: SVGPathElement;
|
|
73
|
+
}, datum: Datum, index: number) => void;
|
|
74
|
+
onpointerdown: (event: Event & {
|
|
75
|
+
currentTarget: SVGPathElement;
|
|
76
|
+
}, datum: Datum, index: number) => void;
|
|
77
|
+
onpointerup: (event: Event & {
|
|
78
|
+
currentTarget: SVGPathElement;
|
|
79
|
+
}, datum: Datum, index: number) => void;
|
|
80
|
+
onpointerenter: (event: Event & {
|
|
81
|
+
currentTarget: SVGPathElement;
|
|
82
|
+
}, datum: Datum, index: number) => void;
|
|
83
|
+
onpointerleave: (event: Event & {
|
|
84
|
+
currentTarget: SVGPathElement;
|
|
85
|
+
}, datum: Datum, index: number) => void;
|
|
86
|
+
onpointermove: (event: Event & {
|
|
87
|
+
currentTarget: SVGPathElement;
|
|
88
|
+
}, datum: Datum, index: number) => void;
|
|
89
|
+
onpointerover: (event: Event & {
|
|
90
|
+
currentTarget: SVGPathElement;
|
|
91
|
+
}, datum: Datum, index: number) => void;
|
|
92
|
+
onpointerout: (event: Event & {
|
|
93
|
+
currentTarget: SVGPathElement;
|
|
94
|
+
}, datum: Datum, index: number) => void;
|
|
95
|
+
ondrag: (event: Event & {
|
|
96
|
+
currentTarget: SVGPathElement;
|
|
97
|
+
}, datum: Datum, index: number) => void;
|
|
98
|
+
ondrop: (event: Event & {
|
|
99
|
+
currentTarget: SVGPathElement;
|
|
100
|
+
}, datum: Datum, index: number) => void;
|
|
101
|
+
ondragstart: (event: Event & {
|
|
102
|
+
currentTarget: SVGPathElement;
|
|
103
|
+
}, datum: Datum, index: number) => void;
|
|
104
|
+
ondragenter: (event: Event & {
|
|
105
|
+
currentTarget: SVGPathElement;
|
|
106
|
+
}, datum: Datum, index: number) => void;
|
|
107
|
+
ondragleave: (event: Event & {
|
|
108
|
+
currentTarget: SVGPathElement;
|
|
109
|
+
}, datum: Datum, index: number) => void;
|
|
110
|
+
ondragover: (event: Event & {
|
|
111
|
+
currentTarget: SVGPathElement;
|
|
112
|
+
}, datum: Datum, index: number) => void;
|
|
113
|
+
ondragend: (event: Event & {
|
|
114
|
+
currentTarget: SVGPathElement;
|
|
115
|
+
}, datum: Datum, index: number) => void;
|
|
116
|
+
ontouchstart: (event: Event & {
|
|
117
|
+
currentTarget: SVGPathElement;
|
|
118
|
+
}, datum: Datum, index: number) => void;
|
|
119
|
+
ontouchmove: (event: Event & {
|
|
120
|
+
currentTarget: SVGPathElement;
|
|
121
|
+
}, datum: Datum, index: number) => void;
|
|
122
|
+
ontouchend: (event: Event & {
|
|
123
|
+
currentTarget: SVGPathElement;
|
|
124
|
+
}, datum: Datum, index: number) => void;
|
|
125
|
+
ontouchcancel: (event: Event & {
|
|
126
|
+
currentTarget: SVGPathElement;
|
|
127
|
+
}, datum: Datum, index: number) => void;
|
|
128
|
+
oncontextmenu: (event: Event & {
|
|
129
|
+
currentTarget: SVGPathElement;
|
|
130
|
+
}, datum: Datum, index: number) => void;
|
|
131
|
+
onwheel: (event: Event & {
|
|
132
|
+
currentTarget: SVGPathElement;
|
|
133
|
+
}, datum: Datum, index: number) => void;
|
|
63
134
|
class: string;
|
|
64
135
|
style: string;
|
|
65
|
-
cursor: import("../../types").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
136
|
+
cursor: import("../../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
137
|
+
title: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
66
138
|
}>, "fx" | "fy" | "fill" | "stroke" | "class"> & {
|
|
67
139
|
data: Datum[];
|
|
68
140
|
x: ChannelAccessor;
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
data: ScaledDataRecord[];
|
|
26
26
|
} = $props();
|
|
27
27
|
|
|
28
|
-
function drawSymbolPath(symbolType: string, size: number, context) {
|
|
28
|
+
function drawSymbolPath(symbolType: string, size: number, context: CanvasRenderingContext2D) {
|
|
29
29
|
// maybeSymbol(symbolType).draw(context, size);
|
|
30
30
|
return d3Symbol(maybeSymbol(symbolType), size).context(context)();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
let _markOptions = $state(mark.options);
|
|
34
34
|
|
|
35
|
-
const renderDots: Attachment = (
|
|
35
|
+
const renderDots: Attachment = (canvasEl: Element) => {
|
|
36
|
+
const canvas = canvasEl as HTMLCanvasElement;
|
|
36
37
|
const context = canvas.getContext('2d');
|
|
37
38
|
|
|
38
39
|
$effect(() => {
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
if (datum.valid) {
|
|
45
46
|
let { fill, stroke } = datum;
|
|
46
47
|
|
|
47
|
-
fill = resolveColor(fill, canvas);
|
|
48
|
-
stroke = resolveColor(stroke, canvas);
|
|
48
|
+
fill = resolveColor(fill ?? 'none', canvas) as string;
|
|
49
|
+
stroke = resolveColor(stroke ?? 'none', canvas) as string;
|
|
49
50
|
|
|
50
51
|
if (stroke && stroke !== 'none') {
|
|
51
52
|
const strokeWidth = resolveProp(
|
|
@@ -53,17 +54,18 @@
|
|
|
53
54
|
datum.datum,
|
|
54
55
|
1.6
|
|
55
56
|
);
|
|
56
|
-
context.lineWidth = strokeWidth;
|
|
57
|
+
context.lineWidth = strokeWidth ?? 1.6;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
context.fillStyle = fill ? fill : 'none';
|
|
60
61
|
context.strokeStyle = stroke ? stroke : 'none';
|
|
61
|
-
context.translate(datum.x, datum.y);
|
|
62
|
+
context.translate(datum.x ?? 0, datum.y ?? 0);
|
|
62
63
|
|
|
63
|
-
const
|
|
64
|
+
const r = datum.r ?? 1;
|
|
65
|
+
const size = r * r * Math.PI;
|
|
64
66
|
|
|
65
67
|
context.beginPath();
|
|
66
|
-
drawSymbolPath(datum.symbol, size, context);
|
|
68
|
+
drawSymbolPath(datum.symbol ?? 'circle', size, context);
|
|
67
69
|
context.closePath();
|
|
68
70
|
|
|
69
71
|
const { opacity = 1, fillOpacity = 1, strokeOpacity = 1 } = datum;
|
|
@@ -74,7 +76,7 @@
|
|
|
74
76
|
if (strokeOpacity != null)
|
|
75
77
|
context.globalAlpha = (opacity ?? 1) * strokeOpacity;
|
|
76
78
|
if (stroke && stroke !== 'none') context.stroke();
|
|
77
|
-
context.translate(-datum.x, -datum.y);
|
|
79
|
+
context.translate(-(datum.x ?? 0), -(datum.y ?? 0));
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -28,11 +28,12 @@
|
|
|
28
28
|
|
|
29
29
|
const plot = usePlot();
|
|
30
30
|
|
|
31
|
-
function maybeOpacity(value) {
|
|
31
|
+
function maybeOpacity(value: unknown) {
|
|
32
32
|
return value == null ? 1 : +value;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const render: Attachment = (
|
|
35
|
+
const render: Attachment = (canvasEl: Element) => {
|
|
36
|
+
const canvas = canvasEl as HTMLCanvasElement;
|
|
36
37
|
const context = canvas.getContext('2d');
|
|
37
38
|
|
|
38
39
|
$effect(() => {
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
|
|
45
46
|
for (const d of data) {
|
|
46
47
|
if (!d.valid) continue;
|
|
47
|
-
const geometry = resolveProp(mark.options.geometry, d.datum, d.datum);
|
|
48
|
+
const geometry = resolveProp((mark.options as any).geometry, d.datum, d.datum);
|
|
48
49
|
// untrack the filter test to avoid redrawing when not necessary
|
|
49
50
|
let { stroke, fill, ...restStyles } = resolveScaledStyleProps(
|
|
50
51
|
d.datum,
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
usedScales,
|
|
53
54
|
plot,
|
|
54
55
|
GEOJSON_PREFER_STROKE.has(geometry.type) ? 'stroke' : 'fill'
|
|
55
|
-
);
|
|
56
|
+
) as { fill: string; stroke: string } & Record<string, unknown>;
|
|
56
57
|
|
|
57
58
|
const opacity = maybeOpacity(restStyles['opacity']);
|
|
58
59
|
const fillOpacity = maybeOpacity(restStyles['fill-opacity']);
|
|
@@ -62,13 +63,13 @@
|
|
|
62
63
|
fill =
|
|
63
64
|
currentColor ||
|
|
64
65
|
(currentColor = getComputedStyle(
|
|
65
|
-
canvas?.parentElement?.parentElement
|
|
66
|
+
canvas?.parentElement?.parentElement ?? canvas
|
|
66
67
|
).getPropertyValue('color'));
|
|
67
68
|
if (`${stroke}`.toLowerCase() === 'currentcolor')
|
|
68
69
|
stroke =
|
|
69
70
|
currentColor ||
|
|
70
71
|
(currentColor = getComputedStyle(
|
|
71
|
-
canvas?.parentElement?.parentElement
|
|
72
|
+
canvas?.parentElement?.parentElement ?? canvas
|
|
72
73
|
).getPropertyValue('color'));
|
|
73
74
|
if (CSS_VAR.test(fill))
|
|
74
75
|
fill = getComputedStyle(canvas).getPropertyValue(fill.slice(4, -1));
|