@uwdata/mosaic-spec 0.7.1 → 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.
Files changed (154) hide show
  1. package/dist/mosaic-schema.json +186153 -0
  2. package/dist/mosaic-spec.js +2977 -4237
  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 +182 -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 +26 -0
  48. package/dist/types/spec/PlotTypes.d.ts +293 -0
  49. package/dist/types/spec/Spec.d.ts +45 -0
  50. package/dist/types/spec/Transform.d.ts +278 -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 +25 -0
  57. package/dist/types/spec/interactors/PanZoom.d.ts +58 -0
  58. package/dist/types/spec/interactors/Toggle.d.ts +51 -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 +129 -0
  69. package/dist/types/spec/marks/Frame.d.ts +21 -0
  70. package/dist/types/spec/marks/Geo.d.ts +53 -0
  71. package/dist/types/spec/marks/Hexbin.d.ts +30 -0
  72. package/dist/types/spec/marks/Hexgrid.d.ts +25 -0
  73. package/dist/types/spec/marks/Image.d.ts +89 -0
  74. package/dist/types/spec/marks/Line.d.ts +82 -0
  75. package/dist/types/spec/marks/Link.d.ts +60 -0
  76. package/dist/types/spec/marks/Marks.d.ts +890 -0
  77. package/dist/types/spec/marks/Raster.d.ts +124 -0
  78. package/dist/types/spec/marks/Rect.d.ts +166 -0
  79. package/dist/types/spec/marks/Regression.d.ts +58 -0
  80. package/dist/types/spec/marks/Rule.d.ts +100 -0
  81. package/dist/types/spec/marks/Text.d.ts +106 -0
  82. package/dist/types/spec/marks/Tick.d.ts +61 -0
  83. package/dist/types/spec/marks/Vector.d.ts +99 -0
  84. package/dist/types/util.d.ts +12 -0
  85. package/jsconfig.json +10 -0
  86. package/package.json +16 -9
  87. package/src/ast/ASTNode.js +23 -2
  88. package/src/ast/DataNode.js +79 -21
  89. package/src/ast/HSpaceNode.js +1 -1
  90. package/src/ast/InputNode.js +1 -2
  91. package/src/ast/ParamNode.js +1 -2
  92. package/src/ast/PlotAttributeNode.js +1 -2
  93. package/src/ast/PlotInteractorNode.js +1 -2
  94. package/src/ast/PlotLegendNode.js +1 -2
  95. package/src/ast/PlotMarkNode.js +3 -2
  96. package/src/ast/TransformNode.js +1 -2
  97. package/src/ast/VSpaceNode.js +1 -1
  98. package/src/ast-to-dom.js +9 -3
  99. package/src/ast-to-esm.js +41 -12
  100. package/src/config/inputs.js +1 -0
  101. package/src/config/plots.js +4 -0
  102. package/src/index.js +4 -0
  103. package/src/parse-spec.js +38 -5
  104. package/src/spec/CSSStyles.ts +9 -0
  105. package/src/spec/Data.ts +184 -0
  106. package/src/spec/Expression.ts +31 -0
  107. package/src/spec/HConcat.ts +9 -0
  108. package/src/spec/HSpace.ts +9 -0
  109. package/src/spec/Input.ts +182 -0
  110. package/src/spec/Param.ts +68 -0
  111. package/src/spec/Plot.ts +15 -0
  112. package/src/spec/PlotAttribute.ts +1783 -0
  113. package/src/spec/PlotFrom.ts +23 -0
  114. package/src/spec/PlotInteractor.ts +25 -0
  115. package/src/spec/PlotLegend.ts +70 -0
  116. package/src/spec/PlotMark.ts +51 -0
  117. package/src/spec/PlotTypes.ts +519 -0
  118. package/src/spec/Spec.ts +63 -0
  119. package/src/spec/Transform.ts +394 -0
  120. package/src/spec/VConcat.ts +9 -0
  121. package/src/spec/VSpace.ts +9 -0
  122. package/src/spec/interactors/Highlight.ts +38 -0
  123. package/src/spec/interactors/Interval1D.ts +67 -0
  124. package/src/spec/interactors/Interval2D.ts +48 -0
  125. package/src/spec/interactors/Nearest.ts +28 -0
  126. package/src/spec/interactors/PanZoom.ts +65 -0
  127. package/src/spec/interactors/Toggle.ts +56 -0
  128. package/src/spec/marks/Area.ts +154 -0
  129. package/src/spec/marks/Arrow.ts +108 -0
  130. package/src/spec/marks/Axis.ts +305 -0
  131. package/src/spec/marks/Bar.ts +160 -0
  132. package/src/spec/marks/Cell.ts +62 -0
  133. package/src/spec/marks/Contour.ts +25 -0
  134. package/src/spec/marks/Delaunay.ts +95 -0
  135. package/src/spec/marks/DenseLine.ts +30 -0
  136. package/src/spec/marks/Density.ts +145 -0
  137. package/src/spec/marks/Dot.ts +147 -0
  138. package/src/spec/marks/Frame.ts +23 -0
  139. package/src/spec/marks/Geo.ts +58 -0
  140. package/src/spec/marks/Hexbin.ts +34 -0
  141. package/src/spec/marks/Hexgrid.ts +27 -0
  142. package/src/spec/marks/Image.ts +101 -0
  143. package/src/spec/marks/Line.ts +93 -0
  144. package/src/spec/marks/Link.ts +70 -0
  145. package/src/spec/marks/Marks.ts +1062 -0
  146. package/src/spec/marks/Raster.ts +145 -0
  147. package/src/spec/marks/Rect.ts +183 -0
  148. package/src/spec/marks/Regression.ts +63 -0
  149. package/src/spec/marks/Rule.ts +113 -0
  150. package/src/spec/marks/Text.ts +122 -0
  151. package/src/spec/marks/Tick.ts +69 -0
  152. package/src/spec/marks/Vector.ts +113 -0
  153. package/src/util.js +8 -0
  154. package/tsconfig.json +11 -0
@@ -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,129 @@
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
+ * The radius of dots; either a channel or constant. When a number, it is
18
+ * interpreted as a constant radius in pixels. Otherwise it is interpreted as
19
+ * a channel, typically bound to the *r* channel, which defaults to the *sqrt*
20
+ * type for proportional symbols. The radius defaults to 4.5 pixels when using
21
+ * the **symbol** channel, and otherwise 3 pixels. Dots with a nonpositive
22
+ * radius are not drawn.
23
+ */
24
+ r?: ChannelValueSpec | number | ParamRef;
25
+ /**
26
+ * The rotation angle of dots in degrees clockwise; either a channel or a
27
+ * constant. When a number, it is interpreted as a constant; otherwise it is
28
+ * interpreted as a channel. Defaults to 0°, pointing up.
29
+ */
30
+ rotate?: ChannelValue | number | ParamRef;
31
+ /**
32
+ * The categorical symbol; either a channel or a constant. A constant symbol
33
+ * can be specified by a valid symbol name such as *star*, or a symbol object
34
+ * (implementing the draw method); otherwise it is interpreted as a channel.
35
+ * Defaults to *circle* for the **dot** mark, and *hexagon* for the
36
+ * **hexagon** mark.
37
+ *
38
+ * If the **symbol** channel’s values are all symbols, symbol names, or
39
+ * nullish, the channel is unscaled (values are interpreted literally);
40
+ * otherwise, the channel is bound to the *symbol* scale.
41
+ */
42
+ symbol?: ChannelValueSpec | SymbolType | ParamRef;
43
+ /**
44
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
45
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
46
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
47
+ * *bottom-left*), or the *middle* of the frame. For example, for dots
48
+ * distributed horizontally at the top of the frame:
49
+ *
50
+ * ```js
51
+ * Plot.dot(data, {x: "date", frameAnchor: "top"})
52
+ * ```
53
+ */
54
+ frameAnchor?: FrameAnchor | ParamRef;
55
+ }
56
+ /** Options for the dotX mark. */
57
+ export interface DotXOptions extends Omit<DotOptions, "y"> {
58
+ /**
59
+ * The vertical position of the dot’s center, typically bound to the *y*
60
+ * scale.
61
+ */
62
+ y?: ChannelValueIntervalSpec;
63
+ /**
64
+ * An interval (such as *day* or a number), to transform **y** values to the
65
+ * middle of the interval.
66
+ */
67
+ interval?: Interval | ParamRef;
68
+ }
69
+ /** Options for the dotY mark. */
70
+ export interface DotYOptions extends Omit<DotOptions, "x"> {
71
+ /**
72
+ * The horizontal position of the dot’s center, typically bound to the *x*
73
+ * scale.
74
+ */
75
+ x?: ChannelValueIntervalSpec;
76
+ /**
77
+ * An interval (such as *day* or a number), to transform **x** values to the
78
+ * middle of the interval.
79
+ */
80
+ interval?: Interval | ParamRef;
81
+ }
82
+ /** The dot mark. */
83
+ export interface Dot extends MarkData, DotOptions {
84
+ /**
85
+ * A dot mark that draws circles, or other symbols, as in a scatterplot.
86
+ *
87
+ * If either **x** or **y** is not specified, the default is determined by the
88
+ * **frameAnchor** option. If none of **x**, **y**, and **frameAnchor** are
89
+ * specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*,
90
+ * *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** =
91
+ * [*y₀*, *y₁*, *y₂*, …].
92
+ *
93
+ * Dots are sorted by descending radius **r** by default to mitigate
94
+ * overplotting; set the **sort** option to null to draw them in input order.
95
+ */
96
+ mark: 'dot';
97
+ }
98
+ /** The dotX mark. */
99
+ export interface DotX extends MarkData, DotXOptions {
100
+ /**
101
+ * Like dot, except that **x** defaults to the identity function, assuming that
102
+ * *data* = [*x₀*, *x₁*, *x₂*, …].
103
+ *
104
+ * If an **interval** is specified, such as *day*, **y** is transformed to the
105
+ * middle of the interval.
106
+ */
107
+ mark: 'dotX';
108
+ }
109
+ /** The dotY mark. */
110
+ export interface DotY extends MarkData, DotYOptions {
111
+ /**
112
+ * Like dot, except that **y** defaults to the identity function, assuming that
113
+ * *data* = [*y₀*, *y₁*, *y₂*, …].
114
+ *
115
+ * If an **interval** is specified, such as *day*, **x** is transformed to the
116
+ * middle of the interval.
117
+ */
118
+ mark: 'dotY';
119
+ }
120
+ /** The circle mark. */
121
+ export interface Circle extends MarkData, Exclude<DotOptions, 'symbol'> {
122
+ /** Like dot, except that the **symbol** option is set to *circle*. */
123
+ mark: 'circle';
124
+ }
125
+ /** The hexagon mark. */
126
+ export interface Hexagon extends MarkData, Exclude<DotOptions, 'symbol'> {
127
+ /** Like dot, except that the **symbol** option is set to *hexagon*. */
128
+ mark: 'hexagon';
129
+ }
@@ -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
+ }
@@ -0,0 +1,89 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import { FrameAnchor } from '../PlotTypes.js';
3
+ import { ChannelValue, ChannelValueSpec, MarkData, MarkOptions } from './Marks.js';
4
+ /** Options for the image mark. */
5
+ export interface ImageOptions extends MarkOptions {
6
+ /**
7
+ * The horizontal position channel specifying the image’s center; typically
8
+ * bound to the *x* scale.
9
+ */
10
+ x?: ChannelValueSpec;
11
+ /**
12
+ * The vertical position channel specifying the image’s center; typically
13
+ * bound to the *y* scale.
14
+ */
15
+ y?: ChannelValueSpec;
16
+ /**
17
+ * The image width in pixels. When a number, it is interpreted as a constant
18
+ * radius in pixels; otherwise it is interpreted as a channel. Also sets the
19
+ * default **height**; if neither are set, defaults to 16. Images with a
20
+ * nonpositive width are not drawn.
21
+ */
22
+ width?: ChannelValue | ParamRef;
23
+ /**
24
+ * The image height in pixels. When a number, it is interpreted as a constant
25
+ * radius in pixels; otherwise it is interpreted as a channel. Also sets the
26
+ * default **height**; if neither are set, defaults to 16. Images with a
27
+ * nonpositive height are not drawn.
28
+ */
29
+ height?: ChannelValue | ParamRef;
30
+ /**
31
+ * The image clip radius, for circular images. If null (default), images are
32
+ * not clipped; when a number, it is interpreted as a constant in pixels;
33
+ * otherwise it is interpreted as a channel, typically bound to the *r* scale.
34
+ * Also defaults **height** and **width** to twice its value.
35
+ */
36
+ r?: ChannelValue | ParamRef;
37
+ /**
38
+ * The rotation angle, in degrees clockwise. When a number, it is interpreted
39
+ * as a constant; otherwise it is interpreted as a channel.
40
+ */
41
+ rotate?: ChannelValue | ParamRef;
42
+ /**
43
+ * The required image URL (or relative path). If a string that starts with a
44
+ * dot, slash, or URL protocol (*e.g.*, “https:”) it is assumed to be a
45
+ * constant; otherwise it is interpreted as a channel.
46
+ */
47
+ src?: ChannelValue | ParamRef;
48
+ /**
49
+ * The image [aspect ratio][1]; defaults to *xMidYMid meet*. To crop the image
50
+ * instead of scaling it to fit, use *xMidYMid slice*.
51
+ *
52
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
53
+ */
54
+ preserveAspectRatio?: string | ParamRef;
55
+ /**
56
+ * The [cross-origin][1] behavior. See the [Plot.image notebook][2] for details.
57
+ *
58
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/crossorigin
59
+ * [2]: https://observablehq.com/@observablehq/plot-image
60
+ */
61
+ crossOrigin?: string | ParamRef;
62
+ /**
63
+ * The frame anchor specifies defaults for **x** and **y** based on the plot’s
64
+ * frame; it may be one of the four sides (*top*, *right*, *bottom*, *left*),
65
+ * one of the four corners (*top-left*, *top-right*, *bottom-right*,
66
+ * *bottom-left*), or the *middle* of the frame.
67
+ */
68
+ frameAnchor?: FrameAnchor | ParamRef;
69
+ /**
70
+ * The [image-rendering attribute][1]; defaults to *auto* (bilinear). The
71
+ * option may be set to *pixelated* to disable bilinear interpolation for a
72
+ * sharper image; however, note that this is not supported in WebKit.
73
+ *
74
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering
75
+ */
76
+ imageRendering?: string | ParamRef;
77
+ }
78
+ export interface Image extends MarkData, ImageOptions {
79
+ /**
80
+ * An image mark that draws images as in a scatterplot.
81
+ *
82
+ * If either **x** or **y** is not specified, the default is determined by
83
+ * the **frameAnchor** option. If none of **x**, **y**, and **frameAnchor**
84
+ * are specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*],
85
+ * [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …]
86
+ * and **y** = [*y₀*, *y₁*, *y₂*, …].
87
+ */
88
+ mark: 'image';
89
+ }