svelteplot 0.2.6 → 0.2.7-pr-65.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/helpers/colors.d.ts +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/scales.d.ts +1 -1
- package/dist/helpers/time.d.ts +4 -3
- package/dist/helpers/time.js +1 -1
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/marks/BollingerX.svelte.d.ts +1 -1
- package/dist/marks/BollingerY.svelte.d.ts +1 -1
- package/dist/marks/Sphere.svelte.d.ts +1 -56
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
- package/dist/transforms/bollinger.d.ts +1 -8
- package/dist/transforms/centroid.d.ts +1 -8
- package/dist/transforms/group.d.ts +4 -12
- package/dist/transforms/index.d.ts +1 -0
- package/dist/transforms/index.js +1 -0
- package/dist/transforms/interval.d.ts +2 -6
- package/dist/transforms/jitter.d.ts +17 -0
- package/dist/transforms/jitter.js +60 -1
- package/dist/transforms/map.d.ts +4 -10
- package/dist/transforms/normalize.d.ts +2 -6
- package/dist/transforms/select.d.ts +7 -21
- package/dist/transforms/sort.d.ts +3 -16
- package/dist/transforms/window.d.ts +2 -14
- package/package.json +118 -117
package/dist/helpers/colors.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type SchemeGetter = (n: number) => readonly string[];
|
|
|
6
6
|
export declare function isOrdinalScheme(scheme: ColorScheme): boolean;
|
|
7
7
|
export declare function ordinalScheme(scheme: string): SchemeGetter | undefined;
|
|
8
8
|
export declare function ordinalRange(scheme: string, length: number): readonly string[] | undefined;
|
|
9
|
-
export declare function maybeBooleanRange(domain: boolean[], scheme?: string):
|
|
9
|
+
export declare function maybeBooleanRange(domain: boolean[], scheme?: string): any[] | undefined;
|
|
10
10
|
export declare function isQuantitativeScheme(scheme: string): boolean;
|
|
11
11
|
export declare function quantitativeScheme(scheme: string): typeof interpolateBrBG | undefined;
|
|
12
12
|
export declare function isDivergingScheme(scheme: string): boolean;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
|
-
export declare function coalesce(...args: (RawValue | undefined | null)[]):
|
|
7
|
-
export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>):
|
|
6
|
+
export declare function coalesce(...args: (RawValue | undefined | null)[]): any;
|
|
7
|
+
export declare function testFilter(datum: DataRecord, options: Record<ChannelName, ChannelAccessor>): any;
|
|
8
8
|
export declare function randomId(): string;
|
|
9
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
10
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
package/dist/helpers/scales.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
|
|
|
15
15
|
autoTitle?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
type: ScaleType;
|
|
18
|
-
domain:
|
|
18
|
+
domain: any;
|
|
19
19
|
range: any;
|
|
20
20
|
fn: any;
|
|
21
21
|
skip: Map<ScaledChannelName, Set<symbol>>;
|
package/dist/helpers/time.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export declare const durations: Map<string, number>;
|
|
1
2
|
export declare const intervalDuration: unique symbol;
|
|
2
3
|
export declare const intervalType: unique symbol;
|
|
3
|
-
export declare function parseTimeInterval(input:
|
|
4
|
-
export declare function maybeTimeInterval(input:
|
|
5
|
-
export declare function maybeUtcInterval(input:
|
|
4
|
+
export declare function parseTimeInterval(input: string): [string, number];
|
|
5
|
+
export declare function maybeTimeInterval(input: string): any;
|
|
6
|
+
export declare function maybeUtcInterval(input: string): any;
|
|
6
7
|
export declare function generalizeTimeInterval(interval: any, n: any): any;
|
package/dist/helpers/time.js
CHANGED
|
@@ -54,7 +54,7 @@ const tickIntervals = [
|
|
|
54
54
|
['50 years', 50 * durationYear],
|
|
55
55
|
['100 years', 100 * durationYear] // TODO generalize to longer time scales
|
|
56
56
|
];
|
|
57
|
-
const durations = new Map([
|
|
57
|
+
export const durations = new Map([
|
|
58
58
|
['second', durationSecond],
|
|
59
59
|
['minute', durationMinute],
|
|
60
60
|
['hour', durationHour],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawValue } from '../types.js';
|
|
2
|
-
export declare function isBooleanOrNull(v: RawValue):
|
|
3
|
-
export declare function isDate(v: RawValue):
|
|
2
|
+
export declare function isBooleanOrNull(v: RawValue): boolean;
|
|
3
|
+
export declare function isDate(v: RawValue): v is Date;
|
|
4
4
|
export declare function isDateOrNull(v: RawValue | null | undefined): boolean;
|
|
5
5
|
export declare function isNumberOrNull(v: RawValue | null | undefined): boolean;
|
|
6
6
|
export declare function isNumberOrNullOrNaN(v: RawValue | null | undefined): boolean;
|
|
7
|
-
export declare function isStringOrNull(v: RawValue | null | undefined):
|
|
7
|
+
export declare function isStringOrNull(v: RawValue | null | undefined): boolean;
|
|
8
8
|
export declare function isSymbolOrNull(v: RawValue | null | undefined): boolean;
|
|
9
|
-
export declare function isColorOrNull(v: RawValue | null | undefined):
|
|
9
|
+
export declare function isColorOrNull(v: RawValue | null | undefined): any;
|
|
10
10
|
export declare function isOpacityOrNull(v: RawValue): boolean;
|
|
@@ -13,6 +13,6 @@ export type BollingerXMarkProps = BaseMarkProps & {
|
|
|
13
13
|
};
|
|
14
14
|
import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
|
|
15
15
|
/** line representing a moving average and an area representing volatility as a band */
|
|
16
|
-
declare const BollingerX: import("svelte").Component<
|
|
16
|
+
declare const BollingerX: import("svelte").Component<any, {}, "">;
|
|
17
17
|
type BollingerX = ReturnType<typeof BollingerX>;
|
|
18
18
|
export default BollingerX;
|
|
@@ -13,6 +13,6 @@ export type BollingerYMarkProps = BaseMarkProps & {
|
|
|
13
13
|
};
|
|
14
14
|
import type { BaseMarkProps, ChannelAccessor, DataRow } from '../types.js';
|
|
15
15
|
/** line representing a moving average and an area representing volatility as a band */
|
|
16
|
-
declare const BollingerY: import("svelte").Component<
|
|
16
|
+
declare const BollingerY: import("svelte").Component<any, {}, "">;
|
|
17
17
|
type BollingerY = ReturnType<typeof BollingerY>;
|
|
18
18
|
export default BollingerY;
|
|
@@ -1,61 +1,6 @@
|
|
|
1
1
|
import { type BaseMarkProps } from '../types.js';
|
|
2
2
|
export type SphereMarkProps = BaseMarkProps;
|
|
3
3
|
/** Geo mark with Sphere geometry object */
|
|
4
|
-
declare const Sphere: import("svelte").Component<
|
|
5
|
-
filter?: import("../types.js").ConstantAccessor<boolean>;
|
|
6
|
-
facet?: "auto" | "include" | "exclude";
|
|
7
|
-
fx: import("../types.js").ChannelAccessor;
|
|
8
|
-
fy: import("../types.js").ChannelAccessor;
|
|
9
|
-
dx: import("../types.js").ConstantAccessor<number>;
|
|
10
|
-
dy: import("../types.js").ConstantAccessor<number>;
|
|
11
|
-
fill: import("../types.js").ConstantAccessor<string>;
|
|
12
|
-
fillOpacity: import("../types.js").ConstantAccessor<number>;
|
|
13
|
-
stroke: import("../types.js").ConstantAccessor<string>;
|
|
14
|
-
strokeWidth: import("../types.js").ConstantAccessor<number>;
|
|
15
|
-
strokeOpacity: import("../types.js").ConstantAccessor<number>;
|
|
16
|
-
strokeLinejoin: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin>;
|
|
17
|
-
strokeLinecap: import("../types.js").ConstantAccessor<import("csstype").Property.StrokeLinecap>;
|
|
18
|
-
strokeMiterlimit: import("../types.js").ConstantAccessor<number>;
|
|
19
|
-
opacity: import("../types.js").ConstantAccessor<number>;
|
|
20
|
-
strokeDasharray: import("../types.js").ConstantAccessor<string>;
|
|
21
|
-
strokeDashoffset: import("../types.js").ConstantAccessor<number>;
|
|
22
|
-
mixBlendMode: import("../types.js").ConstantAccessor<import("csstype").Property.MixBlendMode>;
|
|
23
|
-
clipPath: string;
|
|
24
|
-
imageFilter: import("../types.js").ConstantAccessor<string>;
|
|
25
|
-
shapeRendering: import("../types.js").ConstantAccessor<import("csstype").Property.ShapeRendering>;
|
|
26
|
-
paintOrder: import("../types.js").ConstantAccessor<string>;
|
|
27
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
28
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
29
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
30
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
33
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
34
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
35
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
36
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
37
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
38
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
39
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
40
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
41
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
42
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
43
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
44
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
45
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
46
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
47
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
48
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
49
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
50
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
51
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
52
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
53
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
54
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
55
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
56
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
57
|
-
class: string | null;
|
|
58
|
-
cursor: import("../types.js").ConstantAccessor<import("csstype").Property.Cursor>;
|
|
59
|
-
}>, {}, "">;
|
|
4
|
+
declare const Sphere: import("svelte").Component<BaseMarkProps, {}, "">;
|
|
60
5
|
type Sphere = ReturnType<typeof Sphere>;
|
|
61
6
|
export default Sphere;
|
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
import { type MarkerShape } from './Marker.svelte';
|
|
2
|
-
import type { BaseMarkProps, ConstantAccessor, DataRecord, Mark, PlotScales } from '../../types.js';
|
|
3
|
-
type MarkerPathProps = BaseMarkProps & {
|
|
4
|
-
/**
|
|
5
|
-
* the datum associated with this path, usually the first
|
|
6
|
-
* element of the data array group
|
|
7
|
-
*/
|
|
8
|
-
datum: DataRecord;
|
|
9
|
-
/**
|
|
10
|
-
* the marker shape to use at the start of the path, defaults to
|
|
11
|
-
* circle
|
|
12
|
-
*/
|
|
13
|
-
markerStart?: boolean | MarkerShape;
|
|
14
|
-
/**
|
|
15
|
-
* the marker shape to use at the middle of the path, defaults to circle
|
|
16
|
-
*/
|
|
17
|
-
markerMid?: boolean | MarkerShape;
|
|
18
|
-
/**
|
|
19
|
-
* the marker shape to use at the end of the path, defaults to circle
|
|
20
|
-
*/
|
|
21
|
-
markerEnd?: boolean | MarkerShape;
|
|
22
|
-
/**
|
|
23
|
-
* shorthand for setting all markers
|
|
24
|
-
*/
|
|
25
|
-
marker?: boolean | MarkerShape;
|
|
26
|
-
/**
|
|
27
|
-
* path string
|
|
28
|
-
*/
|
|
29
|
-
d: string;
|
|
30
|
-
style: string;
|
|
31
|
-
startOffset: string;
|
|
32
|
-
textStyle: string;
|
|
33
|
-
textStyleClass?: string | null;
|
|
34
|
-
text: string;
|
|
35
|
-
transform: string;
|
|
36
|
-
color: string;
|
|
37
|
-
strokeWidth: ConstantAccessor<number>;
|
|
38
|
-
mark: Mark<BaseMarkProps>;
|
|
39
|
-
scales: PlotScales;
|
|
40
|
-
};
|
|
41
1
|
/** Helper component for paths with markers and optional text along the path. */
|
|
42
|
-
declare const MarkerPath: import("svelte").Component<
|
|
2
|
+
declare const MarkerPath: import("svelte").Component<any, {}, "">;
|
|
43
3
|
type MarkerPath = ReturnType<typeof MarkerPath>;
|
|
44
4
|
export default MarkerPath;
|
|
@@ -11,11 +11,4 @@ export type BollingerOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function bollingerX(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
|
|
13
13
|
export declare function bollingerY(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
|
|
14
|
-
export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions):
|
|
15
|
-
data: {
|
|
16
|
-
__x: import("../types.js").RawValue;
|
|
17
|
-
__lo: number;
|
|
18
|
-
__avg: number;
|
|
19
|
-
__hi: number;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
14
|
+
export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): any;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { DataRecord, TransformArg } from '../types.js';
|
|
2
|
-
export declare function geoCentroid({ data, ...options }: TransformArg<DataRecord>):
|
|
3
|
-
x: (d: any) => any;
|
|
4
|
-
y: (d: any) => any;
|
|
5
|
-
data: {
|
|
6
|
-
__centroid__: [number, number];
|
|
7
|
-
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
8
|
-
}[];
|
|
9
|
-
};
|
|
2
|
+
export declare function geoCentroid({ data, ...options }: TransformArg<DataRecord>): any;
|
|
@@ -38,29 +38,21 @@ type GroupZOptions = GroupXOptions | GroupYOptions;
|
|
|
38
38
|
* groups the dataset by x and y channel and optionally reduces the group items
|
|
39
39
|
* to output channels fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
40
40
|
*/
|
|
41
|
-
export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions):
|
|
42
|
-
data: DataRecord[];
|
|
43
|
-
};
|
|
41
|
+
export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
|
|
44
42
|
/**
|
|
45
43
|
* groups the dataset by the x channel and optionally reduces the group items
|
|
46
44
|
* to output channels y, y1, y2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
47
45
|
*/
|
|
48
|
-
export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions):
|
|
49
|
-
data: DataRecord[];
|
|
50
|
-
};
|
|
46
|
+
export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
|
|
51
47
|
/**
|
|
52
48
|
* groups the dataset by the y channel and optionally reduces the group items
|
|
53
49
|
* to output channels x, x1, x2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
|
|
54
50
|
*/
|
|
55
|
-
export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions):
|
|
56
|
-
data: DataRecord[];
|
|
57
|
-
};
|
|
51
|
+
export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): any;
|
|
58
52
|
/**
|
|
59
53
|
* groups the dataset by the z channel and optionally reduces the group items
|
|
60
54
|
* to output channels x, x1, x2, y, y1, y2, fill, stroke, r, opacity, fillOpacity,
|
|
61
55
|
* or strokeOpacity
|
|
62
56
|
*/
|
|
63
|
-
export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions):
|
|
64
|
-
data: DataRecord[];
|
|
65
|
-
};
|
|
57
|
+
export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): any;
|
|
66
58
|
export {};
|
|
@@ -6,6 +6,7 @@ export { map, mapX, mapY } from './map.js';
|
|
|
6
6
|
export { normalizeX, normalizeY } from './normalize.js';
|
|
7
7
|
export { group, groupX, groupY, groupZ } from './group.js';
|
|
8
8
|
export { intervalX, intervalY } from './interval.js';
|
|
9
|
+
export { jitterX, jitterY } from './jitter.js';
|
|
9
10
|
export { recordizeX, recordizeY } from './recordize.js';
|
|
10
11
|
export { renameChannels, replaceChannels } from './rename.js';
|
|
11
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
package/dist/transforms/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { map, mapX, mapY } from './map.js';
|
|
|
6
6
|
export { normalizeX, normalizeY } from './normalize.js';
|
|
7
7
|
export { group, groupX, groupY, groupZ } from './group.js';
|
|
8
8
|
export { intervalX, intervalY } from './interval.js';
|
|
9
|
+
export { jitterX, jitterY } from './jitter.js';
|
|
9
10
|
export { recordizeX, recordizeY } from './recordize.js';
|
|
10
11
|
export { renameChannels, replaceChannels } from './rename.js';
|
|
11
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { PlotState, TransformArg } from '../types.js';
|
|
2
2
|
export declare function intervalX<T>(args: TransformArg<T>, { plot }: {
|
|
3
3
|
plot: PlotState;
|
|
4
|
-
}):
|
|
5
|
-
data: T[];
|
|
6
|
-
};
|
|
4
|
+
}): any;
|
|
7
5
|
export declare function intervalY<T>(args: TransformArg<T>, { plot }: {
|
|
8
6
|
plot: PlotState;
|
|
9
|
-
}):
|
|
10
|
-
data: T[];
|
|
11
|
-
};
|
|
7
|
+
}): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Channels, DataRecord, TransformArg } from '../types.js';
|
|
2
|
+
type JitterOptions = {
|
|
3
|
+
type: 'uniform' | 'normal';
|
|
4
|
+
/** width for uniform jittering */
|
|
5
|
+
width: number;
|
|
6
|
+
/** standard deviation for normal jittering */
|
|
7
|
+
std: number;
|
|
8
|
+
/**
|
|
9
|
+
* optional random number source that produces values in range [0,1)
|
|
10
|
+
* useful for testing with a deterministic source
|
|
11
|
+
*/
|
|
12
|
+
source?: () => number;
|
|
13
|
+
};
|
|
14
|
+
export declare function jitterX({ data, ...channels }: TransformArg<DataRecord>, options: JitterOptions): TransformArg<DataRecord>;
|
|
15
|
+
export declare function jitterY({ data, ...channels }: TransformArg<DataRecord>, options: JitterOptions): TransformArg<DataRecord>;
|
|
16
|
+
export declare function jitter(channel: 'x' | 'y', data: DataRecord[], channels: Channels, options: JitterOptions): TransformArg<DataRecord>;
|
|
17
|
+
export {};
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolveChannel } from '../helpers/resolve';
|
|
2
|
+
import { randomUniform, randomNormal } from 'd3-random';
|
|
3
|
+
import { isDate } from '../helpers/typeChecks';
|
|
4
|
+
import { durations, maybeTimeInterval, parseTimeInterval } from '../helpers/time';
|
|
5
|
+
const JITTER_X = Symbol('jitterX');
|
|
6
|
+
const JITTER_Y = Symbol('jitterY');
|
|
7
|
+
export function jitterX({ data, ...channels }, options) {
|
|
8
|
+
return jitter('x', data, channels, options);
|
|
9
|
+
}
|
|
10
|
+
export function jitterY({ data, ...channels }, options) {
|
|
11
|
+
return jitter('y', data, channels, options);
|
|
12
|
+
}
|
|
13
|
+
export function jitter(channel, data, channels, options) {
|
|
14
|
+
if (channels[channel]) {
|
|
15
|
+
const type = options?.type ?? 'uniform';
|
|
16
|
+
const width = parseNumber(options?.width ?? 0.35);
|
|
17
|
+
const std = parseNumber(options?.std ?? 0.15);
|
|
18
|
+
// @todo support time interval strings as width/std parameters
|
|
19
|
+
// Use the provided source or default to Math.random
|
|
20
|
+
const rng = options?.source ?? Math.random;
|
|
21
|
+
const random = type === 'uniform'
|
|
22
|
+
? randomUniform.source(rng)(-width, width)
|
|
23
|
+
: randomNormal.source(rng)(0, std);
|
|
24
|
+
const accKey = channel === 'x' ? JITTER_X : JITTER_Y;
|
|
25
|
+
return {
|
|
26
|
+
data: data.map((row) => {
|
|
27
|
+
const value = resolveChannel(channel, row, channels);
|
|
28
|
+
return {
|
|
29
|
+
...row,
|
|
30
|
+
[accKey]: typeof value === 'number'
|
|
31
|
+
? value + random()
|
|
32
|
+
: isDate(value)
|
|
33
|
+
? new Date(value.getTime() + random())
|
|
34
|
+
: value
|
|
35
|
+
};
|
|
36
|
+
}),
|
|
37
|
+
...channels,
|
|
38
|
+
// point channel to new accessor symbol
|
|
39
|
+
[channel]: accKey
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
data,
|
|
44
|
+
...channels
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function parseNumber(value) {
|
|
48
|
+
if (typeof value === 'number')
|
|
49
|
+
return value;
|
|
50
|
+
if (typeof value === 'string') {
|
|
51
|
+
try {
|
|
52
|
+
const [name, period] = parseTimeInterval(value);
|
|
53
|
+
return durations.get(name) * period;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
package/dist/transforms/map.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type { TransformArg, MapOptions, MapMethod
|
|
2
|
-
export declare function map<T>(args: TransformArg<T>, options: MapOptions):
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function mapX<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
6
|
-
data: DataRecord[];
|
|
7
|
-
};
|
|
8
|
-
export declare function mapY<T>(args: TransformArg<T>, mapper: MapMethod): {
|
|
9
|
-
data: DataRecord[];
|
|
10
|
-
};
|
|
1
|
+
import type { TransformArg, MapOptions, MapMethod } from '../types.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,9 +1,5 @@
|
|
|
1
1
|
import type { TransformArg, MapIndexObject } from '../types.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
|
-
};
|
|
6
|
-
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): {
|
|
7
|
-
data: import("../types.js").DataRecord[];
|
|
8
|
-
};
|
|
3
|
+
export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
4
|
+
export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
|
|
9
5
|
export {};
|
|
@@ -5,31 +5,17 @@ type AtLeastOne<T, U = {
|
|
|
5
5
|
type SelectOptions = 'first' | 'last' | AtLeastOne<{
|
|
6
6
|
[k in ChannelName]: 'min' | 'max';
|
|
7
7
|
}>;
|
|
8
|
-
export declare function select({ data, ...channels }: TransformArg<DataRecord>, options: SelectOptions):
|
|
9
|
-
data: DataRecord[];
|
|
10
|
-
};
|
|
8
|
+
export declare function select({ data, ...channels }: TransformArg<DataRecord>, options: SelectOptions): any;
|
|
11
9
|
/**
|
|
12
10
|
* Keeps only the first item of each group
|
|
13
11
|
*/
|
|
14
|
-
export declare function selectFirst(args: TransformArg<DataRecord>):
|
|
15
|
-
data: DataRecord[];
|
|
16
|
-
};
|
|
12
|
+
export declare function selectFirst(args: TransformArg<DataRecord>): any;
|
|
17
13
|
/**
|
|
18
14
|
* Keeps only the last item of each group
|
|
19
15
|
*/
|
|
20
|
-
export declare function selectLast(args: TransformArg<DataRecord>):
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export declare function
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
export declare function selectMaxX(args: TransformArg<DataRecord>): {
|
|
27
|
-
data: DataRecord[];
|
|
28
|
-
};
|
|
29
|
-
export declare function selectMinY(args: TransformArg<DataRecord>): {
|
|
30
|
-
data: DataRecord[];
|
|
31
|
-
};
|
|
32
|
-
export declare function selectMaxY(args: TransformArg<DataRecord>): {
|
|
33
|
-
data: DataRecord[];
|
|
34
|
-
};
|
|
16
|
+
export declare function selectLast(args: TransformArg<DataRecord>): any;
|
|
17
|
+
export declare function selectMinX(args: TransformArg<DataRecord>): any;
|
|
18
|
+
export declare function selectMaxX(args: TransformArg<DataRecord>): any;
|
|
19
|
+
export declare function selectMinY(args: TransformArg<DataRecord>): any;
|
|
20
|
+
export declare function selectMaxY(args: TransformArg<DataRecord>): any;
|
|
35
21
|
export {};
|
|
@@ -2,27 +2,14 @@ import type { DataRecord, DataRow, TransformArg } from '../types.js';
|
|
|
2
2
|
export declare const SORT_KEY: unique symbol;
|
|
3
3
|
export declare function sort({ data, ...channels }: TransformArg<DataRecord>, options?: {
|
|
4
4
|
reverse?: boolean;
|
|
5
|
-
}):
|
|
6
|
-
sort: null;
|
|
7
|
-
data: {
|
|
8
|
-
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
9
|
-
}[];
|
|
10
|
-
} | {
|
|
11
|
-
data: DataRecord[];
|
|
12
|
-
};
|
|
5
|
+
}): any;
|
|
13
6
|
/**
|
|
14
7
|
* reverses the data row order
|
|
15
8
|
*/
|
|
16
9
|
export declare function shuffle({ data, ...channels }: TransformArg<DataRow[]>, options?: {
|
|
17
10
|
seed?: number;
|
|
18
|
-
}):
|
|
19
|
-
sort: null;
|
|
20
|
-
data: DataRow[][];
|
|
21
|
-
};
|
|
11
|
+
}): any;
|
|
22
12
|
/**
|
|
23
13
|
* reverses the data row order
|
|
24
14
|
*/
|
|
25
|
-
export declare function reverse({ data, ...channels }: TransformArg<DataRow[]>):
|
|
26
|
-
sort: null;
|
|
27
|
-
data: DataRow[][];
|
|
28
|
-
};
|
|
15
|
+
export declare function reverse({ data, ...channels }: TransformArg<DataRow[]>): any;
|
|
@@ -7,18 +7,6 @@ type WindowOptions = {
|
|
|
7
7
|
reduce: ReducerName;
|
|
8
8
|
strict: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions):
|
|
11
|
-
|
|
12
|
-
[x: string]: import("../types.js").RawValue;
|
|
13
|
-
[x: symbol]: import("../types.js").RawValue;
|
|
14
|
-
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
15
|
-
}[];
|
|
16
|
-
};
|
|
17
|
-
export declare function windowY(args: TransformArg<DataRecord>, options: WindowOptions): {
|
|
18
|
-
data: {
|
|
19
|
-
[x: string]: import("../types.js").RawValue;
|
|
20
|
-
[x: symbol]: import("../types.js").RawValue;
|
|
21
|
-
___orig___?: import("../types.js").RawValue | [import("../types.js").RawValue, import("../types.js").RawValue];
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
10
|
+
export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions): any;
|
|
11
|
+
export declare function windowY(args: TransformArg<DataRecord>, options: WindowOptions): any;
|
|
24
12
|
export {};
|
package/package.json
CHANGED
|
@@ -1,123 +1,124 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"svelte": "./dist/index.js"
|
|
2
|
+
"name": "svelteplot",
|
|
3
|
+
"version": "0.2.7-pr-65.0",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Gregor Aisch",
|
|
7
|
+
"email": "gka@users.noreply.github.com"
|
|
13
8
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "vite dev",
|
|
11
|
+
"build": "vite build",
|
|
12
|
+
"preview": "vite preview",
|
|
13
|
+
"test": "npm run test:unit",
|
|
14
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
15
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
16
|
+
"lint": "prettier --check src && eslint src",
|
|
17
|
+
"format": "prettier --write .",
|
|
18
|
+
"test:unit": "vitest",
|
|
19
|
+
"prepack": "npx svelte-package",
|
|
20
|
+
"release-next": "npm version prerelease --preid next && npm publish && git push && git push --tags && sleep 1 && npm dist-tag add svelteplot@$(npm view . version) next",
|
|
21
|
+
"docs": "npm run build && cd build && rsync --recursive . vis4.net:svelteplot/alpha0/"
|
|
16
22
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"svelte": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./*.js": {
|
|
29
|
+
"import": "./dist/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./*.svelte": {
|
|
32
|
+
"import": "./dist/*.svelte"
|
|
33
|
+
},
|
|
34
|
+
"./core/*.svelte": {
|
|
35
|
+
"import": "./dist/core/*.svelte"
|
|
36
|
+
},
|
|
37
|
+
"./marks/*.svelte": {
|
|
38
|
+
"import": "./dist/marks/*.svelte"
|
|
39
|
+
},
|
|
40
|
+
"./transforms": {
|
|
41
|
+
"import": "./dist/transforms/index.js"
|
|
42
|
+
}
|
|
19
43
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
44
|
+
"main": "./dist/index.js",
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"!dist/**/*.test.*",
|
|
48
|
+
"!dist/**/*.spec.*"
|
|
49
|
+
],
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
52
|
+
"@emotion/css": "^11.13.5",
|
|
53
|
+
"@sveltejs/adapter-auto": "^6.0.1",
|
|
54
|
+
"@sveltejs/adapter-static": "^3.0.8",
|
|
55
|
+
"@sveltejs/eslint-config": "^8.2.0",
|
|
56
|
+
"@sveltejs/kit": "^2.21.1",
|
|
57
|
+
"@sveltejs/package": "^2.3.11",
|
|
58
|
+
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
59
|
+
"@sveltepress/theme-default": "^6.0.3",
|
|
60
|
+
"@sveltepress/twoslash": "^1.2.2",
|
|
61
|
+
"@sveltepress/vite": "^1.2.2",
|
|
62
|
+
"@testing-library/svelte": "^5.2.8",
|
|
63
|
+
"@testing-library/user-event": "^14.6.1",
|
|
64
|
+
"@types/d3-array": "^3.2.1",
|
|
65
|
+
"@types/d3-color": "^3.1.3",
|
|
66
|
+
"@types/d3-dsv": "^3.0.7",
|
|
67
|
+
"@types/d3-geo": "^3.1.0",
|
|
68
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
69
|
+
"@types/d3-path": "^3.1.1",
|
|
70
|
+
"@types/d3-random": "^3.0.3",
|
|
71
|
+
"@types/d3-scale": "^4.0.9",
|
|
72
|
+
"@types/d3-scale-chromatic": "^3.1.0",
|
|
73
|
+
"@types/d3-shape": "^3.1.7",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
75
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
76
|
+
"csstype": "^3.1.3",
|
|
77
|
+
"d3-dsv": "^3.0.1",
|
|
78
|
+
"d3-fetch": "^3.0.1",
|
|
79
|
+
"d3-force": "^3.0.0",
|
|
80
|
+
"eslint": "^9.27.0",
|
|
81
|
+
"eslint-config-prettier": "^10.1.5",
|
|
82
|
+
"eslint-plugin-svelte": "3.9.0",
|
|
83
|
+
"jsdom": "^26.1.0",
|
|
84
|
+
"prettier": "^3.5.3",
|
|
85
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
86
|
+
"remark-code-extra": "^1.0.1",
|
|
87
|
+
"remark-code-frontmatter": "^1.0.0",
|
|
88
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
89
|
+
"sass": "^1.89.0",
|
|
90
|
+
"svelte-check": "^4.2.1",
|
|
91
|
+
"svelte-eslint-parser": "1.2.0",
|
|
92
|
+
"svelte-highlight": "^7.8.3",
|
|
93
|
+
"svg-path-parser": "^1.1.0",
|
|
94
|
+
"topojson-client": "^3.1.0",
|
|
95
|
+
"tslib": "^2.8.1",
|
|
96
|
+
"typedoc": "^0.28.4",
|
|
97
|
+
"typedoc-plugin-markdown": "^4.6.3",
|
|
98
|
+
"typescript": "^5.8.3",
|
|
99
|
+
"vite": "^6.3.5",
|
|
100
|
+
"vitest": "^3.1.4",
|
|
101
|
+
"vitest-matchmedia-mock": "^2.0.3"
|
|
22
102
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
103
|
+
"types": "./dist/index.d.ts",
|
|
104
|
+
"type": "module",
|
|
105
|
+
"dependencies": {
|
|
106
|
+
"d3-array": "^3.2.4",
|
|
107
|
+
"d3-color": "^3.1.0",
|
|
108
|
+
"d3-format": "^3.1.0",
|
|
109
|
+
"d3-geo": "^3.1.1",
|
|
110
|
+
"d3-interpolate": "^3.0.1",
|
|
111
|
+
"d3-path": "^3.1.0",
|
|
112
|
+
"d3-quadtree": "^3.0.1",
|
|
113
|
+
"d3-random": "^3.0.1",
|
|
114
|
+
"d3-regression": "^1.3.10",
|
|
115
|
+
"d3-scale": "^4.0.2",
|
|
116
|
+
"d3-scale-chromatic": "^3.1.0",
|
|
117
|
+
"d3-shape": "^3.2.0",
|
|
118
|
+
"d3-time": "^3.1.0",
|
|
119
|
+
"es-toolkit": "^1.38.0",
|
|
120
|
+
"fast-equals": "^5.2.2",
|
|
121
|
+
"merge-deep": "^3.0.3",
|
|
122
|
+
"svelte": "5.33.2"
|
|
28
123
|
}
|
|
29
|
-
|
|
30
|
-
"main": "./dist/index.js",
|
|
31
|
-
"files": [
|
|
32
|
-
"dist",
|
|
33
|
-
"!dist/**/*.test.*",
|
|
34
|
-
"!dist/**/*.spec.*"
|
|
35
|
-
],
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
38
|
-
"@emotion/css": "^11.13.5",
|
|
39
|
-
"@sveltejs/adapter-auto": "^6.0.1",
|
|
40
|
-
"@sveltejs/adapter-static": "^3.0.8",
|
|
41
|
-
"@sveltejs/eslint-config": "^8.2.0",
|
|
42
|
-
"@sveltejs/kit": "^2.21.1",
|
|
43
|
-
"@sveltejs/package": "^2.3.11",
|
|
44
|
-
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
45
|
-
"@sveltepress/theme-default": "^6.0.3",
|
|
46
|
-
"@sveltepress/twoslash": "^1.2.2",
|
|
47
|
-
"@sveltepress/vite": "^1.2.2",
|
|
48
|
-
"@testing-library/svelte": "^5.2.8",
|
|
49
|
-
"@testing-library/user-event": "^14.6.1",
|
|
50
|
-
"@types/d3-array": "^3.2.1",
|
|
51
|
-
"@types/d3-color": "^3.1.3",
|
|
52
|
-
"@types/d3-dsv": "^3.0.7",
|
|
53
|
-
"@types/d3-geo": "^3.1.0",
|
|
54
|
-
"@types/d3-interpolate": "^3.0.4",
|
|
55
|
-
"@types/d3-path": "^3.1.1",
|
|
56
|
-
"@types/d3-random": "^3.0.3",
|
|
57
|
-
"@types/d3-scale": "^4.0.9",
|
|
58
|
-
"@types/d3-scale-chromatic": "^3.1.0",
|
|
59
|
-
"@types/d3-shape": "^3.1.7",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
61
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
62
|
-
"csstype": "^3.1.3",
|
|
63
|
-
"d3-dsv": "^3.0.1",
|
|
64
|
-
"d3-fetch": "^3.0.1",
|
|
65
|
-
"d3-force": "^3.0.0",
|
|
66
|
-
"eslint": "^9.27.0",
|
|
67
|
-
"eslint-config-prettier": "^10.1.5",
|
|
68
|
-
"eslint-plugin-svelte": "3.9.0",
|
|
69
|
-
"jsdom": "^26.1.0",
|
|
70
|
-
"prettier": "^3.5.3",
|
|
71
|
-
"prettier-plugin-svelte": "^3.4.0",
|
|
72
|
-
"remark-code-extra": "^1.0.1",
|
|
73
|
-
"remark-code-frontmatter": "^1.0.0",
|
|
74
|
-
"resize-observer-polyfill": "^1.5.1",
|
|
75
|
-
"sass": "^1.89.0",
|
|
76
|
-
"svelte-check": "^4.2.1",
|
|
77
|
-
"svelte-eslint-parser": "1.2.0",
|
|
78
|
-
"svelte-highlight": "^7.8.3",
|
|
79
|
-
"svg-path-parser": "^1.1.0",
|
|
80
|
-
"topojson-client": "^3.1.0",
|
|
81
|
-
"tslib": "^2.8.1",
|
|
82
|
-
"typedoc": "^0.28.4",
|
|
83
|
-
"typedoc-plugin-markdown": "^4.6.3",
|
|
84
|
-
"typescript": "^5.8.3",
|
|
85
|
-
"vite": "^6.3.5",
|
|
86
|
-
"vitest": "^3.1.4",
|
|
87
|
-
"vitest-matchmedia-mock": "^2.0.3"
|
|
88
|
-
},
|
|
89
|
-
"types": "./dist/index.d.ts",
|
|
90
|
-
"type": "module",
|
|
91
|
-
"dependencies": {
|
|
92
|
-
"d3-array": "^3.2.4",
|
|
93
|
-
"d3-color": "^3.1.0",
|
|
94
|
-
"d3-format": "^3.1.0",
|
|
95
|
-
"d3-geo": "^3.1.1",
|
|
96
|
-
"d3-interpolate": "^3.0.1",
|
|
97
|
-
"d3-path": "^3.1.0",
|
|
98
|
-
"d3-quadtree": "^3.0.1",
|
|
99
|
-
"d3-random": "^3.0.1",
|
|
100
|
-
"d3-regression": "^1.3.10",
|
|
101
|
-
"d3-scale": "^4.0.2",
|
|
102
|
-
"d3-scale-chromatic": "^3.1.0",
|
|
103
|
-
"d3-shape": "^3.2.0",
|
|
104
|
-
"d3-time": "^3.1.0",
|
|
105
|
-
"es-toolkit": "^1.38.0",
|
|
106
|
-
"fast-equals": "^5.2.2",
|
|
107
|
-
"merge-deep": "^3.0.3",
|
|
108
|
-
"svelte": "5.33.2"
|
|
109
|
-
},
|
|
110
|
-
"scripts": {
|
|
111
|
-
"dev": "vite dev",
|
|
112
|
-
"build": "vite build",
|
|
113
|
-
"preview": "vite preview",
|
|
114
|
-
"test": "npm run test:unit",
|
|
115
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
116
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
117
|
-
"lint": "prettier --check src && eslint src",
|
|
118
|
-
"format": "prettier --write .",
|
|
119
|
-
"test:unit": "vitest",
|
|
120
|
-
"release-next": "npm version prerelease --preid next && npm publish && git push && git push --tags && sleep 1 && npm dist-tag add svelteplot@$(npm view . version) next",
|
|
121
|
-
"docs": "npm run build && cd build && rsync --recursive . vis4.net:svelteplot/alpha0/"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
+
}
|