Skip to content

Commit 51ffdde

Browse files
authored
Merge pull request #3176 from perspective-dev/gl-charts
New plugin API, `viewer-charts` features, replace `@perspective-dev/viewer-openlayers`
2 parents 048a0cf + 651c9a8 commit 51ffdde

418 files changed

Lines changed: 32328 additions & 13382 deletions

File tree

Some content is hidden

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

.github/workflows/build.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
- docs/
2929
- examples/
3030
- rust/perspective-python/README.md
31-
pull_request:
31+
pull_request_target:
3232
branches:
3333
- master
3434
workflow_dispatch:
@@ -152,7 +152,7 @@ jobs:
152152
- name: WebAssembly Build
153153
run: pnpm run build --ci
154154
env:
155-
PACKAGE: "server,client,viewer,viewer-datagrid,viewer-charts,viewer-openlayers,workspace,react"
155+
PACKAGE: "server,client,viewer,viewer-datagrid,viewer-charts,workspace,react"
156156
# PSP_USE_CCACHE: 1
157157

158158
- uses: actions/upload-artifact@v4
@@ -166,7 +166,6 @@ jobs:
166166
rust/perspective-viewer/src
167167
packages/viewer-charts/dist
168168
packages/viewer-datagrid/dist
169-
packages/viewer-openlayers/dist
170169
packages/workspace/dist
171170
packages/react/dist
172171
@@ -649,14 +648,24 @@ jobs:
649648
path: .
650649

651650
- name: Run Tests
651+
id: run_tests
652652
run: pnpm run test -- --fetch-snapshots
653653
env:
654-
PACKAGE: "server,client,viewer,viewer-datagrid,viewer-charts,viewer-openlayers,workspace,react"
654+
PACKAGE: "server,client,viewer,viewer-datagrid,viewer-charts,workspace,react"
655655
PSP_SNAPSHOT_REPO: ${{ vars.PSP_SNAPSHOT_REPO }}
656656
PSP_SNAPSHOT_TOKEN: ${{ secrets.PSP_SNAPSHOT_TOKEN }}
657657
PSP_SNAPSHOT_REF: ${{ github.head_ref || github.ref_name }}
658658
# PSP_USE_CCACHE: 1
659659

660+
- name: Upload Test Failures
661+
if: ${{ failure() && steps.run_tests.outcome == 'failure' }}
662+
uses: actions/upload-artifact@v4
663+
with:
664+
name: perspective-js-test-results
665+
path: tools/test/dist/results
666+
if-no-files-found: ignore
667+
overwrite: true
668+
660669
# ,--,--' . .-,--. . .
661670
# `- | ,-. ,-. |- '|__/ . . |- |-. ,-. ,-.
662671
# , | |-' `-. | ,| | | | | | | | | |
@@ -1020,9 +1029,6 @@ jobs:
10201029
- run: pnpm pack --pack-destination=../..
10211030
working-directory: ./packages/viewer-charts
10221031

1023-
- run: pnpm pack --pack-destination=../..
1024-
working-directory: ./packages/viewer-openlayers
1025-
10261032
- run: pnpm pack --pack-destination=../..
10271033
working-directory: ./packages/workspace
10281034

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/md/how_to/javascript/installation.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ which modules they need. The main modules are:
1313
includes the core data engine module as a dependency.
1414

1515
`<perspective-viewer>` by itself only implements a trivial debug renderer, which
16-
prints the currently configured `view()` as a CSV. Plugin modules for popular
17-
JavaScript libraries, such as [d3fc](https://d3fc.io/), are packaged separately
18-
and must be imported individually.
16+
prints the currently configured `view()` as a CSV. Plugin modules are packaged
17+
separately and must be imported individually.
1918

2019
- `@perspective-dev/viewer-datagrid`
2120
A custom high-performance data-grid component based on HTML `<table>`.
2221

2322
- `@perspective-dev/viewer-charts`
24-
A `<perspective-viewer>` plugin for the [d3fc](https://d3fc.io) charting
25-
library.
23+
A set of charting components base on WebGL.
2624

2725
When imported after `@perspective-dev/viewer`, the plugin modules will register
2826
themselves automatically, and the renderers they export will be available in the
@@ -44,7 +42,7 @@ installed separately. All Plugins are optional - but a `<perspective-viewer>`
4442
without Plugins would be rather boring!
4543

4644
```bash
47-
$ npm add @perspective-dev/viewer-charts @perspective-dev/viewer-datagrid @perspective-dev/viewer-openlayers
45+
$ npm add @perspective-dev/viewer-charts @perspective-dev/viewer-datagrid
4846
```
4947

5048
## Node.js

docs/src/components/gallery.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212

1313
import EXAMPLES from "../data/features.js";
14-
import { SUPERSTORE_TABLE } from "../data/superstore.js";
14+
import { WORKER, SUPERSTORE_TABLE } from "../data/superstore.js";
1515
import { getColorMode, getPerspectiveTheme } from "./theme.js";
1616

1717
function showOverlay(index: number) {
@@ -31,9 +31,10 @@ function showOverlay(index: number) {
3131
document.body.appendChild(overlay);
3232

3333
SUPERSTORE_TABLE.then((table: any) => {
34-
viewer.load(table);
34+
viewer.load(WORKER);
3535
viewer.restore({
3636
plugin: "Datagrid",
37+
table: "superstore",
3738
group_by: [],
3839
expressions: {},
3940
split_by: [],
@@ -61,9 +62,7 @@ export async function initGallery(container: HTMLElement) {
6162
img.alt = "Perspective feature gallery";
6263
img.src = `/features/montage${isDark ? "_dark" : "_light"}.png`;
6364
img.addEventListener("click", (event: MouseEvent) => {
64-
const col = Math.floor(
65-
(event.offsetX / img.offsetWidth) * map.columns,
66-
);
65+
const col = Math.floor((event.offsetX / img.offsetWidth) * map.columns);
6766
const row = Math.floor((event.offsetY / img.offsetHeight) * rows);
6867
const tileIndex = row * map.columns + col;
6968
const featureIndex = map.order[tileIndex];

docs/src/data/superstore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ import { worker } from "./worker.js";
1414
// @ts-ignore
1515
import SUPERSTORE_URL from "superstore-arrow/superstore.lz4.arrow";
1616

17+
export const WORKER = worker();
18+
1719
export const SUPERSTORE_TABLE = (async function () {
18-
const w = await worker();
1920
const req = await fetch(SUPERSTORE_URL);
2021
const arrow = await req.arrayBuffer();
21-
return await w.table(arrow.slice());
22+
return await WORKER.then((w) =>
23+
w.table(arrow.slice(), { name: "superstore" }),
24+
);
2225
})();

docs/test/js/examples.spec.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ test.describe("Examples", () => {
6767
let selector = "";
6868
if (new_config.plugin === "Datagrid") {
6969
selector = "perspective-viewer-datagrid";
70-
} else if (new_config.plugin === "Map Scatter") {
71-
selector = "perspective-viewer-openlayers-scatter";
7270
} else {
7371
const plugin = new_config.plugin
7472
.replace(/[-\/\s]/gi, "")

eslint.config.mjs

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
8+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
10+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12+
13+
import tseslint from "typescript-eslint";
14+
// import globals from "globals";
15+
16+
export default tseslint.config(
17+
{
18+
ignores: [
19+
"docs/**",
20+
"tools/**",
21+
"rust/**",
22+
"examples/**",
23+
"packages/cli/**/*",
24+
"packages/jupyterlab/**/*",
25+
// "packages/viewer-charts/**/*",
26+
// "packages/viewer-datagrid/**/*",
27+
"packages/workspace/**/*",
28+
"packages/react/**/*",
29+
30+
".emsdk/**",
31+
"**/py_modules/**",
32+
"**/node_modules/**",
33+
"**/dist/**",
34+
"**/build/**",
35+
"**/target/**",
36+
"**/pkg/**",
37+
],
38+
},
39+
...tseslint.configs.recommended,
40+
{
41+
files: ["**/*.{ts,mts,tsx}"],
42+
languageOptions: {
43+
parserOptions: {
44+
projectService: true,
45+
tsconfigRootDir: import.meta.dirname,
46+
},
47+
// globals: {
48+
// ...globals.browser,
49+
// ...globals.node,
50+
// },
51+
},
52+
rules: {
53+
"@typescript-eslint/no-explicit-any": "off",
54+
curly: "warn",
55+
"padding-line-between-statements": [
56+
"warn",
57+
{ blankLine: "always", prev: "block-like", next: "*" },
58+
],
59+
"@typescript-eslint/no-unused-vars": [
60+
"warn",
61+
{
62+
args: "none",
63+
varsIgnorePattern: "^_",
64+
caughtErrorsIgnorePattern: "^_",
65+
},
66+
],
67+
68+
// // This is why we can't have nice things. I like this rule, but
69+
// // `prettier` doesn't, so we conform or perish.
70+
//
71+
// "lines-around-comment": [
72+
// "warn",
73+
// {
74+
// beforeLineComment: true,
75+
// beforeBlockComment: true,
76+
// },
77+
// ],
78+
"@typescript-eslint/no-empty-object-type": "off",
79+
"@typescript-eslint/no-unused-expressions": "off",
80+
"@typescript-eslint/no-this-alias": "off",
81+
"@typescript-eslint/no-require-imports": "off",
82+
"@typescript-eslint/ban-ts-comment": "off",
83+
"@typescript-eslint/no-namespace": "off",
84+
"@typescript-eslint/no-wrapper-object-types": "off",
85+
"@typescript-eslint/no-unsafe-function-type": "off",
86+
"no-empty": "off",
87+
"no-prototype-builtins": "off",
88+
"no-control-regex": "off",
89+
"no-useless-escape": "off",
90+
"no-async-promise-executor": "off",
91+
"no-cond-assign": "off",
92+
"no-misleading-character-class": "off",
93+
},
94+
},
95+
{
96+
files: ["examples/**/*.{ts,mts,tsx}", "tools/bench/**/*.{ts,mts,tsx}"],
97+
rules: {
98+
"@typescript-eslint/no-unused-vars": "warn",
99+
},
100+
},
101+
);

examples/blocks/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@perspective-dev/viewer": "workspace:",
1717
"@perspective-dev/viewer-charts": "workspace:",
1818
"@perspective-dev/viewer-datagrid": "workspace:",
19-
"@perspective-dev/viewer-openlayers": "workspace:",
2019
"@perspective-dev/workspace": "workspace:",
2120
"superstore-arrow": "catalog:"
2221
},

examples/blocks/src/dataset/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@
182182
if (state.table) {
183183
// await viewer.eject();
184184
// await window.psp_workspace.removeTable("superstore");
185+
for (const viewer of window.psp_workspace.children) {
186+
const cfg = await viewer.save();
187+
if (cfg.table === "superstore") {
188+
await viewer.eject();
189+
}
190+
}
191+
185192
await state.table.then((x) => x.delete({ lazy: true }));
186193
state.table = undefined;
187194
}

examples/blocks/src/evictions/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import "/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js";
1111
import "/node_modules/@perspective-dev/viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js";
1212
import "/node_modules/@perspective-dev/viewer-charts/dist/cdn/perspective-viewer-charts.js";
13-
import "/node_modules/@perspective-dev/viewer-openlayers/dist/cdn/perspective-viewer-openlayers.js";
1413

1514
import { worker } from "/node_modules/@perspective-dev/client/dist/cdn/perspective.js";
1615

0 commit comments

Comments
 (0)