diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json new file mode 100644 index 000000000..32ab8f6b7 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-07-12-30.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: add axis theme", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json new file mode 100644 index 000000000..f6996e8b6 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-bug-fix-0.15.4_2023-12-08-06-27.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: overlay default and hover colors", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2bf7dde50..c96adda09 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@vitejs/plugin-react': 3.1.0 @@ -36,7 +36,7 @@ importers: yargs: ^17.1.1 dependencies: '@arco-design/web-react': 2.46.1_p5xgpqf7wiayqxc6j6o5zt2pdy - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors axios: 1.6.2 @@ -80,7 +80,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.16.10 '@vitejs/plugin-react': 3.1.0 @@ -131,7 +131,7 @@ importers: '@types/react': 18.2.38 '@types/react-dom': 18.2.17 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.2 chai: 4.3.4 @@ -177,10 +177,10 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@visactor/vdataset': ~0.15.7 - '@visactor/vrender': 0.16.17 - '@visactor/vrender-components': 0.16.17 + '@visactor/vrender': 0.16.20 + '@visactor/vrender-components': 0.16.20 '@visactor/vscale': 0.16.0 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.16.10 @@ -223,8 +223,8 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.15.14 - '@visactor/vrender': 0.16.17 - '@visactor/vrender-components': 0.16.17 + '@visactor/vrender': 0.16.20 + '@visactor/vrender-components': 0.16.20 '@visactor/vscale': 0.16.0 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.16.18 @@ -245,7 +245,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.38 '@types/react-dom': 18.2.17 - '@visactor/vchart': 1.7.1 + '@visactor/vchart': 1.7.3 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.2 chai: 4.3.4 @@ -3215,23 +3215,23 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.7.1: - resolution: {integrity: sha512-g+gGNDk7jF3QGw+biOpjLDaMIrFSM2Qf/FHtGjza/APuJwL/W2ZoKXkSOCpLtlJHZ/bFupm6ZTAbNI9ghsQ1BA==} - dependencies: - '@visactor/vdataset': 0.16.18 - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-hierarchy': 0.9.3 - '@visactor/vgrammar-projection': 0.9.3 - '@visactor/vgrammar-sankey': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vgrammar-wordcloud': 0.9.3 - '@visactor/vgrammar-wordcloud-shape': 0.9.3 - '@visactor/vrender-components': 0.16.17 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 - '@visactor/vscale': 0.16.18 - '@visactor/vutils': 0.16.18 - '@visactor/vutils-extension': 1.7.1 + /@visactor/vchart/1.7.3: + resolution: {integrity: sha512-DUYVbU4dXkomkE3YvG9fZuGPcCIcBS+xTKJuPYyrSjB+q/XugqQWp4fYMUMtg8lEf87ik5cDVNhHTVhHWx0//w==} + dependencies: + '@visactor/vdataset': 0.17.1 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-hierarchy': 0.9.4 + '@visactor/vgrammar-projection': 0.9.4 + '@visactor/vgrammar-sankey': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vgrammar-wordcloud': 0.9.4 + '@visactor/vgrammar-wordcloud-shape': 0.9.4 + '@visactor/vrender-components': 0.16.20 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.17.1 + '@visactor/vutils': 0.17.1 + '@visactor/vutils-extension': 1.7.3 /@visactor/vdataset/0.15.14: resolution: {integrity: sha512-uPRUJAcldwEUezQnXUIB5IwFyMhktgc9YyObm0fFtBEf9P+zln+d/cW1jIN8H2oTIaTyAryDCzZ3MDWTI8jOqg==} @@ -3276,72 +3276,93 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.9.3: - resolution: {integrity: sha512-nj/RCmFJqOnpqGJ4MfJH6Fd9Ur1u6mRdj9pfXc7QyAujqOhfhs+oqwZ/hkBb/pwONCdRYG7+EFqgYam5fZ5JtA==} + /@visactor/vdataset/0.17.1: + resolution: {integrity: sha512-hF83iZ/Cl13atkiUhekZluadoeksSkTJK4dUOqapSpTGt0TFR/DWKs7F/DxBUnRDRdohKUIuJzSKtha/qSPS/A==} + dependencies: + '@turf/flatten': 6.5.0 + '@turf/helpers': 6.5.0 + '@turf/rewind': 6.5.0 + '@visactor/vutils': 0.17.1 + d3-dsv: 2.0.0 + d3-geo: 1.12.1 + d3-hexbin: 0.2.2 + d3-hierarchy: 3.1.2 + eventemitter3: 4.0.7 + geobuf: 3.0.2 + geojson-dissolve: 3.1.0 + path-browserify: 1.0.1 + pbf: 3.2.1 + point-at-length: 1.1.0 + simple-statistics: 7.8.3 + simplify-geojson: 1.0.5 + topojson-client: 3.1.0 + + /@visactor/vgrammar-coordinate/0.9.4: + resolution: {integrity: sha512-Lhzs1SpBM/Uw7EVMDlObD9wwhK/WTFvRagphwb9KwC4aRAeotI1lCsH647gr6rOGoEV5s3j1jhqQ9han/l+ygA==} dependencies: - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-core/0.9.3: - resolution: {integrity: sha512-vgdd2rtgeKg1aGS3pCldDh4H+s+s8OylrvEcaloZrSwPlCz2/ZBMI3q+sv+wd+ppU/fHCeNWGknUPus21m5lKA==} + /@visactor/vgrammar-core/0.9.4: + resolution: {integrity: sha512-b1FqHG8AVOQlsPYNLYdYlhxJh12WHhSBMTdSevfGVbVgn/qB4hBG1my+yugf0uwEIiwushJBVvs7yVuTmhZrSg==} dependencies: '@visactor/vdataset': 0.16.18 - '@visactor/vgrammar-coordinate': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-coordinate': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vrender-components': 0.16.17 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-hierarchy/0.9.3: - resolution: {integrity: sha512-9EBfUwZa3Y4F11Ui/N7nFWny6H832JllJteaS/H/Bax78X2ofTAgWZz6NPKNwDTSKIlHms4TfUiUZhOnm1vnHQ==} + /@visactor/vgrammar-hierarchy/0.9.4: + resolution: {integrity: sha512-mYHABCa68dM+kBZtFq+hdrRD7y4HnsTLbjonMO2iaOlhviGypoSr6fnebtgsTgs7MZiFegHdCAHJDAi/pVbLSw==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-projection/0.9.3: - resolution: {integrity: sha512-0UcRS8TBCfPFCpUIF59caoQ79hKQg8v3AY5LDrPI1usOKwRj+LPX7+ymBocQnLJLwIp8jfHSKtPoYzIKILtduA==} + /@visactor/vgrammar-projection/0.9.4: + resolution: {integrity: sha512-sC82dOByPBWipsOfkfCnYDGUvHutaHyDa92TqWE+NoQKEZcWZJrzau49FN61qfDNNbkWstgO0hy0NubuH8807Q==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 '@visactor/vutils': 0.16.18 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.9.3: - resolution: {integrity: sha512-PwplHOvBmFKGyRjCrqCv6Ogw/0WD5cOxuJK5lwd3ZwQEOfYwT0cJmk3MwCsXs1pPmSgeZboQxuiVi7n6DCQM0A==} + /@visactor/vgrammar-sankey/0.9.4: + resolution: {integrity: sha512-tO38gWS0SSJBU3qILscBPITqub95NbK9up+nvWjZgwqOoj1N4/NPqpAvFwxOg4EF7g48saC5QJvt4gyQWikIKg==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-util/0.9.3: - resolution: {integrity: sha512-rPxRXv9Gw0vuOr30nkE/G8ge23D2JesSrvKCHXYvZEF6Tm8dL8vYMUQILMlExxXabGT6J4kNkSH43KbxT9R0lA==} + /@visactor/vgrammar-util/0.9.4: + resolution: {integrity: sha512-i+74qgnEjqdNceLf7qFtiqwhU8Dw5VrG5C7dwG7JF+lBIvLqDvQQ+8m3g0oUW0UfvgDu+9qcPCSht4uXqoM04Q==} dependencies: '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-wordcloud-shape/0.9.3: - resolution: {integrity: sha512-JQyqq3YPnFqZi5qMwwnrWZoykYjNqtmOM4V4Y0fUWsaQgKJXvxFMKlhllWSMN9yEo38tzBdKlEwneqLeDwb//w==} + /@visactor/vgrammar-wordcloud-shape/0.9.4: + resolution: {integrity: sha512-VhG8BnUtBwzJ5PMpT0wql8ymaVhXzLo3h7+5IljfaV1cUTV3f+sAbyPZziYVsbxmPOyJZNNbhMcEHNTexayMnw==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 - /@visactor/vgrammar-wordcloud/0.9.3: - resolution: {integrity: sha512-OYoJTYAhRMrwXZKoklSxIFvLNSdkn2T8VTTy4Pqdzzy8UeSlaZHjQ/uo7EuppIMOBSfGW/b80+6me+HaitpDkQ==} + /@visactor/vgrammar-wordcloud/0.9.4: + resolution: {integrity: sha512-v5geBndJaJQnGbm4kmVl1pQlcRPd6atIq1aTBKLOFpzFK30c0/VFqLy6E3fMrZ7DB2DfoOn5rU3EYq/hllUkzA==} dependencies: - '@visactor/vgrammar-core': 0.9.3 - '@visactor/vgrammar-util': 0.9.3 - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@visactor/vgrammar-core': 0.9.4 + '@visactor/vgrammar-util': 0.9.4 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 '@visactor/vutils': 0.16.18 /@visactor/vrender-components/0.16.17: @@ -3352,12 +3373,26 @@ packages: '@visactor/vscale': 0.16.18 '@visactor/vutils': 0.16.18 + /@visactor/vrender-components/0.16.20: + resolution: {integrity: sha512-kAiYwoyzahhO32OlkI1J1lGRaJX4sOkaob6H2+sUKO+7Qpj+76iegekrYcVGkR4AjUScLWg/Lv6PxWFSbbjz7Q==} + dependencies: + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.16.18 + '@visactor/vutils': 0.16.18 + /@visactor/vrender-core/0.16.17: resolution: {integrity: sha512-cAlxWZ4xV/dDVpoHuUfvXL+YR/bQj3A9L4v39mmWhdADcaE25DIxGkpWsNn6UOJoROdojrXCHPQTPToSZS8P5A==} dependencies: '@visactor/vutils': 0.16.18 color-convert: 2.0.1 + /@visactor/vrender-core/0.16.20: + resolution: {integrity: sha512-eRNz4l8BniXg0MvnwFOLc+lnYWC+8h6GDZgjIDw7K7QR8hIm2uY/PHBAzM/Yk5jHv3aGQ0RC3v33NlFaaAS+wg==} + dependencies: + '@visactor/vutils': 0.16.18 + color-convert: 2.0.1 + /@visactor/vrender-kits/0.16.17: resolution: {integrity: sha512-vwzWy7Ukizf6PpA5yLg3izhgZ619IqjRGbiTSSJrV2vIBqkhIL5LIUIg2NTNPgQD1tSDyPZFu7BFp2sXSeSnFg==} dependencies: @@ -3366,11 +3401,19 @@ packages: '@visactor/vutils': 0.16.18 roughjs: 4.5.2 - /@visactor/vrender/0.16.17: - resolution: {integrity: sha512-72woS3CQ7h3HHrPRneASgF17SLBifFTYY19BiCFxTiQZIfQJRm3aRems7Pbci8mTBDTwUDlWyAmF9jE2sit2mQ==} + /@visactor/vrender-kits/0.16.20: + resolution: {integrity: sha512-XqB7RsrqUxWg9SuyzKWoDRrQZRWVeUPm0Id/w6MsICZqRnZHllVPNezE71FT7trrQ8edpY8nWr5CJaSWyw1ylA==} dependencies: - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 + '@resvg/resvg-js': 2.4.1 + '@visactor/vrender-core': 0.16.20 + '@visactor/vutils': 0.16.18 + roughjs: 4.5.2 + + /@visactor/vrender/0.16.20: + resolution: {integrity: sha512-2iJidENrlbQVyByaB8vajD4zDZ3K92+FdM1nhrLAbL8Nm09nohwuwjJ9ItsEq2VfemGT0XMSgBwsAH8VG6c/mQ==} + dependencies: + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 dev: false /@visactor/vscale/0.16.0: @@ -3384,6 +3427,11 @@ packages: dependencies: '@visactor/vutils': 0.16.18 + /@visactor/vscale/0.17.1: + resolution: {integrity: sha512-vWDuVymipH7BE5qscS1s1aj+7o8L+uR1HdZ6S9qBS0+e3rxeteOiKcKTiFI8u+mLdsPh1KwHzUmec1SclzJyeg==} + dependencies: + '@visactor/vutils': 0.17.1 + /@visactor/vutils-extension/1.5.1-alpha.0: resolution: {integrity: sha512-4qtND+1Djatb5zVzAAbRX+WAKveO2SgEyJhnTzL/gWv7Elc+QYP06VmPaQy6ZnLHmxx6bsnZn1yFitz6fifmig==} dependencies: @@ -3393,13 +3441,13 @@ packages: '@visactor/vutils': 0.16.18 dev: false - /@visactor/vutils-extension/1.7.1: - resolution: {integrity: sha512-XcFpjpDmmSFz+7jFm36PTisKXk6XpnHrasOEHzSrt6OaakAMVB/fhTKHUHXJRsOjlRAokx+2gC1qdsbhwWNG8w==} + /@visactor/vutils-extension/1.7.3: + resolution: {integrity: sha512-MDxORaYXU3EjcZaamwbY3h5VKp+3PGypBWnWGhRA0C0py8yfvUpPNjUHatJb3Y9BN433GoUT8wtBsPsqWMyEqQ==} dependencies: - '@visactor/vrender-core': 0.16.17 - '@visactor/vrender-kits': 0.16.17 - '@visactor/vscale': 0.16.18 - '@visactor/vutils': 0.16.18 + '@visactor/vrender-core': 0.16.20 + '@visactor/vrender-kits': 0.16.20 + '@visactor/vscale': 0.17.1 + '@visactor/vutils': 0.17.1 /@visactor/vutils/0.15.14: resolution: {integrity: sha512-mZuJhXdDZqq5arqc/LfEmWOY6l7ErK1MurO8bR3vESxeCaQ18pN36iit15K2IMQVJuKZPnZ2ksw8+a1irXi/8A==} @@ -3424,6 +3472,13 @@ packages: '@turf/invariant': 6.5.0 eventemitter3: 4.0.7 + /@visactor/vutils/0.17.1: + resolution: {integrity: sha512-rHoY/CfT8VXuoE7YXqEixvpuL95Qy/4tGHRzeoJLaMsrUxAOXFRZeVX1wEbjrdnXeBj7UlpcG5/uVt5pIOFyeQ==} + dependencies: + '@turf/helpers': 6.5.0 + '@turf/invariant': 6.5.0 + eventemitter3: 4.0.7 + /@vitejs/plugin-react/3.1.0_vite@3.2.6: resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==} engines: {node: ^14.18.0 || >=16.0.0} diff --git a/docs/package.json b/docs/package.json index c163db94c..a74a538d9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,7 +12,7 @@ "@arco-design/web-react": "2.46.1", "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 7e6f79614..e81c4f2df 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -52,7 +52,7 @@ "react-is": "^18.2.0" }, "devDependencies": { - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} +} \ No newline at end of file diff --git a/packages/vtable/examples/pivot-chart/pivotChart.ts b/packages/vtable/examples/pivot-chart/pivotChart.ts index 7297e8efb..cc0c7064e 100644 --- a/packages/vtable/examples/pivot-chart/pivotChart.ts +++ b/packages/vtable/examples/pivot-chart/pivotChart.ts @@ -211,7 +211,23 @@ export function createTable() { axes: [ { orient: 'left', visible: true, label: { visible: true } }, { orient: 'bottom', visible: true } - ] + ], + theme: { + // axis: { + // label: { + // style: { + // fill: 'green' + // } + // } + // } + colorScheme: { + default: { + palette: { + axisLabelFontColor: 'red' + } + } + } + } } }, { @@ -9321,6 +9337,22 @@ export function createTable() { frameStyle: { borderLineWidth: 0 } + // axisStyle: { + // defaultAxisStyle: { + // title: { + // style: { + // fill: 'red' + // } + // } + // }, + // leftAxisStyle: { + // label: { + // style: { + // fill: 'yellow' + // } + // } + // } + // } }; const option: VTable.PivotChartConstructorOptions = { columnTree, diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 489223ae2..10939da2a 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,8 +50,8 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender": "0.16.17", - "@visactor/vrender-components": "0.16.17", + "@visactor/vrender": "0.16.20", + "@visactor/vrender-components": "0.16.20", "@visactor/vutils-extension": "1.5.1-alpha.0", "@visactor/vutils": "~0.16.10", "@visactor/vscale": "0.16.0", @@ -60,7 +60,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.7.1", + "@visactor/vchart": "1.7.3", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -123,4 +123,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index 06bc49009..073fee2fc 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -2,7 +2,7 @@ import { degreeToRadian, isNil, isValidNumber, merge } from '@visactor/vutils'; import type { BaseTableAPI } from '../../ts-types/base-table'; import type { ICellAxisOption } from '../../ts-types/component/axis'; import { LineAxis, type LineAxisAttributes } from '@visactor/vrender-components'; -import { commonAxis, getAxisAttributes } from './get-axis-attributes'; +import { commonAxis, getAxisAttributes, getCommonAxis } from './get-axis-attributes'; import { isXAxis, isYAxis } from '../util/orient'; import type { IOrientType } from '../../ts-types/component/util'; import { BandAxisScale } from './band-scale'; @@ -13,7 +13,7 @@ import type { IBaseScale } from '@visactor/vscale'; import { ticks } from '@visactor/vutils-extension'; import { LinearAxisScale } from './linear-scale'; import { doOverlap } from './label-overlap'; -import { getQuadProps } from '../../scenegraph/utils/padding'; +import type { TableTheme } from '../../themes/theme'; const DEFAULT_BAND_INNER_PADDING = 0.1; const DEFAULT_BAND_OUTER_PADDING = 0.3; @@ -42,11 +42,20 @@ export class CartesianAxis { width: number, height: number, padding: [number, number, number, number], + chartSpecTheme: any, table: BaseTableAPI ) { this.table = table; - this.option = merge({}, commonAxis, option); this.orient = option.orient ?? 'left'; + this.type = option.type ?? 'band'; + this.option = merge( + {}, + // commonAxis, + getCommonAxis(chartSpecTheme), + getTableAxisTheme(this.orient, table.theme), + getChartSpecAxisTheme(this.orient, this.type, chartSpecTheme), + option + ); if (this.orient === 'left' || this.orient === 'right') { this.width = width; @@ -59,7 +68,6 @@ export class CartesianAxis { } this.visible = option.visible ?? true; - this.type = option.type ?? 'band'; this.inverse = 'inverse' in option ? !!option.inverse : false; if (option.type === 'band') { this.data = option.domain; @@ -294,3 +302,42 @@ export class CartesianAxis { return (this.scale as LinearAxisScale).domain; } } + +function getTableAxisTheme(orient: IOrientType, theme: TableTheme) { + let directionStyle; + if (orient === 'left') { + directionStyle = theme.axisStyle.leftAxisStyle; + } else if (orient === 'right') { + directionStyle = theme.axisStyle.rightAxisStyle; + } else if (orient === 'top') { + directionStyle = theme.axisStyle.topAxisStyle; + } else if (orient === 'bottom') { + directionStyle = theme.axisStyle.bottomAxisStyle; + } + return merge({}, theme.axisStyle.defaultAxisStyle, directionStyle); +} + +function getChartSpecAxisTheme( + orient: IOrientType, + type: 'linear' | 'band' | 'point' | 'time' | 'log' | 'symlog', + chartSpecTheme?: any +) { + if (!chartSpecTheme) { + return {}; + } + const axisTheme = chartSpecTheme.axis; + let axisTypeTheme; + if (type === 'linear' || type === 'log' || type === 'symlog') { + axisTypeTheme = chartSpecTheme.axisLinear; + } else if (type === 'band') { + axisTypeTheme = chartSpecTheme.axisBand; + } + + let axisOrientTheme; + if (orient === 'top' || orient === 'bottom') { + axisOrientTheme = chartSpecTheme.axisX; + } else if (orient === 'left' || orient === 'right') { + axisOrientTheme = chartSpecTheme.axisY; + } + return merge({}, axisTheme, axisTypeTheme, axisOrientTheme); +} diff --git a/packages/vtable/src/components/axis/get-axis-attributes.ts b/packages/vtable/src/components/axis/get-axis-attributes.ts index c0125d0d8..72c0a3982 100644 --- a/packages/vtable/src/components/axis/get-axis-attributes.ts +++ b/packages/vtable/src/components/axis/get-axis-attributes.ts @@ -95,6 +95,34 @@ export const commonAxis = { } }; +export function getCommonAxis(theme: any) { + if (!theme?.colorScheme?.default?.palette) { + return commonAxis; + } + return merge({}, commonAxis, { + tick: { + style: { + stroke: theme.colorScheme.default.palette.axisDomainColor || '#D9DDE4' + } + }, + subTick: { + style: { + stroke: theme.colorScheme.default.palette.axisDomainColor || '#D9DDE4' + } + }, + label: { + style: { + fill: theme.colorScheme.default.palette.axisLabelFontColor || '#89909D' + } + }, + title: { + style: { + fill: theme.colorScheme.default.palette.secondaryFontColor || '#333333' + } + } + }); +} + export function getAxisAttributes(option: ICellAxisOption) { const spec = merge({}, option); // const spec = option; diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 82b563d75..1ce344363 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -1024,7 +1024,10 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { let count = rowLevelCount; if (this.indicatorsAsCol) { // count = rowLevelCount; - } else if (this.hideIndicatorName && this.rowDimensionKeys[0] === this.indicatorDimensionKey) { + } else if ( + this.hideIndicatorName && + this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey + ) { count = rowLevelCount - 1; } diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index 33f6d6a13..dc8282c04 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -683,8 +683,7 @@ export class AdjustColorGroupBeforeRenderContribution implements IGroupRenderCon if (table.stateManager.interactionState !== InteractionState.scrolling) { const hoverColor = getCellHoverColor(group as Group, table); if (hoverColor) { - (group as any).oldColor = group.attribute.fill; - group.attribute.fill = hoverColor; + (group.attribute as any)._vtableHoverFill = hoverColor; } } } @@ -719,9 +718,19 @@ export class AdjustColorGroupAfterRenderContribution implements IGroupRenderCont ) => boolean ) { // 处理hover颜色 - if ('oldColor' in group) { - group.attribute.fill = group.oldColor as any; - delete group.oldColor; + if ((group.attribute as any)._vtableHoverFill) { + if (fillCb) { + // do nothing + // fillCb(context, group.attribute, groupAttribute); + } else if (fVisible) { + const oldColor = group.attribute.fill; + // draw hover fill + group.attribute.fill = (group.attribute as any)._vtableHoverFill as any; + context.setCommonStyle(group, group.attribute, x, y, groupAttribute); + context.fill(); + group.attribute.fill = oldColor; + (group.attribute as any)._vtableHoverFill = undefined; + } } } } diff --git a/packages/vtable/src/scenegraph/graphic/contributions/index.ts b/packages/vtable/src/scenegraph/graphic/contributions/index.ts index b99e3dbcb..cb0f59256 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/index.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/index.ts @@ -39,12 +39,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(RectRenderContribution).toService(VTableSplitRectAfterRenderContribution); } - // group 渲染器注入contributions - bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution); - bind(SplitGroupBeforeRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(SplitGroupBeforeRenderContribution); - // chart渲染器注入 bind(DefaultCanvasChartRender).toSelf().inSingletonScope(); bind(ChartRender).to(DefaultCanvasChartRender); @@ -57,6 +51,16 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(ImageRenderContribution).toService(AfterImageRenderContribution); // group 渲染器注入contributions + bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution); + bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution); + + bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution); + bind(SplitGroupBeforeRenderContribution).toSelf().inSingletonScope(); + bind(GroupRenderContribution).toService(SplitGroupBeforeRenderContribution); + bind(DashGroupBeforeRenderContribution).toSelf().inSingletonScope(); bind(GroupRenderContribution).toService(DashGroupBeforeRenderContribution); bind(DashGroupAfterRenderContribution).toSelf().inSingletonScope(); @@ -66,9 +70,4 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(GroupRenderContribution).toService(AdjustPosGroupBeforeRenderContribution); bind(AdjustPosGroupAfterRenderContribution).toSelf().inSingletonScope(); bind(GroupRenderContribution).toService(AdjustPosGroupAfterRenderContribution); - - bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution); - bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope(); - bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution); }); diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index 107300e3c..71925a1b6 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -169,7 +169,15 @@ export function createCell( const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row); if (axisConfig) { - const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, table); + const spec = table.internalProps.layoutMap.getRawChartSpec(col, row); + const axis = new CartesianAxis( + axisConfig, + cellGroup.attribute.width, + cellGroup.attribute.height, + padding, + spec?.theme, + table + ); cellGroup.clear(); cellGroup.appendChild(axis.component); axis.overlap(); diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index 9931a41c7..5fc088471 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -298,11 +298,13 @@ function updateCellWidth( const cellStyle = scene.table._getCellStyle(col, row); const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table)); if (axisConfig) { + const spec = scene.table.internalProps.layoutMap.getRawChartSpec(col, row); const axis = new CartesianAxis( axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, + spec?.theme, scene.table ); cellGroup.clear(); diff --git a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts index 209725a5b..e55bb6811 100644 --- a/packages/vtable/src/scenegraph/refresh-node/update-chart.ts +++ b/packages/vtable/src/scenegraph/refresh-node/update-chart.ts @@ -181,7 +181,15 @@ function updateTableAxes(containerGroup: Group, table: BaseTableAPI) { const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row); const cellStyle = table._getCellStyle(cell.col, cell.row); const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table)); - const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table); + const spec = table.internalProps.layoutMap.getRawChartSpec(cell.col, cell.row); + const axis = new CartesianAxis( + axisConfig, + cell.attribute.width, + cell.attribute.height, + padding, + spec?.theme, + table + ); cell.clear(); cell.appendChild(axis.component); axis.overlap(); diff --git a/packages/vtable/src/state/state.ts b/packages/vtable/src/state/state.ts index cb4f0e1bb..e8fedb556 100644 --- a/packages/vtable/src/state/state.ts +++ b/packages/vtable/src/state/state.ts @@ -835,7 +835,8 @@ export class StateManager { ); (icon as any).oldVisibleTime = icon.attribute.visibleTime; icon.setAttribute('visibleTime', 'always'); - icon.setAttribute('visible', true); + // icon.setAttribute('visible', true); + icon.setAttribute('opacity', 1); } } @@ -851,9 +852,13 @@ export class StateManager { this.residentHoverIcon.row ); this.residentHoverIcon.icon.setAttribute('visibleTime', (this.residentHoverIcon.icon as any).oldVisibleTime); + // this.residentHoverIcon.icon.setAttribute( + // 'visible', + // this.residentHoverIcon.icon.attribute.visibleTime === 'always' + // ); this.residentHoverIcon.icon.setAttribute( - 'visible', - this.residentHoverIcon.icon.attribute.visibleTime === 'always' + 'opacity', + this.residentHoverIcon.icon.attribute.visibleTime === 'always' ? 1 : 0 ); this.residentHoverIcon = null; } diff --git a/packages/vtable/src/themes/component.ts b/packages/vtable/src/themes/component.ts new file mode 100644 index 000000000..153e5bafc --- /dev/null +++ b/packages/vtable/src/themes/component.ts @@ -0,0 +1,21 @@ +import type { RequiredTableThemeDefine } from '../ts-types'; + +export function getAxisStyle(axisStyle: RequiredTableThemeDefine['axisStyle']) { + const style = { + defaultAxisStyle: getSingleAxisStyle(axisStyle.defaultAxisStyle), + leftAxisStyle: getSingleAxisStyle(axisStyle.leftAxisStyle), + rightAxisStyle: getSingleAxisStyle(axisStyle.rightAxisStyle), + topAxisStyle: getSingleAxisStyle(axisStyle.topAxisStyle), + bottomAxisStyle: getSingleAxisStyle(axisStyle.bottomAxisStyle) + }; + + return style; +} + +function getSingleAxisStyle(axisStyle?: RequiredTableThemeDefine['axisStyle']['defaultAxisStyle']) { + if (!axisStyle) { + return {}; + } + + return axisStyle; // to do: turn into get mode +} diff --git a/packages/vtable/src/themes/theme.ts b/packages/vtable/src/themes/theme.ts index b61ca2d63..e3c41fc98 100644 --- a/packages/vtable/src/themes/theme.ts +++ b/packages/vtable/src/themes/theme.ts @@ -46,6 +46,7 @@ import { DEFAULTFONTFAMILY, DEFAULTFONTSIZE } from '../tools/global'; +import { getAxisStyle } from './component'; //private symbol // const _ = getSymbol(); @@ -80,6 +81,8 @@ export class TableTheme implements ITableThemeDefine { private _dragHeaderSplitLine: RequiredTableThemeDefine['dragHeaderSplitLine'] | null = null; private _frozenColumnLine: RequiredTableThemeDefine['frozenColumnLine'] | null = null; private _selectionStyle: RequiredTableThemeDefine['selectionStyle'] | null = null; + + private _axisStyle: RequiredTableThemeDefine['axisStyle'] | null = null; constructor(obj: PartialTableThemeDefine | ITableThemeDefine, superTheme: ITableThemeDefine) { this.internalTheme = { obj, @@ -615,6 +618,20 @@ export class TableTheme implements ITableThemeDefine { } return this._selectionStyle; } + + get axisStyle(): RequiredTableThemeDefine['axisStyle'] { + if (!this._axisStyle) { + const { obj, superTheme } = this.internalTheme; + const axisStyle: RequiredTableThemeDefine['axisStyle'] = ingoreNoneValueMerge( + {}, + superTheme.axisStyle, + obj.axisStyle + ); + this._axisStyle = getAxisStyle(axisStyle); + } + return this._axisStyle; + } + hasProperty(names: string[]): boolean { const { obj, superTheme } = this.internalTheme; return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names); diff --git a/packages/vtable/src/ts-types/theme.ts b/packages/vtable/src/ts-types/theme.ts index 77aa4e580..dc8a5118c 100644 --- a/packages/vtable/src/ts-types/theme.ts +++ b/packages/vtable/src/ts-types/theme.ts @@ -3,6 +3,7 @@ import type { ColorsDef, LineDashsDef, LineWidthsDef, LineWidthsPropertyDefine } import type { ITextStyleOption } from './column/style'; import type { ColorPropertyDefine, ColorsPropertyDefine } from './style-define'; import type { ColumnIconOption } from './icon'; +import type { ICellAxisOption } from './component/axis'; // ****** Custom Theme ******* export type PartialTableThemeDefine = Partial; export type ThemeStyle = ITextStyleOption & { @@ -125,6 +126,15 @@ export interface ITableThemeDefine { cellBorderLineWidth?: number; //边框线宽度 cellBgColor?: string; //选择框背景颜色 }; + + // style for axis + axisStyle?: { + defaultAxisStyle?: Omit; + leftAxisStyle?: Omit; + rightAxisStyle?: Omit; + topAxisStyle?: Omit; + bottomAxisStyle?: Omit; + }; } export type RequiredTableThemeDefine = Required;