svelteplot 0.10.3 → 0.11.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/Mark.svelte +42 -25
- package/dist/Mark.svelte.d.ts +111 -32
- package/dist/Plot.svelte +21 -15
- package/dist/core/Facet.svelte +1 -1
- package/dist/core/FacetAxes.svelte +13 -8
- package/dist/core/FacetGrid.svelte +4 -4
- package/dist/core/Plot.svelte +41 -35
- package/dist/helpers/autoScales.d.ts +3 -3
- package/dist/helpers/autoScales.js +28 -18
- package/dist/helpers/autoTicks.js +2 -0
- package/dist/helpers/callWithProps.d.ts +1 -2
- package/dist/helpers/facets.js +0 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/mergeDeep.d.ts +1 -3
- package/dist/helpers/mergeDeep.js +15 -16
- package/dist/helpers/projection.d.ts +4 -3
- package/dist/helpers/projection.js +17 -5
- package/dist/helpers/reduce.d.ts +4 -4
- package/dist/helpers/reduce.js +6 -4
- package/dist/helpers/regressionLoess.js +2 -1
- package/dist/helpers/resolve.d.ts +6 -3
- package/dist/helpers/resolve.js +25 -16
- package/dist/helpers/scales.d.ts +10 -10
- package/dist/helpers/scales.js +43 -13
- package/dist/helpers/time.d.ts +10 -3
- package/dist/helpers/time.js +2 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/plotDefaults.d.ts +3 -1
- package/dist/hooks/plotDefaults.js +33 -1
- package/dist/hooks/usePlot.svelte.d.ts +10 -25
- package/dist/hooks/usePlot.svelte.js +8 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/marks/Area.svelte +24 -13
- package/dist/marks/Area.svelte.d.ts +118 -34
- package/dist/marks/AreaX.svelte +42 -8
- package/dist/marks/AreaX.svelte.d.ts +154 -71
- package/dist/marks/AreaY.svelte +42 -8
- package/dist/marks/AreaY.svelte.d.ts +154 -71
- package/dist/marks/Arrow.svelte +42 -23
- package/dist/marks/Arrow.svelte.d.ts +114 -35
- package/dist/marks/AxisX.svelte +43 -28
- package/dist/marks/AxisX.svelte.d.ts +125 -40
- package/dist/marks/AxisY.svelte +43 -26
- package/dist/marks/AxisY.svelte.d.ts +127 -40
- package/dist/marks/BarX.svelte +12 -10
- package/dist/marks/BarX.svelte.d.ts +104 -32
- package/dist/marks/BarY.svelte +11 -10
- package/dist/marks/BarY.svelte.d.ts +106 -34
- package/dist/marks/BollingerX.svelte +4 -7
- package/dist/marks/BollingerX.svelte.d.ts +105 -30
- package/dist/marks/BollingerY.svelte +3 -0
- package/dist/marks/BollingerY.svelte.d.ts +105 -30
- package/dist/marks/BoxX.svelte +3 -3
- package/dist/marks/BoxY.svelte +12 -9
- package/dist/marks/BoxY.svelte.d.ts +128 -53
- package/dist/marks/Brush.svelte +26 -21
- package/dist/marks/Brush.svelte.d.ts +119 -60
- package/dist/marks/Cell.svelte +13 -9
- package/dist/marks/Cell.svelte.d.ts +105 -30
- package/dist/marks/CellX.svelte +2 -1
- package/dist/marks/CellX.svelte.d.ts +105 -32
- package/dist/marks/CellY.svelte +2 -1
- package/dist/marks/CellY.svelte.d.ts +105 -32
- package/dist/marks/ColorLegend.svelte +24 -13
- package/dist/marks/ColorLegend.svelte.d.ts +1 -0
- package/dist/marks/CustomMark.svelte +16 -10
- package/dist/marks/CustomMark.svelte.d.ts +112 -31
- package/dist/marks/CustomMarkHTML.svelte +8 -2
- package/dist/marks/CustomMarkHTML.svelte.d.ts +8 -2
- package/dist/marks/DifferenceY.svelte +31 -20
- package/dist/marks/DifferenceY.svelte.d.ts +134 -55
- package/dist/marks/Dot.svelte +21 -11
- package/dist/marks/Dot.svelte.d.ts +117 -38
- package/dist/marks/DotX.svelte +2 -0
- package/dist/marks/DotX.svelte.d.ts +136 -62
- package/dist/marks/DotY.svelte +1 -0
- package/dist/marks/DotY.svelte.d.ts +135 -62
- package/dist/marks/Frame.svelte +47 -9
- package/dist/marks/Frame.svelte.d.ts +124 -41
- package/dist/marks/Geo.svelte +21 -12
- package/dist/marks/Geo.svelte.d.ts +105 -30
- package/dist/marks/Graticule.svelte +3 -0
- package/dist/marks/Graticule.svelte.d.ts +3 -0
- package/dist/marks/GridX.svelte +31 -16
- package/dist/marks/GridX.svelte.d.ts +108 -32
- package/dist/marks/GridY.svelte +30 -15
- package/dist/marks/GridY.svelte.d.ts +108 -32
- package/dist/marks/HTMLTooltip.svelte +14 -7
- package/dist/marks/HTMLTooltip.svelte.d.ts +7 -0
- package/dist/marks/Image.svelte +50 -25
- package/dist/marks/Image.svelte.d.ts +117 -35
- package/dist/marks/Line.svelte +67 -44
- package/dist/marks/Line.svelte.d.ts +119 -30
- package/dist/marks/LineX.svelte +2 -1
- package/dist/marks/LineX.svelte.d.ts +142 -69
- package/dist/marks/LineY.svelte +2 -1
- package/dist/marks/LineY.svelte.d.ts +142 -69
- package/dist/marks/Link.svelte +70 -46
- package/dist/marks/Link.svelte.d.ts +126 -41
- package/dist/marks/Pointer.svelte +24 -15
- package/dist/marks/Pointer.svelte.d.ts +7 -0
- package/dist/marks/Rect.svelte +13 -5
- package/dist/marks/Rect.svelte.d.ts +116 -35
- package/dist/marks/RectX.svelte +6 -3
- package/dist/marks/RectX.svelte.d.ts +158 -12
- package/dist/marks/RectY.svelte +6 -3
- package/dist/marks/RectY.svelte.d.ts +158 -12
- package/dist/marks/RegressionX.svelte +13 -6
- package/dist/marks/RegressionX.svelte.d.ts +8 -3
- package/dist/marks/RegressionY.svelte +13 -6
- package/dist/marks/RegressionY.svelte.d.ts +8 -3
- package/dist/marks/RuleX.svelte +18 -11
- package/dist/marks/RuleX.svelte.d.ts +112 -32
- package/dist/marks/RuleY.svelte +19 -12
- package/dist/marks/RuleY.svelte.d.ts +114 -34
- package/dist/marks/Spike.svelte +11 -5
- package/dist/marks/Spike.svelte.d.ts +146 -68
- package/dist/marks/Text.svelte +24 -7
- package/dist/marks/Text.svelte.d.ts +253 -75
- package/dist/marks/TickX.svelte +56 -48
- package/dist/marks/TickX.svelte.d.ts +114 -40
- package/dist/marks/TickY.svelte +59 -51
- package/dist/marks/TickY.svelte.d.ts +117 -43
- package/dist/marks/Trail.svelte +25 -13
- package/dist/marks/Trail.svelte.d.ts +116 -33
- package/dist/marks/Vector.svelte +20 -11
- package/dist/marks/Vector.svelte.d.ts +116 -35
- package/dist/marks/WaffleX.svelte +18 -16
- package/dist/marks/WaffleX.svelte.d.ts +131 -57
- package/dist/marks/WaffleY.svelte +16 -15
- package/dist/marks/WaffleY.svelte.d.ts +129 -56
- package/dist/marks/helpers/Anchor.svelte +17 -2
- package/dist/marks/helpers/Anchor.svelte.d.ts +16 -1
- package/dist/marks/helpers/AreaCanvas.svelte +8 -8
- package/dist/marks/helpers/BaseAxisX.svelte +38 -41
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +11 -17
- package/dist/marks/helpers/BaseAxisY.svelte +35 -35
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +12 -15
- package/dist/marks/helpers/Box.svelte +35 -28
- package/dist/marks/helpers/Box.svelte.d.ts +122 -50
- package/dist/marks/helpers/DotCanvas.svelte +11 -9
- package/dist/marks/helpers/GeoCanvas.svelte +7 -6
- package/dist/marks/helpers/LineCanvas.svelte +7 -7
- package/dist/marks/helpers/LinearGradientX.svelte +2 -2
- package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte +2 -2
- package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
- package/dist/marks/helpers/Marker.svelte +2 -2
- package/dist/marks/helpers/MarkerPath.svelte +15 -12
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +105 -32
- package/dist/marks/helpers/MultilineText.svelte +24 -17
- package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
- package/dist/marks/helpers/RectCanvas.svelte +31 -26
- package/dist/marks/helpers/RectPath.svelte +2 -2
- package/dist/marks/helpers/Regression.svelte +176 -86
- package/dist/marks/helpers/Regression.svelte.d.ts +20 -8
- package/dist/marks/helpers/RuleCanvas.svelte +9 -6
- package/dist/marks/helpers/TextCanvas.svelte +13 -9
- package/dist/marks/helpers/TextCanvas.svelte.d.ts +6 -6
- package/dist/marks/helpers/TickCanvas.svelte +6 -5
- package/dist/marks/helpers/TrailCanvas.svelte +16 -18
- package/dist/marks/helpers/TrailCanvas.svelte.d.ts +3 -5
- package/dist/marks/helpers/canvas.js +16 -9
- package/dist/marks/helpers/events.d.ts +2 -2
- package/dist/marks/helpers/events.js +14 -7
- package/dist/marks/helpers/waffle.d.ts +3 -3
- package/dist/marks/helpers/waffle.js +6 -4
- package/dist/regression/polynomial.d.ts +1 -1
- package/dist/regression/polynomial.js +5 -5
- package/dist/regression/utils/determination.d.ts +1 -1
- package/dist/regression/utils/determination.js +1 -1
- package/dist/regression/utils/geometry.d.ts +1 -1
- package/dist/regression/utils/interpose.d.ts +1 -1
- package/dist/regression/utils/interpose.js +1 -1
- package/dist/regression/utils/points.d.ts +1 -1
- package/dist/transforms/bin.d.ts +3 -3
- package/dist/transforms/bin.js +29 -20
- package/dist/transforms/bollinger.d.ts +8 -0
- package/dist/transforms/bollinger.js +9 -1
- package/dist/transforms/centroid.d.ts +4 -0
- package/dist/transforms/centroid.js +4 -0
- package/dist/transforms/density.d.ts +4 -4
- package/dist/transforms/density.js +20 -13
- package/dist/transforms/dodge.d.ts +12 -1
- package/dist/transforms/dodge.js +15 -6
- package/dist/transforms/group.d.ts +141 -4
- package/dist/transforms/group.js +4 -1
- package/dist/transforms/interval.d.ts +204 -60
- package/dist/transforms/jitter.d.ts +421 -4
- package/dist/transforms/jitter.js +10 -1
- package/dist/transforms/map.d.ts +412 -4
- package/dist/transforms/map.js +3 -3
- package/dist/transforms/normalize.d.ts +276 -5
- package/dist/transforms/normalize.js +5 -3
- package/dist/transforms/recordize.d.ts +17 -5
- package/dist/transforms/recordize.js +13 -9
- package/dist/transforms/rename.d.ts +11 -4
- package/dist/transforms/rename.js +7 -2
- package/dist/transforms/select.d.ts +722 -210
- package/dist/transforms/select.js +13 -1
- package/dist/transforms/shift.d.ts +8 -0
- package/dist/transforms/shift.js +20 -6
- package/dist/transforms/sort.d.ts +13 -258
- package/dist/transforms/sort.js +13 -10
- package/dist/transforms/stack.d.ts +58 -9
- package/dist/transforms/stack.js +27 -11
- package/dist/transforms/window.d.ts +221 -66
- package/dist/transforms/window.js +8 -2
- package/dist/types/axes.d.ts +43 -0
- package/dist/types/axes.js +1 -0
- package/dist/types/channel.d.ts +30 -2
- package/dist/types/data.d.ts +14 -1
- package/dist/types/facet.d.ts +5 -0
- package/dist/types/index.d.ts +33 -8
- package/dist/types/index.js +11 -7
- package/dist/types/mark.d.ts +124 -35
- package/dist/types/plot.d.ts +118 -16
- package/dist/types/scale.d.ts +125 -8
- package/package.json +178 -175
- package/dist/helpers/autoTicks.d.ts +0 -12
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TransformArg, RawValue, MapIndexObject } from '../types/index.js';
|
|
2
|
-
import { sort } from './sort.js';
|
|
3
2
|
type BasisFunction = (I: number[], S: RawValue[]) => number;
|
|
4
3
|
type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | BasisFunction | MapIndexObject;
|
|
5
4
|
type NormalizeOptions = NormalizeBasis | {
|
|
@@ -8,11 +7,283 @@ type NormalizeOptions = NormalizeBasis | {
|
|
|
8
7
|
/**
|
|
9
8
|
* Normalizes the x values based on the specified basis. Uses mapX.
|
|
10
9
|
*/
|
|
11
|
-
export declare function normalizeX<T>(args: TransformArg<T>, options: NormalizeOptions):
|
|
10
|
+
export declare function normalizeX<T>(args: TransformArg<T>, options: NormalizeOptions): {
|
|
11
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
12
|
+
facet?: "auto" | "include" | "exclude" | undefined;
|
|
13
|
+
fx?: import("../types/channel.js").ChannelAccessor<T>;
|
|
14
|
+
fy?: import("../types/channel.js").ChannelAccessor<T>;
|
|
15
|
+
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
16
|
+
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
17
|
+
dodgeX?: import("./dodge.js").DodgeXOptions | undefined;
|
|
18
|
+
dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
|
|
19
|
+
fill?: import("../types/channel.js").ChannelAccessor<T>;
|
|
20
|
+
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
21
|
+
fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, T>;
|
|
22
|
+
fontSize?: import("../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", T>;
|
|
23
|
+
fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, T>;
|
|
24
|
+
fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, T>;
|
|
25
|
+
fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, T>;
|
|
26
|
+
letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, T>;
|
|
27
|
+
wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, T>;
|
|
28
|
+
textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, T>;
|
|
29
|
+
textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, T>;
|
|
30
|
+
textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, T>;
|
|
31
|
+
sort?: ((a: RawValue, b: RawValue) => number) | {
|
|
32
|
+
channel: string;
|
|
33
|
+
order?: "ascending" | "descending";
|
|
34
|
+
} | import("../types/index.js").ConstantAccessor<RawValue, T>;
|
|
35
|
+
stroke?: import("../types/channel.js").ChannelAccessor<T>;
|
|
36
|
+
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
37
|
+
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
38
|
+
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
39
|
+
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
40
|
+
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
41
|
+
opacity?: import("../types/channel.js").ChannelAccessor<T>;
|
|
42
|
+
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
43
|
+
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
44
|
+
blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
45
|
+
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
46
|
+
clipPath?: string | undefined;
|
|
47
|
+
mask?: string | undefined;
|
|
48
|
+
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
49
|
+
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
50
|
+
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
51
|
+
onclick?: ((event: Event & {
|
|
52
|
+
currentTarget: SVGPathElement;
|
|
53
|
+
}, datum: T, index: number) => void) | undefined;
|
|
54
|
+
ondblclick?: ((event: Event & {
|
|
55
|
+
currentTarget: SVGPathElement;
|
|
56
|
+
}, datum: T, index: number) => void) | undefined;
|
|
57
|
+
onmouseup?: ((event: Event & {
|
|
58
|
+
currentTarget: SVGPathElement;
|
|
59
|
+
}, datum: T, index: number) => void) | undefined;
|
|
60
|
+
onmousedown?: ((event: Event & {
|
|
61
|
+
currentTarget: SVGPathElement;
|
|
62
|
+
}, datum: T, index: number) => void) | undefined;
|
|
63
|
+
onmouseenter?: ((event: Event & {
|
|
64
|
+
currentTarget: SVGPathElement;
|
|
65
|
+
}, datum: T, index: number) => void) | undefined;
|
|
66
|
+
onmousemove?: ((event: Event & {
|
|
67
|
+
currentTarget: SVGPathElement;
|
|
68
|
+
}, datum: T, index: number) => void) | undefined;
|
|
69
|
+
onmouseleave?: ((event: Event & {
|
|
70
|
+
currentTarget: SVGPathElement;
|
|
71
|
+
}, datum: T, index: number) => void) | undefined;
|
|
72
|
+
onmouseout?: ((event: Event & {
|
|
73
|
+
currentTarget: SVGPathElement;
|
|
74
|
+
}, datum: T, index: number) => void) | undefined;
|
|
75
|
+
onmouseover?: ((event: Event & {
|
|
76
|
+
currentTarget: SVGPathElement;
|
|
77
|
+
}, datum: T, index: number) => void) | undefined;
|
|
78
|
+
onpointercancel?: ((event: Event & {
|
|
79
|
+
currentTarget: SVGPathElement;
|
|
80
|
+
}, datum: T, index: number) => void) | undefined;
|
|
81
|
+
onpointerdown?: ((event: Event & {
|
|
82
|
+
currentTarget: SVGPathElement;
|
|
83
|
+
}, datum: T, index: number) => void) | undefined;
|
|
84
|
+
onpointerup?: ((event: Event & {
|
|
85
|
+
currentTarget: SVGPathElement;
|
|
86
|
+
}, datum: T, index: number) => void) | undefined;
|
|
87
|
+
onpointerenter?: ((event: Event & {
|
|
88
|
+
currentTarget: SVGPathElement;
|
|
89
|
+
}, datum: T, index: number) => void) | undefined;
|
|
90
|
+
onpointerleave?: ((event: Event & {
|
|
91
|
+
currentTarget: SVGPathElement;
|
|
92
|
+
}, datum: T, index: number) => void) | undefined;
|
|
93
|
+
onpointermove?: ((event: Event & {
|
|
94
|
+
currentTarget: SVGPathElement;
|
|
95
|
+
}, datum: T, index: number) => void) | undefined;
|
|
96
|
+
onpointerover?: ((event: Event & {
|
|
97
|
+
currentTarget: SVGPathElement;
|
|
98
|
+
}, datum: T, index: number) => void) | undefined;
|
|
99
|
+
onpointerout?: ((event: Event & {
|
|
100
|
+
currentTarget: SVGPathElement;
|
|
101
|
+
}, datum: T, index: number) => void) | undefined;
|
|
102
|
+
ondrag?: ((event: Event & {
|
|
103
|
+
currentTarget: SVGPathElement;
|
|
104
|
+
}, datum: T, index: number) => void) | undefined;
|
|
105
|
+
ondrop?: ((event: Event & {
|
|
106
|
+
currentTarget: SVGPathElement;
|
|
107
|
+
}, datum: T, index: number) => void) | undefined;
|
|
108
|
+
ondragstart?: ((event: Event & {
|
|
109
|
+
currentTarget: SVGPathElement;
|
|
110
|
+
}, datum: T, index: number) => void) | undefined;
|
|
111
|
+
ondragenter?: ((event: Event & {
|
|
112
|
+
currentTarget: SVGPathElement;
|
|
113
|
+
}, datum: T, index: number) => void) | undefined;
|
|
114
|
+
ondragleave?: ((event: Event & {
|
|
115
|
+
currentTarget: SVGPathElement;
|
|
116
|
+
}, datum: T, index: number) => void) | undefined;
|
|
117
|
+
ondragover?: ((event: Event & {
|
|
118
|
+
currentTarget: SVGPathElement;
|
|
119
|
+
}, datum: T, index: number) => void) | undefined;
|
|
120
|
+
ondragend?: ((event: Event & {
|
|
121
|
+
currentTarget: SVGPathElement;
|
|
122
|
+
}, datum: T, index: number) => void) | undefined;
|
|
123
|
+
ontouchstart?: ((event: Event & {
|
|
124
|
+
currentTarget: SVGPathElement;
|
|
125
|
+
}, datum: T, index: number) => void) | undefined;
|
|
126
|
+
ontouchmove?: ((event: Event & {
|
|
127
|
+
currentTarget: SVGPathElement;
|
|
128
|
+
}, datum: T, index: number) => void) | undefined;
|
|
129
|
+
ontouchend?: ((event: Event & {
|
|
130
|
+
currentTarget: SVGPathElement;
|
|
131
|
+
}, datum: T, index: number) => void) | undefined;
|
|
132
|
+
ontouchcancel?: ((event: Event & {
|
|
133
|
+
currentTarget: SVGPathElement;
|
|
134
|
+
}, datum: T, index: number) => void) | undefined;
|
|
135
|
+
oncontextmenu?: ((event: Event & {
|
|
136
|
+
currentTarget: SVGPathElement;
|
|
137
|
+
}, datum: T, index: number) => void) | undefined;
|
|
138
|
+
onwheel?: ((event: Event & {
|
|
139
|
+
currentTarget: SVGPathElement;
|
|
140
|
+
}, datum: T, index: number) => void) | undefined;
|
|
141
|
+
class?: string | undefined;
|
|
142
|
+
style?: string | undefined;
|
|
143
|
+
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
144
|
+
title?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
145
|
+
data: Record<string | symbol, RawValue>[];
|
|
146
|
+
};
|
|
12
147
|
/**
|
|
13
148
|
* Normalizes the y values based on the specified basis. Uses mapY.
|
|
14
149
|
*/
|
|
15
|
-
export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeOptions):
|
|
150
|
+
export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeOptions): {
|
|
151
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
|
|
152
|
+
facet?: "auto" | "include" | "exclude" | undefined;
|
|
153
|
+
fx?: import("../types/channel.js").ChannelAccessor<T>;
|
|
154
|
+
fy?: import("../types/channel.js").ChannelAccessor<T>;
|
|
155
|
+
dx?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
156
|
+
dy?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
157
|
+
dodgeX?: import("./dodge.js").DodgeXOptions | undefined;
|
|
158
|
+
dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
|
|
159
|
+
fill?: import("../types/channel.js").ChannelAccessor<T>;
|
|
160
|
+
fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
161
|
+
fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, T>;
|
|
162
|
+
fontSize?: import("../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", T>;
|
|
163
|
+
fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, T>;
|
|
164
|
+
fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, T>;
|
|
165
|
+
fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, T>;
|
|
166
|
+
letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, T>;
|
|
167
|
+
wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, T>;
|
|
168
|
+
textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, T>;
|
|
169
|
+
textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, T>;
|
|
170
|
+
textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, T>;
|
|
171
|
+
sort?: ((a: RawValue, b: RawValue) => number) | {
|
|
172
|
+
channel: string;
|
|
173
|
+
order?: "ascending" | "descending";
|
|
174
|
+
} | import("../types/index.js").ConstantAccessor<RawValue, T>;
|
|
175
|
+
stroke?: import("../types/channel.js").ChannelAccessor<T>;
|
|
176
|
+
strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
177
|
+
strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
178
|
+
strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
|
|
179
|
+
strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
|
|
180
|
+
strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
181
|
+
opacity?: import("../types/channel.js").ChannelAccessor<T>;
|
|
182
|
+
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
183
|
+
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
|
|
184
|
+
blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
185
|
+
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
|
|
186
|
+
clipPath?: string | undefined;
|
|
187
|
+
mask?: string | undefined;
|
|
188
|
+
imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
189
|
+
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
|
|
190
|
+
paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
191
|
+
onclick?: ((event: Event & {
|
|
192
|
+
currentTarget: SVGPathElement;
|
|
193
|
+
}, datum: T, index: number) => void) | undefined;
|
|
194
|
+
ondblclick?: ((event: Event & {
|
|
195
|
+
currentTarget: SVGPathElement;
|
|
196
|
+
}, datum: T, index: number) => void) | undefined;
|
|
197
|
+
onmouseup?: ((event: Event & {
|
|
198
|
+
currentTarget: SVGPathElement;
|
|
199
|
+
}, datum: T, index: number) => void) | undefined;
|
|
200
|
+
onmousedown?: ((event: Event & {
|
|
201
|
+
currentTarget: SVGPathElement;
|
|
202
|
+
}, datum: T, index: number) => void) | undefined;
|
|
203
|
+
onmouseenter?: ((event: Event & {
|
|
204
|
+
currentTarget: SVGPathElement;
|
|
205
|
+
}, datum: T, index: number) => void) | undefined;
|
|
206
|
+
onmousemove?: ((event: Event & {
|
|
207
|
+
currentTarget: SVGPathElement;
|
|
208
|
+
}, datum: T, index: number) => void) | undefined;
|
|
209
|
+
onmouseleave?: ((event: Event & {
|
|
210
|
+
currentTarget: SVGPathElement;
|
|
211
|
+
}, datum: T, index: number) => void) | undefined;
|
|
212
|
+
onmouseout?: ((event: Event & {
|
|
213
|
+
currentTarget: SVGPathElement;
|
|
214
|
+
}, datum: T, index: number) => void) | undefined;
|
|
215
|
+
onmouseover?: ((event: Event & {
|
|
216
|
+
currentTarget: SVGPathElement;
|
|
217
|
+
}, datum: T, index: number) => void) | undefined;
|
|
218
|
+
onpointercancel?: ((event: Event & {
|
|
219
|
+
currentTarget: SVGPathElement;
|
|
220
|
+
}, datum: T, index: number) => void) | undefined;
|
|
221
|
+
onpointerdown?: ((event: Event & {
|
|
222
|
+
currentTarget: SVGPathElement;
|
|
223
|
+
}, datum: T, index: number) => void) | undefined;
|
|
224
|
+
onpointerup?: ((event: Event & {
|
|
225
|
+
currentTarget: SVGPathElement;
|
|
226
|
+
}, datum: T, index: number) => void) | undefined;
|
|
227
|
+
onpointerenter?: ((event: Event & {
|
|
228
|
+
currentTarget: SVGPathElement;
|
|
229
|
+
}, datum: T, index: number) => void) | undefined;
|
|
230
|
+
onpointerleave?: ((event: Event & {
|
|
231
|
+
currentTarget: SVGPathElement;
|
|
232
|
+
}, datum: T, index: number) => void) | undefined;
|
|
233
|
+
onpointermove?: ((event: Event & {
|
|
234
|
+
currentTarget: SVGPathElement;
|
|
235
|
+
}, datum: T, index: number) => void) | undefined;
|
|
236
|
+
onpointerover?: ((event: Event & {
|
|
237
|
+
currentTarget: SVGPathElement;
|
|
238
|
+
}, datum: T, index: number) => void) | undefined;
|
|
239
|
+
onpointerout?: ((event: Event & {
|
|
240
|
+
currentTarget: SVGPathElement;
|
|
241
|
+
}, datum: T, index: number) => void) | undefined;
|
|
242
|
+
ondrag?: ((event: Event & {
|
|
243
|
+
currentTarget: SVGPathElement;
|
|
244
|
+
}, datum: T, index: number) => void) | undefined;
|
|
245
|
+
ondrop?: ((event: Event & {
|
|
246
|
+
currentTarget: SVGPathElement;
|
|
247
|
+
}, datum: T, index: number) => void) | undefined;
|
|
248
|
+
ondragstart?: ((event: Event & {
|
|
249
|
+
currentTarget: SVGPathElement;
|
|
250
|
+
}, datum: T, index: number) => void) | undefined;
|
|
251
|
+
ondragenter?: ((event: Event & {
|
|
252
|
+
currentTarget: SVGPathElement;
|
|
253
|
+
}, datum: T, index: number) => void) | undefined;
|
|
254
|
+
ondragleave?: ((event: Event & {
|
|
255
|
+
currentTarget: SVGPathElement;
|
|
256
|
+
}, datum: T, index: number) => void) | undefined;
|
|
257
|
+
ondragover?: ((event: Event & {
|
|
258
|
+
currentTarget: SVGPathElement;
|
|
259
|
+
}, datum: T, index: number) => void) | undefined;
|
|
260
|
+
ondragend?: ((event: Event & {
|
|
261
|
+
currentTarget: SVGPathElement;
|
|
262
|
+
}, datum: T, index: number) => void) | undefined;
|
|
263
|
+
ontouchstart?: ((event: Event & {
|
|
264
|
+
currentTarget: SVGPathElement;
|
|
265
|
+
}, datum: T, index: number) => void) | undefined;
|
|
266
|
+
ontouchmove?: ((event: Event & {
|
|
267
|
+
currentTarget: SVGPathElement;
|
|
268
|
+
}, datum: T, index: number) => void) | undefined;
|
|
269
|
+
ontouchend?: ((event: Event & {
|
|
270
|
+
currentTarget: SVGPathElement;
|
|
271
|
+
}, datum: T, index: number) => void) | undefined;
|
|
272
|
+
ontouchcancel?: ((event: Event & {
|
|
273
|
+
currentTarget: SVGPathElement;
|
|
274
|
+
}, datum: T, index: number) => void) | undefined;
|
|
275
|
+
oncontextmenu?: ((event: Event & {
|
|
276
|
+
currentTarget: SVGPathElement;
|
|
277
|
+
}, datum: T, index: number) => void) | undefined;
|
|
278
|
+
onwheel?: ((event: Event & {
|
|
279
|
+
currentTarget: SVGPathElement;
|
|
280
|
+
}, datum: T, index: number) => void) | undefined;
|
|
281
|
+
class?: string | undefined;
|
|
282
|
+
style?: string | undefined;
|
|
283
|
+
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
|
|
284
|
+
title?: import("../types/index.js").ConstantAccessor<string, T>;
|
|
285
|
+
data: Record<string | symbol, RawValue>[];
|
|
286
|
+
};
|
|
16
287
|
/**
|
|
17
288
|
* Convenience wrapper for normalizeY for parallel coordinates.
|
|
18
289
|
*
|
|
@@ -21,7 +292,7 @@ export declare function normalizeY<T>(args: TransformArg<T>, options: NormalizeO
|
|
|
21
292
|
* - y: the value to normalize (e.g., 'Value')
|
|
22
293
|
* - z: the grouping variable (e.g., 'Id')
|
|
23
294
|
*/
|
|
24
|
-
export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: NormalizeBasis):
|
|
295
|
+
export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: NormalizeBasis): TransformArg<T>;
|
|
25
296
|
/**
|
|
26
297
|
* Convenience wrapper for normalizeY for parallel coordinates.
|
|
27
298
|
*
|
|
@@ -30,5 +301,5 @@ export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: Norm
|
|
|
30
301
|
* - y: the value to normalize (e.g., 'Value')
|
|
31
302
|
* - z: the grouping variable (e.g., 'Id')
|
|
32
303
|
*/
|
|
33
|
-
export declare function normalizeParallelX<T>(args: TransformArg<T>, basis: NormalizeBasis):
|
|
304
|
+
export declare function normalizeParallelX<T>(args: TransformArg<T>, basis: NormalizeBasis): TransformArg<T>;
|
|
34
305
|
export {};
|
|
@@ -65,9 +65,9 @@ function normalizeAccessor(f) {
|
|
|
65
65
|
const normalizeExtent = {
|
|
66
66
|
mapIndex(I, S, T) {
|
|
67
67
|
const [s1, s2] = extent(I, (i) => S[i]);
|
|
68
|
-
const d = s2 - s1;
|
|
68
|
+
const d = (s2 ?? 0) - (s1 ?? 0);
|
|
69
69
|
for (const i of I) {
|
|
70
|
-
T[i] = S[i] === null ? NaN : (S[i] - s1) / d;
|
|
70
|
+
T[i] = S[i] === null ? NaN : (S[i] - (s1 ?? 0)) / d;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
};
|
|
@@ -77,6 +77,7 @@ const normalizeFirst = normalizeBasis((I, S) => {
|
|
|
77
77
|
if (s != null && isFinite(s))
|
|
78
78
|
return s;
|
|
79
79
|
}
|
|
80
|
+
return NaN;
|
|
80
81
|
});
|
|
81
82
|
const normalizeLast = normalizeBasis((I, S) => {
|
|
82
83
|
for (let i = I.length - 1; i >= 0; --i) {
|
|
@@ -84,13 +85,14 @@ const normalizeLast = normalizeBasis((I, S) => {
|
|
|
84
85
|
if (s != null && isFinite(s))
|
|
85
86
|
return s;
|
|
86
87
|
}
|
|
88
|
+
return NaN;
|
|
87
89
|
});
|
|
88
90
|
const normalizeDeviation = {
|
|
89
91
|
mapIndex(I, S, T) {
|
|
90
92
|
const m = mean(I, (i) => S[i]);
|
|
91
93
|
const d = deviation(I, (i) => S[i]);
|
|
92
94
|
for (const i of I) {
|
|
93
|
-
T[i] = S[i] === null ? NaN : d ? (S[i] - m) / d : 0;
|
|
95
|
+
T[i] = S[i] === null ? NaN : d ? (S[i] - (m ?? 0)) / d : 0;
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import type { TransformArgsRow, TransformArgsRecord, DataRecord, DataRow } from '../types/index.js';
|
|
2
|
-
import { INDEX } from '../constants';
|
|
2
|
+
import { INDEX } from '../constants.js';
|
|
3
3
|
export declare const X: unique symbol;
|
|
4
4
|
export declare const Y: unique symbol;
|
|
5
5
|
export declare const RAW_VALUE: unique symbol;
|
|
6
6
|
export declare function indexData<T extends object>(data: T[]): (T & {
|
|
7
7
|
[INDEX]: number;
|
|
8
8
|
})[];
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* takes an array of raw values and returns data records in which the values
|
|
11
|
+
* are interpreted as the x channel and their index as the y channel
|
|
12
|
+
*/
|
|
13
|
+
export declare function recordizeX({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
|
|
10
14
|
withIndex: boolean;
|
|
11
15
|
}): TransformArgsRecord<DataRecord>;
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* takes an array of raw values and returns data records in which the values
|
|
18
|
+
* are interpreted as the y channel and their index as the x channel
|
|
19
|
+
*/
|
|
20
|
+
export declare function recordizeY({ data, ...channels }: TransformArgsRow<DataRow>, { withIndex }?: {
|
|
13
21
|
withIndex: boolean;
|
|
14
22
|
}): TransformArgsRecord<DataRecord>;
|
|
15
23
|
/**
|
|
@@ -17,5 +25,9 @@ export declare function recordizeY<T>({ data, ...channels }: TransformArgsRow<Da
|
|
|
17
25
|
* as dataset to marks that support it. It transforms the arrays into records, so
|
|
18
26
|
* the rest of our code doesn't have to deal with this case anymore.
|
|
19
27
|
*/
|
|
20
|
-
export declare function recordizeXY
|
|
21
|
-
|
|
28
|
+
export declare function recordizeXY({ data, ...channels }: TransformArgsRow<DataRow>): TransformArgsRecord<DataRecord>;
|
|
29
|
+
/**
|
|
30
|
+
* wraps raw values into data records with index tracking, without
|
|
31
|
+
* assigning them to a specific positional channel
|
|
32
|
+
*/
|
|
33
|
+
export declare function recordize({ data, ...channels }: TransformArgsRow<DataRow>): TransformArgsRecord<DataRecord>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import isDataRecord from '../helpers/isDataRecord.js';
|
|
2
|
-
import { INDEX } from '../constants';
|
|
2
|
+
import { INDEX } from '../constants.js';
|
|
3
3
|
export const X = Symbol('x');
|
|
4
4
|
export const Y = Symbol('y');
|
|
5
5
|
export const RAW_VALUE = Symbol('originalValue');
|
|
6
6
|
export function indexData(data) {
|
|
7
7
|
return data.map((d, i) => ({ ...d, [INDEX]: i }));
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
/**
|
|
10
|
+
* takes an array of raw values and returns data records in which the values
|
|
11
|
+
* are interpreted as the x channel and their index as the y channel
|
|
12
12
|
*/
|
|
13
13
|
export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: true }) {
|
|
14
14
|
const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.x == null;
|
|
15
15
|
if (dataIsRawValueArray) {
|
|
16
16
|
// we remove x, x1 and x2 from the channels since they make no sense when
|
|
17
17
|
// the data is a raw value array
|
|
18
|
-
const { x, x1, x2, ...nonXChannels } = channels;
|
|
18
|
+
const { x: _x, x1: _x1, x2: _x2, ...nonXChannels } = channels;
|
|
19
19
|
return {
|
|
20
20
|
data: data.map((value, index) => ({
|
|
21
21
|
[RAW_VALUE]: value,
|
|
@@ -28,9 +28,9 @@ export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: t
|
|
|
28
28
|
}
|
|
29
29
|
return { data: indexData(data), ...channels };
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
/**
|
|
32
|
+
* takes an array of raw values and returns data records in which the values
|
|
33
|
+
* are interpreted as the y channel and their index as the x channel
|
|
34
34
|
*/
|
|
35
35
|
export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: true }) {
|
|
36
36
|
if (!data)
|
|
@@ -39,7 +39,7 @@ export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: t
|
|
|
39
39
|
if (dataIsRawValueArray) {
|
|
40
40
|
// we remove y, y1 and y2 from the channels since they make no sense when
|
|
41
41
|
// the data is a raw value array
|
|
42
|
-
const { y, y1, y2, ...nonYChannels } = channels;
|
|
42
|
+
const { y: _y, y1: _y1, y2: _y2, ...nonYChannels } = channels;
|
|
43
43
|
return {
|
|
44
44
|
data: Array.from(data).map((value, index) => ({
|
|
45
45
|
[INDEX]: index,
|
|
@@ -78,6 +78,10 @@ export function recordizeXY({ data, ...channels }) {
|
|
|
78
78
|
}
|
|
79
79
|
return { data: data, ...channels };
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* wraps raw values into data records with index tracking, without
|
|
83
|
+
* assigning them to a specific positional channel
|
|
84
|
+
*/
|
|
81
85
|
export function recordize({ data, ...channels }) {
|
|
82
86
|
if (!data)
|
|
83
87
|
return { data, ...channels };
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { DataRecord } from '../types/index.js';
|
|
2
|
-
import type { ScaledChannelName
|
|
2
|
+
import type { ScaledChannelName } from '../types/index.js';
|
|
3
3
|
type RenameChannelsOptions = Partial<Record<ScaledChannelName, ScaledChannelName>>;
|
|
4
4
|
type ReplaceChannelsOptions = Partial<Record<ScaledChannelName, ScaledChannelName[]>>;
|
|
5
|
+
type TransformLike<T extends DataRecord = DataRecord> = {
|
|
6
|
+
data: T[];
|
|
7
|
+
} & Record<string | symbol, any>;
|
|
5
8
|
export declare const RENAME: unique symbol;
|
|
6
9
|
/**
|
|
7
10
|
* renames a channel without modifying the data
|
|
8
11
|
*/
|
|
9
|
-
export declare function renameChannels<T
|
|
12
|
+
export declare function renameChannels<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: RenameChannelsOptions): C;
|
|
10
13
|
/**
|
|
11
14
|
* renames a channel and copy the data
|
|
12
15
|
*/
|
|
13
|
-
export declare function renameChannelsAndData<T
|
|
14
|
-
|
|
16
|
+
export declare function renameChannelsAndData<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: RenameChannelsOptions): C;
|
|
17
|
+
/**
|
|
18
|
+
* copies a channel's accessor to multiple target channels, then removes
|
|
19
|
+
* the source channel
|
|
20
|
+
*/
|
|
21
|
+
export declare function replaceChannels<T extends DataRecord, C extends TransformLike<T>>({ data, ...channels }: C, options: ReplaceChannelsOptions): C;
|
|
15
22
|
export {};
|
|
@@ -23,16 +23,21 @@ export function renameChannelsAndData({ data, ...channels }, options) {
|
|
|
23
23
|
const newData = [];
|
|
24
24
|
for (const datum of data) {
|
|
25
25
|
const newDatum = { ...datum };
|
|
26
|
+
const mutableDatum = newDatum;
|
|
26
27
|
for (const [from, to] of Object.entries(options)) {
|
|
27
28
|
if (channels[from] !== undefined) {
|
|
28
|
-
|
|
29
|
-
delete
|
|
29
|
+
mutableDatum[to] = mutableDatum[from];
|
|
30
|
+
delete mutableDatum[from];
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
newData.push(newDatum);
|
|
33
34
|
}
|
|
34
35
|
return renameChannels({ data: newData, ...channels }, options);
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* copies a channel's accessor to multiple target channels, then removes
|
|
39
|
+
* the source channel
|
|
40
|
+
*/
|
|
36
41
|
export function replaceChannels({ data, ...channels }, options) {
|
|
37
42
|
const newChannels = { ...channels };
|
|
38
43
|
for (const [from, to] of Object.entries(options)) {
|