@uwdata/mosaic-plot 0.18.0 → 0.19.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.
@@ -40,7 +40,7 @@ export class Grid2DMark extends Mark {
40
40
  } | {
41
41
  numRows: number;
42
42
  columns: {
43
- [x: string]: import("./util/grid.js").Arrayish | Uint8Array<ArrayBuffer> | Int8Array<ArrayBuffer> | Uint8ClampedArray<ArrayBuffer> | Int16Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | Int32Array<ArrayBuffer> | Uint32Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Float64Array<ArrayBuffer>;
43
+ [x: string]: import("./util/grid.js").Arrayish | Int32Array<ArrayBuffer> | Uint8Array<ArrayBuffer> | Int8Array<ArrayBuffer> | Uint8ClampedArray<ArrayBuffer> | Int16Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Float64Array<ArrayBuffer>;
44
44
  };
45
45
  };
46
46
  }
@@ -10,7 +10,7 @@ export class RasterTileMark extends Grid2DMark {
10
10
  _filter: any[];
11
11
  tileQuery(extent: any): any;
12
12
  requestTiles(): Promise<void>;
13
- prefetch: import("@uwdata/mosaic-core").QueryResult<unknown>[];
13
+ prefetch: import("@uwdata/mosaic-core").QueryResult<import("@uwdata/flechette").Table<import("@uwdata/flechette").TypeMap>>[];
14
14
  convolve(): this;
15
15
  rasterize(): this;
16
16
  plotSpecs(): {
@@ -1 +1 @@
1
- {"version":3,"file":"RasterTileMark.d.ts","sourceRoot":"","sources":["../../../src/marks/RasterTileMark.js"],"names":[],"mappings":"AASA;IACE,uCASC;IANC,WAAiB;IAGjB,YAAoB;IACpB,WAA4C;IAC5C,WAA4C;IAG9C,qCAIC;IAED,8BAEC;IAED,2BAIC;IAHC,eAAqB;IAKvB,4BA6DC;IAED,8BAiEC;IAZC,+DAEC;IAYH,iBAEC;IAED,kBAgCC;IAED;;;;;;;;;;;;;QAYC;CACF;2BApN0B,iBAAiB"}
1
+ {"version":3,"file":"RasterTileMark.d.ts","sourceRoot":"","sources":["../../../src/marks/RasterTileMark.js"],"names":[],"mappings":"AASA;IACE,uCASC;IANC,WAAiB;IAGjB,YAAoB;IACpB,WAA4C;IAC5C,WAA4C;IAG9C,qCAIC;IAED,8BAEC;IAED,2BAIC;IAHC,eAAqB;IAKvB,4BA6DC;IAED,8BAiEC;IAZC,8HAEC;IAYH,iBAEC;IAED,kBAgCC;IAED;;;;;;;;;;;;;QAYC;CACF;2BApN0B,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/marks/util/grid.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,4BALW,MAAM,UACN,QAAQ,GAEN,QAAQ,CAKpB;AAED;;;;;;;;;;;GAWG;AACH,6BAVW,MAAM,SACN,QAAQ,SACR,QAAQ,WACR,MAAM,CAAC,MAAM,EAAC,QAAQ,CAAC,WACvB,MAAM,EAAE,GACN;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;CACnC,CAiCH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,0BAdW,MAAM,KACN,MAAM,SACN,QAAQ,WAER,MAAM,CAAC,MAAM,EAAC,QAAQ,CAAC,cACvB,MAAM,EAAE,WACR,MAAM,EAAE,2BAGN;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;CACnC,CAkDH;AAED,2DAWC;AAED,sDAUC;;;;uBAzJY,QAAQ,SAAS,GAAG,UAAU,GAAG,iBAAiB,GACzD,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GACnD,YAAY,GAAG,YAAY"}
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/marks/util/grid.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,4BALW,MAAM,UACN,QAAQ,GAEN,QAAQ,CAKpB;AAED;;;;;;;;;;;GAWG;AACH,6BAVW,MAAM,SACN,QAAQ,SACR,QAAQ,WACR,MAAM,CAAC,MAAM,EAAC,QAAQ,CAAC,WACvB,MAAM,EAAE,GACN;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;CACnC,CAkCH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,0BAdW,MAAM,KACN,MAAM,SACN,QAAQ,WAER,MAAM,CAAC,MAAM,EAAC,QAAQ,CAAC,cACvB,MAAM,EAAE,WACR,MAAM,EAAE,2BAGN;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;CACnC,CAmDH;AAED,2DAWC;AAED,sDAUC;;;;uBA3JY,QAAQ,SAAS,GAAG,UAAU,GAAG,iBAAiB,GACzD,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GACnD,YAAY,GAAG,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uwdata/mosaic-plot",
3
- "version": "0.18.0",
3
+ "version": "0.19.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.18.0",
38
- "@uwdata/mosaic-sql": "^0.18.0",
37
+ "@uwdata/mosaic-core": "^0.19.1",
38
+ "@uwdata/mosaic-sql": "^0.19.0",
39
39
  "d3": "^7.9.0"
40
40
  },
41
- "gitHead": "dfb9ded0b0307754e3185ca34cc49a1384fe8455"
41
+ "gitHead": "64ac2aaeefe9ff469edfeed417414a0a7866863f"
42
42
  }
@@ -170,7 +170,7 @@ export class Grid2DMark extends Mark {
170
170
  // no smoothing as default fallback
171
171
  this.grids = grids0;
172
172
 
173
- if (bandwidth > 0) {
173
+ if (bandwidth > 0 && grids0.numRows > 0) {
174
174
  // determine which grid to smooth
175
175
  const prop = aggr.length === 1 ? aggr[0]
176
176
  : aggr.includes(DENSITY) ? DENSITY
@@ -194,7 +194,7 @@ export class Grid2DMark extends Mark {
194
194
  numRows: grids0.numRows,
195
195
  columns: {
196
196
  ...grids0.columns,
197
- // @ts-ignore
197
+ // @ts-expect-error array types
198
198
  [prop]: g.map(grid => dericheConv2d(configX, configY, grid, bins))
199
199
  }
200
200
  };
@@ -195,7 +195,7 @@ function alphaScale(mark, prop) {
195
195
  */
196
196
  function colorScale(mark, prop) {
197
197
  const { plot, grids } = mark;
198
- const data = grids.columns[prop];
198
+ const data = grids.columns[prop] ?? [];
199
199
  const flat = !data[0]?.map; // not array-like
200
200
  const discrete = flat || Array.isArray(data[0]);
201
201
 
@@ -15,7 +15,7 @@ import { InternSet, ascending } from 'd3';
15
15
  * @returns {Arrayish} The generated array.
16
16
  */
17
17
  export function array(size, proto = []) {
18
- // @ts-ignore
18
+ // @ts-expect-error dynamic instantiation
19
19
  return new proto.constructor(size);
20
20
  }
21
21
 
@@ -32,7 +32,9 @@ export function array(size, proto = []) {
32
32
  * }} Named column arrays of generated grid values.
33
33
  */
34
34
  export function grid1d(size, index, value, columns, groupby) {
35
+ if (!index?.length) return { numRows: 0, columns: {} };
35
36
  const numRows = index.length;
37
+ /** @type {{ [key:string]: Arrayish }} */
36
38
  const result = {};
37
39
  const cells = [];
38
40
 
@@ -60,7 +62,6 @@ export function grid1d(size, index, value, columns, groupby) {
60
62
  }
61
63
  }
62
64
 
63
- // @ts-ignore
64
65
  return { numRows: cells.length, columns: result };
65
66
  }
66
67
 
@@ -82,9 +83,11 @@ export function grid1d(size, index, value, columns, groupby) {
82
83
  * }} Named column arrays of generated grid values.
83
84
  */
84
85
  export function grid2d(w, h, index, columns, aggregates, groupby, interpolate) {
86
+ if (!index?.length) return { numRows: 0, columns: {} };
85
87
  const numRows = index.length;
86
88
  const size = w * h;
87
89
  const values = aggregates.map(name => columns[name]);
90
+ /** @type {{ [key:string]: Arrayish }} */
88
91
  const result = {};
89
92
  const cells = [];
90
93
  const group = new Int32Array(numRows);
@@ -127,7 +130,6 @@ export function grid2d(w, h, index, columns, aggregates, groupby, interpolate) {
127
130
  });
128
131
  }
129
132
 
130
- // @ts-ignore
131
133
  return { numRows: cells.length, columns: result };
132
134
  }
133
135