svelteplot 0.0.1-alpha.9 → 0.1.3-next.12
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/LICENSE.md +5 -0
- package/README.md +3 -35
- package/dist/Mark.svelte +292 -0
- package/dist/Mark.svelte.d.ts +22 -0
- package/dist/Plot.svelte +148 -156
- package/dist/Plot.svelte.d.ts +15 -15
- package/dist/constants.d.ts +15 -0
- package/dist/constants.js +110 -0
- package/dist/core/Facet.svelte +59 -0
- package/dist/core/Facet.svelte.d.ts +18 -0
- package/dist/core/FacetAxes.svelte +66 -0
- package/dist/core/FacetAxes.svelte.d.ts +4 -0
- package/dist/core/FacetGrid.svelte +86 -0
- package/dist/core/FacetGrid.svelte.d.ts +13 -0
- package/dist/core/Plot.svelte +568 -0
- package/dist/core/Plot.svelte.d.ts +14 -0
- package/dist/helpers/arrowPath.d.ts +14 -0
- package/dist/helpers/arrowPath.js +129 -0
- package/dist/helpers/autoProjection.d.ts +19 -0
- package/dist/helpers/autoProjection.js +87 -0
- package/dist/helpers/autoScales.d.ts +23 -0
- package/dist/helpers/autoScales.js +203 -0
- package/dist/helpers/autoTicks.d.ts +3 -0
- package/dist/helpers/autoTicks.js +40 -0
- package/dist/helpers/autoTimeFormat.d.ts +2 -2
- package/dist/helpers/autoTimeFormat.js +34 -5
- package/dist/helpers/callWithProps.d.ts +8 -0
- package/dist/helpers/callWithProps.js +13 -0
- package/dist/helpers/colors.js +17 -2
- package/dist/helpers/curves.d.ts +3 -0
- package/dist/helpers/curves.js +42 -0
- package/dist/helpers/data.d.ts +9 -0
- package/dist/helpers/data.js +16 -0
- package/dist/helpers/facets.d.ts +12 -0
- package/dist/helpers/facets.js +49 -0
- package/dist/helpers/formats.d.ts +3 -0
- package/dist/helpers/formats.js +3 -0
- package/dist/helpers/getBaseStyles.d.ts +7 -2
- package/dist/helpers/getBaseStyles.js +34 -10
- package/dist/helpers/getLogTicks.js +5 -5
- package/dist/helpers/group.d.ts +6 -0
- package/dist/helpers/group.js +53 -0
- package/dist/helpers/index.d.ts +18 -0
- package/dist/helpers/index.js +55 -0
- package/dist/helpers/isRawValue.d.ts +2 -0
- package/dist/helpers/isRawValue.js +5 -0
- package/dist/helpers/isValid.d.ts +6 -0
- package/dist/helpers/isValid.js +6 -0
- package/dist/helpers/math.d.ts +19 -0
- package/dist/helpers/math.js +116 -0
- package/dist/helpers/mergeDeep.d.ts +1 -1
- package/dist/helpers/noise.d.ts +1 -0
- package/dist/helpers/noise.js +72 -0
- package/dist/helpers/projection.d.ts +33 -0
- package/dist/helpers/projection.js +100 -0
- package/dist/helpers/reduce.d.ts +10 -0
- package/dist/helpers/reduce.js +85 -0
- package/dist/helpers/regressionLoess.d.ts +12 -0
- package/dist/helpers/regressionLoess.js +47 -0
- package/dist/helpers/removeIdenticalLines.d.ts +8 -1
- package/dist/helpers/removeIdenticalLines.js +14 -7
- package/dist/helpers/resolve.d.ts +21 -0
- package/dist/helpers/resolve.js +156 -0
- package/dist/helpers/roundedRect.d.ts +9 -0
- package/dist/helpers/roundedRect.js +31 -0
- package/dist/helpers/scales.d.ts +42 -0
- package/dist/helpers/scales.js +311 -0
- package/dist/helpers/time.d.ts +6 -0
- package/dist/helpers/time.js +282 -0
- package/dist/helpers/typeChecks.d.ts +8 -5
- package/dist/helpers/typeChecks.js +27 -6
- package/dist/index.d.ts +49 -1
- package/dist/index.js +53 -2
- package/dist/marks/Area.svelte +146 -0
- package/dist/marks/Area.svelte.d.ts +30 -0
- package/dist/marks/AreaX.svelte +27 -0
- package/dist/marks/AreaX.svelte.d.ts +12 -0
- package/dist/marks/AreaY.svelte +38 -0
- package/dist/marks/AreaY.svelte.d.ts +19 -0
- package/dist/marks/Arrow.svelte +139 -0
- package/dist/marks/Arrow.svelte.d.ts +44 -0
- package/dist/marks/AxisX.svelte +198 -93
- package/dist/marks/AxisX.svelte.d.ts +17 -16
- package/dist/marks/AxisY.svelte +176 -62
- package/dist/marks/AxisY.svelte.d.ts +17 -14
- package/dist/marks/BarX.svelte +93 -0
- package/dist/marks/BarX.svelte.d.ts +4 -0
- package/dist/marks/BarY.svelte +103 -0
- package/dist/marks/BarY.svelte.d.ts +25 -0
- package/dist/marks/BollingerX.svelte +44 -0
- package/dist/marks/BollingerX.svelte.d.ts +18 -0
- package/dist/marks/BollingerY.svelte +39 -0
- package/dist/marks/BollingerY.svelte.d.ts +18 -0
- package/dist/marks/BoxX.svelte +89 -0
- package/dist/marks/BoxX.svelte.d.ts +4 -0
- package/dist/marks/BoxY.svelte +110 -0
- package/dist/marks/BoxY.svelte.d.ts +29 -0
- package/dist/marks/Cell.svelte +110 -0
- package/dist/marks/Cell.svelte.d.ts +16 -0
- package/dist/marks/CellX.svelte +24 -0
- package/dist/marks/CellX.svelte.d.ts +3 -0
- package/dist/marks/CellY.svelte +24 -0
- package/dist/marks/CellY.svelte.d.ts +3 -0
- package/dist/marks/ColorLegend.svelte +148 -27
- package/dist/marks/ColorLegend.svelte.d.ts +12 -13
- package/dist/marks/CustomMark.svelte +43 -0
- package/dist/marks/CustomMark.svelte.d.ts +16 -0
- package/dist/marks/CustomMarkHTML.svelte +103 -0
- package/dist/marks/CustomMarkHTML.svelte.d.ts +17 -0
- package/dist/marks/DifferenceY.svelte +144 -0
- package/dist/marks/DifferenceY.svelte.d.ts +30 -0
- package/dist/marks/Dot.svelte +128 -73
- package/dist/marks/Dot.svelte.d.ts +24 -14
- package/dist/marks/DotX.svelte +15 -3
- package/dist/marks/DotX.svelte.d.ts +8 -16
- package/dist/marks/DotY.svelte +8 -3
- package/dist/marks/DotY.svelte.d.ts +5 -17
- package/dist/marks/Frame.svelte +39 -31
- package/dist/marks/Frame.svelte.d.ts +7 -14
- package/dist/marks/Geo.svelte +102 -0
- package/dist/marks/Geo.svelte.d.ts +10 -0
- package/dist/marks/Graticule.svelte +28 -0
- package/dist/marks/Graticule.svelte.d.ts +9 -0
- package/dist/marks/GridX.svelte +67 -36
- package/dist/marks/GridX.svelte.d.ts +7 -18
- package/dist/marks/GridY.svelte +64 -25
- package/dist/marks/GridY.svelte.d.ts +7 -14
- package/dist/marks/HTMLTooltip.svelte +91 -0
- package/dist/marks/HTMLTooltip.svelte.d.ts +11 -0
- package/dist/marks/Line.svelte +219 -58
- package/dist/marks/Line.svelte.d.ts +30 -14
- package/dist/marks/LineX.svelte +8 -8
- package/dist/marks/LineX.svelte.d.ts +4 -17
- package/dist/marks/LineY.svelte +7 -8
- package/dist/marks/LineY.svelte.d.ts +4 -17
- package/dist/marks/Link.svelte +180 -0
- package/dist/marks/Link.svelte.d.ts +21 -0
- package/dist/marks/Pointer.svelte +126 -0
- package/dist/marks/Pointer.svelte.d.ts +23 -0
- package/dist/marks/Rect.svelte +103 -0
- package/dist/marks/Rect.svelte.d.ts +15 -0
- package/dist/marks/RectX.svelte +33 -0
- package/dist/marks/RectX.svelte.d.ts +15 -0
- package/dist/marks/RectY.svelte +33 -0
- package/dist/marks/RectY.svelte.d.ts +15 -0
- package/dist/marks/RegressionX.svelte +26 -0
- package/dist/marks/RegressionX.svelte.d.ts +4 -0
- package/dist/marks/RegressionY.svelte +26 -0
- package/dist/marks/RegressionY.svelte.d.ts +4 -0
- package/dist/marks/RuleX.svelte +52 -28
- package/dist/marks/RuleX.svelte.d.ts +14 -14
- package/dist/marks/RuleY.svelte +52 -28
- package/dist/marks/RuleY.svelte.d.ts +14 -14
- package/dist/marks/Sphere.svelte +8 -0
- package/dist/marks/Sphere.svelte.d.ts +51 -0
- package/dist/marks/Spike.svelte +15 -0
- package/dist/marks/Spike.svelte.d.ts +4 -0
- package/dist/marks/SymbolLegend.svelte +27 -12
- package/dist/marks/SymbolLegend.svelte.d.ts +8 -14
- package/dist/marks/Text.svelte +189 -0
- package/dist/marks/Text.svelte.d.ts +26 -0
- package/dist/marks/TickX.svelte +89 -0
- package/dist/marks/TickX.svelte.d.ts +22 -0
- package/dist/marks/TickY.svelte +90 -0
- package/dist/marks/TickY.svelte.d.ts +22 -0
- package/dist/marks/Vector.svelte +219 -0
- package/dist/marks/Vector.svelte.d.ts +31 -0
- package/dist/marks/helpers/BaseAxisX.svelte +210 -0
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +24 -0
- package/dist/marks/helpers/BaseAxisY.svelte +187 -0
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +23 -0
- package/dist/marks/helpers/CanvasLayer.svelte +38 -0
- package/dist/marks/helpers/CanvasLayer.svelte.d.ts +13 -0
- package/dist/marks/helpers/DotCanvas.svelte +184 -0
- package/dist/marks/helpers/DotCanvas.svelte.d.ts +11 -0
- package/dist/marks/helpers/GeoCanvas.svelte +165 -0
- package/dist/marks/helpers/GeoCanvas.svelte.d.ts +13 -0
- package/dist/marks/helpers/GroupMultiple.svelte +17 -0
- package/dist/marks/helpers/GroupMultiple.svelte.d.ts +9 -0
- package/dist/marks/helpers/Marker.svelte +93 -0
- package/dist/marks/helpers/Marker.svelte.d.ts +10 -0
- package/dist/marks/helpers/MarkerPath.svelte +141 -0
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +44 -0
- package/dist/marks/helpers/Regression.svelte +174 -0
- package/dist/marks/helpers/Regression.svelte.d.ts +26 -0
- package/dist/marks/helpers/events.d.ts +8 -0
- package/dist/marks/helpers/events.js +74 -0
- package/dist/transforms/bin.d.ts +51 -0
- package/dist/transforms/bin.js +171 -0
- package/dist/transforms/bollinger.d.ts +21 -0
- package/dist/transforms/bollinger.js +53 -0
- package/dist/transforms/centroid.d.ts +9 -0
- package/dist/transforms/centroid.js +13 -0
- package/dist/transforms/facet.d.ts +1 -0
- package/dist/transforms/facet.js +1 -0
- package/dist/transforms/filter.d.ts +2 -0
- package/dist/transforms/filter.js +8 -0
- package/dist/transforms/group.d.ts +66 -0
- package/dist/transforms/group.js +109 -0
- package/dist/transforms/interval.d.ts +11 -0
- package/dist/transforms/interval.js +34 -0
- package/dist/transforms/jitter.d.ts +1 -0
- package/dist/transforms/jitter.js +1 -0
- package/dist/transforms/map.d.ts +10 -0
- package/dist/transforms/map.js +89 -0
- package/dist/transforms/normalize.d.ts +9 -0
- package/dist/transforms/normalize.js +86 -0
- package/dist/transforms/recordize.d.ts +15 -0
- package/dist/transforms/recordize.js +78 -0
- package/dist/transforms/rename.d.ts +14 -0
- package/dist/transforms/rename.js +42 -0
- package/dist/transforms/select.d.ts +35 -0
- package/dist/transforms/select.js +55 -0
- package/dist/transforms/shift.d.ts +13 -0
- package/dist/transforms/shift.js +45 -0
- package/dist/transforms/sort.d.ts +28 -0
- package/dist/transforms/sort.js +66 -0
- package/dist/transforms/stack.d.ts +10 -0
- package/dist/transforms/stack.js +110 -0
- package/dist/transforms/window.d.ts +24 -0
- package/dist/transforms/window.js +73 -0
- package/dist/types.d.ts +625 -188
- package/dist/ui/Checkbox.svelte +6 -0
- package/dist/ui/Checkbox.svelte.d.ts +13 -0
- package/dist/ui/RadioInput.svelte +27 -0
- package/dist/ui/RadioInput.svelte.d.ts +9 -0
- package/dist/ui/Select.svelte +27 -0
- package/dist/ui/Select.svelte.d.ts +9 -0
- package/dist/ui/Slider.svelte +47 -0
- package/dist/ui/Slider.svelte.d.ts +11 -0
- package/dist/ui/Spiral.svelte +46 -0
- package/dist/ui/Spiral.svelte.d.ts +15 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +4 -0
- package/package.json +81 -42
- package/LICENSE +0 -11
- package/dist/classes/Channel.svelte.js +0 -74
- package/dist/classes/Mark.svelte.js +0 -17
- package/dist/classes/Plot.svelte.js +0 -98
- package/dist/contants.d.ts +0 -3
- package/dist/contants.js +0 -40
- package/dist/helpers/GroupMultiple.svelte +0 -8
- package/dist/helpers/GroupMultiple.svelte.d.ts +0 -19
- package/dist/helpers/createScale.d.ts +0 -5
- package/dist/helpers/createScale.js +0 -57
- package/dist/helpers/resolveChannel.d.ts +0 -2
- package/dist/helpers/resolveChannel.js +0 -28
- package/dist/helpers/wrapArray.d.ts +0 -2
- package/dist/helpers/wrapArray.js +0 -4
- package/dist/marks/BaseMark.svelte +0 -22
- package/dist/marks/BaseMark.svelte.d.ts +0 -19
package/dist/types.d.ts
CHANGED
|
@@ -1,198 +1,635 @@
|
|
|
1
|
+
import type { ScaleBand, ScaleLinear, ScaleOrdinal } from 'd3-scale';
|
|
1
2
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { CHANNEL_TYPES } from './contants.js';
|
|
3
|
-
import type { Plot } from './classes/Plot.svelte';
|
|
4
3
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
4
|
+
import type { MarkerShape } from './marks/helpers/Marker.svelte';
|
|
5
|
+
import type { Writable } from 'svelte/store';
|
|
6
|
+
export type MarkType = 'area' | 'arrow' | 'axisX' | 'axisY' | 'barX' | 'barY' | 'cell' | 'dot' | 'vector' | 'frame' | 'geo' | 'gridX' | 'gridY' | 'line' | 'rect' | 'regression' | 'ruleX' | 'ruleY' | 'swoopyArrow' | 'text' | 'tickX' | 'tickY';
|
|
7
|
+
export type ScaleName = 'x' | 'y' | 'r' | 'color' | 'opacity' | 'length' | 'symbol' | 'fx' | 'fy' | 'projection';
|
|
8
|
+
export type ScaleType = 'linear' | 'pow' | 'sqrt' | 'log' | 'symlog' | 'time' | 'point' | 'ordinal' | 'sequential' | 'band' | 'categorical' | 'cyclical' | 'threshold' | 'quantile-cont' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
|
|
9
|
+
export type Mark<T> = {
|
|
10
|
+
id: symbol;
|
|
11
|
+
type: MarkType;
|
|
12
|
+
channels: ScaledChannelName[];
|
|
13
|
+
scales: Set<ScaleName>;
|
|
14
|
+
data: DataRecord[];
|
|
15
|
+
options: T;
|
|
16
|
+
};
|
|
17
|
+
export type ScaledChannelName = 'fill' | 'fillOpacity' | 'opacity' | 'r' | 'length' | 'stroke' | 'strokeOpacity' | 'symbol' | 'fx' | 'fy' | 'x' | 'x1' | 'x2' | 'y' | 'y1' | 'y2';
|
|
18
|
+
export type ChannelName = ScaledChannelName | 'z' | 'sort' | 'filter' | 'interval';
|
|
19
|
+
export type RawValue = number | Date | boolean | string;
|
|
20
|
+
export type ScaleOptions = {
|
|
21
|
+
/**
|
|
22
|
+
* Override the automatic scale type detection.
|
|
23
|
+
*/
|
|
24
|
+
type: ScaleType | 'auto';
|
|
25
|
+
/**
|
|
26
|
+
* Set a custom domain for the scale instead of auto-computing the domain
|
|
27
|
+
* from the mark data channels.
|
|
28
|
+
*/
|
|
29
|
+
domain?: RawValue[];
|
|
30
|
+
/**
|
|
31
|
+
* Set a custom range for the scale.
|
|
32
|
+
*/
|
|
33
|
+
range?: RawValue[];
|
|
34
|
+
/**
|
|
35
|
+
* Reverse the scale.
|
|
36
|
+
*/
|
|
37
|
+
reverse: boolean;
|
|
38
|
+
label?: string;
|
|
39
|
+
interval?: string | number;
|
|
40
|
+
clamp: boolean;
|
|
41
|
+
nice: boolean;
|
|
42
|
+
zero: boolean;
|
|
43
|
+
round: boolean;
|
|
44
|
+
percent: boolean;
|
|
45
|
+
transform?: (d: RawValue) => RawValue;
|
|
46
|
+
/**
|
|
47
|
+
* set the padding for band scales
|
|
48
|
+
*/
|
|
49
|
+
padding: number;
|
|
50
|
+
/**
|
|
51
|
+
* set the align for band or point scales
|
|
52
|
+
*/
|
|
53
|
+
align: number;
|
|
54
|
+
/**
|
|
55
|
+
* set the inner padding for band scales
|
|
56
|
+
*/
|
|
57
|
+
paddingInner?: number;
|
|
58
|
+
/**
|
|
59
|
+
* set the outer padding for band scales
|
|
60
|
+
*/
|
|
61
|
+
paddingOuter?: number;
|
|
62
|
+
insetLeft?: number;
|
|
63
|
+
insetRight?: number;
|
|
64
|
+
insetTop?: number;
|
|
65
|
+
insetBottom?: number;
|
|
66
|
+
ticks?: (number | Date)[];
|
|
67
|
+
tickSpacing: number;
|
|
68
|
+
base?: number;
|
|
69
|
+
sort?: ChannelAccessor | ((a: RawValue, b: RawValue) => number) | {
|
|
70
|
+
channel: string;
|
|
71
|
+
order: 'ascending' | 'descending';
|
|
72
|
+
};
|
|
73
|
+
constant?: number;
|
|
74
|
+
};
|
|
75
|
+
export type ColorScaleOptions = ScaleOptions & {
|
|
76
|
+
legend: boolean;
|
|
77
|
+
type: ScaleType | 'categorical' | 'sequential' | 'cyclical' | 'threshold' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
|
|
78
|
+
scheme: string;
|
|
79
|
+
/**
|
|
80
|
+
* fallback color used for null/undefined
|
|
81
|
+
*/
|
|
82
|
+
unknown: string;
|
|
83
|
+
/**
|
|
84
|
+
* center value for diverging scales
|
|
85
|
+
*/
|
|
86
|
+
pivot: number;
|
|
87
|
+
/**
|
|
88
|
+
* number of colors for quantize and quantile-threshold scales
|
|
89
|
+
*/
|
|
90
|
+
n: number;
|
|
91
|
+
interpolate: (d: any) => typeof d;
|
|
38
92
|
};
|
|
39
93
|
export type AxisXAnchor = 'bottom' | 'top' | 'both';
|
|
40
94
|
export type AxisYAnchor = 'left' | 'right' | 'both';
|
|
41
|
-
export type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
95
|
+
export type XScaleOptions = ScaleOptions & {
|
|
96
|
+
/**
|
|
97
|
+
* Activate the implicit GridX mark. For more control over the grid styling
|
|
98
|
+
* and layering, add an explicit GridX mark to your plot instead of using the
|
|
99
|
+
* implicit grids.
|
|
100
|
+
*/
|
|
101
|
+
grid: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Controls the position of the implicit AxisX mark, or set to false to disable
|
|
104
|
+
* the implicit AxisX mark. For more control over the axis styling and layering
|
|
105
|
+
* add an explicit AxisX mark to your plot instead of using the implicit axes.
|
|
106
|
+
*/
|
|
107
|
+
axis: AxisXAnchor | false;
|
|
108
|
+
/**
|
|
109
|
+
* rotate the axis ticks
|
|
110
|
+
*/
|
|
111
|
+
tickRotate: number;
|
|
112
|
+
labelAnchor: 'auto' | 'left' | 'center' | 'right';
|
|
113
|
+
tickFormat: 'auto' | string | ((d: RawValue) => string);
|
|
114
|
+
};
|
|
115
|
+
export type YScaleOptions = ScaleOptions & {
|
|
116
|
+
/**
|
|
117
|
+
* Activate the implicit GridY mark. For more control over the grid styling
|
|
118
|
+
* and layering, add an explicit GridY mark to your plot instead of using the
|
|
119
|
+
* implicit grids.
|
|
120
|
+
*/
|
|
121
|
+
grid: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Controls the position of the implicit AxisY mark, or set to false to disable
|
|
124
|
+
* the implicit AxisY mark. For more control over the axis styling and layering
|
|
125
|
+
* add an explicit AxisY mark to your plot instead of using the implicit axes.
|
|
126
|
+
*/
|
|
127
|
+
axis: AxisYAnchor | false;
|
|
128
|
+
tickFormat: string | ((d: RawValue) => string);
|
|
129
|
+
/**
|
|
130
|
+
* rotate the axis ticks
|
|
131
|
+
*/
|
|
132
|
+
tickRotate: number;
|
|
133
|
+
labelAnchor: 'auto' | 'bottom' | 'middle' | 'top';
|
|
134
|
+
};
|
|
135
|
+
export type LegendScaleOptions = ScaleOptions & {
|
|
136
|
+
legend: boolean;
|
|
137
|
+
};
|
|
138
|
+
export type PlotOptions = {
|
|
139
|
+
/**
|
|
140
|
+
* The plot title, rendered as H2 tag above the SVG element. Instead of
|
|
141
|
+
* using the title, you can also pass a "header" snippet and render your
|
|
142
|
+
* own custom title markup.
|
|
143
|
+
*/
|
|
144
|
+
title: string;
|
|
145
|
+
/**
|
|
146
|
+
* The plot subtitle, rendered as H3 tag above the SVG element. Instead of
|
|
147
|
+
* using the subtitle, you can also pass a "header" snippet and render your
|
|
148
|
+
* own custom title markup.
|
|
149
|
+
*/
|
|
150
|
+
subtitle: string;
|
|
151
|
+
/**
|
|
152
|
+
* The plot caption, rendered as FIGCAPTION tag below the SVG element. Instead of
|
|
153
|
+
* using the caption, you can also pass a "footer" snippet and render your
|
|
154
|
+
* own custom title markup.
|
|
155
|
+
*/
|
|
156
|
+
caption: string;
|
|
157
|
+
/**
|
|
158
|
+
* By default, the plot will extend to fit 100% of the parent container width. By
|
|
159
|
+
* setting the maxWidth style property you can limit the width of your plot.
|
|
160
|
+
*/
|
|
56
161
|
maxWidth?: string;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
r
|
|
135
|
-
|
|
136
|
-
|
|
162
|
+
/**
|
|
163
|
+
* force the plot into a fixed height
|
|
164
|
+
*/
|
|
165
|
+
height: 'auto' | number | ((d: number) => number);
|
|
166
|
+
/**
|
|
167
|
+
* Convenience option for setting all four margins at once, in px.
|
|
168
|
+
*/
|
|
169
|
+
margin: number;
|
|
170
|
+
/**
|
|
171
|
+
* Left margin of the plot, in px.
|
|
172
|
+
*/
|
|
173
|
+
marginLeft: number;
|
|
174
|
+
/**
|
|
175
|
+
* Right margin of the plot, in px.
|
|
176
|
+
*/
|
|
177
|
+
marginRight: number;
|
|
178
|
+
/**
|
|
179
|
+
* Top margin of the plot, in px.
|
|
180
|
+
*/
|
|
181
|
+
marginTop: number;
|
|
182
|
+
/**
|
|
183
|
+
* Bottom margin of the plot, in px.
|
|
184
|
+
*/
|
|
185
|
+
marginBottom: number;
|
|
186
|
+
/**
|
|
187
|
+
* Activates the implicit GridX and GridY marks.
|
|
188
|
+
*/
|
|
189
|
+
grid: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Activates the implicit AxisX and AxisY marks.
|
|
192
|
+
*/
|
|
193
|
+
axes: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Activates the implicit frame marks
|
|
196
|
+
*/
|
|
197
|
+
frame: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Convenience shortcut for setting both the x and y scale insets.
|
|
200
|
+
*/
|
|
201
|
+
inset: number;
|
|
202
|
+
/**
|
|
203
|
+
* Convenience shortcut for setting both the x and y scale paddings
|
|
204
|
+
*/
|
|
205
|
+
padding: number;
|
|
206
|
+
/**
|
|
207
|
+
* Geo-projection
|
|
208
|
+
*/
|
|
209
|
+
projection: string | null;
|
|
210
|
+
/**
|
|
211
|
+
* if not null, computes a default height such that a variation of one
|
|
212
|
+
* unit in the x dimension is represented by the corresponding number
|
|
213
|
+
* of pixels as a variation in the y dimension of one unit.
|
|
214
|
+
*/
|
|
215
|
+
aspectRatio: number | null;
|
|
216
|
+
/**
|
|
217
|
+
* Top-level faceting options
|
|
218
|
+
*/
|
|
219
|
+
facet: Partial<{
|
|
220
|
+
/**
|
|
221
|
+
* The data to facet by. Turns on automatic faceting for all marks that
|
|
222
|
+
* use the exact same data (===)
|
|
223
|
+
*/
|
|
224
|
+
data: DataRecord[];
|
|
225
|
+
x: ChannelAccessor;
|
|
226
|
+
y: ChannelAccessor;
|
|
227
|
+
}>;
|
|
228
|
+
/**
|
|
229
|
+
* Options for the shared x scale.
|
|
230
|
+
*/
|
|
231
|
+
x: Partial<XScaleOptions>;
|
|
232
|
+
/**
|
|
233
|
+
* Options for the shared y scale
|
|
234
|
+
*/
|
|
235
|
+
y: Partial<YScaleOptions>;
|
|
236
|
+
/**
|
|
237
|
+
* Options for the shared radius scale
|
|
238
|
+
*/
|
|
239
|
+
r: ScaleOptions;
|
|
240
|
+
color: ColorScaleOptions;
|
|
241
|
+
opacity: ScaleOptions;
|
|
242
|
+
symbol: LegendScaleOptions;
|
|
243
|
+
length: ScaleOptions;
|
|
244
|
+
fx: Partial<ScaleOptions>;
|
|
245
|
+
fy: Partial<ScaleOptions>;
|
|
246
|
+
children: Snippet<[
|
|
247
|
+
{
|
|
248
|
+
width: number;
|
|
249
|
+
height: number;
|
|
250
|
+
options: PlotOptions;
|
|
251
|
+
scales: PlotScales;
|
|
252
|
+
}
|
|
253
|
+
]>;
|
|
254
|
+
/**
|
|
255
|
+
* You can use the header snippet to render a custom title and subtitle for
|
|
256
|
+
* your plot, or place a legend above the visualization.
|
|
257
|
+
*/
|
|
258
|
+
header: Snippet;
|
|
259
|
+
footer: Snippet;
|
|
260
|
+
/**
|
|
261
|
+
* The underlay snippet is useful for adding a layer of custom HTML markup
|
|
262
|
+
* behind the SVG body of your plot, e.g. for a watermark or background image.
|
|
263
|
+
*/
|
|
264
|
+
underlay: Snippet<[PlotOptions]>;
|
|
265
|
+
/**
|
|
266
|
+
* The overlay snippet is useful for adding a layer of custom HTML markup
|
|
267
|
+
* in front of the SVG body of your plot, e.g. for HTML tooltips.
|
|
268
|
+
*/
|
|
269
|
+
overlay: Snippet;
|
|
270
|
+
facetAxes: Snippet;
|
|
271
|
+
/**
|
|
272
|
+
* if you set testid, the plot container will get a data-testid attribute which
|
|
273
|
+
* can be useful for automatic testing
|
|
274
|
+
*/
|
|
275
|
+
testid: string;
|
|
276
|
+
/**
|
|
277
|
+
* in case you want to give your Plot element an extra CSS class
|
|
278
|
+
*/
|
|
279
|
+
class: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* if set to true, the plot will use the implicit scales
|
|
282
|
+
*/
|
|
283
|
+
implicitScales: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* locale used for automatic axis ticks
|
|
286
|
+
*/
|
|
287
|
+
locale: string;
|
|
288
|
+
/**
|
|
289
|
+
*
|
|
290
|
+
*/
|
|
291
|
+
css: (d: string) => string;
|
|
292
|
+
};
|
|
293
|
+
export type PlotDefaults = {
|
|
294
|
+
axisXAnchor: AxisXAnchor;
|
|
295
|
+
axisYAnchor: AxisYAnchor;
|
|
296
|
+
xTickSpacing: number;
|
|
297
|
+
yTickSpacing: number;
|
|
298
|
+
height: number;
|
|
299
|
+
inset: number;
|
|
300
|
+
colorScheme: ColorScheme | string[];
|
|
301
|
+
categoricalColorScheme: ColorScheme | string[];
|
|
302
|
+
dotRadius: number;
|
|
303
|
+
/**
|
|
304
|
+
* for computing the automatic height based on the number of
|
|
305
|
+
* domain items in a point scale
|
|
306
|
+
*/
|
|
307
|
+
pointScaleHeight: number;
|
|
308
|
+
/**
|
|
309
|
+
* for computing the automatic height based on the number of
|
|
310
|
+
* domain items in a band scale
|
|
311
|
+
*/
|
|
312
|
+
bandScaleHeight: number;
|
|
313
|
+
/**
|
|
314
|
+
* add frame to plots by default
|
|
315
|
+
*/
|
|
316
|
+
frame: boolean;
|
|
317
|
+
grid: boolean;
|
|
318
|
+
axes: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* initial width of the plot before measuring the actual width
|
|
321
|
+
*/
|
|
322
|
+
initialWidth: number;
|
|
323
|
+
/**
|
|
324
|
+
* locale, used for automatic axis ticks
|
|
325
|
+
*/
|
|
326
|
+
locale: string;
|
|
327
|
+
/**
|
|
328
|
+
* default number format for axis ticks
|
|
329
|
+
*/
|
|
330
|
+
numberFormat: Intl.NumberFormatOptions;
|
|
331
|
+
markerDotRadius: number;
|
|
332
|
+
};
|
|
333
|
+
export type GenericMarkOptions = Record<string, any>;
|
|
334
|
+
export type DataRecord = Record<string | symbol, RawValue> & {
|
|
335
|
+
___orig___?: RawValue | [RawValue, RawValue];
|
|
336
|
+
};
|
|
337
|
+
export type ResolvedDataRecord = Partial<Record<ScaledChannelName, any>> & {
|
|
338
|
+
datum: DataRecord;
|
|
339
|
+
};
|
|
340
|
+
export type ScaledDataRecord = Partial<Record<ScaledChannelName, number | string | boolean | undefined>> & {
|
|
341
|
+
datum: DataRecord;
|
|
342
|
+
valid: Boolean;
|
|
137
343
|
};
|
|
138
|
-
export type
|
|
344
|
+
export type DataRow = DataRecord | RawValue | [number, number] | null;
|
|
345
|
+
export type PlotScale = {
|
|
346
|
+
type: ScaleType;
|
|
347
|
+
domain: RawValue[];
|
|
348
|
+
range: RawValue[];
|
|
349
|
+
autoTitle?: string;
|
|
350
|
+
/**
|
|
351
|
+
* The number of marks that are using this scale.
|
|
352
|
+
*/
|
|
353
|
+
manualActiveMarks: number;
|
|
354
|
+
/**
|
|
355
|
+
* Set of accessors used in channels that are bound to this scale.
|
|
356
|
+
*/
|
|
357
|
+
uniqueScaleProps: Set<ChannelAccessor>;
|
|
358
|
+
skip: Map<ScaledChannelName, Set<symbol>>;
|
|
359
|
+
fn: ScaleLinear<RawValue, number> & ScaleBand<RawValue> & ScaleOrdinal<string | Date, number> & ScaleOrdinal<string | Date, string>;
|
|
360
|
+
};
|
|
361
|
+
export type CurveName = 'basis' | 'basis-closed' | 'basis-open' | 'bundle' | 'bump-x' | 'bump-y' | 'cardinal' | 'cardinal-closed' | 'cardinal-open' | 'catmull-rom' | 'catmull-rom-closed' | 'catmull-rom-open' | 'linear' | 'linear-closed' | 'monotone-x' | 'monotone-y' | 'natural' | 'step' | 'step-after' | 'step-before';
|
|
362
|
+
export type MarkerOptions = {
|
|
363
|
+
/**
|
|
364
|
+
* the marker for the starting point of a line segment
|
|
365
|
+
*/
|
|
366
|
+
markerStart?: boolean | MarkerShape | Snippet;
|
|
367
|
+
/**
|
|
368
|
+
* the marker for any intermediate point of a line segment
|
|
369
|
+
*/
|
|
370
|
+
markerMid?: boolean | MarkerShape | Snippet;
|
|
371
|
+
/**
|
|
372
|
+
* the marker for the end point of a line segment
|
|
373
|
+
*/
|
|
374
|
+
markerEnd?: boolean | MarkerShape | Snippet;
|
|
375
|
+
/**
|
|
376
|
+
* shorthand for setting the marker on all points
|
|
377
|
+
*/
|
|
378
|
+
marker?: boolean | MarkerShape | Snippet;
|
|
379
|
+
};
|
|
380
|
+
export type PlotScales = Record<ScaleName, PlotScale>;
|
|
381
|
+
export type ChannelAccessor = RawValue | ((d: DataRow) => RawValue) | null | undefined;
|
|
382
|
+
export type ConstantAccessor<T> = T | ((d: DataRow) => T) | null | undefined;
|
|
383
|
+
export type PlotState = {
|
|
384
|
+
width: number;
|
|
385
|
+
height: number;
|
|
386
|
+
options: PlotOptions;
|
|
387
|
+
facetWidth: number;
|
|
388
|
+
facetHeight: number;
|
|
389
|
+
plotWidth: number;
|
|
390
|
+
plotHeight: number;
|
|
391
|
+
scales: PlotScales;
|
|
392
|
+
body: HTMLDivElement;
|
|
393
|
+
/**
|
|
394
|
+
* True if there's a color scale and a symbol scale and both are bound to the same
|
|
395
|
+
* single channel accessor.
|
|
396
|
+
*/
|
|
397
|
+
colorSymbolRedundant: boolean;
|
|
398
|
+
/**
|
|
399
|
+
* True if the plot is using filled dot marks.
|
|
400
|
+
*/
|
|
401
|
+
hasFilledDotMarks: boolean;
|
|
402
|
+
css: ((d: string) => string) | null;
|
|
403
|
+
};
|
|
404
|
+
export type PlotContext = {
|
|
405
|
+
/**
|
|
406
|
+
* Registers a mark with the Plot component along with its
|
|
407
|
+
* data and the channel mappings.
|
|
408
|
+
*/
|
|
409
|
+
addMark: (mark: Mark<GenericMarkOptions>) => Mark<GenericMarkOptions>;
|
|
410
|
+
/**
|
|
411
|
+
* Updates a mark after either the data or the channel mappings
|
|
412
|
+
* have been updated.
|
|
413
|
+
*/
|
|
414
|
+
updateMark: (mark: Mark<GenericMarkOptions>) => void;
|
|
415
|
+
/**
|
|
416
|
+
* Unregister a mark from the Plot component after the mark
|
|
417
|
+
* component has been destroyed.
|
|
418
|
+
*/
|
|
419
|
+
removeMark: (mark: Mark<GenericMarkOptions>) => void;
|
|
420
|
+
getPlotState: () => PlotState;
|
|
421
|
+
getTopLevelFacet: () => PlotOptions['facet'];
|
|
422
|
+
/**
|
|
423
|
+
* Updates the plots internal facetWidth and facetHeight dimensions
|
|
424
|
+
* which are used as range for the positional scales x and y.
|
|
425
|
+
*/
|
|
426
|
+
updateDimensions: (width: number, height: number) => void;
|
|
427
|
+
};
|
|
428
|
+
type FacetState = {
|
|
429
|
+
fx: RawValue;
|
|
430
|
+
fy: RawValue;
|
|
431
|
+
/**
|
|
432
|
+
* True, if the facet is the leftmost in its row
|
|
433
|
+
*/
|
|
434
|
+
left: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* True, if the facet is the topmost in its column
|
|
437
|
+
*/
|
|
438
|
+
top: boolean;
|
|
439
|
+
/**
|
|
440
|
+
* True, if the facet is the rightmost in its row
|
|
441
|
+
*/
|
|
442
|
+
right: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* True, if the facet is the bottommost in its column
|
|
445
|
+
*/
|
|
446
|
+
bottom: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* True, if the adjacent facet to the top is empty
|
|
449
|
+
*/
|
|
450
|
+
topEmpty: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* True, if the adjacent facet to the bottom is empty
|
|
453
|
+
*/
|
|
454
|
+
bottomEmpty: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* True, if the adjacent facet to the left is empty
|
|
457
|
+
*/
|
|
458
|
+
leftEmpty: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* True, if the adjacent facet to the right is empty
|
|
461
|
+
*/
|
|
462
|
+
rightEmpty: boolean;
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Test if the given data record is visible in the current facet.
|
|
466
|
+
*/
|
|
467
|
+
type TestFacetFunction = (datum: DataRecord, channels: Record<ChannelName, ChannelAccessor>) => boolean;
|
|
468
|
+
export type FacetContext = {
|
|
469
|
+
/**
|
|
470
|
+
* Returns a stateful function that tests whether a specific data
|
|
471
|
+
* record is visible in the current facet or not.
|
|
472
|
+
*/
|
|
473
|
+
getTestFacet: () => TestFacetFunction;
|
|
474
|
+
getFacetState: () => FacetState;
|
|
475
|
+
};
|
|
476
|
+
export type BaseMarkProps = Partial<{
|
|
477
|
+
/**
|
|
478
|
+
* Filter the data without modifying the inferred scales
|
|
479
|
+
*/
|
|
480
|
+
filter?: ConstantAccessor<boolean>;
|
|
481
|
+
facet?: 'auto' | 'include' | 'exclude';
|
|
482
|
+
fx: ChannelAccessor;
|
|
483
|
+
fy: ChannelAccessor;
|
|
484
|
+
dx: ConstantAccessor<number>;
|
|
485
|
+
dy: ConstantAccessor<number>;
|
|
486
|
+
fill: ConstantAccessor<string>;
|
|
487
|
+
fillOpacity: ConstantAccessor<number>;
|
|
488
|
+
stroke: ConstantAccessor<string>;
|
|
489
|
+
strokeWidth: ConstantAccessor<number>;
|
|
490
|
+
strokeOpacity: ConstantAccessor<number>;
|
|
491
|
+
strokeLinejoin: ConstantAccessor<'bevel' | 'miter' | 'miter-clip' | 'round'>;
|
|
492
|
+
strokeLinecap: ConstantAccessor<'butt' | 'square' | 'round'>;
|
|
493
|
+
strokeMiterlimit: ConstantAccessor<number>;
|
|
494
|
+
opacity: ConstantAccessor<number>;
|
|
495
|
+
strokeDasharray: ConstantAccessor<string>;
|
|
496
|
+
strokeDashoffset: ConstantAccessor<number>;
|
|
497
|
+
mixBlendMode: ConstantAccessor<'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'plus-darker' | 'plus-lighter'>;
|
|
498
|
+
clipPath: string;
|
|
499
|
+
imageFilter: ConstantAccessor<string>;
|
|
500
|
+
shapeRendering: ConstantAccessor<'crispEdges' | 'geometricPrecision' | 'optimizeSpeed' | 'auto'>;
|
|
501
|
+
paintOrder: ConstantAccessor<string>;
|
|
502
|
+
onclick?: MouseEventHandler<SVGPathElement>;
|
|
503
|
+
ondblclick?: MouseEventHandler<SVGPathElement>;
|
|
504
|
+
onmouseup?: MouseEventHandler<SVGPathElement>;
|
|
505
|
+
onmousedown?: MouseEventHandler<SVGPathElement>;
|
|
506
|
+
onmouseenter?: MouseEventHandler<SVGPathElement>;
|
|
507
|
+
onmousemove?: MouseEventHandler<SVGPathElement>;
|
|
508
|
+
onmouseleave?: MouseEventHandler<SVGPathElement>;
|
|
509
|
+
onmouseout?: MouseEventHandler<SVGPathElement>;
|
|
510
|
+
ondrag?: MouseEventHandler<SVGPathElement>;
|
|
511
|
+
ondrop?: MouseEventHandler<SVGPathElement>;
|
|
512
|
+
ondragstart?: MouseEventHandler<SVGPathElement>;
|
|
513
|
+
ondragenter?: MouseEventHandler<SVGPathElement>;
|
|
514
|
+
ondragleave?: MouseEventHandler<SVGPathElement>;
|
|
515
|
+
ondragover?: MouseEventHandler<SVGPathElement>;
|
|
516
|
+
ondragend?: MouseEventHandler<SVGPathElement>;
|
|
517
|
+
ontouchstart?: MouseEventHandler<SVGPathElement>;
|
|
518
|
+
ontouchmove?: MouseEventHandler<SVGPathElement>;
|
|
519
|
+
ontouchend?: MouseEventHandler<SVGPathElement>;
|
|
520
|
+
ontouchcancel?: MouseEventHandler<SVGPathElement>;
|
|
521
|
+
oncontextmenu?: MouseEventHandler<SVGPathElement>;
|
|
522
|
+
onwheel?: MouseEventHandler<SVGPathElement>;
|
|
523
|
+
/**
|
|
524
|
+
* simple browser tooltip to be displayed on mouseover
|
|
525
|
+
*/
|
|
526
|
+
title: ConstantAccessor<string>;
|
|
527
|
+
/**
|
|
528
|
+
* if set, the mark element will be wrapped in a <a> link
|
|
529
|
+
* element
|
|
530
|
+
*/
|
|
531
|
+
href: ConstantAccessor<string>;
|
|
532
|
+
target: ConstantAccessor<'_self' | '_blank' | string>;
|
|
533
|
+
/**
|
|
534
|
+
* if you want to give your mark element an extra CSS class
|
|
535
|
+
*/
|
|
536
|
+
class: string;
|
|
537
|
+
}>;
|
|
538
|
+
export type BaseRectMarkProps = {
|
|
539
|
+
rx?: ConstantAccessor<number>;
|
|
540
|
+
ry?: ConstantAccessor<number>;
|
|
541
|
+
inset?: ConstantAccessor<number>;
|
|
542
|
+
insetLeft?: ConstantAccessor<number>;
|
|
543
|
+
insetTop?: ConstantAccessor<number>;
|
|
544
|
+
insetRight?: ConstantAccessor<number>;
|
|
545
|
+
insetBottom?: ConstantAccessor<number>;
|
|
546
|
+
};
|
|
547
|
+
export type Channels = Record<string, ChannelAccessor | ConstantAccessor<string | number | boolean | symbol>>;
|
|
548
|
+
export type TransformArg<K> = Channels & {
|
|
549
|
+
data: K[];
|
|
550
|
+
};
|
|
551
|
+
export type MapArg<K> = Channels & {
|
|
552
|
+
data: K[];
|
|
553
|
+
};
|
|
554
|
+
export type TransformArgsRow = Partial<Channels> & {
|
|
139
555
|
data: DataRow[];
|
|
140
|
-
x?: ChannelAccessor;
|
|
141
|
-
y?: ChannelAccessor;
|
|
142
|
-
z?: ChannelAccessor;
|
|
143
|
-
sort?: ChannelAccessor | {
|
|
144
|
-
channel: 'stroke' | 'fill';
|
|
145
|
-
};
|
|
146
556
|
};
|
|
147
|
-
export type
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
557
|
+
export type TransformArgsRecord = Partial<Channels> & {
|
|
558
|
+
data: DataRecord[];
|
|
559
|
+
};
|
|
560
|
+
export type ColorScheme = 'brbg' | 'prgn' | 'piyg' | 'puor' | 'rdbu' | 'rdgy' | 'rdylbu' | 'rdylgn' | 'spectral' | 'burd' | 'buylrd' | 'blues' | 'greens' | 'grays' | 'greys' | 'oranges' | 'purples' | 'reds' | 'turbo' | 'viridis' | 'magma' | 'inferno' | 'plasma' | 'cividis' | 'cubehelix' | 'warm' | 'cool' | 'bugn' | 'bupu' | 'gnbu' | 'orrd' | 'pubu' | 'pubugn' | 'purd' | 'rdpu' | 'ylgn' | 'ylgnbu' | 'ylorbr' | 'ylorrd' | 'rainbow' | 'sinebow' | 'accent' | 'category10' | 'dark2' | 'paired' | 'pastel1' | 'pastel2' | 'set1' | 'set2' | 'set3' | 'tableau10' | 'observable10';
|
|
561
|
+
export type MarkStyleProps = 'strokeDasharray' | 'strokeLinejoin' | 'strokeLinecap' | 'opacity' | 'cursor' | 'pointerEvents' | 'blend' | 'fill' | 'fillOpacity' | 'fontWeight' | 'fontSize' | 'fontStyle' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'clipPath' | 'mask' | 'filter' | 'angle' | 'radius' | 'symbol' | 'textAnchor' | 'width';
|
|
562
|
+
export type AutoMarginStores = {
|
|
563
|
+
autoMarginTop: Writable<Map<string, number>>;
|
|
564
|
+
autoMarginLeft: Writable<Map<string, number>>;
|
|
565
|
+
autoMarginRight: Writable<Map<string, number>>;
|
|
566
|
+
autoMarginBottom: Writable<Map<string, number>>;
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* these are the default options for the plot marks that can be set using
|
|
570
|
+
* the 'svelteplot/defaults' context.
|
|
571
|
+
*/
|
|
572
|
+
export type DefaultOptions = {
|
|
573
|
+
/**
|
|
574
|
+
* default plot height
|
|
575
|
+
*/
|
|
576
|
+
height: number;
|
|
577
|
+
/**
|
|
578
|
+
* default plot inset
|
|
579
|
+
*/
|
|
580
|
+
inset: number;
|
|
581
|
+
/**
|
|
582
|
+
* default tick line length
|
|
583
|
+
*/
|
|
584
|
+
tickSize: number;
|
|
585
|
+
/**
|
|
586
|
+
* default padding between tick line and tick label
|
|
587
|
+
*/
|
|
588
|
+
tickPadding: number;
|
|
589
|
+
/**
|
|
590
|
+
* default font size for tick labels
|
|
591
|
+
*/
|
|
592
|
+
tickFontSize: number;
|
|
593
|
+
/**
|
|
594
|
+
* default anchor for x axis
|
|
595
|
+
*/
|
|
596
|
+
axisXAnchor: 'bottom' | 'top';
|
|
597
|
+
/**
|
|
598
|
+
* default anchor for y axis
|
|
599
|
+
*/
|
|
600
|
+
axisYAnchor: 'left' | 'right';
|
|
601
|
+
/**
|
|
602
|
+
* default spacing between ticks in AxisX and GridX
|
|
603
|
+
*/
|
|
604
|
+
xTickSpacing: number;
|
|
605
|
+
/**
|
|
606
|
+
* default spacing between ticks in AxisY and GridY
|
|
607
|
+
*/
|
|
608
|
+
yTickSpacing: number;
|
|
609
|
+
/**
|
|
610
|
+
* default color scheme
|
|
611
|
+
*/
|
|
612
|
+
colorScheme: ColorScheme;
|
|
613
|
+
/**
|
|
614
|
+
* default step for graticule, in degrees
|
|
615
|
+
*/
|
|
616
|
+
graticuleStep: number;
|
|
617
|
+
/**
|
|
618
|
+
* locale, used for automatic axis ticks
|
|
619
|
+
*/
|
|
620
|
+
locale: string;
|
|
621
|
+
/**
|
|
622
|
+
* default number format for axis ticks
|
|
623
|
+
*/
|
|
624
|
+
numberFormat: Intl.NumberFormatOptions;
|
|
625
|
+
/**
|
|
626
|
+
* default dot radius for line markers, used in dot, circle, and circle-stroke markers
|
|
627
|
+
*/
|
|
628
|
+
markerDotRadius: number;
|
|
629
|
+
};
|
|
630
|
+
export type MapIndexObject = {
|
|
631
|
+
mapIndex: (I: number[], S: RawValue[], T: RawValue[]) => void;
|
|
632
|
+
};
|
|
633
|
+
export type MapMethod = 'cumsum' | 'rank' | 'quantile' | ((I: number[], S: number[]) => number[]) | MapIndexObject;
|
|
634
|
+
export type MapOptions = Partial<Record<ScaledChannelName, MapMethod>>;
|
|
198
635
|
export {};
|