svelteplot 0.9.1-pr-322.5 → 0.9.1-pr-322.6
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/marks/BarX.svelte +1 -2
- package/dist/marks/BarY.svelte +1 -2
- package/dist/marks/Rect.svelte +1 -3
- package/dist/marks/RectX.svelte +1 -1
- package/dist/marks/RectY.svelte +1 -1
- package/dist/marks/WaffleX.svelte +1 -2
- package/dist/marks/WaffleY.svelte +1 -2
- package/dist/transforms/filter.d.ts +3 -0
- package/dist/transforms/filter.js +3 -0
- package/dist/transforms/interval.d.ts +9 -7
- package/dist/transforms/interval.js +11 -5
- package/dist/transforms/map.d.ts +9 -0
- package/dist/transforms/map.js +9 -0
- package/dist/transforms/normalize.d.ts +6 -0
- package/dist/transforms/normalize.js +6 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/marks/BarX.svelte
CHANGED
package/dist/marks/BarY.svelte
CHANGED
package/dist/marks/Rect.svelte
CHANGED
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
const plot = usePlot();
|
|
49
49
|
|
|
50
|
-
const args = $derived(
|
|
51
|
-
intervalY(intervalX({ data, ...options }, { plot }), { plot }) as RectMarkProps
|
|
52
|
-
);
|
|
50
|
+
const args = $derived(intervalY(intervalX({ data, ...options })) as RectMarkProps);
|
|
53
51
|
</script>
|
|
54
52
|
|
|
55
53
|
<Mark
|
package/dist/marks/RectX.svelte
CHANGED
package/dist/marks/RectY.svelte
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { TransformArg } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Derives interval channels x1 and x2 from the x channel and interval channel.
|
|
4
|
+
*/
|
|
5
|
+
export declare function intervalX<T>(args: TransformArg<T>): any;
|
|
6
|
+
/**
|
|
7
|
+
* Derives interval channels y1 and y2 from the y channel and interval channel.
|
|
8
|
+
*/
|
|
9
|
+
export declare function intervalY<T>(args: TransformArg<T>): any;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { maybeInterval } from '../helpers/autoTicks.js';
|
|
2
2
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Derives interval channels x1 and x2 from the x channel and interval channel.
|
|
5
|
+
*/
|
|
6
|
+
export function intervalX(args) {
|
|
7
|
+
return interval('x', args);
|
|
5
8
|
}
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Derives interval channels y1 and y2 from the y channel and interval channel.
|
|
11
|
+
*/
|
|
12
|
+
export function intervalY(args) {
|
|
13
|
+
return interval('y', args);
|
|
8
14
|
}
|
|
9
|
-
function interval(dim,
|
|
15
|
+
function interval(dim, { data, ...options }) {
|
|
10
16
|
if (options.interval &&
|
|
11
17
|
options[dim] &&
|
|
12
18
|
options[`${dim}1`] == null &&
|
package/dist/transforms/map.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { TransformArg, MapOptions, MapMethod } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Maps one or more positional channels using specified mapping methods.
|
|
4
|
+
*/
|
|
2
5
|
export declare function map<T>(args: TransformArg<T>, options: MapOptions): any;
|
|
6
|
+
/**
|
|
7
|
+
* Maps the x channel values using the specified mapping method.
|
|
8
|
+
*/
|
|
3
9
|
export declare function mapX<T>(args: TransformArg<T>, mapper: MapMethod): any;
|
|
10
|
+
/**
|
|
11
|
+
* Maps the y channel values using the specified mapping method.
|
|
12
|
+
*/
|
|
4
13
|
export declare function mapY<T>(args: TransformArg<T>, mapper: MapMethod): any;
|
package/dist/transforms/map.js
CHANGED
|
@@ -3,6 +3,9 @@ import { count, rank } from 'd3-array';
|
|
|
3
3
|
import { groupFacetsAndZ } from '../helpers/group.js';
|
|
4
4
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
5
5
|
import { sort } from './sort';
|
|
6
|
+
/**
|
|
7
|
+
* Maps one or more positional channels using specified mapping methods.
|
|
8
|
+
*/
|
|
6
9
|
export function map(args, options) {
|
|
7
10
|
const { data, ...channels } = sort(args);
|
|
8
11
|
const newChannels = {};
|
|
@@ -23,6 +26,9 @@ export function map(args, options) {
|
|
|
23
26
|
});
|
|
24
27
|
return { data: newData, ...channels, ...newChannels };
|
|
25
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Maps the x channel values using the specified mapping method.
|
|
31
|
+
*/
|
|
26
32
|
export function mapX(args, mapper) {
|
|
27
33
|
let { x, x1, x2 } = args;
|
|
28
34
|
if (x === undefined && x1 === undefined && x2 === undefined)
|
|
@@ -36,6 +42,9 @@ export function mapX(args, mapper) {
|
|
|
36
42
|
outputs.x2 = mapper;
|
|
37
43
|
return map(args, outputs);
|
|
38
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Maps the y channel values using the specified mapping method.
|
|
47
|
+
*/
|
|
39
48
|
export function mapY(args, mapper) {
|
|
40
49
|
let { y, y1, y2 } = args;
|
|
41
50
|
if (y === undefined && y1 === undefined && y2 === undefined)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { TransformArg, MapIndexObject } from '../types/index.js';
|
|
2
2
|
type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | MapIndexObject;
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes the x values based on the specified basis. Uses mapX.
|
|
5
|
+
*/
|
|
3
6
|
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes the y values based on the specified basis. Uses mapY.
|
|
9
|
+
*/
|
|
4
10
|
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
5
11
|
/**
|
|
6
12
|
* Convenience wrapper for normalizeY for parallel coordinates.
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { mapX, mapY } from './map.js';
|
|
2
2
|
import { min, max, mean, median, sum, deviation, extent } from 'd3-array';
|
|
3
3
|
import { sort } from './sort.js';
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes the x values based on the specified basis. Uses mapX.
|
|
6
|
+
*/
|
|
4
7
|
export function normalizeX(args, basis) {
|
|
5
8
|
return mapX(args, normalize(basis));
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes the y values based on the specified basis. Uses mapY.
|
|
12
|
+
*/
|
|
7
13
|
export function normalizeY(args, basis) {
|
|
8
14
|
return mapY(args, normalize(basis));
|
|
9
15
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export type MapIndexObject = {
|
|
|
48
48
|
mapIndex: (I: number[], S: RawValue[], T: RawValue[]) => void;
|
|
49
49
|
};
|
|
50
50
|
export type MapMethod = 'cumsum' | 'rank' | 'quantile' | ((I: number[], S: number[]) => number[]) | MapIndexObject;
|
|
51
|
+
/**
|
|
52
|
+
* An object specifying mapping methods for one or more scaled channels
|
|
53
|
+
* e.g. ```{ x: 'rank' }```
|
|
54
|
+
*/
|
|
51
55
|
export type MapOptions = Partial<Record<ScaledChannelName, MapMethod>>;
|
|
52
56
|
export type UsedScales = Record<ScaledChannelName, boolean>;
|
|
53
57
|
export * from './channel';
|