@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.
Files changed (158) hide show
  1. package/dist/mosaic-schema.json +192673 -0
  2. package/dist/mosaic-spec.js +5077 -5774
  3. package/dist/mosaic-spec.min.js +23 -23
  4. package/dist/types/ast/ASTNode.d.ts +26 -0
  5. package/dist/types/ast/DataNode.d.ts +60 -0
  6. package/dist/types/ast/ExpressionNode.d.ts +15 -0
  7. package/dist/types/ast/HConcatNode.d.ts +10 -0
  8. package/dist/types/ast/HSpaceNode.d.ts +11 -0
  9. package/dist/types/ast/InputNode.d.ts +8 -0
  10. package/dist/types/ast/LiteralNode.d.ts +7 -0
  11. package/dist/types/ast/OptionsNode.d.ts +10 -0
  12. package/dist/types/ast/ParamNode.d.ts +9 -0
  13. package/dist/types/ast/ParamRefNode.d.ts +8 -0
  14. package/dist/types/ast/PlotAttributeNode.d.ts +18 -0
  15. package/dist/types/ast/PlotFromNode.d.ts +9 -0
  16. package/dist/types/ast/PlotInteractorNode.d.ts +8 -0
  17. package/dist/types/ast/PlotLegendNode.d.ts +10 -0
  18. package/dist/types/ast/PlotMarkNode.d.ts +10 -0
  19. package/dist/types/ast/PlotNode.d.ts +11 -0
  20. package/dist/types/ast/SelectionNode.d.ts +12 -0
  21. package/dist/types/ast/SpecNode.d.ts +10 -0
  22. package/dist/types/ast/TransformNode.d.ts +13 -0
  23. package/dist/types/ast/VConcatNode.d.ts +10 -0
  24. package/dist/types/ast/VSpaceNode.d.ts +11 -0
  25. package/dist/types/ast-to-dom.d.ts +38 -0
  26. package/dist/types/ast-to-esm.d.ts +64 -0
  27. package/dist/types/config/components.d.ts +4 -0
  28. package/dist/types/config/extensions.d.ts +9 -0
  29. package/dist/types/config/inputs.d.ts +5 -0
  30. package/dist/types/config/plots.d.ts +34 -0
  31. package/dist/types/config/transforms.d.ts +4 -0
  32. package/dist/types/constants.d.ts +30 -0
  33. package/dist/types/index.d.ts +29 -0
  34. package/dist/types/parse-spec.d.ts +86 -0
  35. package/dist/types/spec/CSSStyles.d.ts +3 -0
  36. package/dist/types/spec/Data.d.ts +165 -0
  37. package/dist/types/spec/Expression.d.ts +27 -0
  38. package/dist/types/spec/HConcat.d.ts +8 -0
  39. package/dist/types/spec/HSpace.d.ts +9 -0
  40. package/dist/types/spec/Input.d.ts +207 -0
  41. package/dist/types/spec/Param.d.ts +51 -0
  42. package/dist/types/spec/Plot.d.ts +14 -0
  43. package/dist/types/spec/PlotAttribute.d.ts +1522 -0
  44. package/dist/types/spec/PlotFrom.d.ts +20 -0
  45. package/dist/types/spec/PlotInteractor.d.ts +8 -0
  46. package/dist/types/spec/PlotLegend.d.ts +68 -0
  47. package/dist/types/spec/PlotMark.d.ts +27 -0
  48. package/dist/types/spec/PlotTypes.d.ts +293 -0
  49. package/dist/types/spec/Spec.d.ts +52 -0
  50. package/dist/types/spec/Transform.d.ts +314 -0
  51. package/dist/types/spec/VConcat.d.ts +8 -0
  52. package/dist/types/spec/VSpace.d.ts +9 -0
  53. package/dist/types/spec/interactors/Highlight.d.ts +37 -0
  54. package/dist/types/spec/interactors/Interval1D.d.ts +63 -0
  55. package/dist/types/spec/interactors/Interval2D.d.ts +46 -0
  56. package/dist/types/spec/interactors/Nearest.d.ts +44 -0
  57. package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
  58. package/dist/types/spec/interactors/Toggle.d.ts +59 -0
  59. package/dist/types/spec/marks/Area.d.ts +139 -0
  60. package/dist/types/spec/marks/Arrow.d.ts +94 -0
  61. package/dist/types/spec/marks/Axis.d.ts +281 -0
  62. package/dist/types/spec/marks/Bar.d.ts +150 -0
  63. package/dist/types/spec/marks/Cell.d.ts +57 -0
  64. package/dist/types/spec/marks/Contour.d.ts +23 -0
  65. package/dist/types/spec/marks/Delaunay.d.ts +86 -0
  66. package/dist/types/spec/marks/DenseLine.d.ts +27 -0
  67. package/dist/types/spec/marks/Density.d.ts +121 -0
  68. package/dist/types/spec/marks/Dot.d.ts +133 -0
  69. package/dist/types/spec/marks/ErrorBar.d.ts +82 -0
  70. package/dist/types/spec/marks/Frame.d.ts +21 -0
  71. package/dist/types/spec/marks/Geo.d.ts +53 -0
  72. package/dist/types/spec/marks/Hexbin.d.ts +30 -0
  73. package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
  74. package/dist/types/spec/marks/Image.d.ts +89 -0
  75. package/dist/types/spec/marks/Line.d.ts +82 -0
  76. package/dist/types/spec/marks/Link.d.ts +60 -0
  77. package/dist/types/spec/marks/Marks.d.ts +905 -0
  78. package/dist/types/spec/marks/Raster.d.ts +124 -0
  79. package/dist/types/spec/marks/Rect.d.ts +166 -0
  80. package/dist/types/spec/marks/Regression.d.ts +58 -0
  81. package/dist/types/spec/marks/Rule.d.ts +100 -0
  82. package/dist/types/spec/marks/Text.d.ts +110 -0
  83. package/dist/types/spec/marks/Tick.d.ts +61 -0
  84. package/dist/types/spec/marks/Vector.d.ts +99 -0
  85. package/dist/types/util.d.ts +12 -0
  86. package/jsconfig.json +10 -0
  87. package/package.json +14 -9
  88. package/src/ast/ASTNode.js +23 -2
  89. package/src/ast/DataNode.js +79 -21
  90. package/src/ast/HSpaceNode.js +1 -1
  91. package/src/ast/InputNode.js +1 -2
  92. package/src/ast/ParamNode.js +1 -2
  93. package/src/ast/PlotAttributeNode.js +1 -2
  94. package/src/ast/PlotInteractorNode.js +1 -2
  95. package/src/ast/PlotLegendNode.js +1 -2
  96. package/src/ast/PlotMarkNode.js +3 -2
  97. package/src/ast/TransformNode.js +1 -2
  98. package/src/ast/VSpaceNode.js +1 -1
  99. package/src/ast-to-dom.js +9 -3
  100. package/src/ast-to-esm.js +41 -12
  101. package/src/config/inputs.js +1 -0
  102. package/src/config/plots.js +4 -0
  103. package/src/config/transforms.js +6 -0
  104. package/src/index.js +4 -0
  105. package/src/parse-spec.js +38 -5
  106. package/src/spec/CSSStyles.ts +9 -0
  107. package/src/spec/Data.ts +184 -0
  108. package/src/spec/Expression.ts +31 -0
  109. package/src/spec/HConcat.ts +9 -0
  110. package/src/spec/HSpace.ts +9 -0
  111. package/src/spec/Input.ts +204 -0
  112. package/src/spec/Param.ts +68 -0
  113. package/src/spec/Plot.ts +15 -0
  114. package/src/spec/PlotAttribute.ts +1783 -0
  115. package/src/spec/PlotFrom.ts +23 -0
  116. package/src/spec/PlotInteractor.ts +25 -0
  117. package/src/spec/PlotLegend.ts +70 -0
  118. package/src/spec/PlotMark.ts +53 -0
  119. package/src/spec/PlotTypes.ts +519 -0
  120. package/src/spec/Spec.ts +70 -0
  121. package/src/spec/Transform.ts +446 -0
  122. package/src/spec/VConcat.ts +9 -0
  123. package/src/spec/VSpace.ts +9 -0
  124. package/src/spec/interactors/Highlight.ts +38 -0
  125. package/src/spec/interactors/Interval1D.ts +67 -0
  126. package/src/spec/interactors/Interval2D.ts +48 -0
  127. package/src/spec/interactors/Nearest.ts +48 -0
  128. package/src/spec/interactors/PanZoom.ts +65 -0
  129. package/src/spec/interactors/Toggle.ts +65 -0
  130. package/src/spec/marks/Area.ts +154 -0
  131. package/src/spec/marks/Arrow.ts +108 -0
  132. package/src/spec/marks/Axis.ts +305 -0
  133. package/src/spec/marks/Bar.ts +160 -0
  134. package/src/spec/marks/Cell.ts +62 -0
  135. package/src/spec/marks/Contour.ts +25 -0
  136. package/src/spec/marks/Delaunay.ts +95 -0
  137. package/src/spec/marks/DenseLine.ts +30 -0
  138. package/src/spec/marks/Density.ts +145 -0
  139. package/src/spec/marks/Dot.ts +152 -0
  140. package/src/spec/marks/ErrorBar.ts +91 -0
  141. package/src/spec/marks/Frame.ts +23 -0
  142. package/src/spec/marks/Geo.ts +58 -0
  143. package/src/spec/marks/Hexbin.ts +34 -0
  144. package/src/spec/marks/Hexgrid.ts +27 -0
  145. package/src/spec/marks/Image.ts +101 -0
  146. package/src/spec/marks/Line.ts +93 -0
  147. package/src/spec/marks/Link.ts +70 -0
  148. package/src/spec/marks/Marks.ts +1088 -0
  149. package/src/spec/marks/Raster.ts +145 -0
  150. package/src/spec/marks/Rect.ts +183 -0
  151. package/src/spec/marks/Regression.ts +63 -0
  152. package/src/spec/marks/Rule.ts +113 -0
  153. package/src/spec/marks/Text.ts +127 -0
  154. package/src/spec/marks/Tick.ts +69 -0
  155. package/src/spec/marks/Vector.ts +113 -0
  156. package/src/util.js +8 -0
  157. package/tsconfig.json +11 -0
  158. package/LICENSE +0 -47
@@ -0,0 +1,57 @@
1
+ import { ChannelValueSpec, InsetOptions, MarkData, MarkOptions } from './Marks.js';
2
+ import { RectCornerOptions } from './Rect.js';
3
+ /** Options for the cell mark. */
4
+ export interface CellOptions extends MarkOptions, InsetOptions, RectCornerOptions {
5
+ /**
6
+ * The horizontal position of the cell; an optional ordinal channel typically
7
+ * bound to the *x* scale. If not specified, the cell spans the horizontal
8
+ * extent of the frame; otherwise the *x* scale must be a *band* scale.
9
+ *
10
+ * If *x* represents quantitative or temporal values, use a barX mark instead;
11
+ * if *y* is also quantitative or temporal, use a rect mark.
12
+ */
13
+ x?: ChannelValueSpec;
14
+ /**
15
+ * The vertical position of the cell; an optional ordinal channel typically
16
+ * bound to the *y* scale. If not specified, the cell spans the vertical
17
+ * extent of the frame; otherwise the *y* scale must be a *band* scale.
18
+ *
19
+ * If *y* represents quantitative or temporal values, use a barY mark instead;
20
+ * if *x* is also quantitative or temporal, use a rect mark.
21
+ */
22
+ y?: ChannelValueSpec;
23
+ }
24
+ /** The cell mark. */
25
+ export interface Cell extends MarkData, CellOptions {
26
+ /**
27
+ * A rectangular cell mark. Along with **x** and/or **y**, a **fill** channel
28
+ * is typically specified to encode value as color.
29
+ *
30
+ * If neither **x** nor **y** are specified, *data* is assumed to be an array of
31
+ * pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*,
32
+ * *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
33
+ *
34
+ * Both **x** and **y** should be ordinal; if only **x** is quantitative (or
35
+ * temporal), use a barX mark; if only **y** is quantitative, use a barY mark;
36
+ * if both are quantitative, use a rect mark.
37
+ */
38
+ mark: 'cell';
39
+ }
40
+ /** The cellX mark. */
41
+ export interface CellX extends MarkData, CellOptions {
42
+ /**
43
+ * Like cell, but **x** defaults to the zero-based index [0, 1, 2, …], and if
44
+ * **stroke** is not a channel, **fill** defaults to the identity function,
45
+ * assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
46
+ */
47
+ mark: 'cellX';
48
+ }
49
+ /** The cellY mark. */
50
+ export interface CellY extends MarkData, CellOptions {
51
+ /**
52
+ * Like cell, but **y** defaults to the zero-based index [0, 1, 2, …], and if
53
+ * **stroke** is not a channel, **fill** defaults to the identity function,
54
+ * assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
55
+ */
56
+ mark: 'cellY';
57
+ }
@@ -0,0 +1,23 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { MarkData, MarkOptions } from './Marks.js';
3
+ import { Grid2DOptions } from './Raster.js';
4
+ export interface ContourOptions extends MarkOptions, Grid2DOptions {
5
+ /**
6
+ * The number of contour thresholds to subdivide the domain into discrete
7
+ * level sets; defaults to 10. One of:
8
+ *
9
+ * - a count representing the desired number of bins
10
+ * - an array of *n* threshold values for *n* - 1 bins
11
+ */
12
+ thresholds?: number | number[] | ParamRef;
13
+ }
14
+ /** The contour mark. */
15
+ export interface Contour extends MarkData, ContourOptions {
16
+ /**
17
+ * A contour mark that draws isolines to delineate regions above and below a
18
+ * particular continuous value. It is often used to convey densities as a
19
+ * height field. The special column name "density" can be used to map density
20
+ * values to the fill or stroke options.
21
+ */
22
+ mark: 'contour';
23
+ }
@@ -0,0 +1,86 @@
1
+ import { ChannelValue, ChannelValueSpec, CurveOptions, MarkData, MarkOptions, MarkerOptions } from './Marks.js';
2
+ /** Options for the Delaunay marks. */
3
+ export interface DelaunayOptions extends MarkOptions, MarkerOptions, CurveOptions {
4
+ /** The horizontal position channel, typically bound to the *x* scale. */
5
+ x?: ChannelValueSpec;
6
+ /** The vertical position channel, typically bound to the *y* scale. */
7
+ y?: ChannelValueSpec;
8
+ /**
9
+ * An optional ordinal channel for grouping to produce multiple
10
+ * (possibly overlapping) triangulations.
11
+ */
12
+ z?: ChannelValue;
13
+ }
14
+ /** The delaunayLink mark. */
15
+ export interface DelaunayLink extends MarkData, DelaunayOptions {
16
+ /**
17
+ * A mark that draws links for each edge of the Delaunay triangulation
18
+ * of points given by the **x** and **y** channels. Like the link mark,
19
+ * except that **x1**, **y1**, **x2**, and **y2** are derived automatically
20
+ * from **x** and **y**. When an aesthetic channel is specified (such as
21
+ * **stroke** or **strokeWidth**), the link inherits the corresponding
22
+ * channel value from one of its two endpoints arbitrarily.
23
+ *
24
+ * If **z** is specified, the input points are grouped by *z*, producing a
25
+ * separate Delaunay triangulation for each group.
26
+ */
27
+ mark: 'delaunayLink';
28
+ }
29
+ /** The delaunayMesh mark. */
30
+ export interface DelaunayMesh extends MarkData, DelaunayOptions {
31
+ /**
32
+ * A mark that draws a mesh of the Delaunay triangulation of the points
33
+ * given by the **x** and **y** channels. The **stroke** option defaults to
34
+ * _currentColor_, and the **strokeOpacity** defaults to 0.2; the **fill**
35
+ * option is not supported. When an aesthetic channel is specified (such as
36
+ * **stroke** or **strokeWidth**), the mesh inherits the corresponding
37
+ * channel value from one of its constituent points arbitrarily.
38
+ *
39
+ * If **z** is specified, the input points are grouped by *z*, producing a
40
+ * separate Delaunay triangulation for each group.
41
+ */
42
+ mark: 'delaunayMesh';
43
+ }
44
+ /** The hull mark. */
45
+ export interface Hull extends MarkData, DelaunayOptions {
46
+ /**
47
+ * A mark that draws a convex hull around the points given by the **x** and
48
+ * **y** channels. The **stroke** option defaults to _currentColor_ and the
49
+ * **fill** option defaults to _none_. When an aesthetic channel is specified
50
+ * (such as **stroke** or **strokeWidth**), the hull inherits the
51
+ * corresponding channel value from one of its constituent points
52
+ * arbitrarily.
53
+ *
54
+ * If **z** is specified, the input points are grouped by *z*, producing a
55
+ * separate hull for each group. If **z** is not specified, it defaults to
56
+ * the **fill** channel, if any, or the **stroke** channel, if any.
57
+ */
58
+ mark: 'hull';
59
+ }
60
+ /** The voronoi mark. */
61
+ export interface Voronoi extends MarkData, DelaunayOptions {
62
+ /**
63
+ * A mark that draws polygons for each cell of the Voronoi tesselation
64
+ * of the points given by the **x** and **y** channels.
65
+ *
66
+ * If **z** is specified, the input points are grouped by *z*, producing a
67
+ * separate Voronoi tesselation for each group.
68
+ */
69
+ mark: 'voronoi';
70
+ }
71
+ /** The voronoiMesh mark. */
72
+ export interface VoronoiMesh extends MarkData, DelaunayOptions {
73
+ /**
74
+ * A mark that draws a mesh for the cell boundaries of the Voronoi
75
+ * tesselation of the points given by the **x** and **y** channels. The
76
+ * **stroke** option defaults to _currentColor_, and the **strokeOpacity**
77
+ * defaults to 0.2. The **fill** option is not supported. When an aesthetic
78
+ * channel is specified (such as **stroke** or **strokeWidth**), the mesh
79
+ * inherits the corresponding channel value from one of its constituent
80
+ * points arbitrarily.
81
+ *
82
+ * If **z** is specified, the input points are grouped by *z*, producing a
83
+ * separate Voronoi tesselation for each group.
84
+ */
85
+ mark: 'voronoiMesh';
86
+ }
@@ -0,0 +1,27 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { ChannelValue, MarkData } from './Marks.js';
3
+ import { RasterOptions } from './Raster.js';
4
+ export interface DenseLineOptions extends RasterOptions {
5
+ /**
6
+ * Flag to perform approximate arc length normalization of line segments
7
+ * to prevent artifacts due to overcounting steep lines. Defaults to `true`.
8
+ */
9
+ normalize?: boolean | ParamRef;
10
+ /**
11
+ * A ordinal channel for grouping data into series to be drawn as separate
12
+ * lines.
13
+ */
14
+ z?: ChannelValue;
15
+ }
16
+ /** The denseLine mark. */
17
+ export interface DenseLine extends MarkData, DenseLineOptions {
18
+ /**
19
+ * A denseLine mark that plots line densities rather than point densities.
20
+ * The mark forms a binned raster grid and "draws" straight lines into it.
21
+ * To avoid over-weighting steep lines, by default each drawn series is
22
+ * normalized on a per-column basis to approximate arc length normalization.
23
+ * The values for each series are aggregated to form the line density, which
24
+ * is then drawn as an image similar to the raster mark.
25
+ */
26
+ mark: 'denseLine';
27
+ }
@@ -0,0 +1,121 @@
1
+ import { ParamRef } from "../Param.js";
2
+ import { AreaXOptions, AreaYOptions } from "./Area.js";
3
+ import { DotOptions } from "./Dot.js";
4
+ import { LineXOptions, LineYOptions } from "./Line.js";
5
+ import { MarkData, MarkOptions, TextStyles } from "./Marks.js";
6
+ import { Grid2DOptions } from "./Raster.js";
7
+ import { TextOptions } from "./Text.js";
8
+ export interface Density2DOptions extends MarkOptions, Omit<DotOptions, 'x' | 'y'>, TextStyles, Grid2DOptions {
9
+ /**
10
+ * The basic mark type to use to render 2D density values.
11
+ * Defaults to a dot mark; cell and text marks are also supported.
12
+ */
13
+ type?: 'dot' | 'circle' | 'hexagon' | 'cell' | 'text' | ParamRef;
14
+ }
15
+ /** The density mark for 2D densities. */
16
+ export interface Density extends MarkData, Density2DOptions {
17
+ /**
18
+ * A 2D density mark that shows smoothed point cloud densities along two
19
+ * dimensions. The mark bins the data, counts the number of records that fall
20
+ * into each bin, and smooths the resulting counts, then plots the smoothed
21
+ * distribution, by default using a circular dot mark. The density mark
22
+ * calculates density values that can be mapped to encoding channels such as
23
+ * fill or r using the special field name "density".
24
+ *
25
+ * Set the *type* property to use a different base mark type.
26
+ */
27
+ mark: 'density';
28
+ }
29
+ export interface Density1DOptions {
30
+ /**
31
+ * The kernel density bandwidth for smoothing, in pixels. Defaults to 20.
32
+ */
33
+ bandwidth?: number | ParamRef;
34
+ /**
35
+ * The number of bins over which to discretize the data prior to smoothing.
36
+ * Defaults to 1024.
37
+ */
38
+ bins?: number | ParamRef;
39
+ }
40
+ export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2'> {
41
+ /**
42
+ * The basic mark type to use to render 1D density values. Defaults to an
43
+ * areaX mark; lineX, dotX, and textX marks are also supported.
44
+ */
45
+ type: 'areaX';
46
+ }
47
+ export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2'> {
48
+ /**
49
+ * The basic mark type to use to render 1D density values. Defaults to an
50
+ * areaY mark; lineY, dot, and text marks are also supported.
51
+ */
52
+ type?: 'areaY';
53
+ }
54
+ export interface DensityLineXOptions extends Omit<LineXOptions, 'x' | 'x1' | 'x2'> {
55
+ /**
56
+ * The basic mark type to use to render 1D density values. Defaults to an
57
+ * areaX mark; lineX, dotX, and textX marks are also supported.
58
+ */
59
+ type: 'lineX';
60
+ }
61
+ export interface DensityLineYOptions extends Omit<LineYOptions, 'y' | 'y1' | 'y2'> {
62
+ /**
63
+ * The basic mark type to use to render 1D density values. Defaults to an
64
+ * areaY mark; lineY, dot, and text marks are also supported.
65
+ */
66
+ type: 'lineY';
67
+ }
68
+ export interface DensityDotXOptions extends Omit<DotOptions, 'x'> {
69
+ /**
70
+ * The basic mark type to use to render 1D density values. Defaults to an
71
+ * areaX mark; lineX, dotX, and textX marks are also supported.
72
+ */
73
+ type: 'dotX';
74
+ }
75
+ export interface DensityDotYOptions extends Omit<DotOptions, 'y'> {
76
+ /**
77
+ * The basic mark type to use to render 1D density values. Defaults to an
78
+ * areaY mark; lineY, dot, and text marks are also supported.
79
+ */
80
+ type: 'dot' | 'dotY' | 'circle' | 'hexagon';
81
+ }
82
+ export interface DensityTextXOptions extends Omit<TextOptions, 'x'> {
83
+ /**
84
+ * The basic mark type to use to render 1D density values. Defaults to an
85
+ * areaX mark; lineX, dotX, and textX marks are also supported.
86
+ */
87
+ type: 'textX';
88
+ }
89
+ export interface DensityTextYOptions extends Omit<TextOptions, 'y'> {
90
+ /**
91
+ * The basic mark type to use to render 1D density values. Defaults to an
92
+ * areaY mark; lineY, dot, and text marks are also supported.
93
+ */
94
+ type: 'text' | 'textY';
95
+ }
96
+ export interface DensityXBase extends MarkData, Density1DOptions {
97
+ /**
98
+ * A densityX mark that visualizes smoothed point cloud densities along the
99
+ * **x** dimension. The mark bins the data, counts the number of records that
100
+ * fall into each bin, smooths the resulting counts, and then plots the
101
+ * smoothed distribution, by default using an areaX mark.
102
+ *
103
+ * Set the *type* property to use a different base mark type.
104
+ */
105
+ mark: 'densityX';
106
+ }
107
+ export interface DensityYBase extends MarkData, Density1DOptions {
108
+ /**
109
+ * A densityY mark that visualizes smoothed point cloud densities along the
110
+ * **y** dimension. The mark bins the data, counts the number of records that
111
+ * fall into each bin, smooths the resulting counts, and then plots the
112
+ * smoothed distribution, by default using an areaY mark.
113
+ *
114
+ * Set the *type* property to use a different base mark type.
115
+ */
116
+ mark: 'densityY';
117
+ }
118
+ /** The densityX mark. */
119
+ export type DensityX = DensityXBase & (DensityAreaXOptions | DensityLineXOptions | DensityDotXOptions | DensityTextXOptions);
120
+ /** The densityY mark. */
121
+ export type DensityY = DensityYBase & (DensityAreaYOptions | DensityLineYOptions | DensityDotYOptions | DensityTextYOptions);
@@ -0,0 +1,133 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { FrameAnchor, Interval, SymbolType } from '../PlotTypes.js';
3
+ import { ChannelValue, ChannelValueIntervalSpec, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
4
+ /** Options for the dot mark. */
5
+ export interface DotOptions extends MarkOptions {
6
+ /**
7
+ * The horizontal position channel specifying the dot’s center, typically
8
+ * bound to the *x* scale.
9
+ */
10
+ x?: ChannelValueSpec;
11
+ /**
12
+ * The vertical position channel specifying the dot’s center, typically bound
13
+ * to the *y* scale.
14
+ */
15
+ y?: ChannelValueSpec;
16
+ /**
17
+ * An optional ordinal channel for grouping data into series.
18
+ */
19
+ z?: ChannelValue;
20
+ /**
21
+ * The radius of dots; either a channel or constant. When a number, it is
22
+ * interpreted as a constant radius in pixels. Otherwise it is interpreted as
23
+ * a channel, typically bound to the *r* channel, which defaults to the *sqrt*
24
+ * type for proportional symbols. The radius defaults to 4.5 pixels when using
25
+ * the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive
26
+ * radius are not drawn.
27
+ */
28
+ r?: ChannelValueSpec | number | ParamRef;
29
+ /**
30
+ * The rotation angle of dots in degrees clockwise; either a channel or a
31
+ * constant. When a number, it is interpreted as a constant; otherwise it is
32
+ * interpreted as a channel. Defaults to 0°, pointing up.
33
+ */
34
+ rotate?: ChannelValue | number | ParamRef;
35
+ /**
36
+ * The categorical symbol; either a channel or a constant. A constant symbol
37
+ * can be specified by a valid symbol name such as *star*, or a symbol object
38
+ * (implementing the draw method); otherwise it is interpreted as a channel.
39
+ * Defaults to *circle* for the **dot** mark, and *hexagon* for the
40
+ * **hexagon** mark.
41
+ *
42
+ * If the **symbol** channel’s values are all symbols, symbol names, or
43
+ * nullish, the channel is unscaled (values are interpreted literally);
44
+ * otherwise, the channel is bound to the *symbol* scale.
45
+ */
46
+ symbol?: ChannelValueSpec | SymbolType | ParamRef;
47
+ /**
48
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
49
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
50
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
51
+ * *bottom-left*), or the *middle* of the frame. For example, for dots
52
+ * distributed horizontally at the top of the frame:
53
+ *
54
+ * ```js
55
+ * Plot.dot(data, {x: "date", frameAnchor: "top"})
56
+ * ```
57
+ */
58
+ frameAnchor?: FrameAnchor | ParamRef;
59
+ }
60
+ /** Options for the dotX mark. */
61
+ export interface DotXOptions extends Omit<DotOptions, "y"> {
62
+ /**
63
+ * The vertical position of the dot’s center, typically bound to the *y*
64
+ * scale.
65
+ */
66
+ y?: ChannelValueIntervalSpec;
67
+ /**
68
+ * An interval (such as *day* or a number), to transform **y** values to the
69
+ * middle of the interval.
70
+ */
71
+ interval?: Interval | ParamRef;
72
+ }
73
+ /** Options for the dotY mark. */
74
+ export interface DotYOptions extends Omit<DotOptions, "x"> {
75
+ /**
76
+ * The horizontal position of the dot’s center, typically bound to the *x*
77
+ * scale.
78
+ */
79
+ x?: ChannelValueIntervalSpec;
80
+ /**
81
+ * An interval (such as *day* or a number), to transform **x** values to the
82
+ * middle of the interval.
83
+ */
84
+ interval?: Interval | ParamRef;
85
+ }
86
+ /** The dot mark. */
87
+ export interface Dot extends MarkData, DotOptions {
88
+ /**
89
+ * A dot mark that draws circles, or other symbols, as in a scatterplot.
90
+ *
91
+ * If either **x** or **y** is not specified, the default is determined by the
92
+ * **frameAnchor** option. If none of **x**, **y**, and **frameAnchor** are
93
+ * specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*,
94
+ * *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** =
95
+ * [*y₀*, *y₁*, *y₂*, …].
96
+ *
97
+ * Dots are sorted by descending radius **r** by default to mitigate
98
+ * overplotting; set the **sort** option to null to draw them in input order.
99
+ */
100
+ mark: 'dot';
101
+ }
102
+ /** The dotX mark. */
103
+ export interface DotX extends MarkData, DotXOptions {
104
+ /**
105
+ * Like dot, except that **x** defaults to the identity function, assuming that
106
+ * *data* = [*x₀*, *x₁*, *x₂*, …].
107
+ *
108
+ * If an **interval** is specified, such as *day*, **y** is transformed to the
109
+ * middle of the interval.
110
+ */
111
+ mark: 'dotX';
112
+ }
113
+ /** The dotY mark. */
114
+ export interface DotY extends MarkData, DotYOptions {
115
+ /**
116
+ * Like dot, except that **y** defaults to the identity function, assuming that
117
+ * *data* = [*y₀*, *y₁*, *y₂*, …].
118
+ *
119
+ * If an **interval** is specified, such as *day*, **x** is transformed to the
120
+ * middle of the interval.
121
+ */
122
+ mark: 'dotY';
123
+ }
124
+ /** The circle mark. */
125
+ export interface Circle extends MarkData, Exclude<DotOptions, 'symbol'> {
126
+ /** Like dot, except that the **symbol** option is set to *circle*. */
127
+ mark: 'circle';
128
+ }
129
+ /** The hexagon mark. */
130
+ export interface Hexagon extends MarkData, Exclude<DotOptions, 'symbol'> {
131
+ /** Like dot, except that the **symbol** option is set to *hexagon*. */
132
+ mark: 'hexagon';
133
+ }
@@ -0,0 +1,82 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions, MarkerOptions } from './Marks.js';
3
+ /** Options for errorbar marks. */
4
+ interface ErrorBarOptions extends MarkOptions, MarkerOptions {
5
+ /**
6
+ * The confidence interval in (0, 1); defaults to 0.95.
7
+ */
8
+ ci?: number | ParamRef;
9
+ /**
10
+ * An optional ordinal channel for grouping data, producing an independent
11
+ * error bar for each group. If not specified, it defaults to **stroke** if
12
+ * a channel.
13
+ */
14
+ z?: ChannelValue;
15
+ }
16
+ /** Options for the errorbarX mark. */
17
+ export interface ErrorBarXOptions extends ErrorBarOptions {
18
+ /**
19
+ * The dependent variable horizontal position channel, typically bound to the
20
+ * *x* scale.
21
+ */
22
+ x: ChannelValueSpec;
23
+ /**
24
+ * The independent variable vertical position channel, typically bound to
25
+ * the *y* scale; defaults to the zero-based index of the data [0, 1, 2, …].
26
+ */
27
+ y?: ChannelValueSpec;
28
+ }
29
+ /** The errorbarX mark. */
30
+ export interface ErrorBarX extends MarkData, ErrorBarXOptions {
31
+ /**
32
+ * A mark that draws error bars for a calculated parametric confidence
33
+ * interval for a dependent variable (*x*), potentially grouped by an
34
+ * independent variable (*y*).
35
+ *
36
+ * This mark aggregates raw values to produce a [parametric confidence
37
+ * interval][1] of the mean, assuming a normal distribution. To instead
38
+ * visualize pre-computeted interval values or custom aggregations, use
39
+ * a **ruleY** mark with specified **x1** and **x2** channels.
40
+ *
41
+ * Multiple error bars can be produced by specifying a **z** or **stroke**
42
+ * channel. Set the **marker** option to `'tick'` to add small perpendicular
43
+ * lines at the start and end of the error interval.
44
+ *
45
+ * [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
46
+ */
47
+ mark: 'errorbarX';
48
+ }
49
+ /** Options for the errorbarY mark. */
50
+ export interface ErrorBarYOptions extends ErrorBarOptions {
51
+ /**
52
+ * The independent variable horizontal position channel, typically bound to
53
+ * the *x* scale; defaults to the zero-based index of the data [0, 1, 2, …].
54
+ */
55
+ x?: ChannelValueSpec;
56
+ /**
57
+ * The dependent variable vertical position channel, typically bound to the
58
+ * *y* scale.
59
+ */
60
+ y: ChannelValueSpec;
61
+ }
62
+ /** The errorbarY mark. */
63
+ export interface ErrorBarY extends MarkData, ErrorBarYOptions {
64
+ /**
65
+ * A mark that draws error bars for a calculated parametric confidence
66
+ * interval for a dependent variable (*y*), potentially grouped by an
67
+ * independent variable (*x*).
68
+ *
69
+ * This mark aggregates raw values to produce a [parametric confidence
70
+ * interval][1] of the mean, assuming a normal distribution. To instead
71
+ * visualize pre-computeted interval values or custom aggregations, use
72
+ * a **ruleX** mark with specified **y1** and **y2** channels.
73
+ *
74
+ * Multiple error bars can be produced by specifying a **z** or **stroke**
75
+ * channel. Set the **marker** option to `'tick'` to add small perpendicular
76
+ * lines at the start and end of the error interval.
77
+ *
78
+ * [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
79
+ */
80
+ mark: 'errorbarY';
81
+ }
82
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { InsetOptions, MarkOptions } from './Marks.js';
3
+ import { RectCornerOptions } from './Rect.js';
4
+ /** Options for the frame decoration mark. */
5
+ export interface FrameOptions extends MarkOptions, InsetOptions, RectCornerOptions {
6
+ /**
7
+ * If null (default), the rectangular outline of the frame is drawn;
8
+ * otherwise the frame is drawn as a line only on the given side, and the
9
+ * **rx**, **ry**, **fill**, and **fillOpacity** options are ignored.
10
+ */
11
+ anchor?: 'top' | 'right' | 'bottom' | 'left' | null | ParamRef;
12
+ }
13
+ /** The frame mark. */
14
+ export interface Frame extends FrameOptions {
15
+ /**
16
+ * Draws a rectangle around the plot’s frame, or if an **anchor** is given,
17
+ * a line on the given side. Useful for visual separation of facets, or in
18
+ * conjunction with axes and grids to fill the frame’s background.
19
+ */
20
+ mark: 'frame';
21
+ }
@@ -0,0 +1,53 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
3
+ /** Options for the geo mark. */
4
+ export interface GeoOptions extends MarkOptions {
5
+ /**
6
+ * A required channel for the geometry to render; defaults to identity,
7
+ * assuming *data* is a GeoJSON object or an iterable of GeoJSON objects.
8
+ */
9
+ geometry?: ChannelValue;
10
+ /**
11
+ * The size of Point and MultiPoint geometries, defaulting to a constant 3
12
+ * pixels. If **r** is a number, it is interpreted as a constant radius in
13
+ * pixels; otherwise it is interpreted as a channel and the effective radius
14
+ * is controlled by the *r* scale, which defaults to a *sqrt* scale such that
15
+ * the visual area of a point is proportional to its associated value.
16
+ *
17
+ * If **r** is a channel, geometries will be sorted by descending radius by
18
+ * default, to limit occlusion; use the **sort** transform to control render
19
+ * order. Geometries with a nonpositive radius are not drawn.
20
+ */
21
+ r?: ChannelValueSpec | ParamRef;
22
+ }
23
+ /** The geo mark. */
24
+ export interface Geo extends MarkData, GeoOptions {
25
+ /**
26
+ * A geo mark. The **geometry** channel, which defaults to the identity
27
+ * function assuming that *data* is a GeoJSON object or an iterable of
28
+ * GeoJSON objects, is projected to the plane using the plot’s top-level
29
+ * **projection**.
30
+ *
31
+ * If *data* is a GeoJSON feature collection, then the mark’s data is
32
+ * *data*.features; if *data* is a GeoJSON geometry collection, then the
33
+ * mark’s data is *data*.geometries; if *data* is some other GeoJSON
34
+ * object, then the mark’s data is the single-element array [*data*].
35
+ */
36
+ mark: 'geo';
37
+ }
38
+ /** The sphere mark. */
39
+ export interface Sphere extends MarkOptions {
40
+ /**
41
+ * A geo mark whose *data* is the outline of the sphere on the
42
+ * projection’s plane. (For use with a spherical **projection** only.)
43
+ */
44
+ mark: 'sphere';
45
+ }
46
+ /** The graticule mark. */
47
+ export interface Graticule extends MarkOptions {
48
+ /**
49
+ * A geo mark whose *data* is a 10° global graticule. (For use with a
50
+ * spherical **projection** only.)
51
+ */
52
+ mark: 'graticule';
53
+ }
@@ -0,0 +1,30 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { DotOptions } from './Dot.js';
3
+ import { ChannelValue, MarkData, TextStyles } from './Marks.js';
4
+ export interface HexbinOptions extends DotOptions, TextStyles {
5
+ /**
6
+ * The basic mark type to use for hex-binned values.
7
+ * Defaults to a hexagon mark; dot and text marks are also supported.
8
+ */
9
+ type?: 'dot' | 'circle' | 'hexagon' | 'text' | ParamRef;
10
+ /**
11
+ * The distance between centers of neighboring hexagons, in pixels; defaults
12
+ * to 20. If also using a hexgrid mark, use matching **binWidth** values.
13
+ */
14
+ binWidth?: number | ParamRef;
15
+ /**
16
+ * How to subdivide bins. If not specified, defaults to the *fill* channel,
17
+ * if any, or the *stroke* channel, if any. If null, bins will not be
18
+ * subdivided.
19
+ */
20
+ z?: ChannelValue;
21
+ }
22
+ /** The hexbin mark. */
23
+ export interface Hexbin extends MarkData, HexbinOptions {
24
+ /**
25
+ * A hexbin mark that bins **x** and **y** data into a hexagonal grid and
26
+ * visualizes aggregate functions per bin (e.g., count for binned density).
27
+ * Aggregate functions can be used for fill, stroke, or r (radius) options.
28
+ */
29
+ mark: 'hexbin';
30
+ }
@@ -0,0 +1,25 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { MarkOptions } from './Marks.js';
3
+ /** Options for the hexgrid mark. */
4
+ export interface HexgridOptions extends MarkOptions {
5
+ /**
6
+ * The distance between centers of neighboring hexagons, in pixels; defaults
7
+ * to 20. Should match the **binWidth** of the hexbin mark.
8
+ */
9
+ binWidth?: number | ParamRef;
10
+ }
11
+ /** The hexgrid mark. */
12
+ export interface Hexgrid extends HexgridOptions {
13
+ /**
14
+ * The hexgrid decoration mark complements the hexbin mark, showing the
15
+ * outlines of all hexagons spanning the frame with a default **stroke** of
16
+ * *currentColor* and a default **strokeOpacity** of 0.1, similar to the
17
+ * default axis grids.
18
+ *
19
+ * Note that the **binWidth** option of the hexgrid mark should match that of
20
+ * the hexbin transform. The grid is clipped by the frame. This is a
21
+ * stroke-only mark, and **fill** is not supported; to fill the frame,
22
+ * use the frame mark.
23
+ */
24
+ mark: 'hexgrid';
25
+ }