@uwdata/mosaic-spec 0.8.0 → 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.
@@ -0,0 +1,91 @@
1
+ import { ParamRef } from '../Param.js';
2
+ import {
3
+ ChannelValue, ChannelValueSpec, MarkData, MarkOptions, MarkerOptions
4
+ } from './Marks.js';
5
+
6
+ /** Options for errorbar marks. */
7
+ interface ErrorBarOptions extends MarkOptions, MarkerOptions {
8
+ /**
9
+ * The confidence interval in (0, 1); defaults to 0.95.
10
+ */
11
+ ci?: number | ParamRef;
12
+
13
+ /**
14
+ * An optional ordinal channel for grouping data, producing an independent
15
+ * error bar for each group. If not specified, it defaults to **stroke** if
16
+ * a channel.
17
+ */
18
+ z?: ChannelValue;
19
+ }
20
+
21
+ /** Options for the errorbarX mark. */
22
+ export interface ErrorBarXOptions extends ErrorBarOptions {
23
+ /**
24
+ * The dependent variable horizontal position channel, typically bound to the
25
+ * *x* scale.
26
+ */
27
+ x: ChannelValueSpec;
28
+
29
+ /**
30
+ * The independent variable vertical position channel, typically bound to
31
+ * the *y* scale; defaults to the zero-based index of the data [0, 1, 2, …].
32
+ */
33
+ y?: ChannelValueSpec;
34
+ }
35
+
36
+ /** The errorbarX mark. */
37
+ export interface ErrorBarX extends MarkData, ErrorBarXOptions {
38
+ /**
39
+ * A mark that draws error bars for a calculated parametric confidence
40
+ * interval for a dependent variable (*x*), potentially grouped by an
41
+ * independent variable (*y*).
42
+ *
43
+ * This mark aggregates raw values to produce a [parametric confidence
44
+ * interval][1] of the mean, assuming a normal distribution. To instead
45
+ * visualize pre-computeted interval values or custom aggregations, use
46
+ * a **ruleY** mark with specified **x1** and **x2** channels.
47
+ *
48
+ * Multiple error bars can be produced by specifying a **z** or **stroke**
49
+ * channel. Set the **marker** option to `'tick'` to add small perpendicular
50
+ * lines at the start and end of the error interval.
51
+ *
52
+ * [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
53
+ */
54
+ mark: 'errorbarX';
55
+ }
56
+
57
+ /** Options for the errorbarY mark. */
58
+ export interface ErrorBarYOptions extends ErrorBarOptions {
59
+ /**
60
+ * The independent variable horizontal position channel, typically bound to
61
+ * the *x* scale; defaults to the zero-based index of the data [0, 1, 2, …].
62
+ */
63
+ x?: ChannelValueSpec;
64
+
65
+ /**
66
+ * The dependent variable vertical position channel, typically bound to the
67
+ * *y* scale.
68
+ */
69
+ y: ChannelValueSpec;
70
+ }
71
+
72
+ /** The errorbarY mark. */
73
+ export interface ErrorBarY extends MarkData, ErrorBarYOptions {
74
+ /**
75
+ * A mark that draws error bars for a calculated parametric confidence
76
+ * interval for a dependent variable (*y*), potentially grouped by an
77
+ * independent variable (*x*).
78
+ *
79
+ * This mark aggregates raw values to produce a [parametric confidence
80
+ * interval][1] of the mean, assuming a normal distribution. To instead
81
+ * visualize pre-computeted interval values or custom aggregations, use
82
+ * a **ruleX** mark with specified **y1** and **y2** channels.
83
+ *
84
+ * Multiple error bars can be produced by specifying a **z** or **stroke**
85
+ * channel. Set the **marker** option to `'tick'` to add small perpendicular
86
+ * lines at the start and end of the error interval.
87
+ *
88
+ * [1]: https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals
89
+ */
90
+ mark: 'errorbarY';
91
+ }
@@ -194,6 +194,18 @@ export type SortOrder =
194
194
  /** The pointer mode for the tip; corresponds to pointerX, pointerY, and pointer. */
195
195
  export type TipPointer = 'x' | 'y' | 'xy';
196
196
 
197
+ /** Selection filters to apply internally to mark data. */
198
+ export type SelectFilter =
199
+ | 'first'
200
+ | 'last'
201
+ | 'maxX'
202
+ | 'maxY'
203
+ | 'minX'
204
+ | 'minY'
205
+ | 'nearest'
206
+ | 'nearestX'
207
+ | 'nearestY';
208
+
197
209
  export interface MarkData {
198
210
  /**
199
211
  * The data source for the mark.
@@ -215,10 +227,24 @@ export interface MarkOptions {
215
227
  * channel values; only truthy values are retained.
216
228
  *
217
229
  * Note that filtering only affects the rendered mark index, not the
218
- * associated channel values, and thus has no effect on imputed scale domains.
230
+ * associated channel values, and has no effect on imputed scale domains.
219
231
  */
220
232
  filter?: ChannelValue;
221
233
 
234
+ /**
235
+ * Applies a filter transform after data is loaded to highlight selected
236
+ * values only. For example, `first` and `last` select the first or last
237
+ * values of series only (using the *z* channel to separate series).
238
+ * Meanwhile, `nearestX` and `nearestY` select the point nearest to the
239
+ * pointer along the *x* or *y* channel dimension. Unlike Mosaic selections,
240
+ * a mark level *select* is internal to the mark only, and does not populate
241
+ * a param or selection value to be shared across clients.
242
+ *
243
+ * Note that filtering only affects the rendered mark index, not the
244
+ * associated channel values, and has no effect on imputed scale domains.
245
+ */
246
+ select?: SelectFilter;
247
+
222
248
  /**
223
249
  * Applies a transform to reverse the order of the mark’s index, say for
224
250
  * reverse input order.
@@ -19,6 +19,11 @@ export interface TextOptions extends MarkOptions, TextStyles {
19
19
  */
20
20
  y?: ChannelValueSpec;
21
21
 
22
+ /**
23
+ * An optional ordinal channel for grouping data into series.
24
+ */
25
+ z?: ChannelValue;
26
+
22
27
  /**
23
28
  * The text contents channel, possibly with line breaks (\n, \r\n, or \r). If
24
29
  * not specified, defaults to the zero-based index [0, 1, 2, …].
package/LICENSE DELETED
@@ -1,47 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2023, UW Interactive Data Lab
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-
30
- ---
31
-
32
- Portions of this software are derived from Observable Plot, which is released
33
- under the ISC license.
34
-
35
- Copyright 2020-2023 Observable, Inc.
36
-
37
- Permission to use, copy, modify, and/or distribute this software for any purpose
38
- with or without fee is hereby granted, provided that the above copyright notice
39
- and this permission notice appear in all copies.
40
-
41
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
42
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
43
- FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
44
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
45
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
46
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
47
- THIS SOFTWARE.