svelteplot 0.3.11 → 0.4.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/core/FacetGrid.svelte +3 -0
- package/dist/helpers/group.d.ts +2 -2
- package/dist/helpers/index.d.ts +3 -6
- package/dist/helpers/index.js +1 -1
- package/dist/marks/GridX.svelte +4 -2
- package/dist/marks/GridY.svelte +4 -2
- package/dist/marks/HTMLTooltip.svelte +38 -12
- package/dist/marks/HTMLTooltip.svelte.d.ts +2 -0
- package/dist/marks/Text.svelte +5 -3
- package/dist/marks/Text.svelte.d.ts +6 -2
- package/dist/marks/helpers/MultilineText.svelte +4 -2
- package/dist/transforms/filter.d.ts +2 -2
- package/dist/transforms/index.d.ts +1 -1
- package/dist/transforms/index.js +1 -1
- package/dist/transforms/map.d.ts +4 -184
- package/dist/transforms/normalize.d.ts +3 -123
- package/dist/transforms/sort.d.ts +50 -50
- package/dist/transforms/stack.d.ts +23 -1
- package/dist/transforms/stack.js +71 -2
- package/dist/types/channel.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/scale.d.ts +1 -1
- package/dist/ui/ExamplesGrid.svelte +2 -1
- package/package.json +16 -16
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
{#each fyValues as facetY, j (j)}
|
|
60
60
|
<g
|
|
61
61
|
class="facet"
|
|
62
|
+
data-facet-x={i}
|
|
63
|
+
data-facet-y={j}
|
|
64
|
+
data-facet={i * fyValues.length + j}
|
|
62
65
|
fill="currentColor"
|
|
63
66
|
style:display={emptyFacets.get(facetX)?.get(facetY) ? 'none' : 'block'}
|
|
64
67
|
transform="translate({useFacetX ? facetXScale(facetX) : 0}, {useFacetY
|
package/dist/helpers/group.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Channels
|
|
1
|
+
import type { Channels } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Groups the data by the fx, fy and z channels and calls the reduce function
|
|
4
4
|
* for each group. Returns the new channels to be added in the transform.
|
|
5
5
|
*/
|
|
6
|
-
export declare function groupFacetsAndZ(items:
|
|
6
|
+
export declare function groupFacetsAndZ<T>(items: T[], channels: Channels<T>, reduce: (items: T[]) => any): any;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChannelName, Channels, DataRecord, RawValue } from '../types/index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
6
|
export declare function coalesce(...args: (RawValue | undefined | null)[]): RawValue | null;
|
|
7
|
-
export declare function testFilter(datum:
|
|
8
|
-
value: import("../types/index.js").ChannelValue<Record<string | symbol, RawValue>>;
|
|
9
|
-
scale: boolean | null;
|
|
10
|
-
} | null;
|
|
7
|
+
export declare function testFilter<T>(datum: T, options: Channels<T>): true | T | null;
|
|
11
8
|
export declare function randomId(): string;
|
|
12
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
13
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
|
14
11
|
export declare function maybeData(data: DataRecord[]): DataRecord[];
|
|
15
|
-
export declare function isObject(option: object |
|
|
12
|
+
export declare function isObject<T>(option: object | T): option is object;
|
|
16
13
|
export declare function maybeNumber(value: RawValue | null): number | null;
|
|
17
14
|
export declare const constant: <T>(x: T) => () => T;
|
|
18
15
|
export declare const POSITION_CHANNELS: Set<ChannelName>;
|
package/dist/helpers/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export function coalesce(...args) {
|
|
|
14
14
|
}
|
|
15
15
|
export function testFilter(datum, options) {
|
|
16
16
|
return (options.filter == null ||
|
|
17
|
-
resolveProp(options.filter, datum
|
|
17
|
+
resolveProp(options.filter, isObject(datum) && datum.hasOwnProperty(RAW_VALUE) ? datum[RAW_VALUE] : datum));
|
|
18
18
|
}
|
|
19
19
|
export function randomId() {
|
|
20
20
|
return Math.ceil(1e9 + Math.random() * 1e9).toString(36);
|
package/dist/marks/GridX.svelte
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { getContext } from 'svelte';
|
|
10
10
|
import Mark from '../Mark.svelte';
|
|
11
11
|
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types/index.js';
|
|
12
|
-
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
12
|
+
import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
13
13
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
14
14
|
import { testFilter } from '../helpers/index.js';
|
|
15
15
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
(plot.scales.x.type === 'band' ? plot.scales.x.fn.bandwidth() * 0.5 : 0)}
|
|
69
69
|
{@const y1_ = resolveChannel('y1', tick, options)}
|
|
70
70
|
{@const y2_ = resolveChannel('y2', tick, options)}
|
|
71
|
+
{@const dx = +resolveProp(options?.dx, tick, 0)}
|
|
72
|
+
{@const dy = +resolveProp(options?.dy, tick, 0)}
|
|
71
73
|
{@const y1 = options.y1 != null ? plot.scales.y.fn(y1_) : 0}
|
|
72
74
|
{@const y2 = options.y2 != null ? plot.scales.y.fn(y2_) : plot.facetHeight}
|
|
73
75
|
{@const [style, styleClass] = resolveStyles(
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
)}
|
|
81
83
|
<line
|
|
82
84
|
class={styleClass}
|
|
83
|
-
transform="translate({x},{plot.options.marginTop})"
|
|
85
|
+
transform="translate({x + dx},{plot.options.marginTop + dy})"
|
|
84
86
|
{style}
|
|
85
87
|
{y1}
|
|
86
88
|
{y2} />
|
package/dist/marks/GridY.svelte
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { getContext } from 'svelte';
|
|
10
10
|
import Mark from '../Mark.svelte';
|
|
11
11
|
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types/index.js';
|
|
12
|
-
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
12
|
+
import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
13
13
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
14
14
|
import { testFilter } from '../helpers/index.js';
|
|
15
15
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
{@const x2_ = resolveChannel('x2', tick, options)}
|
|
71
71
|
{@const x1 = options.x1 != null ? plot.scales.x.fn(x1_) : 0}
|
|
72
72
|
{@const x2 = options.x2 != null ? plot.scales.x.fn(x2_) : plot.facetWidth}
|
|
73
|
+
{@const dx = +resolveProp(options?.dx, tick, 0)}
|
|
74
|
+
{@const dy = +resolveProp(options?.dy, tick, 0)}
|
|
73
75
|
{@const [style, styleClass] = resolveStyles(
|
|
74
76
|
plot,
|
|
75
77
|
{ datum: { [RAW_VALUE]: tick } },
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
<line
|
|
82
84
|
{style}
|
|
83
85
|
class={styleClass}
|
|
84
|
-
transform="translate({plot.options.marginLeft},{y})"
|
|
86
|
+
transform="translate({plot.options.marginLeft + dx},{y + dy})"
|
|
85
87
|
{x1}
|
|
86
88
|
{x2} />
|
|
87
89
|
{/if}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
x?: ChannelAccessor<Datum>;
|
|
9
9
|
y?: ChannelAccessor<Datum>;
|
|
10
10
|
r?: ChannelAccessor<Datum>;
|
|
11
|
+
fx?: ChannelAccessor<Datum>;
|
|
12
|
+
fy?: ChannelAccessor<Datum>;
|
|
11
13
|
children: Snippet<[{ datum: Datum }]>;
|
|
12
14
|
}
|
|
13
15
|
import { getContext, type Snippet } from 'svelte';
|
|
@@ -19,18 +21,33 @@
|
|
|
19
21
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
20
22
|
import { quadtree } from 'd3-quadtree';
|
|
21
23
|
import { projectX, projectY } from '../helpers/scales.js';
|
|
24
|
+
import { groupFacetsAndZ } from '../helpers/group.js';
|
|
22
25
|
|
|
23
|
-
let { data, x, y, r, children }: HTMLTooltipMarkProps = $props();
|
|
26
|
+
let { data, x, y, r, fx, fy, children }: HTMLTooltipMarkProps = $props();
|
|
24
27
|
|
|
25
28
|
let datum = $state(false);
|
|
26
29
|
let tooltipX = $state();
|
|
27
30
|
let tooltipY = $state();
|
|
28
31
|
|
|
32
|
+
let facetOffsetX = $state(0);
|
|
33
|
+
let facetOffsetY = $state(0);
|
|
34
|
+
|
|
29
35
|
function onPointerMove(evt: MouseEvent) {
|
|
30
36
|
const plotRect = plot.body.getBoundingClientRect();
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
let facetEl = evt.target as SVGElement;
|
|
38
|
+
while (facetEl && !facetEl.classList.contains('facet')) {
|
|
39
|
+
facetEl = facetEl.parentElement;
|
|
40
|
+
}
|
|
41
|
+
const facetIndex = +(facetEl?.dataset?.facet ?? 0);
|
|
42
|
+
const facetRect = (facetEl?.firstChild ?? plot.body).getBoundingClientRect();
|
|
43
|
+
|
|
44
|
+
facetOffsetX = facetRect.left - plotRect.left - plot.options.marginLeft;
|
|
45
|
+
facetOffsetY = facetRect.top - plotRect.top - plot.options.marginTop;
|
|
46
|
+
|
|
47
|
+
const relativeX = evt.clientX - facetRect.left + (plot.options.marginLeft ?? 0);
|
|
48
|
+
const relativeY = evt.clientY - facetRect.top + (plot.options.marginTop ?? 0);
|
|
49
|
+
|
|
50
|
+
const pt = trees[facetIndex].find(relativeX, relativeY, 25);
|
|
34
51
|
if (pt) {
|
|
35
52
|
tooltipX = resolveChannel('x', pt, { x, y, r });
|
|
36
53
|
tooltipY = resolveChannel('y', pt, { x, y, r });
|
|
@@ -54,18 +71,26 @@
|
|
|
54
71
|
};
|
|
55
72
|
});
|
|
56
73
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
const groups = $derived.by(() => {
|
|
75
|
+
const groups: Datum[][] = [];
|
|
76
|
+
groupFacetsAndZ(data, { fx, fy }, (d) => groups.push(d));
|
|
77
|
+
return groups;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const trees = $derived(
|
|
81
|
+
groups.map((items) =>
|
|
82
|
+
quadtree()
|
|
83
|
+
.x((d) => projectX('x', plot.scales, resolveChannel('x', d, { x, y, r })))
|
|
84
|
+
.y((d) => projectY('y', plot.scales, resolveChannel('y', d, { x, y, r })))
|
|
85
|
+
.addAll(items)
|
|
86
|
+
)
|
|
62
87
|
);
|
|
63
88
|
</script>
|
|
64
89
|
|
|
65
90
|
<div
|
|
66
91
|
class={['tooltip', { hide: !datum }]}
|
|
67
|
-
style:left="{tooltipX ? projectX('x', plot.scales, tooltipX) : 0}px"
|
|
68
|
-
style:top="{tooltipY ? projectY('y', plot.scales, tooltipY) : 0}px">
|
|
92
|
+
style:left="{tooltipX ? facetOffsetX + projectX('x', plot.scales, tooltipX) : 0}px"
|
|
93
|
+
style:top="{tooltipY ? facetOffsetY + projectY('y', plot.scales, tooltipY) : 0}px">
|
|
69
94
|
<div class="tooltip-body">
|
|
70
95
|
{@render children({ datum })}
|
|
71
96
|
</div>
|
|
@@ -77,9 +102,10 @@
|
|
|
77
102
|
background: var(--svelteplot-tooltip-bg);
|
|
78
103
|
border: 1px solid #ccc;
|
|
79
104
|
border-color: var(--svelteplot-tooltip-border);
|
|
80
|
-
font-size:
|
|
105
|
+
font-size: 12px;
|
|
81
106
|
padding: 1ex 1em;
|
|
82
107
|
border-radius: 3px;
|
|
108
|
+
line-height: 1.2;
|
|
83
109
|
box-shadow:
|
|
84
110
|
rgba(50, 50, 93, 0.25) 0px 2px 5px -1px,
|
|
85
111
|
rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
|
package/dist/marks/Text.svelte
CHANGED
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
| 'bottom-right',
|
|
50
50
|
Datum
|
|
51
51
|
>;
|
|
52
|
+
/**
|
|
53
|
+
* rotate text by angle in degrees
|
|
54
|
+
*/
|
|
55
|
+
rotate?: ConstantAccessor<number, Datum>;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
import { getContext, type Snippet } from 'svelte';
|
|
@@ -59,14 +63,11 @@
|
|
|
59
63
|
ConstantAccessor,
|
|
60
64
|
ChannelAccessor,
|
|
61
65
|
PlotDefaults,
|
|
62
|
-
TransformArg,
|
|
63
|
-
RawValue,
|
|
64
66
|
LinkableMarkProps
|
|
65
67
|
} from '../types/index.js';
|
|
66
68
|
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
67
69
|
import Mark from '../Mark.svelte';
|
|
68
70
|
import { sort } from '../index.js';
|
|
69
|
-
import Anchor from './helpers/Anchor.svelte';
|
|
70
71
|
|
|
71
72
|
import MultilineText from './helpers/MultilineText.svelte';
|
|
72
73
|
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
strokeWidth: 1.6,
|
|
77
78
|
frameAnchor: 'center',
|
|
78
79
|
lineHeight: 1.1,
|
|
80
|
+
rotate: 0,
|
|
79
81
|
...getContext<PlotDefaults>('svelteplot/_defaults').text
|
|
80
82
|
};
|
|
81
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as CSS from 'csstype';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
import type { DataRecord, ConstantAccessor, ChannelAccessor,
|
|
3
|
+
import type { DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
|
|
4
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
5
5
|
props(): Partial<{
|
|
6
6
|
filter?: ConstantAccessor<boolean, Datum>;
|
|
@@ -14,7 +14,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
14
14
|
sort: {
|
|
15
15
|
channel: string;
|
|
16
16
|
order?: "ascending" | "descending";
|
|
17
|
-
} | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
|
|
17
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | ConstantAccessor<import("../types/data").RawValue, Datum>;
|
|
18
18
|
stroke: ChannelAccessor<Datum>;
|
|
19
19
|
strokeWidth: ConstantAccessor<number, Datum>;
|
|
20
20
|
strokeOpacity: ConstantAccessor<number, Datum>;
|
|
@@ -94,6 +94,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
94
94
|
*/
|
|
95
95
|
lineHeight?: ConstantAccessor<number, Datum>;
|
|
96
96
|
frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
|
|
97
|
+
/**
|
|
98
|
+
* rotate text by angle in degrees
|
|
99
|
+
*/
|
|
100
|
+
rotate?: ConstantAccessor<number, Datum>;
|
|
97
101
|
};
|
|
98
102
|
events(): {};
|
|
99
103
|
slots(): {};
|
|
@@ -116,6 +116,8 @@
|
|
|
116
116
|
const lineHeight = $derived(
|
|
117
117
|
textLines.length > 1 ? (resolveProp(args.lineHeight, d.datum) ?? 1.2) : 0
|
|
118
118
|
);
|
|
119
|
+
|
|
120
|
+
const rotate = $derived(+resolveProp(args.rotate, d.datum, 0));
|
|
119
121
|
</script>
|
|
120
122
|
|
|
121
123
|
{#if textLines.length > 1}
|
|
@@ -134,7 +136,7 @@
|
|
|
134
136
|
: 0) *
|
|
135
137
|
computedFontSize *
|
|
136
138
|
lineHeight
|
|
137
|
-
)})"
|
|
139
|
+
)}) rotate({rotate})"
|
|
138
140
|
>{#each textLines as line, l (l)}<tspan
|
|
139
141
|
x="0"
|
|
140
142
|
dy={l ? computedFontSize * lineHeight : 0}
|
|
@@ -146,7 +148,7 @@
|
|
|
146
148
|
<text
|
|
147
149
|
class={[textClassName, styleClass]}
|
|
148
150
|
dominant-baseline={LINE_ANCHOR[lineAnchor]}
|
|
149
|
-
transform="translate({Math.round(x + dx)},{Math.round(y + dy)})"
|
|
151
|
+
transform="translate({Math.round(x + dx)},{Math.round(y + dy)}) rotate({rotate})"
|
|
150
152
|
{style}
|
|
151
153
|
>{textLines[0]}{#if title}<title>{title}</title>{/if}</text>
|
|
152
154
|
{/if}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function filter({ data, ...channels }: TransformArg<
|
|
1
|
+
import type { TransformArg } from '../types/index.js';
|
|
2
|
+
export declare function filter<T>({ data, ...channels }: TransformArg<T>): TransformArg<T>;
|
|
@@ -12,5 +12,5 @@ export { renameChannels, replaceChannels } from './rename.js';
|
|
|
12
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
|
13
13
|
export { shiftX, shiftY } from './shift.js';
|
|
14
14
|
export { sort, shuffle, reverse } from './sort.js';
|
|
15
|
-
export { stackX, stackY } from './stack.js';
|
|
15
|
+
export { stackX, stackY, stackMosaicX, stackMosaicY } from './stack.js';
|
|
16
16
|
export { windowX, windowY } from './window.js';
|
package/dist/transforms/index.js
CHANGED
|
@@ -12,5 +12,5 @@ export { renameChannels, replaceChannels } from './rename.js';
|
|
|
12
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
|
13
13
|
export { shiftX, shiftY } from './shift.js';
|
|
14
14
|
export { sort, shuffle, reverse } from './sort.js';
|
|
15
|
-
export { stackX, stackY } from './stack.js';
|
|
15
|
+
export { stackX, stackY, stackMosaicX, stackMosaicY } from './stack.js';
|
|
16
16
|
export { windowX, windowY } from './window.js';
|
package/dist/transforms/map.d.ts
CHANGED
|
@@ -1,184 +1,4 @@
|
|
|
1
|
-
import type { TransformArg, MapOptions, MapMethod
|
|
2
|
-
export declare function map<T>(args: TransformArg<T>, options: MapOptions):
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
6
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
7
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
8
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
9
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
10
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
11
|
-
sort?: {
|
|
12
|
-
channel: string;
|
|
13
|
-
order?: "ascending" | "descending";
|
|
14
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
15
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
16
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
17
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
18
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
19
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
20
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
21
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
22
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
23
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
24
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
25
|
-
clipPath?: string | undefined;
|
|
26
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
27
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
28
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
29
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
30
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
31
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
32
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
33
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
34
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
35
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
36
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
37
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
38
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
39
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
40
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
41
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
42
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
43
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
44
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
45
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
46
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
47
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
48
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
49
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
50
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
51
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
52
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
53
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
54
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
55
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
56
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
57
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
58
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
59
|
-
class?: string | null | undefined;
|
|
60
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
61
|
-
data: DataRecord[];
|
|
62
|
-
};
|
|
63
|
-
export declare function mapX<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
64
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
65
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
66
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
67
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
68
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
69
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
70
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
71
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
72
|
-
sort?: {
|
|
73
|
-
channel: string;
|
|
74
|
-
order?: "ascending" | "descending";
|
|
75
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
76
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
77
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
78
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
79
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
80
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
81
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
82
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
83
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
84
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
85
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
86
|
-
clipPath?: string | undefined;
|
|
87
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
88
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
89
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
90
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
91
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
92
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
93
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
94
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
95
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
96
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
97
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
98
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
99
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
100
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
101
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
102
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
103
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
104
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
105
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
106
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
107
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
108
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
109
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
110
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
111
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
112
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
113
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
114
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
115
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
116
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
117
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
118
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
119
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
120
|
-
class?: string | null | undefined;
|
|
121
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
122
|
-
data: DataRecord[];
|
|
123
|
-
};
|
|
124
|
-
export declare function mapY<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
125
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
126
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
127
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
128
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
129
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
130
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
131
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
132
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
133
|
-
sort?: {
|
|
134
|
-
channel: string;
|
|
135
|
-
order?: "ascending" | "descending";
|
|
136
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
137
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
138
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
139
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
140
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
141
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
142
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
143
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
144
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
145
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
146
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
147
|
-
clipPath?: string | undefined;
|
|
148
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
149
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
150
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
151
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
152
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
153
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
154
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
155
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
156
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
157
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
158
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
159
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
160
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
161
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
162
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
163
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
164
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
165
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
166
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
167
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
168
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
169
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
170
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
171
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
172
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
173
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
174
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
175
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
176
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
177
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
178
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
179
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
180
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
181
|
-
class?: string | null | undefined;
|
|
182
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
183
|
-
data: DataRecord[];
|
|
184
|
-
};
|
|
1
|
+
import type { TransformArg, MapOptions, MapMethod } from '../types/index.js';
|
|
2
|
+
export declare function map<T>(args: TransformArg<T>, options: MapOptions): any;
|
|
3
|
+
export declare function mapX<T>(args: TransformArg<T>, mapper: MapMethod): any;
|
|
4
|
+
export declare function mapY<T>(args: TransformArg<T>, mapper: MapMethod): any;
|
|
@@ -1,125 +1,5 @@
|
|
|
1
|
-
import type { TransformArg,
|
|
1
|
+
import type { TransformArg, MapIndexObject } from '../types/index.js';
|
|
2
2
|
type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | MapIndexObject;
|
|
3
|
-
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis):
|
|
4
|
-
|
|
5
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
6
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
7
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
8
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
9
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
10
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
11
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
12
|
-
sort?: {
|
|
13
|
-
channel: string;
|
|
14
|
-
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: RawValue, b: RawValue) => number) | import("../types/index.js").ConstantAccessor<RawValue, T>;
|
|
16
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
17
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
18
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
19
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
20
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
21
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
22
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
23
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
24
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
25
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
26
|
-
clipPath?: string | undefined;
|
|
27
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
28
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
29
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
30
|
-
onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
31
|
-
ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
32
|
-
onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
33
|
-
onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
34
|
-
onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
35
|
-
onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
36
|
-
onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
37
|
-
onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
38
|
-
onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
39
|
-
onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
40
|
-
onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
41
|
-
onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
42
|
-
onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
43
|
-
onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
44
|
-
onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
45
|
-
onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
46
|
-
onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
47
|
-
ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
48
|
-
ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
49
|
-
ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
50
|
-
ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
51
|
-
ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
52
|
-
ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
53
|
-
ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
54
|
-
ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
55
|
-
ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
56
|
-
ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
57
|
-
ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
58
|
-
oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
59
|
-
onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
60
|
-
class?: string | null | undefined;
|
|
61
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
62
|
-
data: import("../types/index.js").DataRecord[];
|
|
63
|
-
};
|
|
64
|
-
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): {
|
|
65
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
66
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
67
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
68
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
69
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
70
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
71
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
72
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
73
|
-
sort?: {
|
|
74
|
-
channel: string;
|
|
75
|
-
order?: "ascending" | "descending";
|
|
76
|
-
} | ((a: RawValue, b: RawValue) => number) | import("../types/index.js").ConstantAccessor<RawValue, T>;
|
|
77
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
78
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
79
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
80
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
81
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
82
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
83
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
84
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
85
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
86
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
87
|
-
clipPath?: string | undefined;
|
|
88
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
89
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
90
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
91
|
-
onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
92
|
-
ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
93
|
-
onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
94
|
-
onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
95
|
-
onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
96
|
-
onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
97
|
-
onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
98
|
-
onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
99
|
-
onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
100
|
-
onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
101
|
-
onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
102
|
-
onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
103
|
-
onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
104
|
-
onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
105
|
-
onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
106
|
-
onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
107
|
-
onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
108
|
-
ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
109
|
-
ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
110
|
-
ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
111
|
-
ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
112
|
-
ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
113
|
-
ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
114
|
-
ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
115
|
-
ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
116
|
-
ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
117
|
-
ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
118
|
-
ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
119
|
-
oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
120
|
-
onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement> | undefined;
|
|
121
|
-
class?: string | null | undefined;
|
|
122
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
123
|
-
data: import("../types/index.js").DataRecord[];
|
|
124
|
-
};
|
|
3
|
+
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
4
|
+
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
125
5
|
export {};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataRow, TransformArg } from '../types/index.js';
|
|
2
2
|
export declare const SORT_KEY: unique symbol;
|
|
3
3
|
export declare const IS_SORTED: unique symbol;
|
|
4
|
-
export declare function sort({ data, ...channels }: TransformArg<
|
|
4
|
+
export declare function sort<T>({ data, ...channels }: TransformArg<T>, options?: {
|
|
5
5
|
reverse?: boolean;
|
|
6
6
|
}): {
|
|
7
7
|
[IS_SORTED]: string | number | true | symbol | Date | {
|
|
8
8
|
channel: string;
|
|
9
9
|
order?: "ascending" | "descending";
|
|
10
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | ((d:
|
|
10
|
+
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | ((d: T) => import("../types/index.js").RawValue);
|
|
11
11
|
sort: null;
|
|
12
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean,
|
|
12
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
13
13
|
facet?: "auto" | "include" | "exclude" | undefined;
|
|
14
|
-
fx?: import("../types/index.js").ChannelAccessor<
|
|
15
|
-
fy?: import("../types/index.js").ChannelAccessor<
|
|
16
|
-
dx?: import("../types/index.js").ConstantAccessor<number,
|
|
17
|
-
dy?: import("../types/index.js").ConstantAccessor<number,
|
|
18
|
-
fill?: import("../types/index.js").ChannelAccessor<
|
|
19
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number,
|
|
20
|
-
stroke?: import("../types/index.js").ChannelAccessor<
|
|
21
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number,
|
|
22
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number,
|
|
23
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin,
|
|
24
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap,
|
|
25
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number,
|
|
26
|
-
opacity?: import("../types/index.js").ChannelAccessor<
|
|
27
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string,
|
|
28
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number,
|
|
29
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode,
|
|
14
|
+
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
15
|
+
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
16
|
+
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
17
|
+
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
18
|
+
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
19
|
+
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
20
|
+
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
21
|
+
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
22
|
+
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
23
|
+
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
24
|
+
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
25
|
+
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
26
|
+
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
27
|
+
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
28
|
+
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
29
|
+
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
30
30
|
clipPath?: string | undefined;
|
|
31
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string,
|
|
32
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering,
|
|
33
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string,
|
|
31
|
+
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
32
|
+
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
33
|
+
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
34
34
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
35
35
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
36
36
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
@@ -62,37 +62,37 @@ export declare function sort({ data, ...channels }: TransformArg<DataRecord>, op
|
|
|
62
62
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
63
63
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
64
64
|
class?: string | null | undefined;
|
|
65
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor,
|
|
66
|
-
data: {
|
|
67
|
-
|
|
68
|
-
}[];
|
|
65
|
+
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
66
|
+
data: T[] | Omit<T & {
|
|
67
|
+
[SORT_KEY]: number | Date | string;
|
|
68
|
+
}, typeof SORT_KEY>[];
|
|
69
69
|
} | {
|
|
70
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean,
|
|
70
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
71
71
|
facet?: "auto" | "include" | "exclude" | undefined;
|
|
72
|
-
fx?: import("../types/index.js").ChannelAccessor<
|
|
73
|
-
fy?: import("../types/index.js").ChannelAccessor<
|
|
74
|
-
dx?: import("../types/index.js").ConstantAccessor<number,
|
|
75
|
-
dy?: import("../types/index.js").ConstantAccessor<number,
|
|
76
|
-
fill?: import("../types/index.js").ChannelAccessor<
|
|
77
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number,
|
|
72
|
+
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
73
|
+
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
74
|
+
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
75
|
+
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
76
|
+
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
77
|
+
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
78
78
|
sort?: {
|
|
79
79
|
channel: string;
|
|
80
80
|
order?: "ascending" | "descending";
|
|
81
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue,
|
|
82
|
-
stroke?: import("../types/index.js").ChannelAccessor<
|
|
83
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number,
|
|
84
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number,
|
|
85
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin,
|
|
86
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap,
|
|
87
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number,
|
|
88
|
-
opacity?: import("../types/index.js").ChannelAccessor<
|
|
89
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string,
|
|
90
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number,
|
|
91
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode,
|
|
81
|
+
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
82
|
+
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
83
|
+
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
84
|
+
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
85
|
+
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
86
|
+
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
87
|
+
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
88
|
+
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
89
|
+
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
90
|
+
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
91
|
+
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
92
92
|
clipPath?: string | undefined;
|
|
93
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string,
|
|
94
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering,
|
|
95
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string,
|
|
93
|
+
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
94
|
+
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
95
|
+
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
96
96
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
97
97
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
98
98
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
@@ -124,8 +124,8 @@ export declare function sort({ data, ...channels }: TransformArg<DataRecord>, op
|
|
|
124
124
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
125
125
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
126
126
|
class?: string | null | undefined;
|
|
127
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor,
|
|
128
|
-
data:
|
|
127
|
+
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
128
|
+
data: T[];
|
|
129
129
|
};
|
|
130
130
|
/**
|
|
131
131
|
* shuffles the data row order
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TransformArg } from '../types/index.js';
|
|
1
|
+
import type { ChannelAccessor, TransformArg } from '../types/index.js';
|
|
2
2
|
export type StackOrder = 'none' | 'appearance' | 'inside-out' | 'sum';
|
|
3
3
|
export type StackOffset = 'none' | 'wiggle' | 'center' | 'normalize' | 'diverging';
|
|
4
4
|
export type StackOptions = {
|
|
@@ -8,3 +8,25 @@ export type StackOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function stackY<T>({ data, ...channels }: T, opts?: Partial<StackOptions>): T;
|
|
10
10
|
export declare function stackX({ data, ...channels }: TransformArg, opts?: Partial<StackOptions>): TransformArg;
|
|
11
|
+
export declare function stackMosaicX<T>(args: any, opts: any): {
|
|
12
|
+
fx: ChannelAccessor<unknown>;
|
|
13
|
+
fy: ChannelAccessor<unknown>;
|
|
14
|
+
data: unknown[];
|
|
15
|
+
x: symbol;
|
|
16
|
+
x1: symbol;
|
|
17
|
+
x2: symbol;
|
|
18
|
+
y: symbol;
|
|
19
|
+
y1: symbol;
|
|
20
|
+
y2: symbol;
|
|
21
|
+
};
|
|
22
|
+
export declare function stackMosaicY<T>(args: any, opts: any): {
|
|
23
|
+
fx: ChannelAccessor<unknown>;
|
|
24
|
+
fy: ChannelAccessor<unknown>;
|
|
25
|
+
data: unknown[];
|
|
26
|
+
x: symbol;
|
|
27
|
+
x1: symbol;
|
|
28
|
+
x2: symbol;
|
|
29
|
+
y: symbol;
|
|
30
|
+
y1: symbol;
|
|
31
|
+
y2: symbol;
|
|
32
|
+
};
|
package/dist/transforms/stack.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import isDataRecord from '../helpers/isDataRecord.js';
|
|
2
|
-
import { resolveChannel } from '../helpers/resolve.js';
|
|
2
|
+
import { resolveChannel, resolveProp } from '../helpers/resolve.js';
|
|
3
3
|
import { stack, stackOffsetExpand, stackOffsetSilhouette, stackOffsetWiggle, stackOrderAppearance, stackOrderAscending, stackOrderInsideOut, stackOrderNone, stackOffsetDiverging } from 'd3-shape';
|
|
4
|
-
import { index, union, groups as d3Groups } from 'd3-array';
|
|
4
|
+
import { index, union, sum, groups as d3Groups, extent, min } from 'd3-array';
|
|
5
|
+
import { groupFacetsAndZ } from '../helpers/group';
|
|
6
|
+
import { filter } from './filter.js';
|
|
7
|
+
import { sort } from './sort.js';
|
|
5
8
|
const GROUP = Symbol('group');
|
|
6
9
|
const FACET = Symbol('group');
|
|
7
10
|
const DEFAULT_STACK_OPTIONS = {
|
|
@@ -110,3 +113,69 @@ function applyDefaults(opts) {
|
|
|
110
113
|
}
|
|
111
114
|
return { ...DEFAULT_STACK_OPTIONS, ...opts };
|
|
112
115
|
}
|
|
116
|
+
const X = Symbol('x');
|
|
117
|
+
const X1 = Symbol('x1');
|
|
118
|
+
const X2 = Symbol('x2');
|
|
119
|
+
const Y = Symbol('y');
|
|
120
|
+
const Y1 = Symbol('y1');
|
|
121
|
+
const Y2 = Symbol('y2');
|
|
122
|
+
function stackMosaic({ data, x, y, value, fx, fy, ...rest }, { outer, inner }, { x: xOpt, y: yOpt } = {}) {
|
|
123
|
+
const out = [];
|
|
124
|
+
const { data: filtered, ...restArgs } = sort(filter({ data, x, y, value, fx, fy, ...rest }));
|
|
125
|
+
if (!filtered)
|
|
126
|
+
throw new Error('stackMosaic: missing data');
|
|
127
|
+
if (!x)
|
|
128
|
+
throw new Error('stackMosaic: missing x channel');
|
|
129
|
+
if (!y)
|
|
130
|
+
throw new Error('stackMosaic: missing y channel');
|
|
131
|
+
if (!value)
|
|
132
|
+
throw new Error('stackMosaic: missing value channel');
|
|
133
|
+
if (min(filtered, (d) => resolveProp(d[value], d)) < 0)
|
|
134
|
+
throw new Error('stackMosaic: negative values not supported');
|
|
135
|
+
groupFacetsAndZ(filtered, restArgs, (data) => {
|
|
136
|
+
const total = sum(data, (d) => resolveProp(d[value], d));
|
|
137
|
+
let outerPos = 0;
|
|
138
|
+
const outerChannel = outer === 'x' ? x : y;
|
|
139
|
+
const innerChannel = inner === 'x' ? x : y;
|
|
140
|
+
const outerSym1 = outer === 'x' ? X1 : Y1;
|
|
141
|
+
const outerSym2 = outer === 'x' ? X2 : Y2;
|
|
142
|
+
const innerSym1 = inner === 'x' ? X1 : Y1;
|
|
143
|
+
const innerSym2 = inner === 'x' ? X2 : Y2;
|
|
144
|
+
const outerOpt = outer === 'x' ? xOpt : yOpt;
|
|
145
|
+
const innerOpt = inner === 'x' ? xOpt : yOpt;
|
|
146
|
+
const grouped = d3Groups(data, (d) => resolveProp(d[outerChannel], d));
|
|
147
|
+
const innerOrder = new Map(grouped[0][1].map((d, i) => [d[innerChannel], i]));
|
|
148
|
+
grouped.forEach(([k, items], i) => {
|
|
149
|
+
const groupValue = sum(items, (d) => resolveProp(d[value], d));
|
|
150
|
+
const o1 = outerPos, o2 = outerPos + groupValue;
|
|
151
|
+
outerPos = o2;
|
|
152
|
+
let innerPos = 0;
|
|
153
|
+
(i
|
|
154
|
+
? items.sort((a, b) => innerOrder.get(a[innerChannel]) - innerOrder.get(b[innerChannel]))
|
|
155
|
+
: items).forEach((d) => {
|
|
156
|
+
const iv = resolveProp(d[value], d);
|
|
157
|
+
const i1 = innerPos, i2 = innerPos + iv;
|
|
158
|
+
innerPos = i2;
|
|
159
|
+
const normO1 = outerOpt?.percent ? o1 / total : o1;
|
|
160
|
+
const normO2 = outerOpt?.percent ? o2 / total : o2;
|
|
161
|
+
const normI1 = innerOpt?.percent ? i1 / groupValue : i1;
|
|
162
|
+
const normI2 = innerOpt?.percent ? i2 / groupValue : i2;
|
|
163
|
+
const result = { ...d };
|
|
164
|
+
result[outerSym1] = normO1;
|
|
165
|
+
result[outerSym2] = normO2;
|
|
166
|
+
result[innerSym1] = normI1;
|
|
167
|
+
result[innerSym2] = normI2;
|
|
168
|
+
result[X] = (result[X1] + result[X2]) / 2;
|
|
169
|
+
result[Y] = (result[Y1] + result[Y2]) / 2;
|
|
170
|
+
out.push(result);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
return { ...rest, fx, fy, data: out, x: X, x1: X1, x2: X2, y: Y, y1: Y1, y2: Y2 };
|
|
175
|
+
}
|
|
176
|
+
export function stackMosaicX(args, opts) {
|
|
177
|
+
return stackMosaic(args, { outer: 'x', inner: 'y' }, opts);
|
|
178
|
+
}
|
|
179
|
+
export function stackMosaicY(args, opts) {
|
|
180
|
+
return stackMosaic(args, { outer: 'y', inner: 'x' }, opts);
|
|
181
|
+
}
|
package/dist/types/channel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConstantAccessor, RawValue } from './index.js';
|
|
2
|
-
export type Channels = Record<string, ChannelAccessor | ConstantAccessor<string | number | boolean | symbol>>;
|
|
2
|
+
export type Channels<T> = Record<string, ChannelAccessor<T> | ConstantAccessor<T, string | number | boolean | symbol>>;
|
|
3
3
|
export type ChannelAccessor<T = Record<string | symbol, RawValue>> = ChannelValue<T> | {
|
|
4
4
|
/** the channel value */
|
|
5
5
|
value: ChannelValue<T>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -25,11 +25,11 @@ export type MarkerOptions = {
|
|
|
25
25
|
marker?: boolean | MarkerShape | Snippet;
|
|
26
26
|
};
|
|
27
27
|
export type ConstantAccessor<T, D = Record<string | symbol, RawValue>> = T | ((d: D) => T) | null | undefined;
|
|
28
|
-
export type TransformArg<
|
|
29
|
-
data:
|
|
28
|
+
export type TransformArg<T> = Channels<T> & BaseMarkProps<T> & {
|
|
29
|
+
data: T[];
|
|
30
30
|
};
|
|
31
|
-
export type MapArg<
|
|
32
|
-
data:
|
|
31
|
+
export type MapArg<T> = Channels<T> & {
|
|
32
|
+
data: T[];
|
|
33
33
|
};
|
|
34
34
|
export type TransformArgsRow = Partial<Channels> & {
|
|
35
35
|
data: DataRow[];
|
package/dist/types/scale.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { resolve } from '$app/paths';
|
|
2
3
|
let { examples } = $props();
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
6
|
<div class="list">
|
|
6
7
|
{#each examples as page, i (i)}
|
|
7
|
-
<a href={page.url}>
|
|
8
|
+
<a href={resolve(page.url)}>
|
|
8
9
|
<div>
|
|
9
10
|
{#if page.screenshot}
|
|
10
11
|
<img src={page.screenshot} alt={page.title} />{/if}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteplot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Gregor Aisch",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
38
38
|
"@emotion/css": "^11.13.5",
|
|
39
|
-
"@sveltejs/adapter-auto": "^6.0
|
|
40
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
39
|
+
"@sveltejs/adapter-auto": "^6.1.0",
|
|
40
|
+
"@sveltejs/adapter-static": "^3.0.9",
|
|
41
41
|
"@sveltejs/eslint-config": "^8.3.4",
|
|
42
|
-
"@sveltejs/kit": "^2.
|
|
43
|
-
"@sveltejs/package": "^2.
|
|
42
|
+
"@sveltejs/kit": "^2.37.0",
|
|
43
|
+
"@sveltejs/package": "^2.5.0",
|
|
44
44
|
"@sveltejs/vite-plugin-svelte": "5.1.1",
|
|
45
45
|
"@sveltepress/theme-default": "^6.0.4",
|
|
46
46
|
"@sveltepress/twoslash": "^1.2.2",
|
|
@@ -61,32 +61,32 @@
|
|
|
61
61
|
"@types/geojson": "^7946.0.16",
|
|
62
62
|
"@types/topojson": "^3.2.6",
|
|
63
63
|
"@types/topojson-client": "^3.1.5",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
65
|
-
"@typescript-eslint/parser": "^8.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
65
|
+
"@typescript-eslint/parser": "^8.42.0",
|
|
66
66
|
"csstype": "^3.1.3",
|
|
67
67
|
"d3-dsv": "^3.0.1",
|
|
68
68
|
"d3-fetch": "^3.0.1",
|
|
69
69
|
"d3-force": "^3.0.0",
|
|
70
|
-
"eslint": "^9.
|
|
70
|
+
"eslint": "^9.34.0",
|
|
71
71
|
"eslint-config-prettier": "^10.1.8",
|
|
72
|
-
"eslint-plugin-svelte": "3.
|
|
72
|
+
"eslint-plugin-svelte": "3.12.1",
|
|
73
73
|
"jsdom": "^26.1.0",
|
|
74
74
|
"prettier": "^3.6.2",
|
|
75
75
|
"prettier-plugin-svelte": "^3.4.0",
|
|
76
|
-
"puppeteer": "^24.
|
|
76
|
+
"puppeteer": "^24.19.0",
|
|
77
77
|
"remark-code-extra": "^1.0.1",
|
|
78
78
|
"remark-code-frontmatter": "^1.0.0",
|
|
79
79
|
"resize-observer-polyfill": "^1.5.1",
|
|
80
|
-
"sass": "^1.
|
|
80
|
+
"sass": "^1.92.0",
|
|
81
81
|
"svelte-check": "^4.3.1",
|
|
82
82
|
"svelte-eslint-parser": "1.3.1",
|
|
83
|
-
"svelte-highlight": "^7.8.
|
|
83
|
+
"svelte-highlight": "^7.8.4",
|
|
84
84
|
"svg-path-parser": "^1.1.0",
|
|
85
85
|
"topojson-client": "^3.1.0",
|
|
86
86
|
"ts-essentials": "^10.1.1",
|
|
87
87
|
"tslib": "^2.8.1",
|
|
88
|
-
"typedoc": "^0.28.
|
|
89
|
-
"typedoc-plugin-markdown": "^4.8.
|
|
88
|
+
"typedoc": "^0.28.12",
|
|
89
|
+
"typedoc-plugin-markdown": "^4.8.1",
|
|
90
90
|
"typescript": "^5.9.2",
|
|
91
91
|
"vite": "^6.3.5",
|
|
92
92
|
"vitest": "^3.2.4",
|
|
@@ -108,10 +108,10 @@
|
|
|
108
108
|
"d3-scale-chromatic": "^3.1.0",
|
|
109
109
|
"d3-shape": "^3.2.0",
|
|
110
110
|
"d3-time": "^3.1.0",
|
|
111
|
-
"es-toolkit": "^1.39.
|
|
111
|
+
"es-toolkit": "^1.39.10",
|
|
112
112
|
"fast-equals": "^5.2.2",
|
|
113
113
|
"merge-deep": "^3.0.3",
|
|
114
|
-
"svelte": "5.
|
|
114
|
+
"svelte": "5.38.7"
|
|
115
115
|
},
|
|
116
116
|
"scripts": {
|
|
117
117
|
"dev": "vite dev",
|