@uwdata/mosaic-spec 0.7.0 → 0.8.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 +186153 -0
- package/dist/mosaic-spec.js +3387 -4641
- 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 +182 -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 +26 -0
- package/dist/types/spec/PlotTypes.d.ts +293 -0
- package/dist/types/spec/Spec.d.ts +45 -0
- package/dist/types/spec/Transform.d.ts +278 -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 +25 -0
- package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
- package/dist/types/spec/interactors/Toggle.d.ts +51 -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 +129 -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 +890 -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 +106 -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 +16 -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 +16 -7
- package/src/ast-to-esm.js +41 -12
- package/src/config/inputs.js +1 -0
- package/src/config/plots.js +4 -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 +182 -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 +51 -0
- package/src/spec/PlotTypes.ts +519 -0
- package/src/spec/Spec.ts +63 -0
- package/src/spec/Transform.ts +394 -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 +28 -0
- package/src/spec/interactors/PanZoom.ts +65 -0
- package/src/spec/interactors/Toggle.ts +56 -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 +147 -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 +1062 -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 +122 -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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
|
|
3
|
+
|
|
4
|
+
/** Options for the geo mark. */
|
|
5
|
+
export interface GeoOptions extends MarkOptions {
|
|
6
|
+
/**
|
|
7
|
+
* A required channel for the geometry to render; defaults to identity,
|
|
8
|
+
* assuming *data* is a GeoJSON object or an iterable of GeoJSON objects.
|
|
9
|
+
*/
|
|
10
|
+
geometry?: ChannelValue;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The size of Point and MultiPoint geometries, defaulting to a constant 3
|
|
14
|
+
* pixels. If **r** is a number, it is interpreted as a constant radius in
|
|
15
|
+
* pixels; otherwise it is interpreted as a channel and the effective radius
|
|
16
|
+
* is controlled by the *r* scale, which defaults to a *sqrt* scale such that
|
|
17
|
+
* the visual area of a point is proportional to its associated value.
|
|
18
|
+
*
|
|
19
|
+
* If **r** is a channel, geometries will be sorted by descending radius by
|
|
20
|
+
* default, to limit occlusion; use the **sort** transform to control render
|
|
21
|
+
* order. Geometries with a nonpositive radius are not drawn.
|
|
22
|
+
*/
|
|
23
|
+
r?: ChannelValueSpec | ParamRef;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The geo mark. */
|
|
27
|
+
export interface Geo extends MarkData, GeoOptions {
|
|
28
|
+
/**
|
|
29
|
+
* A geo mark. The **geometry** channel, which defaults to the identity
|
|
30
|
+
* function assuming that *data* is a GeoJSON object or an iterable of
|
|
31
|
+
* GeoJSON objects, is projected to the plane using the plot’s top-level
|
|
32
|
+
* **projection**.
|
|
33
|
+
*
|
|
34
|
+
* If *data* is a GeoJSON feature collection, then the mark’s data is
|
|
35
|
+
* *data*.features; if *data* is a GeoJSON geometry collection, then the
|
|
36
|
+
* mark’s data is *data*.geometries; if *data* is some other GeoJSON
|
|
37
|
+
* object, then the mark’s data is the single-element array [*data*].
|
|
38
|
+
*/
|
|
39
|
+
mark: 'geo';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The sphere mark. */
|
|
43
|
+
export interface Sphere extends MarkOptions {
|
|
44
|
+
/**
|
|
45
|
+
* A geo mark whose *data* is the outline of the sphere on the
|
|
46
|
+
* projection’s plane. (For use with a spherical **projection** only.)
|
|
47
|
+
*/
|
|
48
|
+
mark: 'sphere';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The graticule mark. */
|
|
52
|
+
export interface Graticule extends MarkOptions {
|
|
53
|
+
/**
|
|
54
|
+
* A geo mark whose *data* is a 10° global graticule. (For use with a
|
|
55
|
+
* spherical **projection** only.)
|
|
56
|
+
*/
|
|
57
|
+
mark: 'graticule';
|
|
58
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { DotOptions } from './Dot.js';
|
|
3
|
+
import { ChannelValue, MarkData, TextStyles } from './Marks.js';
|
|
4
|
+
|
|
5
|
+
export interface HexbinOptions extends DotOptions, TextStyles {
|
|
6
|
+
/**
|
|
7
|
+
* The basic mark type to use for hex-binned values.
|
|
8
|
+
* Defaults to a hexagon mark; dot and text marks are also supported.
|
|
9
|
+
*/
|
|
10
|
+
type?: 'dot' | 'circle' | 'hexagon' | 'text' | ParamRef;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The distance between centers of neighboring hexagons, in pixels; defaults
|
|
14
|
+
* to 20. If also using a hexgrid mark, use matching **binWidth** values.
|
|
15
|
+
*/
|
|
16
|
+
binWidth?: number | ParamRef;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* How to subdivide bins. If not specified, defaults to the *fill* channel,
|
|
20
|
+
* if any, or the *stroke* channel, if any. If null, bins will not be
|
|
21
|
+
* subdivided.
|
|
22
|
+
*/
|
|
23
|
+
z?: ChannelValue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The hexbin mark. */
|
|
27
|
+
export interface Hexbin extends MarkData, HexbinOptions {
|
|
28
|
+
/**
|
|
29
|
+
* A hexbin mark that bins **x** and **y** data into a hexagonal grid and
|
|
30
|
+
* visualizes aggregate functions per bin (e.g., count for binned density).
|
|
31
|
+
* Aggregate functions can be used for fill, stroke, or r (radius) options.
|
|
32
|
+
*/
|
|
33
|
+
mark: 'hexbin';
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { MarkOptions } from './Marks.js';
|
|
3
|
+
|
|
4
|
+
/** Options for the hexgrid mark. */
|
|
5
|
+
export interface HexgridOptions extends MarkOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The distance between centers of neighboring hexagons, in pixels; defaults
|
|
8
|
+
* to 20. Should match the **binWidth** of the hexbin mark.
|
|
9
|
+
*/
|
|
10
|
+
binWidth?: number | ParamRef;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The hexgrid mark. */
|
|
14
|
+
export interface Hexgrid extends HexgridOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The hexgrid decoration mark complements the hexbin mark, showing the
|
|
17
|
+
* outlines of all hexagons spanning the frame with a default **stroke** of
|
|
18
|
+
* *currentColor* and a default **strokeOpacity** of 0.1, similar to the
|
|
19
|
+
* default axis grids.
|
|
20
|
+
*
|
|
21
|
+
* Note that the **binWidth** option of the hexgrid mark should match that of
|
|
22
|
+
* the hexbin transform. The grid is clipped by the frame. This is a
|
|
23
|
+
* stroke-only mark, and **fill** is not supported; to fill the frame,
|
|
24
|
+
* use the frame mark.
|
|
25
|
+
*/
|
|
26
|
+
mark: 'hexgrid';
|
|
27
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import { FrameAnchor } from '../PlotTypes.js';
|
|
3
|
+
import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
|
|
4
|
+
|
|
5
|
+
/** Options for the image mark. */
|
|
6
|
+
export interface ImageOptions extends MarkOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The horizontal position channel specifying the image’s center; typically
|
|
9
|
+
* bound to the *x* scale.
|
|
10
|
+
*/
|
|
11
|
+
x?: ChannelValueSpec;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The vertical position channel specifying the image’s center; typically
|
|
15
|
+
* bound to the *y* scale.
|
|
16
|
+
*/
|
|
17
|
+
y?: ChannelValueSpec;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The image width in pixels. When a number, it is interpreted as a constant
|
|
21
|
+
* radius in pixels; otherwise it is interpreted as a channel. Also sets the
|
|
22
|
+
* default **height**; if neither are set, defaults to 16. Images with a
|
|
23
|
+
* nonpositive width are not drawn.
|
|
24
|
+
*/
|
|
25
|
+
width?: ChannelValue | ParamRef;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The image height in pixels. When a number, it is interpreted as a constant
|
|
29
|
+
* radius in pixels; otherwise it is interpreted as a channel. Also sets the
|
|
30
|
+
* default **height**; if neither are set, defaults to 16. Images with a
|
|
31
|
+
* nonpositive height are not drawn.
|
|
32
|
+
*/
|
|
33
|
+
height?: ChannelValue | ParamRef;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The image clip radius, for circular images. If null (default), images are
|
|
37
|
+
* not clipped; when a number, it is interpreted as a constant in pixels;
|
|
38
|
+
* otherwise it is interpreted as a channel, typically bound to the *r* scale.
|
|
39
|
+
* Also defaults **height** and **width** to twice its value.
|
|
40
|
+
*/
|
|
41
|
+
r?: ChannelValue | ParamRef;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The rotation angle, in degrees clockwise. When a number, it is interpreted
|
|
45
|
+
* as a constant; otherwise it is interpreted as a channel.
|
|
46
|
+
*/
|
|
47
|
+
rotate?: ChannelValue | ParamRef;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The required image URL (or relative path). If a string that starts with a
|
|
51
|
+
* dot, slash, or URL protocol (*e.g.*, “https:”) it is assumed to be a
|
|
52
|
+
* constant; otherwise it is interpreted as a channel.
|
|
53
|
+
*/
|
|
54
|
+
src?: ChannelValue | ParamRef;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The image [aspect ratio][1]; defaults to *xMidYMid meet*. To crop the image
|
|
58
|
+
* instead of scaling it to fit, use *xMidYMid slice*.
|
|
59
|
+
*
|
|
60
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
|
|
61
|
+
*/
|
|
62
|
+
preserveAspectRatio?: string | ParamRef;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The [cross-origin][1] behavior. See the [Plot.image notebook][2] for details.
|
|
66
|
+
*
|
|
67
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/crossorigin
|
|
68
|
+
* [2]: https://observablehq.com/@observablehq/plot-image
|
|
69
|
+
*/
|
|
70
|
+
crossOrigin?: string | ParamRef;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The frame anchor specifies defaults for **x** and **y** based on the plot’s
|
|
74
|
+
* frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
|
|
75
|
+
* one of the four corners (*top-left*, *top-right*, *bottom-right*,
|
|
76
|
+
* *bottom-left*), or the *middle* of the frame.
|
|
77
|
+
*/
|
|
78
|
+
frameAnchor?: FrameAnchor | ParamRef;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The [image-rendering attribute][1]; defaults to *auto* (bilinear). The
|
|
82
|
+
* option may be set to *pixelated* to disable bilinear interpolation for a
|
|
83
|
+
* sharper image; however, note that this is not supported in WebKit.
|
|
84
|
+
*
|
|
85
|
+
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering
|
|
86
|
+
*/
|
|
87
|
+
imageRendering?: string | ParamRef;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface Image extends MarkData, ImageOptions {
|
|
91
|
+
/**
|
|
92
|
+
* An image mark that draws images as in a scatterplot.
|
|
93
|
+
*
|
|
94
|
+
* If either **x** or **y** is not specified, the default is determined by
|
|
95
|
+
* the **frameAnchor** option. If none of **x**, **y**, and **frameAnchor**
|
|
96
|
+
* are specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*],
|
|
97
|
+
* [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …]
|
|
98
|
+
* and **y** = [*y₀*, *y₁*, *y₂*, …].
|
|
99
|
+
*/
|
|
100
|
+
mark: 'image';
|
|
101
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChannelValue, ChannelValueSpec, CurveAutoOptions,
|
|
3
|
+
MarkData, MarkOptions, MarkerOptions
|
|
4
|
+
} from './Marks.js';
|
|
5
|
+
|
|
6
|
+
/** Options for the line mark. */
|
|
7
|
+
export interface LineOptions extends MarkOptions, MarkerOptions, CurveAutoOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The required horizontal position channel, typically bound to the *x*
|
|
10
|
+
* scale.
|
|
11
|
+
*/
|
|
12
|
+
x?: ChannelValueSpec;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The required vertical position channel, typically bound to the *y* scale.
|
|
16
|
+
*/
|
|
17
|
+
y?: ChannelValueSpec;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* An optional ordinal channel for grouping data into (possibly stacked)
|
|
21
|
+
* series to be drawn as separate lines. If not specified, it defaults to
|
|
22
|
+
* **fill** if a channel, or **stroke** if a channel.
|
|
23
|
+
*/
|
|
24
|
+
z?: ChannelValue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Options for the lineX mark. */
|
|
28
|
+
export interface LineXOptions extends LineOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The vertical position channel, typically bound to the *y* scale;
|
|
31
|
+
* defaults to the zero-based index of the data [0, 1, 2, …].
|
|
32
|
+
*/
|
|
33
|
+
y?: ChannelValueSpec;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Options for the lineY mark. */
|
|
37
|
+
export interface LineYOptions extends LineOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The horizontal position channel, typically bound to the *x* scale;
|
|
40
|
+
* defaults to the zero-based index of the data [0, 1, 2, …].
|
|
41
|
+
*/
|
|
42
|
+
x?: ChannelValueSpec;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The line mark. */
|
|
46
|
+
export interface Line extends MarkData, LineOptions {
|
|
47
|
+
/**
|
|
48
|
+
* A line mark that connects control points.
|
|
49
|
+
*
|
|
50
|
+
* Points along the line are connected in input order. If there are multiple
|
|
51
|
+
* series via the **z**, **fill**, or **stroke** channel, series are drawn in
|
|
52
|
+
* input order such that the last series is drawn on top. Typically *data* is
|
|
53
|
+
* already in sorted order, such as chronological for time series; if needed,
|
|
54
|
+
* consider a **sort** transform.
|
|
55
|
+
*
|
|
56
|
+
* If any **x** or **y** values are invalid (undefined, null, or NaN), the
|
|
57
|
+
* line will be interrupted, resulting in a break that divides the line shape
|
|
58
|
+
* into multiple segments. If a line segment consists of only a single point,
|
|
59
|
+
* it may appear invisible unless rendered with rounded or square line caps.
|
|
60
|
+
* In addition, some curves such as *cardinal-open* only render a visible
|
|
61
|
+
* segment if it contains multiple points.
|
|
62
|
+
*
|
|
63
|
+
* Variable aesthetic channels are supported: if the **stroke** is defined as
|
|
64
|
+
* a channel, the line will be broken into contiguous overlapping segments
|
|
65
|
+
* when the stroke color changes; the stroke color will apply to the interval
|
|
66
|
+
* spanning the current data point and the following data point. This
|
|
67
|
+
* behavior also applies to the **fill**, **fillOpacity**, **strokeOpacity**,
|
|
68
|
+
* **strokeWidth**, **opacity**, **href**, **title**, and **ariaLabel**
|
|
69
|
+
* channels. When any of these channels are used, setting an explicit **z**
|
|
70
|
+
* channel (possibly to null) is strongly recommended.
|
|
71
|
+
*/
|
|
72
|
+
mark: 'line';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The lineX mark. */
|
|
76
|
+
export interface LineX extends MarkData, LineXOptions {
|
|
77
|
+
/**
|
|
78
|
+
* Like line, except that **x** defaults to the identity function assuming
|
|
79
|
+
* that *data* = [*x₀*, *x₁*, *x₂*, …] and **y** defaults to the zero-based
|
|
80
|
+
* index [0, 1, 2, …].
|
|
81
|
+
*/
|
|
82
|
+
mark: 'lineX'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The lineY mark. */
|
|
86
|
+
export interface LineY extends MarkData, LineYOptions {
|
|
87
|
+
/**
|
|
88
|
+
* Like line, except **y** defaults to the identity function and assumes
|
|
89
|
+
* that *data* = [*y₀*, *y₁*, *y₂*, …] and **x** defaults to the zero-based
|
|
90
|
+
* index [0, 1, 2, …].
|
|
91
|
+
*/
|
|
92
|
+
mark: 'lineY'
|
|
93
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ParamRef } from '../Param.js';
|
|
2
|
+
import {
|
|
3
|
+
ChannelValueSpec, CurveAutoOptions, MarkData, MarkOptions, MarkerOptions
|
|
4
|
+
} from './Marks.js';
|
|
5
|
+
|
|
6
|
+
/** Options for the link mark. */
|
|
7
|
+
export interface LinkOptions extends MarkOptions, MarkerOptions, CurveAutoOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The horizontal position, for vertical links; typically bound to the *x*
|
|
10
|
+
* scale; shorthand for setting defaults for both **x1** and **x2**.
|
|
11
|
+
*/
|
|
12
|
+
x?: ChannelValueSpec;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The vertical position, for horizontal links; typically bound to the *y*
|
|
16
|
+
* scale; shorthand for setting defaults for both **y1** and **y2**.
|
|
17
|
+
*/
|
|
18
|
+
y?: ChannelValueSpec;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The starting horizontal position; typically bound to the *x* scale; also
|
|
22
|
+
* sets a default for **x2**.
|
|
23
|
+
*/
|
|
24
|
+
x1?: ChannelValueSpec;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The starting vertical position; typically bound to the *y* scale; also sets
|
|
28
|
+
* a default for **y2**.
|
|
29
|
+
*/
|
|
30
|
+
y1?: ChannelValueSpec;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The ending horizontal position; typically bound to the *x* scale; also sets
|
|
34
|
+
* a default for **x1**.
|
|
35
|
+
*/
|
|
36
|
+
x2?: ChannelValueSpec;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The ending vertical position; typically bound to the *y* scale; also sets a
|
|
40
|
+
* default for **y1**.
|
|
41
|
+
*/
|
|
42
|
+
y2?: ChannelValueSpec;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The curve (interpolation) method for connecting adjacent points.
|
|
46
|
+
*
|
|
47
|
+
* Since a link has exactly two points, only the following curves (or a custom
|
|
48
|
+
* curve) are recommended: *linear*, *step*, *step-after*, *step-before*,
|
|
49
|
+
* *bump-x*, or *bump-y*. Note that the *linear* curve is incapable of showing
|
|
50
|
+
* a fill since a straight line has zero area. For a curved link, use an arrow
|
|
51
|
+
* mark with the **bend** option.
|
|
52
|
+
*
|
|
53
|
+
* If the plot uses a spherical **projection**, the default *auto* **curve**
|
|
54
|
+
* will render links as geodesics; to draw a straight line instead, use the
|
|
55
|
+
* *linear* **curve**.
|
|
56
|
+
*/
|
|
57
|
+
curve?: CurveAutoOptions['curve'] | ParamRef;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The link mark. */
|
|
61
|
+
export interface Link extends MarkData, LinkOptions {
|
|
62
|
+
/**
|
|
63
|
+
* A link mark, drawing line segments (curves) connecting pairs of points.
|
|
64
|
+
*
|
|
65
|
+
* If the plot uses a spherical **projection**, the default *auto* **curve**
|
|
66
|
+
* will render links as geodesics; to draw a straight line instead, use the
|
|
67
|
+
* *linear* **curve**.
|
|
68
|
+
*/
|
|
69
|
+
mark: 'link';
|
|
70
|
+
}
|