@uwdata/mosaic-plot 0.20.1 → 0.21.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide-marks.d.ts","sourceRoot":"","sources":["../../../../src/marks/util/guide-marks.js"],"names":[],"mappings":"AAAA,qCAKG"}
|
package/dist/src/plot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/plot.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/plot.js"],"names":[],"mappings":"AAYA;IACE;;OAEG;IACH,sBAFW,WAAW,EAuBrB;IApBC,kCAAkC;IAClC,YADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACa;IAC3C,yBAAqB;IACrB,mBAAqB;IACrB,2EAA2E;IAC3E,SADW;QAAE,MAAM,EAAE,OAAO,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CACtD;IACjB,+CAA+C;IAC/C,OADW,OAAO,iBAAiB,EAAE,IAAI,EAAE,CAC5B;IACf,yDAAyD;IACzD,SADW,GAAG,CAAC,OAAO,iBAAiB,EAAE,IAAI,CAAC,GAAG,IAAI,CAClC;IACnB,yFAAyF;IACzF,QADW,GAAG,CAAC,wCAAmC,EAAE,OAAO,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAChE;IACrB,2BAA2B;IAC3B,OADW,YAAY,CACQ;IAE/B,0BAA0B;IAC1B,SADW,WAAW,CACiC;IAMzD;;;;;MAOC;IAED,qBAGC;IAED,2CASC;IAED,yBAEC;IAED,iCAMC;IAJG,uBAAyB;IAM7B,wBASC;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,GAAC,CAIb;IAED;;;;;OAKG;IACH,mBALW,MAAM,SACN,GAAC,YACD;QAAC,MAAM,EAAE,OAAO,CAAA;KAAC,GACf,OAAO,CAenB;IAED;;;;OAIG;IACH,2BAJW,MAAM,YACN,GAAC,GACC,IAAI,CAOhB;IAED;;;;OAIG;IACH,8BAJW,MAAM,YACN,GAAC,GACC,IAAI,CAIhB;IAED,0CAcC;IAED,yBAWC;IAED,mDAEC;IAED,8BAGC;IAED,gDAGC;CACF;6BAnLsC,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-plot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "A Mosaic-powered plotting framework based on Observable Plot.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@observablehq/plot": "^0.6.17",
|
|
37
|
-
"@uwdata/mosaic-core": "^0.
|
|
38
|
-
"@uwdata/mosaic-sql": "^0.
|
|
37
|
+
"@uwdata/mosaic-core": "^0.21.1",
|
|
38
|
+
"@uwdata/mosaic-sql": "^0.21.1",
|
|
39
39
|
"d3": "^7.9.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "296762423ac032193344646ad4f10cf604ca69a2"
|
|
42
42
|
}
|
package/src/plot-renderer.js
CHANGED
|
@@ -43,7 +43,7 @@ export async function plotRenderer(plot) {
|
|
|
43
43
|
|
|
44
44
|
// instantiate Plot mark and add to spec
|
|
45
45
|
spec.marks.push(Plot[type](...arg));
|
|
46
|
-
indices.push(mark.index);
|
|
46
|
+
if (mark.index > -1) indices.push(mark.index);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -144,8 +144,11 @@ function annotatePlot(svg, indices) {
|
|
|
144
144
|
for (const child of svg.children) {
|
|
145
145
|
const aria = child.getAttribute('aria-label') || '';
|
|
146
146
|
const skip = child.nodeName === 'style'
|
|
147
|
+
// skip axis, grid, and frame marks
|
|
147
148
|
|| aria.includes('-axis')
|
|
148
|
-
|| aria.includes('-grid')
|
|
149
|
+
|| aria.includes('-grid')
|
|
150
|
+
|| aria === 'frame'
|
|
151
|
+
|| aria === 'hexgrid';
|
|
149
152
|
if (!skip) {
|
|
150
153
|
child.setAttribute('data-index', indices[++index]);
|
|
151
154
|
}
|
package/src/plot.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { distinct, Synchronizer } from '@uwdata/mosaic-core';
|
|
2
2
|
import { plotRenderer } from './plot-renderer.js';
|
|
3
|
+
import { guideMarks } from './marks/util/guide-marks.js';
|
|
3
4
|
|
|
4
5
|
const DEFAULT_ATTRIBUTES = {
|
|
5
6
|
width: 640,
|
|
@@ -151,7 +152,13 @@ export class Plot {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
addMark(mark) {
|
|
154
|
-
|
|
155
|
+
// determine index for annotating marks
|
|
156
|
+
// we use this to match marks with SVG output
|
|
157
|
+
// skip all guides (axis, grid, frame, etc)
|
|
158
|
+
const idx = guideMarks.has(mark.type)
|
|
159
|
+
? -1
|
|
160
|
+
: this.marks.reduce((sum, mark) => sum + (guideMarks.has(mark.type) ? 0 : 1), 0);
|
|
161
|
+
mark.setPlot(this, idx);
|
|
155
162
|
this.marks.push(mark);
|
|
156
163
|
this.markset = null;
|
|
157
164
|
return this;
|