@uwdata/mosaic-spec 0.7.1 → 0.9.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/mosaic-schema.json +192673 -0
- package/dist/mosaic-spec.js +5077 -5774
- package/dist/mosaic-spec.min.js +23 -23
- package/dist/types/ast/ASTNode.d.ts +26 -0
- package/dist/types/ast/DataNode.d.ts +60 -0
- package/dist/types/ast/ExpressionNode.d.ts +15 -0
- package/dist/types/ast/HConcatNode.d.ts +10 -0
- package/dist/types/ast/HSpaceNode.d.ts +11 -0
- package/dist/types/ast/InputNode.d.ts +8 -0
- package/dist/types/ast/LiteralNode.d.ts +7 -0
- package/dist/types/ast/OptionsNode.d.ts +10 -0
- package/dist/types/ast/ParamNode.d.ts +9 -0
- package/dist/types/ast/ParamRefNode.d.ts +8 -0
- package/dist/types/ast/PlotAttributeNode.d.ts +18 -0
- package/dist/types/ast/PlotFromNode.d.ts +9 -0
- package/dist/types/ast/PlotInteractorNode.d.ts +8 -0
- package/dist/types/ast/PlotLegendNode.d.ts +10 -0
- package/dist/types/ast/PlotMarkNode.d.ts +10 -0
- package/dist/types/ast/PlotNode.d.ts +11 -0
- package/dist/types/ast/SelectionNode.d.ts +12 -0
- package/dist/types/ast/SpecNode.d.ts +10 -0
- package/dist/types/ast/TransformNode.d.ts +13 -0
- package/dist/types/ast/VConcatNode.d.ts +10 -0
- package/dist/types/ast/VSpaceNode.d.ts +11 -0
- package/dist/types/ast-to-dom.d.ts +38 -0
- package/dist/types/ast-to-esm.d.ts +64 -0
- package/dist/types/config/components.d.ts +4 -0
- package/dist/types/config/extensions.d.ts +9 -0
- package/dist/types/config/inputs.d.ts +5 -0
- package/dist/types/config/plots.d.ts +34 -0
- package/dist/types/config/transforms.d.ts +4 -0
- package/dist/types/constants.d.ts +30 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/parse-spec.d.ts +86 -0
- package/dist/types/spec/CSSStyles.d.ts +3 -0
- package/dist/types/spec/Data.d.ts +165 -0
- package/dist/types/spec/Expression.d.ts +27 -0
- package/dist/types/spec/HConcat.d.ts +8 -0
- package/dist/types/spec/HSpace.d.ts +9 -0
- package/dist/types/spec/Input.d.ts +207 -0
- package/dist/types/spec/Param.d.ts +51 -0
- package/dist/types/spec/Plot.d.ts +14 -0
- package/dist/types/spec/PlotAttribute.d.ts +1522 -0
- package/dist/types/spec/PlotFrom.d.ts +20 -0
- package/dist/types/spec/PlotInteractor.d.ts +8 -0
- package/dist/types/spec/PlotLegend.d.ts +68 -0
- package/dist/types/spec/PlotMark.d.ts +27 -0
- package/dist/types/spec/PlotTypes.d.ts +293 -0
- package/dist/types/spec/Spec.d.ts +52 -0
- package/dist/types/spec/Transform.d.ts +314 -0
- package/dist/types/spec/VConcat.d.ts +8 -0
- package/dist/types/spec/VSpace.d.ts +9 -0
- package/dist/types/spec/interactors/Highlight.d.ts +37 -0
- package/dist/types/spec/interactors/Interval1D.d.ts +63 -0
- package/dist/types/spec/interactors/Interval2D.d.ts +46 -0
- package/dist/types/spec/interactors/Nearest.d.ts +44 -0
- package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
- package/dist/types/spec/interactors/Toggle.d.ts +59 -0
- package/dist/types/spec/marks/Area.d.ts +139 -0
- package/dist/types/spec/marks/Arrow.d.ts +94 -0
- package/dist/types/spec/marks/Axis.d.ts +281 -0
- package/dist/types/spec/marks/Bar.d.ts +150 -0
- package/dist/types/spec/marks/Cell.d.ts +57 -0
- package/dist/types/spec/marks/Contour.d.ts +23 -0
- package/dist/types/spec/marks/Delaunay.d.ts +86 -0
- package/dist/types/spec/marks/DenseLine.d.ts +27 -0
- package/dist/types/spec/marks/Density.d.ts +121 -0
- package/dist/types/spec/marks/Dot.d.ts +133 -0
- package/dist/types/spec/marks/ErrorBar.d.ts +82 -0
- package/dist/types/spec/marks/Frame.d.ts +21 -0
- package/dist/types/spec/marks/Geo.d.ts +53 -0
- package/dist/types/spec/marks/Hexbin.d.ts +30 -0
- package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
- package/dist/types/spec/marks/Image.d.ts +89 -0
- package/dist/types/spec/marks/Line.d.ts +82 -0
- package/dist/types/spec/marks/Link.d.ts +60 -0
- package/dist/types/spec/marks/Marks.d.ts +905 -0
- package/dist/types/spec/marks/Raster.d.ts +124 -0
- package/dist/types/spec/marks/Rect.d.ts +166 -0
- package/dist/types/spec/marks/Regression.d.ts +58 -0
- package/dist/types/spec/marks/Rule.d.ts +100 -0
- package/dist/types/spec/marks/Text.d.ts +110 -0
- package/dist/types/spec/marks/Tick.d.ts +61 -0
- package/dist/types/spec/marks/Vector.d.ts +99 -0
- package/dist/types/util.d.ts +12 -0
- package/jsconfig.json +10 -0
- package/package.json +14 -9
- package/src/ast/ASTNode.js +23 -2
- package/src/ast/DataNode.js +79 -21
- package/src/ast/HSpaceNode.js +1 -1
- package/src/ast/InputNode.js +1 -2
- package/src/ast/ParamNode.js +1 -2
- package/src/ast/PlotAttributeNode.js +1 -2
- package/src/ast/PlotInteractorNode.js +1 -2
- package/src/ast/PlotLegendNode.js +1 -2
- package/src/ast/PlotMarkNode.js +3 -2
- package/src/ast/TransformNode.js +1 -2
- package/src/ast/VSpaceNode.js +1 -1
- package/src/ast-to-dom.js +9 -3
- package/src/ast-to-esm.js +41 -12
- package/src/config/inputs.js +1 -0
- package/src/config/plots.js +4 -0
- package/src/config/transforms.js +6 -0
- package/src/index.js +4 -0
- package/src/parse-spec.js +38 -5
- package/src/spec/CSSStyles.ts +9 -0
- package/src/spec/Data.ts +184 -0
- package/src/spec/Expression.ts +31 -0
- package/src/spec/HConcat.ts +9 -0
- package/src/spec/HSpace.ts +9 -0
- package/src/spec/Input.ts +204 -0
- package/src/spec/Param.ts +68 -0
- package/src/spec/Plot.ts +15 -0
- package/src/spec/PlotAttribute.ts +1783 -0
- package/src/spec/PlotFrom.ts +23 -0
- package/src/spec/PlotInteractor.ts +25 -0
- package/src/spec/PlotLegend.ts +70 -0
- package/src/spec/PlotMark.ts +53 -0
- package/src/spec/PlotTypes.ts +519 -0
- package/src/spec/Spec.ts +70 -0
- package/src/spec/Transform.ts +446 -0
- package/src/spec/VConcat.ts +9 -0
- package/src/spec/VSpace.ts +9 -0
- package/src/spec/interactors/Highlight.ts +38 -0
- package/src/spec/interactors/Interval1D.ts +67 -0
- package/src/spec/interactors/Interval2D.ts +48 -0
- package/src/spec/interactors/Nearest.ts +48 -0
- package/src/spec/interactors/PanZoom.ts +65 -0
- package/src/spec/interactors/Toggle.ts +65 -0
- package/src/spec/marks/Area.ts +154 -0
- package/src/spec/marks/Arrow.ts +108 -0
- package/src/spec/marks/Axis.ts +305 -0
- package/src/spec/marks/Bar.ts +160 -0
- package/src/spec/marks/Cell.ts +62 -0
- package/src/spec/marks/Contour.ts +25 -0
- package/src/spec/marks/Delaunay.ts +95 -0
- package/src/spec/marks/DenseLine.ts +30 -0
- package/src/spec/marks/Density.ts +145 -0
- package/src/spec/marks/Dot.ts +152 -0
- package/src/spec/marks/ErrorBar.ts +91 -0
- package/src/spec/marks/Frame.ts +23 -0
- package/src/spec/marks/Geo.ts +58 -0
- package/src/spec/marks/Hexbin.ts +34 -0
- package/src/spec/marks/Hexgrid.ts +27 -0
- package/src/spec/marks/Image.ts +101 -0
- package/src/spec/marks/Line.ts +93 -0
- package/src/spec/marks/Link.ts +70 -0
- package/src/spec/marks/Marks.ts +1088 -0
- package/src/spec/marks/Raster.ts +145 -0
- package/src/spec/marks/Rect.ts +183 -0
- package/src/spec/marks/Regression.ts +63 -0
- package/src/spec/marks/Rule.ts +113 -0
- package/src/spec/marks/Text.ts +127 -0
- package/src/spec/marks/Tick.ts +69 -0
- package/src/spec/marks/Vector.ts +113 -0
- package/src/util.js +8 -0
- package/tsconfig.json +11 -0
- package/LICENSE +0 -47
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** Options for nearest interactors. */
|
|
4
|
+
export interface NearestOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The output selection. A clause of the form `field = value`
|
|
7
|
+
* is added for the currently nearest value.
|
|
8
|
+
*/
|
|
9
|
+
as: ParamRef;
|
|
10
|
+
/**
|
|
11
|
+
* The encoding channels whose domain values should be selected. For example,
|
|
12
|
+
* a setting of `['color']` selects the data value backing the color channel,
|
|
13
|
+
* whereas `['x', 'z']` selects both x and z channel domain values. If
|
|
14
|
+
* unspecified, the selected channels default to match the current pointer
|
|
15
|
+
* settings: a `nearestX` interactor selects the `['x']` channels, while
|
|
16
|
+
* a `nearest` interactor selects the `['x', 'y']` channels.
|
|
17
|
+
*/
|
|
18
|
+
channels?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* The fields (database column names) to use in generated selection clause
|
|
21
|
+
* predicates. If unspecified, the fields backing the selected *channels*
|
|
22
|
+
* in the first valid prior mark definition are used by default.
|
|
23
|
+
*/
|
|
24
|
+
fields?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* The maximum radius of a nearest selection (default 40). Marks with (x, y)
|
|
27
|
+
* coordinates outside this radius will not be selected as nearest points.
|
|
28
|
+
*/
|
|
29
|
+
maxRadius?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A nearest interactor. */
|
|
33
|
+
export interface Nearest extends NearestOptions {
|
|
34
|
+
/** Select values from the mark closest to the pointer. */
|
|
35
|
+
select: 'nearest';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A nearestX interactor. */
|
|
39
|
+
export interface NearestX extends NearestOptions {
|
|
40
|
+
/** Select values from the mark closest to the pointer *x* location. */
|
|
41
|
+
select: 'nearestX';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A nearestY interactor. */
|
|
45
|
+
export interface NearestY extends NearestOptions {
|
|
46
|
+
/** Select values from the mark closest to the pointer *y* location. */
|
|
47
|
+
select: 'nearestY';
|
|
48
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** Options for pan/zoom interactors. */
|
|
4
|
+
export interface PanZoomOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The output selection for the `x` domain.
|
|
7
|
+
* A clause of the form `field BETWEEN x1 AND x2` is added for the
|
|
8
|
+
* current pan/zom interval [x1, x2].
|
|
9
|
+
*/
|
|
10
|
+
x?: ParamRef;
|
|
11
|
+
/**
|
|
12
|
+
* The output selection for the `y` domain.
|
|
13
|
+
* A clause of the form `field BETWEEN y1 AND y2` is added for the
|
|
14
|
+
* current pan/zom interval [y1, y2].
|
|
15
|
+
*/
|
|
16
|
+
y?: ParamRef;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the field (database column) over which the `x`-component
|
|
19
|
+
* of the pan/zoom interval should be defined. If unspecified, the `x`
|
|
20
|
+
* channel field of the first valid prior mark definition is used.
|
|
21
|
+
*/
|
|
22
|
+
xfield?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The name of the field (database column) over which the `y`-component
|
|
25
|
+
* of the pan/zoom interval should be defined. If unspecified, the `y`
|
|
26
|
+
* channel field of the first valid prior mark definition is used.
|
|
27
|
+
*/
|
|
28
|
+
yfield?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A pan interactor. */
|
|
32
|
+
export interface Pan extends PanZoomOptions {
|
|
33
|
+
/** Pan a plot along both the `x` and `y` scales. */
|
|
34
|
+
select: 'pan';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A panX interactor. */
|
|
38
|
+
export interface PanX extends PanZoomOptions {
|
|
39
|
+
/** Pan a plot along the `x` scale only. */
|
|
40
|
+
select: 'panX';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A panY interactor. */
|
|
44
|
+
export interface PanY extends PanZoomOptions {
|
|
45
|
+
/** Pan a plot along the `y` scale only. */
|
|
46
|
+
select: 'panY';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A panZoom interactor. */
|
|
50
|
+
export interface PanZoom extends PanZoomOptions {
|
|
51
|
+
/** Pan and zoom a plot along both the `x` and `y` scales. */
|
|
52
|
+
select: 'panZoom';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A panZoomX interactor. */
|
|
56
|
+
export interface PanZoomX extends PanZoomOptions {
|
|
57
|
+
/** Pan and zoom a plot along the `x` scale only. */
|
|
58
|
+
select: 'panZoomX';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A panZoomY interactor. */
|
|
62
|
+
export interface PanZoomY extends PanZoomOptions {
|
|
63
|
+
/** Pan and zoom a plot along the `y` scale only. */
|
|
64
|
+
select: 'panZoomY';
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
|
|
3
|
+
/** Options for toggle interactors. */
|
|
4
|
+
export interface ToggleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The output selection. A clause of the form
|
|
7
|
+
* `(field = value1) OR (field = value2) ...`
|
|
8
|
+
* is added for the currently selected values.
|
|
9
|
+
*/
|
|
10
|
+
as: ParamRef;
|
|
11
|
+
/**
|
|
12
|
+
* A flag indicating if peer (sibling) marks are when cross-filtering
|
|
13
|
+
* (default `true`). If set, peer marks will not be filtered by this
|
|
14
|
+
* interactor's selection in cross-filtering setups.
|
|
15
|
+
*/
|
|
16
|
+
peers?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A toggle interactor. */
|
|
20
|
+
export interface Toggle extends ToggleOptions {
|
|
21
|
+
/** Select individal values. */
|
|
22
|
+
select: 'toggle';
|
|
23
|
+
/**
|
|
24
|
+
* The encoding channels over which to select values.
|
|
25
|
+
* For a selected mark, selection clauses will cover
|
|
26
|
+
* the backing data fields for each channel.
|
|
27
|
+
*/
|
|
28
|
+
channels: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A toggleX interactor. */
|
|
32
|
+
export interface ToggleX extends ToggleOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Select individal values in the `x` scale domain.
|
|
35
|
+
* Clicking or touching a mark toggles its selection status.
|
|
36
|
+
*/
|
|
37
|
+
select: 'toggleX';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A toggleY interactor. */
|
|
41
|
+
export interface ToggleY extends ToggleOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Select individal values in the `y` scale domain.
|
|
44
|
+
* Clicking or touching a mark toggles its selection status.
|
|
45
|
+
*/
|
|
46
|
+
select: 'toggleY';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A toggleZ interactor. */
|
|
50
|
+
export interface ToggleZ extends ToggleOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Select individal values in the `z` scale domain.
|
|
53
|
+
* Clicking or touching a mark toggles its selection status.
|
|
54
|
+
*/
|
|
55
|
+
select: 'toggleZ';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A toggleColor interactor. */
|
|
59
|
+
export interface ToggleColor extends ToggleOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Select individal values in the `color` scale domain.
|
|
62
|
+
* Clicking or touching a mark toggles its selection status.
|
|
63
|
+
*/
|
|
64
|
+
select: 'toggleColor';
|
|
65
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChannelValue, ChannelValueSpec, CurveOptions,
|
|
3
|
+
MarkData, MarkOptions, StackOptions
|
|
4
|
+
} from './Marks.js';
|
|
5
|
+
|
|
6
|
+
/** Options for the area, areaX, and areaY marks. */
|
|
7
|
+
export interface AreaOptions extends MarkOptions, StackOptions, CurveOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The required primary (starting, often left) horizontal position channel,
|
|
10
|
+
* representing the area’s baseline, typically bound to the *x* scale. For
|
|
11
|
+
* areaX, setting this option disables the implicit stackX transform.
|
|
12
|
+
*/
|
|
13
|
+
x1?: ChannelValueSpec;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The optional secondary (ending, often right) horizontal position channel,
|
|
17
|
+
* representing the area’s topline, typically bound to the *x* scale; if not
|
|
18
|
+
* specified, **x1** is used. For areaX, setting this option disables the
|
|
19
|
+
* implicit stackX transform.
|
|
20
|
+
*/
|
|
21
|
+
x2?: ChannelValueSpec;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The required primary (starting, often bottom) vertical position channel,
|
|
25
|
+
* representing the area’s baseline, typically bound to the *y* scale. For
|
|
26
|
+
* areaY, setting this option disables the implicit stackY transform.
|
|
27
|
+
*/
|
|
28
|
+
y1?: ChannelValueSpec;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The optional secondary (ending, often top) vertical position channel,
|
|
32
|
+
* representing the area’s topline, typically bound to the *y* scale; if not
|
|
33
|
+
* specified, **y1** is used. For areaY, setting this option disables the
|
|
34
|
+
* implicit stackY transform.
|
|
35
|
+
*/
|
|
36
|
+
y2?: ChannelValueSpec;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An optional ordinal channel for grouping data into (possibly stacked)
|
|
40
|
+
* series to be drawn as separate areas; defaults to **fill** if a channel, or
|
|
41
|
+
* **stroke** if a channel.
|
|
42
|
+
*/
|
|
43
|
+
z?: ChannelValue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Options for the areaX mark. */
|
|
47
|
+
export interface AreaXOptions extends Omit<AreaOptions, 'y1' | 'y2'> {
|
|
48
|
+
/**
|
|
49
|
+
* The horizontal position (or length) channel, typically bound to the *x*
|
|
50
|
+
* scale.
|
|
51
|
+
*
|
|
52
|
+
* If neither **x1** nor **x2** is specified, an implicit stackX transform is
|
|
53
|
+
* applied and **x** defaults to the identity function, assuming that *data* =
|
|
54
|
+
* [*x₀*, *x₁*, *x₂*, …]. Otherwise, if only one of **x1** or **x2** is
|
|
55
|
+
* specified, the other defaults to **x**, which defaults to zero.
|
|
56
|
+
*/
|
|
57
|
+
x?: ChannelValueSpec;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The vertical position channel, typically bound to the *y* scale; defaults
|
|
61
|
+
* to the zero-based index of the data [0, 1, 2, …].
|
|
62
|
+
*/
|
|
63
|
+
y?: ChannelValueSpec;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Options for the areaY mark. */
|
|
67
|
+
export interface AreaYOptions extends Omit<AreaOptions, 'x1' | 'x2'> {
|
|
68
|
+
/**
|
|
69
|
+
* The horizontal position channel, typically bound to the *x* scale; defaults
|
|
70
|
+
* to the zero-based index of the data [0, 1, 2, …].
|
|
71
|
+
*/
|
|
72
|
+
x?: ChannelValueSpec;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The vertical position (or length) channel, typically bound to the *y*
|
|
76
|
+
* scale.
|
|
77
|
+
*
|
|
78
|
+
* If neither **y1** nor **y2** is specified, an implicit stackY transform is
|
|
79
|
+
* applied and **y** defaults to the identity function, assuming that *data* =
|
|
80
|
+
* [*y₀*, *y₁*, *y₂*, …]. Otherwise, if only one of **y1** or **y2** is
|
|
81
|
+
* specified, the other defaults to **y**, which defaults to zero.
|
|
82
|
+
*/
|
|
83
|
+
y?: ChannelValueSpec;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The area mark. */
|
|
87
|
+
export interface Area extends MarkData, AreaOptions {
|
|
88
|
+
/**
|
|
89
|
+
* An area mark. The area mark is rarely used directly; it is only needed
|
|
90
|
+
* when the baseline and topline have neither *x* nor *y* values in common.
|
|
91
|
+
* Use areaY for a horizontal orientation where the baseline and topline
|
|
92
|
+
* share *x* values, or areaX for a vertical orientation where the baseline
|
|
93
|
+
* and topline share *y* values.
|
|
94
|
+
*/
|
|
95
|
+
mark: 'area';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The areaX mark. */
|
|
99
|
+
export interface AreaX extends MarkData, AreaXOptions {
|
|
100
|
+
/**
|
|
101
|
+
* A vertically-oriented area mark, where the baseline and topline share
|
|
102
|
+
* **y** values, as in a time-series area chart where time goes up↑.
|
|
103
|
+
*
|
|
104
|
+
* If neither **x1** nor **x2** is specified, an implicit stackX transform is
|
|
105
|
+
* applied and **x** defaults to the identity function, assuming that *data* =
|
|
106
|
+
* [*x₀*, *x₁*, *x₂*, …]. Otherwise, if only one of **x1** or **x2** is
|
|
107
|
+
* specified, the other defaults to **x**, which defaults to zero.
|
|
108
|
+
*
|
|
109
|
+
* If an **interval** is specified, **y** values are binned accordingly,
|
|
110
|
+
* allowing zeroes for empty bins instead of interpolating across gaps. This is
|
|
111
|
+
* recommended to “regularize” sampled data; for example, if your data
|
|
112
|
+
* represents timestamped observations and you expect one observation per day,
|
|
113
|
+
* use *day* as the **interval**.
|
|
114
|
+
*
|
|
115
|
+
* Variable aesthetic channels are supported: if the **fill** is defined as a
|
|
116
|
+
* channel, the area will be broken into contiguous overlapping sections when
|
|
117
|
+
* the fill color changes; the fill color will apply to the interval spanning
|
|
118
|
+
* the current data point and the following data point. This behavior also
|
|
119
|
+
* applies to the **fillOpacity**, **stroke**, **strokeOpacity**,
|
|
120
|
+
* **strokeWidth**, **opacity**, **href**, **title**, and **ariaLabel**
|
|
121
|
+
* channels. When any of these channels are used, setting an explicit **z**
|
|
122
|
+
* channel (possibly to null) is strongly recommended.
|
|
123
|
+
*/
|
|
124
|
+
mark: 'areaX';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The areaY mark. */
|
|
128
|
+
export interface AreaY extends MarkData, AreaYOptions {
|
|
129
|
+
/**
|
|
130
|
+
* A horizontally-oriented area mark, where the baseline and topline share
|
|
131
|
+
* **x** values, as in a time-series area chart where time goes right→.
|
|
132
|
+
*
|
|
133
|
+
* If neither **y1** nor **y2** is specified, an implicit stackY transform is
|
|
134
|
+
* applied and **y** defaults to the identity function, assuming that *data* =
|
|
135
|
+
* [*y₀*, *y₁*, *y₂*, …]. Otherwise, if only one of **y1** or **y2** is
|
|
136
|
+
* specified, the other defaults to **y**, which defaults to zero.
|
|
137
|
+
*
|
|
138
|
+
* If an **interval** is specified, **x** values are binned accordingly,
|
|
139
|
+
* allowing zeroes for empty bins instead of interpolating across gaps. This is
|
|
140
|
+
* recommended to “regularize” sampled data; for example, if your data
|
|
141
|
+
* represents timestamped observations and you expect one observation per day,
|
|
142
|
+
* use *day* as the **interval**.
|
|
143
|
+
*
|
|
144
|
+
* Variable aesthetic channels are supported: if the **fill** is defined as a
|
|
145
|
+
* channel, the area will be broken into contiguous overlapping sections when
|
|
146
|
+
* the fill color changes; the fill color will apply to the interval spanning
|
|
147
|
+
* the current data point and the following data point. This behavior also
|
|
148
|
+
* applies to the **fillOpacity**, **stroke**, **strokeOpacity**,
|
|
149
|
+
* **strokeWidth**, **opacity**, **href**, **title**, and **ariaLabel**
|
|
150
|
+
* channels. When any of these channels are used, setting an explicit **z**
|
|
151
|
+
* channel (possibly to null) is strongly recommended.
|
|
152
|
+
*/
|
|
153
|
+
mark: 'areaY';
|
|
154
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
|
|
3
|
+
|
|
4
|
+
/** Options for the arrow mark. */
|
|
5
|
+
export interface ArrowOptions extends MarkOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The horizontal position, for vertical arrows; typically bound to the *x*
|
|
8
|
+
* scale; shorthand for setting defaults for both **x1** and **x2**.
|
|
9
|
+
*/
|
|
10
|
+
x?: ChannelValueSpec;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The vertical position, for horizontal arrows; typically bound to the *y*
|
|
14
|
+
* scale; shorthand for setting defaults for both **y1** and **y2**.
|
|
15
|
+
*/
|
|
16
|
+
y?: ChannelValueSpec;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The starting horizontal position; typically bound to the *x* scale; also
|
|
20
|
+
* sets a default for **x2**.
|
|
21
|
+
*/
|
|
22
|
+
x1?: ChannelValueSpec;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The starting vertical position; typically bound to the *y* scale; also
|
|
26
|
+
* sets a default for **y2**.
|
|
27
|
+
*/
|
|
28
|
+
y1?: ChannelValueSpec;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The ending horizontal position; typically bound to the *x* scale; also
|
|
32
|
+
* sets a default for **x1**.
|
|
33
|
+
*/
|
|
34
|
+
x2?: ChannelValueSpec;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The ending vertical position; typically bound to the *y* scale; also sets
|
|
38
|
+
* a default for **y1**.
|
|
39
|
+
*/
|
|
40
|
+
y2?: ChannelValueSpec;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The angle, a constant in degrees, between the straight line intersecting
|
|
44
|
+
* the arrow’s two control points and the outgoing tangent direction of the
|
|
45
|
+
* arrow from the start point. The angle must be within ±90°; a positive
|
|
46
|
+
* angle will produce a clockwise curve, while a negative angle will produce
|
|
47
|
+
* a counterclockwise curve; zero (the default) will produce a straight line.
|
|
48
|
+
* Use true for 22.5°.
|
|
49
|
+
*/
|
|
50
|
+
bend?: number | boolean | ParamRef;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* How pointy the arrowhead is, in degrees; a constant typically between 0°
|
|
54
|
+
* and 180°, and defaults to 60°.
|
|
55
|
+
*/
|
|
56
|
+
headAngle?: number | ParamRef;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The size of the arrowhead relative to the **strokeWidth**; a constant.
|
|
60
|
+
* Assuming the default of stroke width 1.5px, this is the length of the
|
|
61
|
+
* arrowhead’s side in pixels.
|
|
62
|
+
*/
|
|
63
|
+
headLength?: number | ParamRef;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Shorthand to set the same default for **insetStart** and **insetEnd**.
|
|
67
|
+
*/
|
|
68
|
+
inset?: number | ParamRef;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The starting inset, a constant in pixels; defaults to 0. A positive inset
|
|
72
|
+
* shortens the arrow by moving the starting point towards the endpoint
|
|
73
|
+
* point, while a negative inset extends it by moving the starting point in
|
|
74
|
+
* the opposite direction. A positive starting inset may be useful if the
|
|
75
|
+
* arrow emerges from a dot.
|
|
76
|
+
*/
|
|
77
|
+
insetStart?: number | ParamRef;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The ending inset, a constant in pixels; defaults to 0. A positive inset
|
|
81
|
+
* shortens the arrow by moving the ending point towards the starting point,
|
|
82
|
+
* while a negative inset extends it by moving the ending point in the
|
|
83
|
+
* opposite direction. A positive ending inset may be useful if the arrow
|
|
84
|
+
* points to a dot.
|
|
85
|
+
*/
|
|
86
|
+
insetEnd?: number | ParamRef;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The sweep order; defaults to 1 indicating a positive (clockwise) bend
|
|
90
|
+
* angle; -1 indicates a negative (anticlockwise) bend angle; 0 effectively
|
|
91
|
+
* clears the bend angle. If set to *-x*, the bend angle is flipped when the
|
|
92
|
+
* ending point is to the left of the starting point — ensuring all arrows
|
|
93
|
+
* bulge up (down if bend is negative); if set to *-y*, the bend angle is
|
|
94
|
+
* flipped when the ending point is above the starting point — ensuring all
|
|
95
|
+
* arrows bulge right (left if bend is negative); the sign is negated for
|
|
96
|
+
* *+x* and *+y*.
|
|
97
|
+
*/
|
|
98
|
+
sweep?: number | '+x' | '-x' | '+y' | '-y' | ParamRef;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The arrow mark. */
|
|
102
|
+
export interface Arrow extends MarkData, ArrowOptions {
|
|
103
|
+
/**
|
|
104
|
+
* An arrow mark, drawing (possibly swoopy) arrows connecting pairs of
|
|
105
|
+
* points.
|
|
106
|
+
*/
|
|
107
|
+
mark: 'arrow';
|
|
108
|
+
}
|