diff --git a/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json b/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json new file mode 100644 index 000000000..b5071b3be --- /dev/null +++ b/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: add axis innerOffset config", + "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 1e735ceda..eba6beb9c 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.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@visactor/vtable-export': workspace:* @@ -37,7 +37,7 @@ importers: yargs: ^17.1.1 dependencies: '@arco-design/web-react': 2.46.1_p2jlmv6k7k3po6tueteg46f2ku - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors '@visactor/vtable-export': link:../packages/vtable-export @@ -82,7 +82,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -133,7 +133,7 @@ importers: '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -179,7 +179,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vdataset': ~0.17.1 '@visactor/vrender-components': 0.17.20-alpha.3 '@visactor/vrender-core': 0.17.20-alpha.3 @@ -249,7 +249,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.48 '@types/react-dom': 18.2.18 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -348,7 +348,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -402,7 +402,7 @@ importers: '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -3353,23 +3353,23 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.9.0: - resolution: {integrity: sha512-2iZg1TjBQ068De6IHjQl3zdoYlwcZ+yZmHr1R/+MGVevSOHKkpqq4O5fIQPzHDqDnk4PW7amfl6g9+B+JQ5GsA==} + /@visactor/vchart/1.9.1: + resolution: {integrity: sha512-mtI/z0gA4tSN01uwjZzz3DPLrDlsrVBQlffAmXNaCMz3HDPVipqvgasASOaKJEJSDsqSwLN85Ogs77eEg/la5A==} dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-hierarchy': 0.11.5 - '@visactor/vgrammar-projection': 0.11.5 - '@visactor/vgrammar-sankey': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 - '@visactor/vgrammar-wordcloud': 0.11.5 - '@visactor/vgrammar-wordcloud-shape': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-hierarchy': 0.11.6 + '@visactor/vgrammar-projection': 0.11.6 + '@visactor/vgrammar-sankey': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 + '@visactor/vgrammar-wordcloud': 0.11.6 + '@visactor/vgrammar-wordcloud-shape': 0.11.6 '@visactor/vrender-components': 0.17.19 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - '@visactor/vutils-extension': 1.9.0 + '@visactor/vutils-extension': 1.9.1 /@visactor/vdataset/0.17.4: resolution: {integrity: sha512-o43a4/z9J3Wr/u+5BI8G+XwtWAJSHl+Pg0+UZDYoS+lXQLJV64THokAfhWUEWrMqxnrUbdBqaPgZAozYzaZJdg==} @@ -3392,70 +3392,70 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.11.5: - resolution: {integrity: sha512-j3oIOQOI229s5g3FlJGqUmPd9kFMqdNDXK2lim1g+SLxLKxIvf5lP7w6IrJL18dL5r5bfw0OO7qfWQrHMxm5eA==} + /@visactor/vgrammar-coordinate/0.11.6: + resolution: {integrity: sha512-mln1WQjpIiddXVWdky+twPphOFkrASMNY5ni1c5FOA+n8u/N00NKVKYBTV/vwh/FDU62t6PDiCzfEsK+OoMDaQ==} dependencies: - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-core/0.11.5: - resolution: {integrity: sha512-mjhps1xC9sYvWmgVp1lV3UVl8dUT+waHhPC3hL2XDRZ+YV0e694U2HPiWlh0JsVHXerYFdjm63t1UVfy48LqRg==} + /@visactor/vgrammar-core/0.11.6: + resolution: {integrity: sha512-Cl6fxVLUvFNN9t6xgYcwF2H6KjGR+TU0Eqx9wGi84pMrTdmBiWW9R1ItEMmSZUUnzP1qIf2it7qdeo2ZndKgXQ==} dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vgrammar-coordinate': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-coordinate': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-components': 0.17.19 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-hierarchy/0.11.5: - resolution: {integrity: sha512-HVsKusLuL1VwcuNXXqQA0uZ9XIQc25uLa0D3xBBwzkTxyMAvRWSmfh/sLFxnd+HiCZsV8iTXXzvyPUY9V/uOpQ==} + /@visactor/vgrammar-hierarchy/0.11.6: + resolution: {integrity: sha512-OGbVgIkpz59s8crpWJEoJxlwBYutL0dnMHJfcj0Ti/t6S1C1PPxG5vVwVShb+w+Vee+2j6wraEmbmrJePwaoAg==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-projection/0.11.5: - resolution: {integrity: sha512-ZzzP0UMn4iD8wIFGG/R59kJbTsN0hruyx6vxju7tYQTNCwO/n7T+JDAbjVFpVSfMmu8/xYO0NKRdJX0PqQ8iZA==} + /@visactor/vgrammar-projection/0.11.6: + resolution: {integrity: sha512-lXNNynQKtDCiya6uQZWFsWSFSb3JcWroUftXDN/bwMEfRZ6xqf78FD/aCLKeo+d4bMhDHatUObC2X9JnsNCJpQ==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vutils': 0.17.4 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.11.5: - resolution: {integrity: sha512-SOsMj0tj9Zu13NBErdQkKoQcyUNu3Er3BnZP85fyv0lGzdQW6m3o/T2ziVP7sZJwWm8vXwiUOI2dYEaN9zJNwQ==} + /@visactor/vgrammar-sankey/0.11.6: + resolution: {integrity: sha512-RFTaKjrSJRiz6fYLj7zNfiZL7WfmE9o5zwHy0NAFefQVo4WYyjWD1KH7pYIxWRbdCU9oQIx/hPbhmFO7ivYWSw==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-util/0.11.5: - resolution: {integrity: sha512-trbgNsbj+TBa+202Iw+ews79w0iiZSeLgoWcq80pS+2U+xiuCjjdyDe6U1sbJV/6HKtRR1mSk4dwdR0NRVs0hQ==} + /@visactor/vgrammar-util/0.11.6: + resolution: {integrity: sha512-e1bsJeNfale7GqhxdLlqsvIXaRFoEN3OILDiQaOq/+7fwA/hqIf2Oso+f3HSDbigbyeolBK09T8Gt7vfPYLATg==} dependencies: '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud-shape/0.11.5: - resolution: {integrity: sha512-+6hKAXZ3OaNiw3PfNcPc5K0BLz8Z6tC5F3eYdzrlLBVvzQGyea+o7LjHPMfcPH6jHhatOXsPOrXb6QAVoL9A0A==} + /@visactor/vgrammar-wordcloud-shape/0.11.6: + resolution: {integrity: sha512-tzhzGzlKH+UNx993SQKEKJa6aHnJqRo3lzY9u2oe3OcsYUVHS9PnDeohsh66AzQKIdWn3Zq9dOeDiotwAKHQDw==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud/0.11.5: - resolution: {integrity: sha512-zWzfs1nQyQJv/pgJHilC/DnDhe+M3u/d51bBPlaAmSNijPVY85sNSIwbGVJVuGi2zSJLmB5YbbFuZCWp23TuwA==} + /@visactor/vgrammar-wordcloud/0.11.6: + resolution: {integrity: sha512-cxDLS1DRG5CZDVpp8BjonSmWcBUfBCXMBOpaog6Iy0CZFFua1uCovA647Z9YuPc5qrlvuZ+tAMMrv3eJx9yeNA==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 @@ -3537,8 +3537,8 @@ packages: '@visactor/vutils': 0.17.4 dev: false - /@visactor/vutils-extension/1.9.0: - resolution: {integrity: sha512-yZpk+E8tyil/Iz/0riIXQRB40H2ExfKfv0fm6UFrzGit3kigIk5vKKGe2rO2OO30FGC+V1DpG4H2U/5QKmNOIA==} + /@visactor/vutils-extension/1.9.1: + resolution: {integrity: sha512-CX1wgVlNNSxY3z1pk/oeVBruELj8jy0EGsrH9IL+R8+gU/v0XlWAe6fS96dS4poftMngMtTYIaEEPgvGk0tBfQ==} dependencies: '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 diff --git a/docs/package.json b/docs/package.json index af30a660a..1b6f8224b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,7 +13,7 @@ "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", "@visactor/vtable-export": "workspace:*", - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "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 34a42b702..ab92fab65 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.9.0", + "@visactor/vchart": "1.9.1", "@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-export/package.json b/packages/vtable-export/package.json index a341d3b01..594eca167 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -40,7 +40,7 @@ "exceljs": "4.4.0" }, "devDependencies": { - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} +} \ 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 cfa63157a..558b29d1f 100644 --- a/packages/vtable/examples/pivot-chart/pivotChart.ts +++ b/packages/vtable/examples/pivot-chart/pivotChart.ts @@ -124,8 +124,25 @@ export function createTable() { yField: '230417171050011', seriesField: '230417171050030', axes: [ - { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + { + orient: 'left', + visible: true, + label: { + visible: true + }, + innerOffset: { + top: 20, + bottom: 20 + } + }, + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], bar: { state: { @@ -226,7 +243,15 @@ export function createTable() { ], axes: [ { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], theme: { // axis: { @@ -272,7 +297,14 @@ export function createTable() { seriesField: '230417171050030', axes: [ { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], line: { state: { diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 3174fbe4b..989c5b396 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -61,7 +61,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -124,4 +124,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 ecd0d54b9..064e7098e 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -57,13 +57,17 @@ export class CartesianAxis { ); if (this.orient === 'left' || this.orient === 'right') { + const innerOffsetTop = this.option.innerOffset?.top ?? 0; + const innerOffsetBottom = this.option.innerOffset?.bottom ?? 0; this.width = width; - this.height = height - padding[2]; - this.y = padding[0]; + this.height = height - padding[2] - innerOffsetBottom; + this.y = padding[0] + innerOffsetTop; } else if (this.orient === 'top' || this.orient === 'bottom') { - this.width = width - padding[1]; + const innerOffsetLeft = this.option.innerOffset?.left ?? 0; + const innerOffsetRight = this.option.innerOffset?.right ?? 0; + this.width = width - padding[1] - innerOffsetRight; this.height = height; - this.x = padding[3]; + this.x = padding[3] + innerOffsetLeft; } this.visible = option.visible ?? true;