@uwdata/vgplot 0.12.0 → 0.12.1
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/README.md +2 -0
- package/dist/vgplot.js +70 -26
- package/dist/vgplot.min.js +11 -11
- package/package.json +6 -6
- package/src/api.js +2 -1
- package/src/plot/marks.js +3 -0
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# vgplot: A Mosaic-powered Visualization Grammar
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@uwdata/vgplot)
|
|
4
|
+
|
|
3
5
|
A **v**isualization **g**rammar for interactive Mosaic-powered visualizations and dashboards. This package provides convenient, composable methods that combines multiple Mosaic packages (core, inputs, plot, etc.) in an integrated API.
|
|
4
6
|
|
|
5
7
|
vgplot is a JavaScript API for creating visualizations and dashboards. See the [mosaic-spec](https://github.com/uwdata/mosaic/tree/main/packages/spec) package to instead use declarative specifications in JSON or YAML format.
|
package/dist/vgplot.js
CHANGED
|
@@ -19664,7 +19664,7 @@ function clausePoint(field3, value, {
|
|
|
19664
19664
|
source,
|
|
19665
19665
|
clients = source ? /* @__PURE__ */ new Set([source]) : void 0
|
|
19666
19666
|
}) {
|
|
19667
|
-
const predicate = value !== void 0 ?
|
|
19667
|
+
const predicate = value !== void 0 ? isIn(field3, [literal(value)]) : null;
|
|
19668
19668
|
return {
|
|
19669
19669
|
meta: { type: "point" },
|
|
19670
19670
|
source,
|
|
@@ -20118,6 +20118,8 @@ __export(api_exports, {
|
|
|
20118
20118
|
voronoi: () => voronoi2,
|
|
20119
20119
|
voronoiMesh: () => voronoiMesh2,
|
|
20120
20120
|
vspace: () => vspace,
|
|
20121
|
+
waffleX: () => waffleX2,
|
|
20122
|
+
waffleY: () => waffleY2,
|
|
20121
20123
|
width: () => width,
|
|
20122
20124
|
xAlign: () => xAlign,
|
|
20123
20125
|
xAriaDescription: () => xAriaDescription,
|
|
@@ -45856,13 +45858,16 @@ var HexbinMark = class extends Mark2 {
|
|
|
45856
45858
|
float642(x12),
|
|
45857
45859
|
div(add(mul(add(x4, mul(0.5, bitAnd(y4, 1))), dx), ox2), xr)
|
|
45858
45860
|
),
|
|
45859
|
-
[yc.as]: sub(
|
|
45861
|
+
[yc.as]: sub(
|
|
45862
|
+
float642(y22),
|
|
45863
|
+
div(add(mul(y4, dy), oy2), yr)
|
|
45864
|
+
),
|
|
45860
45865
|
...cols
|
|
45861
45866
|
}).groupby(x4, y4, ...dims).from(
|
|
45862
45867
|
// Subquery performs hex binning in screen space and also passes
|
|
45863
45868
|
// original columns through (the DB should optimize this).
|
|
45864
45869
|
Query.select({
|
|
45865
|
-
[py]: div(mul(yr, sub(
|
|
45870
|
+
[py]: div(sub(mul(yr, sub(y22, yc.field)), oy2), dy),
|
|
45866
45871
|
[pj]: int322(round(py)),
|
|
45867
45872
|
[px]: sub(
|
|
45868
45873
|
div(sub(mul(xr, sub(xc.field, x12)), ox2), dx),
|
|
@@ -47592,6 +47597,11 @@ var Menu = class extends MosaicClient {
|
|
|
47592
47597
|
this.selectedValue(value2);
|
|
47593
47598
|
}
|
|
47594
47599
|
});
|
|
47600
|
+
} else {
|
|
47601
|
+
this.select.addEventListener("pointerenter", (evt) => {
|
|
47602
|
+
if (!evt.buttons) this.activate();
|
|
47603
|
+
});
|
|
47604
|
+
this.select.addEventListener("focus", () => this.activate());
|
|
47595
47605
|
}
|
|
47596
47606
|
}
|
|
47597
47607
|
}
|
|
@@ -47611,6 +47621,9 @@ var Menu = class extends MosaicClient {
|
|
|
47611
47621
|
reset() {
|
|
47612
47622
|
this.select.selectedIndex = this.from ? 0 : -1;
|
|
47613
47623
|
}
|
|
47624
|
+
activate() {
|
|
47625
|
+
this.selection.activate(clausePoint(this.field, 0, { source: this }));
|
|
47626
|
+
}
|
|
47614
47627
|
publish(value) {
|
|
47615
47628
|
const { selection: selection2, field: field3 } = this;
|
|
47616
47629
|
if (isSelection(selection2)) {
|
|
@@ -47716,17 +47729,28 @@ var Search = class extends MosaicClient {
|
|
|
47716
47729
|
this.searchbox.value = value;
|
|
47717
47730
|
}
|
|
47718
47731
|
});
|
|
47732
|
+
} else {
|
|
47733
|
+
this.searchbox.addEventListener("pointerenter", (evt) => {
|
|
47734
|
+
if (!evt.buttons) this.activate();
|
|
47735
|
+
});
|
|
47736
|
+
this.searchbox.addEventListener("focus", () => this.activate());
|
|
47719
47737
|
}
|
|
47720
47738
|
}
|
|
47721
47739
|
}
|
|
47722
47740
|
reset() {
|
|
47723
47741
|
this.searchbox.value = "";
|
|
47724
47742
|
}
|
|
47743
|
+
clause(value) {
|
|
47744
|
+
const { field: field3, type: type2 } = this;
|
|
47745
|
+
return clauseMatch(field3, value, { source: this, method: type2 });
|
|
47746
|
+
}
|
|
47747
|
+
activate() {
|
|
47748
|
+
this.selection.activate(this.clause(""));
|
|
47749
|
+
}
|
|
47725
47750
|
publish(value) {
|
|
47726
|
-
const { selection: selection2
|
|
47751
|
+
const { selection: selection2 } = this;
|
|
47727
47752
|
if (isSelection(selection2)) {
|
|
47728
|
-
|
|
47729
|
-
selection2.update(clause);
|
|
47753
|
+
selection2.update(this.clause(value));
|
|
47730
47754
|
} else if (isParam(selection2)) {
|
|
47731
47755
|
selection2.update(value);
|
|
47732
47756
|
}
|
|
@@ -47845,13 +47869,20 @@ var Slider = class extends MosaicClient {
|
|
|
47845
47869
|
this.curval.innerText = value2;
|
|
47846
47870
|
if (this.selection) this.publish(+value2);
|
|
47847
47871
|
});
|
|
47848
|
-
if (this.selection
|
|
47849
|
-
this.selection
|
|
47850
|
-
|
|
47851
|
-
this.slider.value
|
|
47852
|
-
|
|
47853
|
-
|
|
47854
|
-
|
|
47872
|
+
if (this.selection) {
|
|
47873
|
+
if (!isSelection(this.selection)) {
|
|
47874
|
+
this.selection.addEventListener("value", (value2) => {
|
|
47875
|
+
if (value2 !== +this.slider.value) {
|
|
47876
|
+
this.slider.value = value2;
|
|
47877
|
+
this.curval.innerText = value2;
|
|
47878
|
+
}
|
|
47879
|
+
});
|
|
47880
|
+
} else {
|
|
47881
|
+
this.slider.addEventListener("pointerenter", (evt) => {
|
|
47882
|
+
if (!evt.buttons) this.activate();
|
|
47883
|
+
});
|
|
47884
|
+
this.slider.addEventListener("focus", () => this.activate());
|
|
47885
|
+
}
|
|
47855
47886
|
}
|
|
47856
47887
|
}
|
|
47857
47888
|
query(filter3 = []) {
|
|
@@ -47875,20 +47906,27 @@ var Slider = class extends MosaicClient {
|
|
|
47875
47906
|
}
|
|
47876
47907
|
return this;
|
|
47877
47908
|
}
|
|
47909
|
+
clause(value) {
|
|
47910
|
+
const { field: field3, selectionType } = this;
|
|
47911
|
+
if (selectionType === "interval") {
|
|
47912
|
+
const domain = [this.min ?? 0, value];
|
|
47913
|
+
return clauseInterval(field3, domain, {
|
|
47914
|
+
source: this,
|
|
47915
|
+
bin: "ceil",
|
|
47916
|
+
scale: { type: "identity", domain },
|
|
47917
|
+
pixelSize: this.step
|
|
47918
|
+
});
|
|
47919
|
+
} else {
|
|
47920
|
+
return clausePoint(field3, value, { source: this });
|
|
47921
|
+
}
|
|
47922
|
+
}
|
|
47923
|
+
activate() {
|
|
47924
|
+
this.selection.activate(this.clause(0));
|
|
47925
|
+
}
|
|
47878
47926
|
publish(value) {
|
|
47879
|
-
const {
|
|
47927
|
+
const { selection: selection2 } = this;
|
|
47880
47928
|
if (isSelection(selection2)) {
|
|
47881
|
-
|
|
47882
|
-
const domain = [this.min ?? 0, value];
|
|
47883
|
-
selection2.update(clauseInterval(field3, domain, {
|
|
47884
|
-
source: this,
|
|
47885
|
-
bin: "ceil",
|
|
47886
|
-
scale: { type: "identity", domain },
|
|
47887
|
-
pixelSize: this.step
|
|
47888
|
-
}));
|
|
47889
|
-
} else {
|
|
47890
|
-
selection2.update(clausePoint(field3, value, { source: this }));
|
|
47891
|
-
}
|
|
47929
|
+
selection2.update(this.clause(value));
|
|
47892
47930
|
} else if (isParam(this.selection)) {
|
|
47893
47931
|
selection2.update(value);
|
|
47894
47932
|
}
|
|
@@ -48791,7 +48829,9 @@ __export(marks_exports, {
|
|
|
48791
48829
|
vectorX: () => vectorX2,
|
|
48792
48830
|
vectorY: () => vectorY2,
|
|
48793
48831
|
voronoi: () => voronoi2,
|
|
48794
|
-
voronoiMesh: () => voronoiMesh2
|
|
48832
|
+
voronoiMesh: () => voronoiMesh2,
|
|
48833
|
+
waffleX: () => waffleX2,
|
|
48834
|
+
waffleY: () => waffleY2
|
|
48795
48835
|
});
|
|
48796
48836
|
var decorators = /* @__PURE__ */ new Set([
|
|
48797
48837
|
"frame",
|
|
@@ -48888,6 +48928,8 @@ var gridFy2 = (...args) => mark("gridFy", ...args);
|
|
|
48888
48928
|
var geo2 = (...args) => implicitType(GeoMark, ...args);
|
|
48889
48929
|
var sphere2 = (...args) => mark("sphere", ...args);
|
|
48890
48930
|
var graticule3 = (...args) => mark("graticule", ...args);
|
|
48931
|
+
var waffleX2 = (...args) => mark("waffleX", ...args);
|
|
48932
|
+
var waffleY2 = (...args) => mark("waffleY", ...args);
|
|
48891
48933
|
|
|
48892
48934
|
// src/plot/interactors.js
|
|
48893
48935
|
var interactors_exports = {};
|
|
@@ -49369,6 +49411,8 @@ export {
|
|
|
49369
49411
|
voronoi2 as voronoi,
|
|
49370
49412
|
voronoiMesh2 as voronoiMesh,
|
|
49371
49413
|
vspace,
|
|
49414
|
+
waffleX2 as waffleX,
|
|
49415
|
+
waffleY2 as waffleY,
|
|
49372
49416
|
wasmConnector,
|
|
49373
49417
|
width,
|
|
49374
49418
|
xAlign,
|