Skip to content

Commit a68a048

Browse files
committed
package bump
2 parents fbd7623 + 948d06a commit a68a048

File tree

6 files changed

+57
-6
lines changed

6 files changed

+57
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "deepscatter",
33
"type": "module",
4-
"version": "2.15.1-RC-1",
4+
"version": "2.15.2",
55
"description": "Fast, animated zoomable scatterplots scaling to billions of points",
66
"files": [
77
"dist"

release_notes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
# 2.15.1
3+
4+
* Adds a method to `Dataset` called visit_full that returns a promise which iterates over all the tiles in the dataset including those that have not yet loaded. (Their load is triggered.)
5+
16
# 2.15.0
27

38
This would be a bugfix release except that it's possible this might accidentally break code taking advantage of undocumented behavior involving the domain for categorical scales. If you've ever set a scale to have domain [-2047, 2047], the console will now throw a warning and autochange the extent to provide more sensible support for dictionary fields.

src/Dataset.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,52 @@ export abstract class Dataset<T extends Tile> {
307307
}
308308
}
309309

310+
/**
311+
* Invoke a function on all tiles in the dataset that have been downloaded.
312+
* The general architecture here is taken from the
313+
* d3 quadtree functions. That's why, for example, it doesn't
314+
* recurse.
315+
316+
* @param callback The function to invoke on each tile.
317+
* @param after Whether to execute the visit in bottom-up order. Default false.
318+
* @param filter
319+
*/
320+
321+
async visit_full(
322+
callback: (tile: T) => Promise<void>,
323+
after = false,
324+
starting_tile : T | null = null,
325+
filter: (t: T) => boolean = (x) => true,
326+
updateFunction: (tile: T, completed, total) => Promise<void>
327+
) {
328+
329+
// Visit all children with a callback function.
330+
// In general recursing quadtrees isn't that fast, but
331+
// we rarely have more than ten tiles deep and the
332+
// code is much cleaner this way than an async queue.
333+
334+
let seen = 0;
335+
const start = starting_tile || this.root_tile;
336+
await start.download();
337+
const total = JSON.parse(start.record_batch.schema.metadata.get("total_points"))
338+
339+
async function resolve(tile: T) {
340+
await tile.download();
341+
if (after) {
342+
await Promise.all(tile.children.map(resolve))
343+
await callback(tile);
344+
seen += tile.record_batch.numRows
345+
void updateFunction(tile, seen, total)
346+
} else {
347+
await callback(tile);
348+
seen += tile.record_batch.numRows
349+
void updateFunction(tile, seen, total)
350+
await Promise.all(tile.children.map(resolve))
351+
}
352+
}
353+
await resolve(start);
354+
}
355+
310356
async schema() {
311357
await this.ready;
312358
if (this._schema) {

src/deepscatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ class Scatterplot<T extends Tile> {
206206
}
207207
}
208208
const selection = new DataSelection<T>(this, params);
209-
await selection.ready;
210209
this.selection_history.push({
211210
selection,
212211
name: selection.name,
213212
flushed: false,
214213
});
214+
await selection.ready;
215215
return selection;
216216
}
217217

src/tile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export abstract class Tile {
7474
return this._children;
7575
}
7676

77-
download() {
77+
download() : Promise<void> {
7878
throw new Error('Not implemented');
7979
}
8080

@@ -253,7 +253,7 @@ export abstract class Tile {
253253
}
254254

255255
async schema() {
256-
this.download();
256+
await this.download();
257257
await this.promise;
258258
return this._schema;
259259
}

vietnam2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h1>Vietnam</h1>
5555

5656
const prefs = {
5757
source_url: 'https://bmschmidt.github.io/vietnam_war/',
58-
max_points: 100000,
58+
max_points: 1000,
5959
alpha: 10.12, // Target saturation for the full page.
6060
zoom_balance: 0.12, // Rate at which points increase size. https://observablehq.com/@bmschmidt/zoom-strategies-for-huge-scatterplots-with-three-js
6161
point_size: 2, // Default point size before application of size scaling
@@ -184,7 +184,7 @@ <h1>Vietnam</h1>
184184
scatterplot
185185
.plotAPI({
186186
alpha: 3.5,
187-
max_points: 10000,
187+
max_points: 1000,
188188
point_size: 5,
189189
duration: 0.1,
190190
encoding: {

0 commit comments

Comments
 (0)