Skip to content

Commit e04ac2b

Browse files
authored
Merge branch 'main' into fil/occlusion
2 parents 7d6bc27 + b5366f9 commit e04ac2b

File tree

78 files changed

+3705
-3233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3705
-3233
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
name: github-pages
1616
url: ${{ steps.deployment.outputs.page_url }}
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: actions/setup-node@v3
2020
with:
21-
node-version: 16
22-
cache: 'yarn'
21+
node-version: 20
22+
cache: yarn
2323
- run: yarn --frozen-lockfile
2424
- run: yarn prepublishOnly
2525
- run: yarn docs:build

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- uses: actions/setup-node@v3
1515
with:
16-
node-version: 16
17-
cache: 'yarn'
16+
node-version: 20
17+
cache: yarn
1818
- run: yarn --frozen-lockfile
1919
- run: yarn test:mocha
2020
- run: yarn test:tsc

.mocharc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/transforms/bin.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ The following named reducers are supported:
274274
* *y* - the middle of the bin’s *y* extent (when binning on *y*)
275275
* *y1* - the lower bound of the bin’s *y* extent (when binning on *y*)
276276
* *y2* - the upper bound of the bin’s *y* extent (when binning on *y*)
277+
* *z* <VersionBadge pr="1959" /> - the bin’s *z* value (*z*, *fill*, or *stroke*)
277278

278279
In addition, a reducer may be specified as:
279280

docs/transforms/dodge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Plot.plot({
177177
```
178178
:::
179179

180-
The dodge transform can be use with any mark that supports **x** and **y** position. Below, we use the [text mark](../marks/text.md) instead to show company valuations (in billions).
180+
The dodge transform can be used with any mark that supports **x** and **y** position. Below, we use the [text mark](../marks/text.md) instead to show company valuations (in billions).
181181

182182
:::plot defer https://observablehq.com/@observablehq/plot-text-dodge
183183
```js

docs/transforms/group.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Although barX applies an implicit stackX transform, [textX](../marks/text.md) do
329329

330330
## Group options
331331

332-
Given input *data* = [*d₀*, *d₁*, *d₂*, …], by default the resulting grouped data is an array of arrays where each inner array is a subset of the input data such as [[*d₁*, *d₂*, …], [*d₀*, …], …]. Each inner array is in input order. The outer array is in natural ascending order according to the associated dimension (*x* then *y*).
332+
Given input *data* = [*d₀*, *d₁*, *d₂*, …], by default the resulting grouped data is an array of arrays where each inner array is a subset of the input data such as [[*d₁*, *d₂*, …], [*d₀*, …], …]. Each inner array is in input order. The outer array is in input order according to the first element of each group.
333333

334334
By specifying a different reducer for the **data** output, as described below, you can change how the grouped data is computed. The outputs may also include **filter** and **sort** options specified as reducers, and a **reverse** option to reverse the order of generated groups. By default, empty groups are omitted, and non-empty groups are generated in ascending (natural) order.
335335

@@ -370,6 +370,7 @@ The following named reducers are supported:
370370
* *identity* - the array of values
371371
* *x* <VersionBadge version="0.6.12" pr="1916" /> - the group’s *x* value (when grouping on *x*)
372372
* *y* <VersionBadge version="0.6.12" pr="1916" /> - the group’s *y* value (when grouping on *y*)
373+
* *z* <VersionBadge pr="1959" /> - the group’s *z* value (*z*, *fill*, or *stroke*)
373374

374375
In addition, a reducer may be specified as:
375376

loader.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"scripts": {
3030
"test": "yarn test:mocha && yarn test:tsc && yarn test:lint && yarn test:prettier",
3131
"test:coverage": "c8 yarn test:mocha",
32-
"test:mocha": "mkdir -p test/output && TZ=America/Los_Angeles mocha 'test/**/*-test.*' 'test/plot.js'",
32+
"test:mocha": "mkdir -p test/output && TZ=America/Los_Angeles tsx node_modules/.bin/mocha 'test/**/*-test.*' 'test/plot.*'",
3333
"test:lint": "eslint src test",
3434
"test:prettier": "prettier --check src test",
3535
"test:tsc": "tsc",
@@ -47,7 +47,6 @@
4747
"./src/plot.js"
4848
],
4949
"devDependencies": {
50-
"@esbuild-kit/core-utils": "^3.1.0",
5150
"@observablehq/runtime": "^5.7.3",
5251
"@rollup/plugin-commonjs": "^25.0.2",
5352
"@rollup/plugin-json": "^6.0.0",
@@ -62,20 +61,20 @@
6261
"canvas": "^2.0.0",
6362
"d3-geo-projection": "^4.0.0",
6463
"eslint": "^8.16.0",
65-
"eslint-config-prettier": "^8.5.0",
66-
"get-tsconfig": "^4.1.0",
64+
"eslint-config-prettier": "^9.1.0",
6765
"htl": "^0.3.0",
6866
"js-beautify": "1",
69-
"jsdom": "^22.1.0",
70-
"markdown-it-container": "^3.0.0",
67+
"jsdom": "^23.0.1",
68+
"markdown-it-container": "^4.0.0",
7169
"mocha": "^10.0.0",
7270
"module-alias": "^2.0.0",
73-
"prettier": "^3.0.0",
74-
"rollup": "^3.7.0",
71+
"prettier": "~3.0.0",
72+
"rollup": "^4.9.1",
7573
"topojson-client": "^3.1.0",
76-
"ts-morph": "^19.0.0",
74+
"ts-morph": "^21.0.1",
75+
"tsx": "^4.7.0",
7776
"typescript": "^5.0.2",
78-
"vite": "^4.4.9",
77+
"vite": "^5.0.10",
7978
"vitepress": "^1.0.0-rc.12"
8079
},
8180
"c8": {

src/transforms/bin.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export interface BinOptions {
117117
* - *y* - the middle of the bin’s **y** extent (when binning on **y**)
118118
* - *y1* - the lower bound of the bin’s **y** extent (when binning on **y**)
119119
* - *y2* - the upper bound of the bin’s **y** extent (when binning on **y**)
120+
* - *z* - the bin’s **z** value (when grouping on **z**, **fill**, or **stroke**)
120121
* - a function that takes an array of values and returns the reduced value
121122
* - an object that implements the *reduceIndex* method
122123
*
@@ -132,7 +133,8 @@ export type BinReducer =
132133
| "x2"
133134
| "y"
134135
| "y1"
135-
| "y2";
136+
| "y2"
137+
| "z";
136138

137139
/**
138140
* A shorthand functional bin reducer implementation: given an array of input

src/transforms/bin.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ import {
4141
maybeSubgroup,
4242
reduceCount,
4343
reduceFirst,
44-
reduceIdentity
44+
reduceIdentity,
45+
reduceZ
4546
} from "./group.js";
4647
import {maybeInsetX, maybeInsetY} from "./inset.js";
4748

@@ -180,6 +181,7 @@ function binn(
180181
for (const [f, I] of maybeGroup(facet, G)) {
181182
for (const [k, g] of maybeGroup(I, K)) {
182183
for (const [b, extent] of bin(g)) {
184+
if (G) extent.z = f;
183185
if (filter && !filter.reduce(b, extent)) continue;
184186
groupFacet.push(i++);
185187
groupData.push(reduceData.reduceIndex(b, data, extent));
@@ -190,7 +192,7 @@ function binn(
190192
if (BX1) BX1.push(extent.x1), BX2.push(extent.x2);
191193
if (BY1) BY1.push(extent.y1), BY2.push(extent.y2);
192194
for (const o of outputs) o.reduce(b, extent);
193-
if (sort) sort.reduce(b);
195+
if (sort) sort.reduce(b, extent);
194196
}
195197
}
196198
}
@@ -355,6 +357,8 @@ function maybeBinReduceFallback(reduce) {
355357
return reduceY1;
356358
case "y2":
357359
return reduceY2;
360+
case "z":
361+
return reduceZ;
358362
}
359363
throw new Error(`invalid bin reduce: ${reduce}`);
360364
}

0 commit comments

Comments
 (0)