svelteplot 0.3.11-pr-153.9 → 0.3.11-pr-153.10
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.
|
@@ -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,
|
|
15
|
+
export { stackX, stackY, stackMosaic } 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,
|
|
15
|
+
export { stackX, stackY, stackMosaic } from './stack.js';
|
|
16
16
|
export { windowX, windowY } from './window.js';
|
|
@@ -8,7 +8,7 @@ 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
|
|
11
|
+
export declare function stackMosaic<T>(args: {
|
|
12
12
|
data: T[];
|
|
13
13
|
x: ChannelAccessor<T>;
|
|
14
14
|
y: ChannelAccessor<T>;
|
package/dist/transforms/stack.js
CHANGED
|
@@ -113,21 +113,25 @@ function applyDefaults(opts) {
|
|
|
113
113
|
}
|
|
114
114
|
return { ...DEFAULT_STACK_OPTIONS, ...opts };
|
|
115
115
|
}
|
|
116
|
-
const X = Symbol('x')
|
|
117
|
-
const
|
|
118
|
-
|
|
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
|
+
export function stackMosaic(args, { x: xOpt, y: yOpt } = {}) {
|
|
119
123
|
const out = [];
|
|
120
124
|
const { data, x, y, value, ...rest } = sort(filter(args));
|
|
121
125
|
if (data == null)
|
|
122
|
-
throw new Error('
|
|
126
|
+
throw new Error('stackMosaic: missing data');
|
|
123
127
|
if (x == null)
|
|
124
|
-
throw new Error('
|
|
128
|
+
throw new Error('stackMosaic: missing x channel');
|
|
125
129
|
if (y == null)
|
|
126
|
-
throw new Error('
|
|
130
|
+
throw new Error('stackMosaic: missing y channel');
|
|
127
131
|
if (value == null)
|
|
128
|
-
throw new Error('
|
|
132
|
+
throw new Error('stackMosaic: missing value channel');
|
|
129
133
|
if (min(data, (d) => resolveProp(d[value], d)) < 0)
|
|
130
|
-
throw new Error('
|
|
134
|
+
throw new Error('stackMosaic: negative values not supported');
|
|
131
135
|
groupFacetsAndZ(data, { ...rest }, (data) => {
|
|
132
136
|
const total = sum(data, (d) => d[value]);
|
|
133
137
|
let xPos = 0;
|