@uwdata/mosaic-plot 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mosaic-plot.js +7721 -16747
- package/dist/mosaic-plot.min.js +19 -28
- package/package.json +6 -6
- package/src/interactors/Highlight.js +1 -1
- package/src/interactors/Nearest.js +11 -10
- package/src/marks/ConnectedMark.js +1 -1
- package/src/marks/util/stats.js +1 -1
- package/src/plot.js +1 -1
- package/src/transforms/time-interval.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-plot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A Mosaic-powered plotting framework based on Observable Plot.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"prebuild": "rimraf dist && mkdir dist",
|
|
25
25
|
"build": "node ../../esbuild.js mosaic-plot",
|
|
26
26
|
"lint": "eslint src test",
|
|
27
|
-
"test": "
|
|
27
|
+
"test": "vitest run",
|
|
28
28
|
"prepublishOnly": "npm run test && npm run lint && npm run build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@observablehq/plot": "^0.6.
|
|
32
|
-
"@uwdata/mosaic-core": "^0.
|
|
33
|
-
"@uwdata/mosaic-sql": "^0.
|
|
31
|
+
"@observablehq/plot": "^0.6.16",
|
|
32
|
+
"@uwdata/mosaic-core": "^0.11.0",
|
|
33
|
+
"@uwdata/mosaic-sql": "^0.11.0",
|
|
34
34
|
"d3": "^7.9.0",
|
|
35
35
|
"isoformat": "^0.2.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "861d616f39926a1d2aee83b59dbdd70b0b3caf12"
|
|
38
38
|
}
|
|
@@ -99,6 +99,6 @@ async function predicateFunction(mark, selection) {
|
|
|
99
99
|
const data = await mark.coordinator.query(q);
|
|
100
100
|
const v = data.getChild?.('__');
|
|
101
101
|
return !(data.numRows || data.length) ? (() => false)
|
|
102
|
-
: v ? (i => v.
|
|
102
|
+
: v ? (i => v.at(i))
|
|
103
103
|
: (i => data[i].__);
|
|
104
104
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clausePoints, isSelection } from '@uwdata/mosaic-core';
|
|
1
|
+
import { clausePoint, clausePoints, isSelection } from '@uwdata/mosaic-core';
|
|
2
2
|
import { select, pointer } from 'd3';
|
|
3
3
|
import { getField } from './util/get-field.js';
|
|
4
4
|
|
|
@@ -24,10 +24,12 @@ export class Nearest {
|
|
|
24
24
|
|
|
25
25
|
clause(value) {
|
|
26
26
|
const { clients, fields } = this;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const opt = { source: this, clients };
|
|
28
|
+
// if only one field, use a simpler clause that passes the value
|
|
29
|
+
// this allows a single field selection value to act like a param
|
|
30
|
+
return fields.length > 1
|
|
31
|
+
? clausePoints(fields, value ? [value] : value, opt)
|
|
32
|
+
: clausePoint(fields[0], value?.[0], opt);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
init(svg) {
|
|
@@ -56,11 +58,10 @@ export class Nearest {
|
|
|
56
58
|
if (i !== this.valueIndex) {
|
|
57
59
|
this.valueIndex = i;
|
|
58
60
|
const v = i < 0 ? undefined : keys.map(k => columns[k][i]);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
61
|
+
selection.update(
|
|
62
|
+
// provide value for param, clause for selection
|
|
63
|
+
param ? (!v || v.length > 1 ? v : v[0]) : that.clause(v)
|
|
64
|
+
);
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
|
|
@@ -45,7 +45,7 @@ export class ConnectedMark extends Mark {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* M4 is an optimization for value-preserving time-series aggregation
|
|
48
|
-
* (
|
|
48
|
+
* (https://www.vldb.org/pvldb/vol7/p797-jugel.pdf). This implementation uses
|
|
49
49
|
* an efficient version with a single scan and the aggregate function
|
|
50
50
|
* argmin and argmax, following https://arxiv.org/pdf/2306.03714.pdf.
|
|
51
51
|
*/
|
package/src/marks/util/stats.js
CHANGED
|
@@ -172,7 +172,7 @@ export function qt(p, dof) {
|
|
|
172
172
|
export function erfinv(x) {
|
|
173
173
|
// Implementation from "Approximating the erfinv function" by Mike Giles,
|
|
174
174
|
// GPU Computing Gems, volume 2, 2010.
|
|
175
|
-
// Ported from Apache Commons Math,
|
|
175
|
+
// Ported from Apache Commons Math, https://www.apache.org/licenses/LICENSE-2.0
|
|
176
176
|
|
|
177
177
|
// beware that the logarithm argument must be
|
|
178
178
|
// computed as (1.0 - x) * (1.0 + x),
|
package/src/plot.js
CHANGED
|
@@ -132,7 +132,7 @@ export class Plot {
|
|
|
132
132
|
params.set(param, [mark]);
|
|
133
133
|
param.addEventListener('value', () => {
|
|
134
134
|
return Promise.allSettled(
|
|
135
|
-
params.get(param).map(mark => mark.
|
|
135
|
+
params.get(param).map(mark => mark.initialize())
|
|
136
136
|
);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
@@ -43,7 +43,7 @@ export function timeInterval(min, max, steps) {
|
|
|
43
43
|
const target = span / steps;
|
|
44
44
|
let i = bisector(i => i[2]).right(intervals, target);
|
|
45
45
|
if (i === intervals.length) {
|
|
46
|
-
return { interval: YEAR, step: binStep(span, steps) };
|
|
46
|
+
return { interval: YEAR, step: binStep(span / durationYear, steps) };
|
|
47
47
|
} else if (i) {
|
|
48
48
|
i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i];
|
|
49
49
|
return { interval: i[0], step: i[1] };
|