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
package/dist/transforms/stack.js
CHANGED
|
@@ -2,7 +2,7 @@ import isDataRecord from '../helpers/isDataRecord.js';
|
|
|
2
2
|
import { resolveChannel, resolveProp } from '../helpers/resolve.js';
|
|
3
3
|
import { stack, stackOffsetExpand, stackOffsetSilhouette, stackOffsetWiggle, stackOrderAppearance, stackOrderAscending, stackOrderInsideOut, stackOrderNone, stackOffsetDiverging } from 'd3-shape';
|
|
4
4
|
import { sum, groups as d3Groups, min, range } from 'd3-array';
|
|
5
|
-
import { groupFacetsAndZ } from '../helpers/group';
|
|
5
|
+
import { groupFacetsAndZ } from '../helpers/group.js';
|
|
6
6
|
import { filter } from './filter.js';
|
|
7
7
|
import { sort } from './sort.js';
|
|
8
8
|
import { INDEX, ORIGINAL_NAME_KEYS } from '../constants.js';
|
|
@@ -55,7 +55,7 @@ function stackXY(byDim, data, channels, options) {
|
|
|
55
55
|
channels[`${byLow}`] === undefined &&
|
|
56
56
|
channels[`${byHigh}`] === undefined) {
|
|
57
57
|
// resolve all channels for easier computation below
|
|
58
|
-
const resolvedData = indexData(data).map((d
|
|
58
|
+
const resolvedData = indexData(data).map((d) => ({
|
|
59
59
|
...(isDataRecord(d) ? d : { [RAW_VALUE]: d }),
|
|
60
60
|
[S[secondDim]]: resolveChannel(secondDim, d, channels),
|
|
61
61
|
[GROUP]: groupBy === true ? 'G' : resolveChannel(groupBy, d, channels),
|
|
@@ -91,7 +91,7 @@ function stackXY(byDim, data, channels, options) {
|
|
|
91
91
|
// Unit stacking: map each secondary-dimension bucket to an array of values.
|
|
92
92
|
// Series are positional (0..N-1) within each bucket.
|
|
93
93
|
let maxKeys = 0;
|
|
94
|
-
stackData = groupedBySecondDim.map(([
|
|
94
|
+
stackData = groupedBySecondDim.map(([_k, items]) => {
|
|
95
95
|
const values = items
|
|
96
96
|
// keep original order within bucket; no stable series identity across buckets
|
|
97
97
|
.map((d) => ({ i: d[INDEX], v: d[S[byDim]] }));
|
|
@@ -104,7 +104,7 @@ function stackXY(byDim, data, channels, options) {
|
|
|
104
104
|
else {
|
|
105
105
|
// Grouped stacking: keep consistent series identities using the group key
|
|
106
106
|
const keySet = new Set(facetData.map((d) => d[GROUP]));
|
|
107
|
-
stackData = groupedBySecondDim.map(([
|
|
107
|
+
stackData = groupedBySecondDim.map(([_k, items]) => {
|
|
108
108
|
const obj = {};
|
|
109
109
|
items.forEach((d) => {
|
|
110
110
|
const key = d[GROUP];
|
|
@@ -130,11 +130,11 @@ function stackXY(byDim, data, channels, options) {
|
|
|
130
130
|
const series = stack()
|
|
131
131
|
.order(stackOrder)
|
|
132
132
|
// Wiggle requires consistent series identities; fall back to 'center' for unit stacking
|
|
133
|
-
.offset(groupBy === true && options.offset === 'wiggle'
|
|
133
|
+
.offset((groupBy === true && options.offset === 'wiggle'
|
|
134
134
|
? STACK_OFFSET['center']
|
|
135
|
-
: STACK_OFFSET[options.offset])
|
|
135
|
+
: STACK_OFFSET[options.offset ?? 'none']))
|
|
136
136
|
.keys(keys)
|
|
137
|
-
.value((d, key,
|
|
137
|
+
.value((d, key, _i, _data) => {
|
|
138
138
|
return d[key]?.v == null ? undefined : d[key]?.v;
|
|
139
139
|
})(stackData);
|
|
140
140
|
// and combine it all back into a flat array
|
|
@@ -153,21 +153,28 @@ function stackXY(byDim, data, channels, options) {
|
|
|
153
153
|
...(typeof channels[byDim] === 'string' && !channels[ORIGINAL_NAME_KEYS[byDim]]
|
|
154
154
|
? { [ORIGINAL_NAME_KEYS[byDim]]: channels[byDim] }
|
|
155
155
|
: {}),
|
|
156
|
-
|
|
156
|
+
[byLow]: S[byLow],
|
|
157
|
+
[byHigh]: S[byHigh]
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
return { data, ...channels };
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* stacks data along the y dimension, producing y1 and y2 channels
|
|
164
|
+
*/
|
|
161
165
|
export function stackY({ data, ...channels }, opts = {}) {
|
|
162
166
|
return stackXY('y', data, channels, applyDefaults(opts));
|
|
163
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* stacks data along the x dimension, producing x1 and x2 channels
|
|
170
|
+
*/
|
|
164
171
|
export function stackX({ data, ...channels }, opts = {}) {
|
|
165
172
|
return stackXY('x', data, channels, applyDefaults(opts));
|
|
166
173
|
}
|
|
167
174
|
function applyDefaults(opts) {
|
|
168
175
|
if (opts === false)
|
|
169
176
|
return false;
|
|
170
|
-
if (opts.offset === 'wiggle' && opts.order === undefined) {
|
|
177
|
+
if (typeof opts === 'object' && opts.offset === 'wiggle' && opts.order === undefined) {
|
|
171
178
|
return { ...DEFAULT_STACK_OPTIONS, order: 'inside-out', ...opts };
|
|
172
179
|
}
|
|
173
180
|
return { ...DEFAULT_STACK_OPTIONS, ...opts };
|
|
@@ -198,13 +205,14 @@ function stackMosaic({ data, x, y, value, fx, fy, ...rest }, { outer, inner }, {
|
|
|
198
205
|
const innerOpt = inner === 'x' ? xOpt : yOpt;
|
|
199
206
|
const grouped = d3Groups(data, (d) => resolveProp(d[outerChannel], d));
|
|
200
207
|
const innerOrder = new Map(grouped[0][1].map((d, i) => [d[innerChannel], i]));
|
|
201
|
-
grouped.forEach(([
|
|
208
|
+
grouped.forEach(([_k, items], i) => {
|
|
202
209
|
const groupValue = sum(items, (d) => resolveProp(d[value], d));
|
|
203
210
|
const o1 = outerPos, o2 = outerPos + groupValue;
|
|
204
211
|
outerPos = o2;
|
|
205
212
|
let innerPos = 0;
|
|
206
213
|
(i
|
|
207
|
-
? items.sort((a, b) => innerOrder.get(a[innerChannel])
|
|
214
|
+
? items.sort((a, b) => (innerOrder.get(a[innerChannel]) ?? 0) -
|
|
215
|
+
(innerOrder.get(b[innerChannel]) ?? 0))
|
|
208
216
|
: items).forEach((d) => {
|
|
209
217
|
const iv = resolveProp(d[value], d);
|
|
210
218
|
const i1 = innerPos, i2 = innerPos + iv;
|
|
@@ -237,9 +245,17 @@ function stackMosaic({ data, x, y, value, fx, fy, ...rest }, { outer, inner }, {
|
|
|
237
245
|
y2: S.y2
|
|
238
246
|
};
|
|
239
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* creates a mosaic layout with the outer (width) dimension along x and
|
|
250
|
+
* the inner (height) dimension along y
|
|
251
|
+
*/
|
|
240
252
|
export function stackMosaicX(args, opts) {
|
|
241
253
|
return stackMosaic(args, { outer: 'x', inner: 'y' }, opts);
|
|
242
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* creates a mosaic layout with the outer (height) dimension along y and
|
|
257
|
+
* the inner (width) dimension along x
|
|
258
|
+
*/
|
|
243
259
|
export function stackMosaicY(args, opts) {
|
|
244
260
|
return stackMosaic(args, { outer: 'y', inner: 'x' }, opts);
|
|
245
261
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { type ReducerName } from '../helpers/reduce.js';
|
|
2
2
|
import type { DataRecord, TransformArg } from '../types/index.js';
|
|
3
|
-
type
|
|
3
|
+
export type WindowAnchor = 'start' | 'middle' | 'end';
|
|
4
|
+
export type WindowOptions = {
|
|
5
|
+
/** the window size (number of data points) */
|
|
4
6
|
k: number;
|
|
5
|
-
interval
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/** a time interval string to use instead of a fixed window size */
|
|
8
|
+
interval?: string;
|
|
9
|
+
/** where to align the window relative to the current data point */
|
|
10
|
+
anchor?: WindowAnchor;
|
|
11
|
+
/** the reducer function to apply within each window (e.g. "mean", "median", "sum") */
|
|
12
|
+
reduce?: ReducerName;
|
|
13
|
+
/** if true, return null when the window has fewer than k values */
|
|
14
|
+
strict?: boolean | number;
|
|
9
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* applies a sliding window reducer to the x channel
|
|
18
|
+
*/
|
|
10
19
|
export declare function windowX(args: TransformArg<DataRecord>, options: WindowOptions): {
|
|
11
20
|
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
12
21
|
facet?: "auto" | "include" | "exclude" | undefined;
|
|
@@ -18,6 +27,16 @@ export declare function windowX(args: TransformArg<DataRecord>, options: WindowO
|
|
|
18
27
|
dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
|
|
19
28
|
fill?: import("../types/channel.js").ChannelAccessor<Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
20
29
|
fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
30
|
+
fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
31
|
+
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", Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
32
|
+
fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
33
|
+
fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
34
|
+
fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
35
|
+
letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
36
|
+
wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
37
|
+
textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
38
|
+
textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
39
|
+
textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
21
40
|
sort?: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
|
|
22
41
|
channel: string;
|
|
23
42
|
order?: "ascending" | "descending";
|
|
@@ -31,50 +50,115 @@ export declare function windowX(args: TransformArg<DataRecord>, options: WindowO
|
|
|
31
50
|
opacity?: import("../types/channel.js").ChannelAccessor<Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
32
51
|
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
33
52
|
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
53
|
+
blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
34
54
|
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
35
55
|
clipPath?: string | undefined;
|
|
36
56
|
mask?: string | undefined;
|
|
37
57
|
imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
38
58
|
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
39
59
|
paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
40
|
-
onclick?:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
onclick?: ((event: Event & {
|
|
61
|
+
currentTarget: SVGPathElement;
|
|
62
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
63
|
+
ondblclick?: ((event: Event & {
|
|
64
|
+
currentTarget: SVGPathElement;
|
|
65
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
66
|
+
onmouseup?: ((event: Event & {
|
|
67
|
+
currentTarget: SVGPathElement;
|
|
68
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
69
|
+
onmousedown?: ((event: Event & {
|
|
70
|
+
currentTarget: SVGPathElement;
|
|
71
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
72
|
+
onmouseenter?: ((event: Event & {
|
|
73
|
+
currentTarget: SVGPathElement;
|
|
74
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
75
|
+
onmousemove?: ((event: Event & {
|
|
76
|
+
currentTarget: SVGPathElement;
|
|
77
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
78
|
+
onmouseleave?: ((event: Event & {
|
|
79
|
+
currentTarget: SVGPathElement;
|
|
80
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
81
|
+
onmouseout?: ((event: Event & {
|
|
82
|
+
currentTarget: SVGPathElement;
|
|
83
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
84
|
+
onmouseover?: ((event: Event & {
|
|
85
|
+
currentTarget: SVGPathElement;
|
|
86
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
87
|
+
onpointercancel?: ((event: Event & {
|
|
88
|
+
currentTarget: SVGPathElement;
|
|
89
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
90
|
+
onpointerdown?: ((event: Event & {
|
|
91
|
+
currentTarget: SVGPathElement;
|
|
92
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
93
|
+
onpointerup?: ((event: Event & {
|
|
94
|
+
currentTarget: SVGPathElement;
|
|
95
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
96
|
+
onpointerenter?: ((event: Event & {
|
|
97
|
+
currentTarget: SVGPathElement;
|
|
98
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
99
|
+
onpointerleave?: ((event: Event & {
|
|
100
|
+
currentTarget: SVGPathElement;
|
|
101
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
102
|
+
onpointermove?: ((event: Event & {
|
|
103
|
+
currentTarget: SVGPathElement;
|
|
104
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
105
|
+
onpointerover?: ((event: Event & {
|
|
106
|
+
currentTarget: SVGPathElement;
|
|
107
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
108
|
+
onpointerout?: ((event: Event & {
|
|
109
|
+
currentTarget: SVGPathElement;
|
|
110
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
111
|
+
ondrag?: ((event: Event & {
|
|
112
|
+
currentTarget: SVGPathElement;
|
|
113
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
114
|
+
ondrop?: ((event: Event & {
|
|
115
|
+
currentTarget: SVGPathElement;
|
|
116
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
117
|
+
ondragstart?: ((event: Event & {
|
|
118
|
+
currentTarget: SVGPathElement;
|
|
119
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
120
|
+
ondragenter?: ((event: Event & {
|
|
121
|
+
currentTarget: SVGPathElement;
|
|
122
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
123
|
+
ondragleave?: ((event: Event & {
|
|
124
|
+
currentTarget: SVGPathElement;
|
|
125
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
126
|
+
ondragover?: ((event: Event & {
|
|
127
|
+
currentTarget: SVGPathElement;
|
|
128
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
129
|
+
ondragend?: ((event: Event & {
|
|
130
|
+
currentTarget: SVGPathElement;
|
|
131
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
132
|
+
ontouchstart?: ((event: Event & {
|
|
133
|
+
currentTarget: SVGPathElement;
|
|
134
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
135
|
+
ontouchmove?: ((event: Event & {
|
|
136
|
+
currentTarget: SVGPathElement;
|
|
137
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
138
|
+
ontouchend?: ((event: Event & {
|
|
139
|
+
currentTarget: SVGPathElement;
|
|
140
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
141
|
+
ontouchcancel?: ((event: Event & {
|
|
142
|
+
currentTarget: SVGPathElement;
|
|
143
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
144
|
+
oncontextmenu?: ((event: Event & {
|
|
145
|
+
currentTarget: SVGPathElement;
|
|
146
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
147
|
+
onwheel?: ((event: Event & {
|
|
148
|
+
currentTarget: SVGPathElement;
|
|
149
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
70
150
|
class?: string | undefined;
|
|
71
151
|
style?: string | undefined;
|
|
72
152
|
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
153
|
+
title?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
73
154
|
data: {
|
|
74
155
|
[x: string]: import("../types/data.js").RawValue;
|
|
75
156
|
[x: symbol]: import("../types/data.js").RawValue;
|
|
76
157
|
}[];
|
|
77
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* applies a sliding window reducer to the y channel
|
|
161
|
+
*/
|
|
78
162
|
export declare function windowY(args: TransformArg<DataRecord>, options: WindowOptions): {
|
|
79
163
|
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
80
164
|
facet?: "auto" | "include" | "exclude" | undefined;
|
|
@@ -86,6 +170,16 @@ export declare function windowY(args: TransformArg<DataRecord>, options: WindowO
|
|
|
86
170
|
dodgeY?: import("./dodge.js").DodgeYOptions | undefined;
|
|
87
171
|
fill?: import("../types/channel.js").ChannelAccessor<Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
88
172
|
fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
173
|
+
fontFamily?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
174
|
+
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", Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
175
|
+
fontStyle?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
176
|
+
fontVariant?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
177
|
+
fontWeight?: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
178
|
+
letterSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
179
|
+
wordSpacing?: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
180
|
+
textAnchor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
181
|
+
textTransform?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
182
|
+
textDecoration?: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
89
183
|
sort?: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
|
|
90
184
|
channel: string;
|
|
91
185
|
order?: "ascending" | "descending";
|
|
@@ -99,48 +193,109 @@ export declare function windowY(args: TransformArg<DataRecord>, options: WindowO
|
|
|
99
193
|
opacity?: import("../types/channel.js").ChannelAccessor<Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
100
194
|
strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
101
195
|
strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
196
|
+
blend?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
102
197
|
mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
103
198
|
clipPath?: string | undefined;
|
|
104
199
|
mask?: string | undefined;
|
|
105
200
|
imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
106
201
|
shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
107
202
|
paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
108
|
-
onclick?:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
203
|
+
onclick?: ((event: Event & {
|
|
204
|
+
currentTarget: SVGPathElement;
|
|
205
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
206
|
+
ondblclick?: ((event: Event & {
|
|
207
|
+
currentTarget: SVGPathElement;
|
|
208
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
209
|
+
onmouseup?: ((event: Event & {
|
|
210
|
+
currentTarget: SVGPathElement;
|
|
211
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
212
|
+
onmousedown?: ((event: Event & {
|
|
213
|
+
currentTarget: SVGPathElement;
|
|
214
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
215
|
+
onmouseenter?: ((event: Event & {
|
|
216
|
+
currentTarget: SVGPathElement;
|
|
217
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
218
|
+
onmousemove?: ((event: Event & {
|
|
219
|
+
currentTarget: SVGPathElement;
|
|
220
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
221
|
+
onmouseleave?: ((event: Event & {
|
|
222
|
+
currentTarget: SVGPathElement;
|
|
223
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
224
|
+
onmouseout?: ((event: Event & {
|
|
225
|
+
currentTarget: SVGPathElement;
|
|
226
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
227
|
+
onmouseover?: ((event: Event & {
|
|
228
|
+
currentTarget: SVGPathElement;
|
|
229
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
230
|
+
onpointercancel?: ((event: Event & {
|
|
231
|
+
currentTarget: SVGPathElement;
|
|
232
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
233
|
+
onpointerdown?: ((event: Event & {
|
|
234
|
+
currentTarget: SVGPathElement;
|
|
235
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
236
|
+
onpointerup?: ((event: Event & {
|
|
237
|
+
currentTarget: SVGPathElement;
|
|
238
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
239
|
+
onpointerenter?: ((event: Event & {
|
|
240
|
+
currentTarget: SVGPathElement;
|
|
241
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
242
|
+
onpointerleave?: ((event: Event & {
|
|
243
|
+
currentTarget: SVGPathElement;
|
|
244
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
245
|
+
onpointermove?: ((event: Event & {
|
|
246
|
+
currentTarget: SVGPathElement;
|
|
247
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
248
|
+
onpointerover?: ((event: Event & {
|
|
249
|
+
currentTarget: SVGPathElement;
|
|
250
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
251
|
+
onpointerout?: ((event: Event & {
|
|
252
|
+
currentTarget: SVGPathElement;
|
|
253
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
254
|
+
ondrag?: ((event: Event & {
|
|
255
|
+
currentTarget: SVGPathElement;
|
|
256
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
257
|
+
ondrop?: ((event: Event & {
|
|
258
|
+
currentTarget: SVGPathElement;
|
|
259
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
260
|
+
ondragstart?: ((event: Event & {
|
|
261
|
+
currentTarget: SVGPathElement;
|
|
262
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
263
|
+
ondragenter?: ((event: Event & {
|
|
264
|
+
currentTarget: SVGPathElement;
|
|
265
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
266
|
+
ondragleave?: ((event: Event & {
|
|
267
|
+
currentTarget: SVGPathElement;
|
|
268
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
269
|
+
ondragover?: ((event: Event & {
|
|
270
|
+
currentTarget: SVGPathElement;
|
|
271
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
272
|
+
ondragend?: ((event: Event & {
|
|
273
|
+
currentTarget: SVGPathElement;
|
|
274
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
275
|
+
ontouchstart?: ((event: Event & {
|
|
276
|
+
currentTarget: SVGPathElement;
|
|
277
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
278
|
+
ontouchmove?: ((event: Event & {
|
|
279
|
+
currentTarget: SVGPathElement;
|
|
280
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
281
|
+
ontouchend?: ((event: Event & {
|
|
282
|
+
currentTarget: SVGPathElement;
|
|
283
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
284
|
+
ontouchcancel?: ((event: Event & {
|
|
285
|
+
currentTarget: SVGPathElement;
|
|
286
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
287
|
+
oncontextmenu?: ((event: Event & {
|
|
288
|
+
currentTarget: SVGPathElement;
|
|
289
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
290
|
+
onwheel?: ((event: Event & {
|
|
291
|
+
currentTarget: SVGPathElement;
|
|
292
|
+
}, datum: Record<string | symbol, import("../types/data.js").RawValue>, index: number) => void) | undefined;
|
|
138
293
|
class?: string | undefined;
|
|
139
294
|
style?: string | undefined;
|
|
140
295
|
cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
296
|
+
title?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data.js").RawValue>>;
|
|
141
297
|
data: {
|
|
142
298
|
[x: string]: import("../types/data.js").RawValue;
|
|
143
299
|
[x: symbol]: import("../types/data.js").RawValue;
|
|
144
300
|
}[];
|
|
145
301
|
};
|
|
146
|
-
export {};
|
|
@@ -3,16 +3,22 @@ import { isValid } from '../helpers/index.js';
|
|
|
3
3
|
import { mayberReducer } from '../helpers/reduce.js';
|
|
4
4
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
5
5
|
import { groups as d3Groups } from 'd3-array';
|
|
6
|
+
/**
|
|
7
|
+
* applies a sliding window reducer to the x channel
|
|
8
|
+
*/
|
|
6
9
|
export function windowX(args, options) {
|
|
7
10
|
return windowDim('x', args, options);
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* applies a sliding window reducer to the y channel
|
|
14
|
+
*/
|
|
9
15
|
export function windowY(args, options) {
|
|
10
16
|
return windowDim('y', args, options);
|
|
11
17
|
}
|
|
12
18
|
function windowDim(dim, { data, ...channels }, options) {
|
|
13
19
|
const { anchor = 'middle', reduce = 'mean', strict = false } = options;
|
|
14
|
-
let { k
|
|
15
|
-
interval = maybeInterval(interval
|
|
20
|
+
let { k } = options;
|
|
21
|
+
const interval = options.interval ? maybeInterval(options.interval) : undefined;
|
|
16
22
|
// we only change the data, but not the
|
|
17
23
|
if (!((k = Math.floor(k)) > 0))
|
|
18
24
|
throw new Error(`invalid k: ${k}`);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type * as CSS from 'csstype';
|
|
2
|
+
import type { ChannelAccessor, ConstantAccessor, DataRecord, RawValue } from './index.js';
|
|
3
|
+
export type AxisTextAnchor = 'start' | 'middle' | 'end';
|
|
4
|
+
export type AxisTickDatum<TKeyRaw extends symbol = symbol, TKeyIndex extends symbol = symbol> = DataRecord & {
|
|
5
|
+
[K in TKeyRaw]: RawValue;
|
|
6
|
+
} & {
|
|
7
|
+
[K in TKeyIndex]: number;
|
|
8
|
+
};
|
|
9
|
+
export type AxisXTick<TDatum extends DataRecord = DataRecord> = TDatum & {
|
|
10
|
+
hidden: boolean;
|
|
11
|
+
dx: number;
|
|
12
|
+
dy: number;
|
|
13
|
+
x: number;
|
|
14
|
+
text: string[];
|
|
15
|
+
element: SVGTextElement | null;
|
|
16
|
+
};
|
|
17
|
+
export type AxisYTick<TDatum extends DataRecord = DataRecord> = TDatum & {
|
|
18
|
+
hidden: boolean;
|
|
19
|
+
dx: number;
|
|
20
|
+
dy: number;
|
|
21
|
+
y: number;
|
|
22
|
+
text: string | string[];
|
|
23
|
+
element: SVGTextElement | null;
|
|
24
|
+
};
|
|
25
|
+
export type BaseAxisXOptions = Record<string | symbol, any> & {
|
|
26
|
+
dx?: ConstantAccessor<number>;
|
|
27
|
+
dy?: ConstantAccessor<number>;
|
|
28
|
+
filter?: ChannelAccessor;
|
|
29
|
+
wordwrap?: boolean;
|
|
30
|
+
fontWeight?: ConstantAccessor<CSS.Property.FontWeight>;
|
|
31
|
+
textAnchor?: ConstantAccessor<AxisTextAnchor> | 'auto';
|
|
32
|
+
removeDuplicateTicks?: boolean;
|
|
33
|
+
anchor?: ConstantAccessor<'start' | 'end'>;
|
|
34
|
+
style?: string;
|
|
35
|
+
};
|
|
36
|
+
export type BaseAxisYOptions = Record<string | symbol, any> & {
|
|
37
|
+
dx?: ConstantAccessor<number>;
|
|
38
|
+
dy?: ConstantAccessor<number>;
|
|
39
|
+
filter?: ChannelAccessor;
|
|
40
|
+
fontWeight?: ConstantAccessor<CSS.Property.FontWeight>;
|
|
41
|
+
textAnchor?: ConstantAccessor<AxisTextAnchor>;
|
|
42
|
+
style?: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/channel.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
import type { ConstantAccessor, RawValue } from './index.js';
|
|
2
|
-
|
|
2
|
+
/** a partial record of channel names to their accessor definitions */
|
|
3
|
+
export type Channels<T = Record<string | symbol, RawValue>> = Partial<Record<string | symbol, ChannelAccessor<T> | ConstantAccessor<RawValue, T>>>;
|
|
4
|
+
type BivariantCallback<TArgs extends unknown[], TResult> = {
|
|
5
|
+
bivarianceHack(...args: TArgs): TResult;
|
|
6
|
+
}['bivarianceHack'];
|
|
7
|
+
/** channel accessor callback receiving a typed datum */
|
|
8
|
+
export type ChannelValueAccessor<T = Record<string | symbol, RawValue>> = BivariantCallback<[
|
|
9
|
+
d: T,
|
|
10
|
+
index: number
|
|
11
|
+
], RawValue>;
|
|
12
|
+
/** plain objects are allowed as constants, except accessor option objects with `value`/`scale` keys */
|
|
13
|
+
export type ChannelConstantObject = object & {
|
|
14
|
+
value?: never;
|
|
15
|
+
scale?: never;
|
|
16
|
+
};
|
|
17
|
+
/** constant channel values (non-accessor) */
|
|
18
|
+
export type ChannelConstantValue = Exclude<RawValue, object> | Date | ChannelConstantObject | null | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* a channel accessor: either a simple channel value, or an object with
|
|
21
|
+
* a value and an optional scale override
|
|
22
|
+
*/
|
|
3
23
|
export type ChannelAccessor<T = Record<string | symbol, RawValue>> = ChannelValue<T> | {
|
|
4
24
|
/** the channel value */
|
|
5
25
|
value: ChannelValue<T>;
|
|
6
26
|
/** you can bypass the scale by passing null */
|
|
7
27
|
scale: boolean | null;
|
|
8
28
|
};
|
|
9
|
-
|
|
29
|
+
/**
|
|
30
|
+
* the value for a channel: a constant, a data field name, an accessor
|
|
31
|
+
* function, or null/undefined to leave the channel unset
|
|
32
|
+
*/
|
|
33
|
+
export type ChannelValue<T = Record<string | symbol, RawValue>> = ChannelConstantValue | keyof T | ChannelValueAccessor<T> | null | undefined;
|
|
34
|
+
/** the name of a channel that is bound to a scale */
|
|
10
35
|
export type ScaledChannelName = 'fill' | 'fillOpacity' | 'opacity' | 'r' | 'length' | 'stroke' | 'strokeOpacity' | 'symbol' | 'fx' | 'fy' | 'x' | 'x1' | 'x2' | 'y' | 'y1' | 'y2';
|
|
36
|
+
/** maps a scaled channel name to its output type (string for color/symbol, number otherwise) */
|
|
11
37
|
export type ScaledChannelType<T extends ScaledChannelName> = T extends 'fill' | 'stroke' | 'symbol' ? string : number;
|
|
38
|
+
/** all channel names, including non-scaled channels like z, sort, filter, and interval */
|
|
12
39
|
export type ChannelName = ScaledChannelName | 'z' | 'sort' | 'filter' | 'interval';
|
|
40
|
+
export {};
|