svelteplot 0.4.10 → 0.5.0-pr-233.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Mark.svelte +87 -73
- package/dist/Mark.svelte.d.ts +39 -36
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/index.d.ts +4 -2
- package/dist/helpers/index.js +11 -0
- package/dist/helpers/scales.d.ts +1 -1
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/marks/Area.svelte.d.ts +39 -36
- package/dist/marks/AreaX.svelte.d.ts +40 -37
- package/dist/marks/Arrow.svelte.d.ts +39 -36
- package/dist/marks/AxisX.svelte +6 -1
- package/dist/marks/AxisX.svelte.d.ts +40 -37
- package/dist/marks/AxisY.svelte +6 -1
- package/dist/marks/AxisY.svelte.d.ts +40 -37
- package/dist/marks/BarX.svelte.d.ts +39 -36
- package/dist/marks/BarY.svelte.d.ts +39 -36
- package/dist/marks/BollingerX.svelte.d.ts +2 -74
- package/dist/marks/BollingerY.svelte.d.ts +2 -74
- package/dist/marks/BoxY.svelte.d.ts +6 -66
- package/dist/marks/Cell.svelte.d.ts +39 -36
- package/dist/marks/CustomMark.svelte.d.ts +2 -81
- package/dist/marks/CustomMarkHTML.svelte.d.ts +1 -1
- package/dist/marks/DifferenceY.svelte.d.ts +7 -67
- package/dist/marks/Dot.svelte +1 -1
- package/dist/marks/Dot.svelte.d.ts +39 -36
- package/dist/marks/DotX.svelte.d.ts +40 -37
- package/dist/marks/DotY.svelte.d.ts +40 -37
- package/dist/marks/Geo.svelte.d.ts +39 -36
- package/dist/marks/GridX.svelte +9 -2
- package/dist/marks/GridX.svelte.d.ts +39 -36
- package/dist/marks/GridY.svelte +10 -2
- package/dist/marks/GridY.svelte.d.ts +39 -36
- package/dist/marks/Line.svelte.d.ts +40 -37
- package/dist/marks/LineX.svelte.d.ts +41 -38
- package/dist/marks/LineY.svelte.d.ts +41 -38
- package/dist/marks/Link.svelte.d.ts +39 -36
- package/dist/marks/Rect.svelte.d.ts +39 -36
- package/dist/marks/RuleX.svelte.d.ts +39 -36
- package/dist/marks/RuleY.svelte.d.ts +39 -36
- package/dist/marks/Spike.svelte.d.ts +40 -37
- package/dist/marks/Text.svelte.d.ts +41 -38
- package/dist/marks/TickX.svelte.d.ts +39 -36
- package/dist/marks/TickY.svelte.d.ts +39 -36
- package/dist/marks/Vector.svelte.d.ts +39 -36
- package/dist/marks/helpers/BaseAxisX.svelte +15 -4
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +3 -1
- package/dist/marks/helpers/BaseAxisY.svelte +15 -6
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +3 -1
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +2 -160
- package/dist/marks/helpers/RectPath.svelte.d.ts +3 -63
- package/dist/transforms/bollinger.d.ts +1 -67
- package/dist/transforms/dodge.d.ts +17 -0
- package/dist/transforms/dodge.js +128 -0
- package/dist/transforms/group.d.ts +4 -12
- package/dist/transforms/interval.d.ts +2 -124
- package/dist/transforms/recordize.d.ts +1 -4
- package/dist/transforms/select.d.ts +7 -434
- package/dist/transforms/sort.d.ts +3 -246
- package/dist/transforms/stack.d.ts +3 -23
- package/dist/transforms/window.d.ts +2 -130
- package/dist/types/index.d.ts +7 -0
- package/dist/types/mark.d.ts +37 -34
- package/dist/ui/ExamplesPageList.svelte +63 -0
- package/dist/ui/ExamplesPageList.svelte.d.ts +12 -0
- package/package.json +129 -127
|
@@ -1,75 +1,15 @@
|
|
|
1
|
-
import type { BaseRectMarkProps } from '../../types/mark.js';
|
|
1
|
+
import type { BaseMarkProps, BaseRectMarkProps } from '../../types/mark.js';
|
|
2
2
|
import type { DataRecord, ScaledDataRecord } from '../../types/data.js';
|
|
3
3
|
import type { UsedScales } from '../../types/index.js';
|
|
4
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
5
5
|
props(): {
|
|
6
|
-
datum: ScaledDataRecord<
|
|
6
|
+
datum: ScaledDataRecord<Datum_1>;
|
|
7
7
|
class: string | null;
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
|
-
options: BaseRectMarkProps<
|
|
13
|
-
filter?: import("../../types/index.js").ConstantAccessor<boolean, Datum>;
|
|
14
|
-
facet?: "auto" | "include" | "exclude";
|
|
15
|
-
fx: import("../../types/index.js").ChannelAccessor<Datum>;
|
|
16
|
-
fy: import("../../types/index.js").ChannelAccessor<Datum>;
|
|
17
|
-
dx: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
18
|
-
dy: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
19
|
-
fill: import("../../types/index.js").ChannelAccessor<Datum>;
|
|
20
|
-
fillOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
21
|
-
sort: ((a: import("../../types/data.js").RawValue, b: import("../../types/data.js").RawValue) => number) | {
|
|
22
|
-
channel: string;
|
|
23
|
-
order?: "ascending" | "descending";
|
|
24
|
-
} | import("../../types/index.js").ConstantAccessor<import("../../types/data.js").RawValue, Datum>;
|
|
25
|
-
stroke: import("../../types/index.js").ChannelAccessor<Datum>;
|
|
26
|
-
strokeWidth: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
27
|
-
strokeOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
28
|
-
strokeLinejoin: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
29
|
-
strokeLinecap: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
30
|
-
strokeMiterlimit: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
31
|
-
opacity: import("../../types/index.js").ChannelAccessor<Datum>;
|
|
32
|
-
strokeDasharray: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
33
|
-
strokeDashoffset: import("../../types/index.js").ConstantAccessor<number, Datum>;
|
|
34
|
-
mixBlendMode: import("../../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
35
|
-
clipPath: string;
|
|
36
|
-
imageFilter: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
37
|
-
shapeRendering: import("../../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
38
|
-
paintOrder: import("../../types/index.js").ConstantAccessor<string, Datum>;
|
|
39
|
-
onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
40
|
-
ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
41
|
-
onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
42
|
-
onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
43
|
-
onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
44
|
-
onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
45
|
-
onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
46
|
-
onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
47
|
-
onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
48
|
-
onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
49
|
-
onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
50
|
-
onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
51
|
-
onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
52
|
-
onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
53
|
-
onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
54
|
-
onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
55
|
-
onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
56
|
-
ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
57
|
-
ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
58
|
-
ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
59
|
-
ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
60
|
-
ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
61
|
-
ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
62
|
-
ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
63
|
-
ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
64
|
-
ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
65
|
-
ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
66
|
-
ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
67
|
-
oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
68
|
-
onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
69
|
-
class?: string;
|
|
70
|
-
style?: string;
|
|
71
|
-
cursor: import("../../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
72
|
-
}>;
|
|
12
|
+
options: BaseRectMarkProps<Datum_1> & BaseMarkProps<Datum_1>;
|
|
73
13
|
/**
|
|
74
14
|
* By default, the `inset` property is applied to all four insets. Mark components
|
|
75
15
|
* can tweak this behavior for insetTop and insetBottom by setting the
|
|
@@ -11,70 +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
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
16
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
17
|
-
fx?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
18
|
-
fy?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
19
|
-
dx?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
20
|
-
dy?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
21
|
-
fill?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
22
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
23
|
-
sort?: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
|
|
24
|
-
channel: string;
|
|
25
|
-
order?: "ascending" | "descending";
|
|
26
|
-
} | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
27
|
-
stroke?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
28
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
29
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
30
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
31
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
32
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
33
|
-
opacity?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
34
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
35
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
36
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
37
|
-
clipPath?: string | undefined;
|
|
38
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
39
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
40
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
41
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
42
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
43
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
44
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
45
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
46
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
47
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
48
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
49
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
50
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
51
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
52
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
53
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
54
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
55
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
56
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
57
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
58
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
59
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
60
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
61
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
62
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
63
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
64
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
65
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
66
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
67
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
68
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
69
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
70
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
71
|
-
class?: string | undefined;
|
|
72
|
-
style?: string | undefined;
|
|
73
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/index.js").RawValue>>;
|
|
74
|
-
data: {
|
|
75
|
-
__x: import("../types/index.js").RawValue;
|
|
76
|
-
__lo: number;
|
|
77
|
-
__avg: number;
|
|
78
|
-
__hi: number;
|
|
79
|
-
}[];
|
|
80
|
-
};
|
|
14
|
+
export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScaledDataRecord, TransformArg, PlotState } from '../types';
|
|
2
|
+
type BaseDodgeOptions = {
|
|
3
|
+
anchor?: string;
|
|
4
|
+
padding?: number;
|
|
5
|
+
r?: number;
|
|
6
|
+
};
|
|
7
|
+
type AnchorX = 'left' | 'right' | 'middle';
|
|
8
|
+
type AnchorY = 'top' | 'bottom' | 'middle';
|
|
9
|
+
export type DodgeXOptions = AnchorX | (BaseDodgeOptions & {
|
|
10
|
+
anchor?: 'left' | 'right' | 'middle';
|
|
11
|
+
});
|
|
12
|
+
export type DodgeYOptions = AnchorY | (BaseDodgeOptions & {
|
|
13
|
+
anchor?: 'top' | 'bottom' | 'middle';
|
|
14
|
+
});
|
|
15
|
+
export declare function dodgeX(args: TransformArg<ScaledDataRecord>, plotState: PlotState): ScaledDataRecord[];
|
|
16
|
+
export declare function dodgeY(args: TransformArg<ScaledDataRecord>, plotState: PlotState): ScaledDataRecord[];
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import IntervalTree from 'interval-tree-1d';
|
|
2
|
+
import { groupFacetsAndZ } from '../helpers/group';
|
|
3
|
+
export function dodgeX(args, plotState) {
|
|
4
|
+
if (!args.dodgeX)
|
|
5
|
+
return args.data;
|
|
6
|
+
let { anchor = 'left', padding = 1, r = args.dodgeX.r } = maybeAnchor(args.dodgeX);
|
|
7
|
+
let anchorFunction;
|
|
8
|
+
switch (`${anchor}`.toLowerCase()) {
|
|
9
|
+
case 'left':
|
|
10
|
+
anchorFunction = anchorXLeft;
|
|
11
|
+
break;
|
|
12
|
+
case 'right':
|
|
13
|
+
anchorFunction = anchorXRight;
|
|
14
|
+
break;
|
|
15
|
+
case 'middle':
|
|
16
|
+
anchorFunction = anchorXMiddle;
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
throw new Error(`unknown dodge anchor: ${anchor}`);
|
|
20
|
+
}
|
|
21
|
+
return dodge('x', 'y', anchorFunction, Number(padding), r, args, plotState);
|
|
22
|
+
}
|
|
23
|
+
export function dodgeY(args, plotState) {
|
|
24
|
+
if (!args.dodgeY)
|
|
25
|
+
return args.data;
|
|
26
|
+
let { anchor = 'bottom', padding = 1, r = args.dodgeY.r } = maybeAnchor(args.dodgeY);
|
|
27
|
+
let anchorFunction;
|
|
28
|
+
switch (`${anchor}`.toLowerCase()) {
|
|
29
|
+
case 'top':
|
|
30
|
+
anchorFunction = anchorYTop;
|
|
31
|
+
break;
|
|
32
|
+
case 'bottom':
|
|
33
|
+
anchorFunction = anchorYBottom;
|
|
34
|
+
break;
|
|
35
|
+
case 'middle':
|
|
36
|
+
anchorFunction = anchorYMiddle;
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`unknown dodge anchor: ${anchor}`);
|
|
40
|
+
}
|
|
41
|
+
return dodge('y', 'x', anchorFunction, Number(padding), r, args, plotState);
|
|
42
|
+
}
|
|
43
|
+
function dodge(y, x, anchor, padding, r, { data, ...channels }, plotState) {
|
|
44
|
+
if (r != null && typeof r !== 'number') {
|
|
45
|
+
// use the r channel
|
|
46
|
+
// let { channels, sort, reverse } = options;
|
|
47
|
+
// channels = maybeNamed(channels);
|
|
48
|
+
// if (channels?.r === undefined)
|
|
49
|
+
// options = { ...options, channels: { ...channels, r: { value: r, scale: 'r' } } };
|
|
50
|
+
// if (sort === undefined && reverse === undefined) options.sort = { channel: '-r' };
|
|
51
|
+
}
|
|
52
|
+
const { fx, fy } = channels;
|
|
53
|
+
let [ky, ty] = anchor(plotState);
|
|
54
|
+
const compare = ky ? compareAscending : compareSymmetric;
|
|
55
|
+
const cr = r !== undefined ? r : 3; // default radius if no r channel
|
|
56
|
+
// group data by facets
|
|
57
|
+
groupFacetsAndZ(data, { fx, fy }, (items) => {
|
|
58
|
+
// apply dodge within each facet
|
|
59
|
+
const tree = IntervalTree();
|
|
60
|
+
const data = items.filter((d) => (typeof d.r !== 'number' || d.r >= 0) && isFinite(d[x]) && isFinite(d[y]));
|
|
61
|
+
const intervals = new Float64Array(2 * data.length + 2);
|
|
62
|
+
data.forEach((d, i) => {
|
|
63
|
+
const ri = d.r ?? r ?? 3;
|
|
64
|
+
const y0 = ky ? ri + padding : 0; // offset baseline for varying radius
|
|
65
|
+
const l = d[x] - ri;
|
|
66
|
+
const h = d[x] + ri;
|
|
67
|
+
// The first two positions are 0 to test placing the dot on the baseline.
|
|
68
|
+
let k = 2;
|
|
69
|
+
// For any previously placed circles that may overlap this circle, compute
|
|
70
|
+
// the y-positions that place this circle tangent to these other circles.
|
|
71
|
+
// https://observablehq.com/@mbostock/circle-offset-along-line
|
|
72
|
+
tree.queryInterval(l - padding, h + padding, ([, , j]) => {
|
|
73
|
+
const yj = data[j][y] - y0;
|
|
74
|
+
const dx = d[x] - data[j][x];
|
|
75
|
+
const dr = padding + (channels.r ? d.r + data[j].r : 2 * cr);
|
|
76
|
+
const dy = Math.sqrt(dr * dr - dx * dx);
|
|
77
|
+
intervals[k++] = yj - dy;
|
|
78
|
+
intervals[k++] = yj + dy;
|
|
79
|
+
});
|
|
80
|
+
// Find the best y-value where this circle can fit.
|
|
81
|
+
let candidates = intervals.slice(0, k);
|
|
82
|
+
if (ky)
|
|
83
|
+
candidates = candidates.filter((y) => y >= 0);
|
|
84
|
+
out: for (const diff of candidates.sort(compare)) {
|
|
85
|
+
for (let j = 0; j < k; j += 2) {
|
|
86
|
+
if (intervals[j] + 1e-6 < diff && diff < intervals[j + 1] - 1e-6) {
|
|
87
|
+
continue out;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
d[y] = diff + y0;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
// Insert the placed circle into the interval tree.
|
|
94
|
+
tree.insert([l, h, i]);
|
|
95
|
+
});
|
|
96
|
+
if (!ky)
|
|
97
|
+
ky = 1;
|
|
98
|
+
data.forEach((d) => (d[y] = d[y] * ky + ty));
|
|
99
|
+
});
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
function maybeAnchor(anchor) {
|
|
103
|
+
return typeof anchor === 'string' ? { anchor } : anchor;
|
|
104
|
+
}
|
|
105
|
+
function anchorXLeft({ options: { marginLeft } }) {
|
|
106
|
+
return [1, marginLeft];
|
|
107
|
+
}
|
|
108
|
+
function anchorXRight({ facetWidth: width, options: { marginLeft } }) {
|
|
109
|
+
return [-1, marginLeft + width];
|
|
110
|
+
}
|
|
111
|
+
function anchorXMiddle({ facetWidth: width, options: { marginLeft } }) {
|
|
112
|
+
return [0, marginLeft + width / 2];
|
|
113
|
+
}
|
|
114
|
+
function anchorYTop({ options: { marginTop } }) {
|
|
115
|
+
return [1, marginTop];
|
|
116
|
+
}
|
|
117
|
+
function anchorYBottom({ facetHeight: height }) {
|
|
118
|
+
return [-1, height];
|
|
119
|
+
}
|
|
120
|
+
function anchorYMiddle({ facetHeight: height, options: { marginTop, marginBottom } }) {
|
|
121
|
+
return [0, (marginTop + height) / 2];
|
|
122
|
+
}
|
|
123
|
+
function compareSymmetric(a, b) {
|
|
124
|
+
return Math.abs(a) - Math.abs(b);
|
|
125
|
+
}
|
|
126
|
+
function compareAscending(a, b) {
|
|
127
|
+
return a - b;
|
|
128
|
+
}
|
|
@@ -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: Record<string | symbol, RawValue>[];
|
|
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: Record<string | symbol, RawValue>[];
|
|
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: Record<string | symbol, RawValue>[];
|
|
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: Record<string | symbol, RawValue>[];
|
|
65
|
-
};
|
|
57
|
+
export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): any;
|
|
66
58
|
export {};
|
|
@@ -1,129 +1,7 @@
|
|
|
1
1
|
import type { PlotState, TransformArg } from '../types/index.js';
|
|
2
2
|
export declare function intervalX<T>(args: TransformArg<T>, { plot }: {
|
|
3
3
|
plot: PlotState;
|
|
4
|
-
}):
|
|
5
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
6
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
7
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
8
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
9
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
10
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
11
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
12
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
13
|
-
sort?: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
|
|
14
|
-
channel: string;
|
|
15
|
-
order?: "ascending" | "descending";
|
|
16
|
-
} | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
17
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
18
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
19
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
20
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
21
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
22
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
23
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
24
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
25
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
26
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
27
|
-
clipPath?: string | undefined;
|
|
28
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
29
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
30
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
31
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
32
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
33
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
34
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
35
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
36
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
37
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
38
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
39
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
40
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
41
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
42
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
43
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
44
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
45
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
46
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
47
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
48
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
49
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
50
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
51
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
52
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
53
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
54
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
55
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
56
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
57
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
58
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
59
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
60
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
61
|
-
class?: string | undefined;
|
|
62
|
-
style?: string | undefined;
|
|
63
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
64
|
-
data: T[];
|
|
65
|
-
};
|
|
4
|
+
}): any;
|
|
66
5
|
export declare function intervalY<T>(args: TransformArg<T>, { plot }: {
|
|
67
6
|
plot: PlotState;
|
|
68
|
-
}):
|
|
69
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
70
|
-
facet?: "auto" | "include" | "exclude" | undefined;
|
|
71
|
-
fx?: import("../types/index.js").ChannelAccessor<T>;
|
|
72
|
-
fy?: import("../types/index.js").ChannelAccessor<T>;
|
|
73
|
-
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
74
|
-
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
75
|
-
fill?: import("../types/index.js").ChannelAccessor<T>;
|
|
76
|
-
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
77
|
-
sort?: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
|
|
78
|
-
channel: string;
|
|
79
|
-
order?: "ascending" | "descending";
|
|
80
|
-
} | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
|
|
81
|
-
stroke?: import("../types/index.js").ChannelAccessor<T>;
|
|
82
|
-
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
83
|
-
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
84
|
-
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
85
|
-
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
86
|
-
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
87
|
-
opacity?: import("../types/index.js").ChannelAccessor<T>;
|
|
88
|
-
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
89
|
-
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
90
|
-
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
91
|
-
clipPath?: string | undefined;
|
|
92
|
-
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
93
|
-
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
94
|
-
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
95
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
96
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
97
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
98
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
99
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
100
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
101
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
102
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
103
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
104
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
105
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
106
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
107
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
108
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
109
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
110
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
111
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
112
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
113
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
114
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
115
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
116
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
117
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
118
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
119
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
120
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
121
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
122
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
123
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
124
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
|
|
125
|
-
class?: string | undefined;
|
|
126
|
-
style?: string | undefined;
|
|
127
|
-
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
128
|
-
data: T[];
|
|
129
|
-
};
|
|
7
|
+
}): any;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { TransformArgsRow, TransformArgsRecord } from '../types/index.js';
|
|
2
|
-
import { INDEX } from '../constants';
|
|
3
2
|
export declare const X: unique symbol;
|
|
4
3
|
export declare const Y: unique symbol;
|
|
5
4
|
export declare const RAW_VALUE: unique symbol;
|
|
6
|
-
export declare function indexData<T extends object>(data: T[]): (T & {
|
|
7
|
-
[INDEX]: number;
|
|
8
|
-
})[];
|
|
5
|
+
export declare function indexData<T extends object>(data: T[]): (T & {})[];
|
|
9
6
|
export declare function recordizeX<T>({ data, ...channels }: TransformArgsRow<T>, { withIndex }?: {
|
|
10
7
|
withIndex: boolean;
|
|
11
8
|
}): TransformArgsRecord<T>;
|