@uwdata/mosaic-spec 0.16.2 → 0.17.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 (97) hide show
  1. package/package.json +8 -12
  2. package/src/ast/TransformNode.js +11 -17
  3. package/src/ast/WindowFrameNode.js +61 -0
  4. package/src/config/transforms.js +8 -0
  5. package/src/constants.js +1 -0
  6. package/src/spec/Interval.ts +75 -0
  7. package/src/spec/Transform.ts +56 -46
  8. package/tsconfig.json +10 -8
  9. package/LICENSE +0 -47
  10. package/dist/mosaic-schema.json +0 -200164
  11. package/dist/types/ast/ASTNode.d.ts +0 -26
  12. package/dist/types/ast/ColumnParamRefNode.d.ts +0 -8
  13. package/dist/types/ast/DataNode.d.ts +0 -60
  14. package/dist/types/ast/ExpressionNode.d.ts +0 -13
  15. package/dist/types/ast/HConcatNode.d.ts +0 -10
  16. package/dist/types/ast/HSpaceNode.d.ts +0 -11
  17. package/dist/types/ast/InputNode.d.ts +0 -8
  18. package/dist/types/ast/LiteralNode.d.ts +0 -7
  19. package/dist/types/ast/OptionsNode.d.ts +0 -10
  20. package/dist/types/ast/ParamNode.d.ts +0 -8
  21. package/dist/types/ast/ParamRefNode.d.ts +0 -8
  22. package/dist/types/ast/PlotAttributeNode.d.ts +0 -18
  23. package/dist/types/ast/PlotFromNode.d.ts +0 -9
  24. package/dist/types/ast/PlotInteractorNode.d.ts +0 -8
  25. package/dist/types/ast/PlotLegendNode.d.ts +0 -10
  26. package/dist/types/ast/PlotMarkNode.d.ts +0 -10
  27. package/dist/types/ast/PlotNode.d.ts +0 -11
  28. package/dist/types/ast/SelectionNode.d.ts +0 -24
  29. package/dist/types/ast/SpecNode.d.ts +0 -10
  30. package/dist/types/ast/TransformNode.d.ts +0 -21
  31. package/dist/types/ast/VConcatNode.d.ts +0 -10
  32. package/dist/types/ast/VSpaceNode.d.ts +0 -11
  33. package/dist/types/ast-to-dom.d.ts +0 -40
  34. package/dist/types/ast-to-esm.d.ts +0 -64
  35. package/dist/types/config/components.d.ts +0 -4
  36. package/dist/types/config/extensions.d.ts +0 -9
  37. package/dist/types/config/inputs.d.ts +0 -5
  38. package/dist/types/config/plots.d.ts +0 -34
  39. package/dist/types/config/transforms.d.ts +0 -4
  40. package/dist/types/constants.d.ts +0 -31
  41. package/dist/types/index.d.ts +0 -29
  42. package/dist/types/parse-spec.d.ts +0 -111
  43. package/dist/types/spec/CSSStyles.d.ts +0 -3
  44. package/dist/types/spec/Data.d.ts +0 -165
  45. package/dist/types/spec/Expression.d.ts +0 -27
  46. package/dist/types/spec/HConcat.d.ts +0 -8
  47. package/dist/types/spec/HSpace.d.ts +0 -9
  48. package/dist/types/spec/Input.d.ts +0 -212
  49. package/dist/types/spec/Param.d.ts +0 -63
  50. package/dist/types/spec/Plot.d.ts +0 -14
  51. package/dist/types/spec/PlotAttribute.d.ts +0 -1534
  52. package/dist/types/spec/PlotFrom.d.ts +0 -20
  53. package/dist/types/spec/PlotInteractor.d.ts +0 -9
  54. package/dist/types/spec/PlotLegend.d.ts +0 -68
  55. package/dist/types/spec/PlotMark.d.ts +0 -28
  56. package/dist/types/spec/PlotTypes.d.ts +0 -293
  57. package/dist/types/spec/Spec.d.ts +0 -52
  58. package/dist/types/spec/Transform.d.ts +0 -346
  59. package/dist/types/spec/VConcat.d.ts +0 -8
  60. package/dist/types/spec/VSpace.d.ts +0 -9
  61. package/dist/types/spec/interactors/BrushStyles.d.ts +0 -27
  62. package/dist/types/spec/interactors/Highlight.d.ts +0 -37
  63. package/dist/types/spec/interactors/Interval1D.d.ts +0 -42
  64. package/dist/types/spec/interactors/Interval2D.d.ts +0 -47
  65. package/dist/types/spec/interactors/Nearest.d.ts +0 -44
  66. package/dist/types/spec/interactors/PanZoom.d.ts +0 -58
  67. package/dist/types/spec/interactors/Region.d.ts +0 -32
  68. package/dist/types/spec/interactors/Toggle.d.ts +0 -59
  69. package/dist/types/spec/marks/Area.d.ts +0 -139
  70. package/dist/types/spec/marks/Arrow.d.ts +0 -94
  71. package/dist/types/spec/marks/Axis.d.ts +0 -281
  72. package/dist/types/spec/marks/Bar.d.ts +0 -150
  73. package/dist/types/spec/marks/Cell.d.ts +0 -57
  74. package/dist/types/spec/marks/Contour.d.ts +0 -23
  75. package/dist/types/spec/marks/Delaunay.d.ts +0 -86
  76. package/dist/types/spec/marks/DenseLine.d.ts +0 -27
  77. package/dist/types/spec/marks/Density.d.ts +0 -136
  78. package/dist/types/spec/marks/Dot.d.ts +0 -133
  79. package/dist/types/spec/marks/ErrorBar.d.ts +0 -82
  80. package/dist/types/spec/marks/Frame.d.ts +0 -21
  81. package/dist/types/spec/marks/Geo.d.ts +0 -53
  82. package/dist/types/spec/marks/Hexbin.d.ts +0 -30
  83. package/dist/types/spec/marks/Hexgrid.d.ts +0 -25
  84. package/dist/types/spec/marks/Image.d.ts +0 -89
  85. package/dist/types/spec/marks/Line.d.ts +0 -82
  86. package/dist/types/spec/marks/Link.d.ts +0 -60
  87. package/dist/types/spec/marks/Marks.d.ts +0 -910
  88. package/dist/types/spec/marks/Raster.d.ts +0 -124
  89. package/dist/types/spec/marks/Rect.d.ts +0 -166
  90. package/dist/types/spec/marks/Regression.d.ts +0 -58
  91. package/dist/types/spec/marks/Rule.d.ts +0 -100
  92. package/dist/types/spec/marks/Text.d.ts +0 -110
  93. package/dist/types/spec/marks/Tick.d.ts +0 -61
  94. package/dist/types/spec/marks/Vector.d.ts +0 -99
  95. package/dist/types/spec/marks/Waffle.d.ts +0 -58
  96. package/dist/types/util.d.ts +0 -12
  97. package/jsconfig.json +0 -10
@@ -1,150 +0,0 @@
1
- import { ParamRef } from '../Param.js';
2
- import { Interval } from '../PlotTypes.js';
3
- import { ChannelValueIntervalSpec, ChannelValueSpec, InsetOptions, MarkData, MarkOptions, StackOptions } from './Marks.js';
4
- import { RectCornerOptions } from './Rect.js';
5
- /** Options for the barX and barY marks. */
6
- interface BarOptions extends MarkOptions, InsetOptions, RectCornerOptions, StackOptions {
7
- /**
8
- * How to convert a continuous value (**x** for barX, or **y** for barY) into
9
- * an interval (**x1** and **x2** for barX, or **y1** and **y2** for barY);
10
- * one of:
11
- *
12
- * - a named time interval such as *day* (for date intervals)
13
- * - a number (for number intervals), defining intervals at integer multiples of *n*
14
- *
15
- * Setting this option disables the implicit stack transform (stackX for barX,
16
- * or stackY for barY).
17
- */
18
- interval?: Interval | ParamRef;
19
- }
20
- /** Options for the barX mark. */
21
- export interface BarXOptions extends BarOptions {
22
- /**
23
- * The horizontal position (or length/width) channel, typically bound to the
24
- * *x* scale.
25
- *
26
- * If neither **x1** nor **x2** nor **interval** is specified, an implicit
27
- * stackX transform is applied and **x** defaults to the identity function,
28
- * assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
29
- * is specified, then **x1** and **x2** are derived from **x**, representing
30
- * the lower and upper bound of the containing interval, respectively.
31
- * Otherwise, if only one of **x1** or **x2** is specified, the other
32
- * defaults to **x**, which defaults to zero.
33
- */
34
- x?: ChannelValueIntervalSpec;
35
- /**
36
- * The required primary (starting, often left) horizontal position channel,
37
- * typically bound to the *x* scale. Setting this option disables the
38
- * implicit stackX transform.
39
- *
40
- * If *x* represents ordinal values, use a cell mark instead.
41
- */
42
- x1?: ChannelValueSpec;
43
- /**
44
- * The required secondary (ending, often right) horizontal position channel,
45
- * typically bound to the *x* scale. Setting this option disables the
46
- * implicit stackX transform.
47
- *
48
- * If *x* represents ordinal values, use a cell mark instead.
49
- */
50
- x2?: ChannelValueSpec;
51
- /**
52
- * The optional vertical position of the bar; a ordinal channel typically
53
- * bound to the *y* scale. If not specified, the bar spans the vertical
54
- * extent of the frame; otherwise the *y* scale must be a *band* scale.
55
- *
56
- * If *y* represents quantitative or temporal values, use a rectX mark
57
- * instead.
58
- */
59
- y?: ChannelValueSpec;
60
- }
61
- /** Options for the barY mark. */
62
- export interface BarYOptions extends BarOptions {
63
- /**
64
- * The vertical position (or length/height) channel, typically bound to the
65
- * *y* scale.
66
- *
67
- * If neither **y1** nor **y2** nor **interval** is specified, an implicit
68
- * stackY transform is applied and **y** defaults to the identity function,
69
- * assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
70
- * is specified, then **y1** and **y2** are derived from **y**, representing
71
- * the lower and upper bound of the containing interval, respectively.
72
- * Otherwise, if only one of **y1** or **y2** is specified, the other
73
- * defaults to **y**, which defaults to zero.
74
- */
75
- y?: ChannelValueIntervalSpec;
76
- /**
77
- * The required primary (starting, often bottom) vertical position channel,
78
- * typically bound to the *y* scale. Setting this option disables the
79
- * implicit stackY transform.
80
- *
81
- * If *y* represents ordinal values, use a cell mark instead.
82
- */
83
- y1?: ChannelValueSpec;
84
- /**
85
- * The required secondary (ending, often top) horizontal position channel,
86
- * typically bound to the *y* scale. Setting this option disables the
87
- * implicit stackY transform.
88
- *
89
- * If *y* represents ordinal values, use a cell mark instead.
90
- */
91
- y2?: ChannelValueSpec;
92
- /**
93
- * The optional horizontal position of the bar; a ordinal channel typically
94
- * bound to the *x* scale. If not specified, the bar spans the horizontal
95
- * extent of the frame; otherwise the *x* scale must be a *band* scale.
96
- *
97
- * If *x* represents quantitative or temporal values, use a rectY mark
98
- * instead.
99
- */
100
- x?: ChannelValueSpec;
101
- }
102
- /** The barX mark. */
103
- export interface BarX extends MarkData, BarXOptions {
104
- /**
105
- * A horizontal bar mark. The required *x* values should be quantitative or
106
- * temporal, and the optional *y* values should be ordinal.
107
- *
108
- * If neither **x1** nor **x2** nor **interval** is specified, an implicit
109
- * stackX transform is applied and **x** defaults to the identity function,
110
- * assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. Otherwise if an **interval**
111
- * is specified, then **x1** and **x2** are derived from **x**, representing
112
- * the lower and upper bound of the containing interval, respectively.
113
- * Otherwise, if only one of **x1** or **x2** is specified, the other
114
- * defaults to **x**, which defaults to zero.
115
- *
116
- * The optional **y** ordinal channel specifies the vertical position; it is
117
- * typically bound to the *y* scale, which must be a *band* scale. If the
118
- * **y** channel is not specified, the bar will span the vertical extent of
119
- * the plot’s frame.
120
- *
121
- * If *y* is quantitative, use the rectX mark instead.
122
- * If *x* is ordinal, use the cell mark instead.
123
- */
124
- mark: 'barX';
125
- }
126
- /** The barY mark. */
127
- export interface BarY extends MarkData, BarYOptions {
128
- /**
129
- * A vertical bar mark. The required *y* values should be quantitative or
130
- * temporal, and the optional *x* values should be ordinal.
131
- *
132
- * If neither **y1** nor **y2** nor **interval** is specified, an implicit
133
- * stackY transform is applied and **y** defaults to the identity function,
134
- * assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. Otherwise if an **interval**
135
- * is specified, then **y1** and **y2** are derived from **y**, representing
136
- * the lower and upper bound of the containing interval, respectively.
137
- * Otherwise, if only one of **y1** or **y2** is specified, the other
138
- * defaults to **y**, which defaults to zero.
139
- *
140
- * The optional **x** ordinal channel specifies the horizontal position; it
141
- * is typically bound to the *x* scale, which must be a *band* scale. If the
142
- * **x** channel is not specified, the bar will span the horizontal extent of
143
- * the plot’s frame.
144
- *
145
- * If *x* is quantitative, use the rectY mark instead.
146
- * If *y* is ordinal, use the cell mark instead.
147
- */
148
- mark: 'barY';
149
- }
150
- export {};
@@ -1,57 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- }
@@ -1,86 +0,0 @@
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
- }
@@ -1,27 +0,0 @@
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
- }
@@ -1,136 +0,0 @@
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
- * Normalization method for density estimates. If `false` or `'none'` (the
41
- * default), the density estimates are smoothed weighted counts. If `true`
42
- * or `'sum'`, density estimates are divided by the sum of the total point
43
- * mass. If `'max'`, estimates are divided by the maximum smoothed value.
44
- */
45
- normalize?: boolean | 'max' | 'sum' | 'none' | ParamRef;
46
- }
47
- export interface DensityAreaXOptions extends Omit<AreaXOptions, 'x' | 'x1' | 'x2'> {
48
- /**
49
- * The basic mark type to use to render 1D density values. Defaults to an
50
- * areaX mark; lineX, dotX, and textX marks are also supported.
51
- */
52
- type: 'areaX';
53
- /**
54
- * Flag indicating if densities should be stacked. Defaults to false.
55
- */
56
- stack?: boolean | ParamRef;
57
- }
58
- export interface DensityAreaYOptions extends Omit<AreaYOptions, 'y' | 'y1' | 'y2'> {
59
- /**
60
- * The basic mark type to use to render 1D density values. Defaults to an
61
- * areaY mark; lineY, dot, and text marks are also supported.
62
- */
63
- type?: 'areaY';
64
- /**
65
- * Flag indicating if densities should be stacked. Defaults to false.
66
- */
67
- stack?: boolean | ParamRef;
68
- }
69
- export interface DensityLineXOptions extends Omit<LineXOptions, 'x' | 'x1' | 'x2'> {
70
- /**
71
- * The basic mark type to use to render 1D density values. Defaults to an
72
- * areaX mark; lineX, dotX, and textX marks are also supported.
73
- */
74
- type: 'lineX';
75
- }
76
- export interface DensityLineYOptions extends Omit<LineYOptions, 'y' | 'y1' | 'y2'> {
77
- /**
78
- * The basic mark type to use to render 1D density values. Defaults to an
79
- * areaY mark; lineY, dot, and text marks are also supported.
80
- */
81
- type: 'lineY';
82
- }
83
- export interface DensityDotXOptions extends Omit<DotOptions, 'x'> {
84
- /**
85
- * The basic mark type to use to render 1D density values. Defaults to an
86
- * areaX mark; lineX, dotX, and textX marks are also supported.
87
- */
88
- type: 'dotX';
89
- }
90
- export interface DensityDotYOptions extends Omit<DotOptions, 'y'> {
91
- /**
92
- * The basic mark type to use to render 1D density values. Defaults to an
93
- * areaY mark; lineY, dot, and text marks are also supported.
94
- */
95
- type: 'dot' | 'dotY' | 'circle' | 'hexagon';
96
- }
97
- export interface DensityTextXOptions extends Omit<TextOptions, 'x'> {
98
- /**
99
- * The basic mark type to use to render 1D density values. Defaults to an
100
- * areaX mark; lineX, dotX, and textX marks are also supported.
101
- */
102
- type: 'textX';
103
- }
104
- export interface DensityTextYOptions extends Omit<TextOptions, 'y'> {
105
- /**
106
- * The basic mark type to use to render 1D density values. Defaults to an
107
- * areaY mark; lineY, dot, and text marks are also supported.
108
- */
109
- type: 'text' | 'textY';
110
- }
111
- export interface DensityXBase extends MarkData, Density1DOptions {
112
- /**
113
- * A densityX mark that visualizes smoothed point cloud densities along the
114
- * **x** dimension. The mark bins the data, counts the number of records that
115
- * fall into each bin, smooths the resulting counts, and then plots the
116
- * smoothed distribution, by default using an areaX mark.
117
- *
118
- * Set the *type* property to use a different base mark type.
119
- */
120
- mark: 'densityX';
121
- }
122
- export interface DensityYBase extends MarkData, Density1DOptions {
123
- /**
124
- * A densityY mark that visualizes smoothed point cloud densities along the
125
- * **y** dimension. The mark bins the data, counts the number of records that
126
- * fall into each bin, smooths the resulting counts, and then plots the
127
- * smoothed distribution, by default using an areaY mark.
128
- *
129
- * Set the *type* property to use a different base mark type.
130
- */
131
- mark: 'densityY';
132
- }
133
- /** The densityX mark. */
134
- export type DensityX = DensityXBase & (DensityAreaXOptions | DensityLineXOptions | DensityDotXOptions | DensityTextXOptions);
135
- /** The densityY mark. */
136
- export type DensityY = DensityYBase & (DensityAreaYOptions | DensityLineYOptions | DensityDotYOptions | DensityTextYOptions);
@@ -1,133 +0,0 @@
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
- }