diff --git a/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-17-14-23.json b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-17-14-23.json new file mode 100644 index 0000000000..f09679720e --- /dev/null +++ b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-17-14-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "feat(axis): axis adds `sampling` property, which is used to control whether to enable the axis sampling logic, which is enabled by default", + "type": "patch" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-09.json b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-09.json new file mode 100644 index 0000000000..8d108e37a8 --- /dev/null +++ b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-09.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "feat(axis): add anti-overlapping logic for cartesian axis labels", + "type": "patch" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-13.json b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-13.json new file mode 100644 index 0000000000..56944b3e30 --- /dev/null +++ b/common/changes/@visactor/vchart/feat-axis-label-layout_2023-07-18-04-13.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "feat(axis): support \\`dataFilter\\` property for axis label and tick for data filter", + "type": "patch" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-config.json b/common/config/rush/pnpm-config.json index 3378189965..adb9a79da0 100644 --- a/common/config/rush/pnpm-config.json +++ b/common/config/rush/pnpm-config.json @@ -90,7 +90,7 @@ */ "globalOverrides": { // "@visactor/vrender": "0.12.0", - // "@visactor/vrender-components": "0.12.0" + // "@visactor/vrender-components": "0.13.2-alpha.2" // "example2": "npm:@company/example2@^1.0.0" }, diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 1d4ff7c763..f2aa67ce33 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 '@visactor/vchart': workspace:1.1.0-beta.8 - '@visactor/vgrammar': ~0.4.0 - '@visactor/vrender': ~0.13.0 + '@visactor/vgrammar': ~0.4.1 + '@visactor/vrender': ~0.13.2 '@visactor/vutils': ~0.13.3 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -74,8 +74,8 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vgrammar': 0.4.0 - '@visactor/vrender': 0.13.1 + '@visactor/vgrammar': 0.4.1 + '@visactor/vrender': 0.13.2 '@visactor/vutils': 0.13.3 react-is: 18.2.0 devDependencies: @@ -205,16 +205,16 @@ importers: '@types/jest': ^26.0.0 '@types/node': '*' '@types/offscreencanvas': 2019.6.4 - '@visactor/vdataset': ~0.13.3 - '@visactor/vgrammar': ~0.4.0 - '@visactor/vgrammar-hierarchy': ~0.4.0 - '@visactor/vgrammar-projection': ~0.4.0 - '@visactor/vgrammar-sankey': ~0.4.0 - '@visactor/vgrammar-util': ~0.4.0 - '@visactor/vgrammar-wordcloud': ~0.4.0 - '@visactor/vgrammar-wordcloud-shape': ~0.4.0 - '@visactor/vrender': ~0.13.0 - '@visactor/vrender-components': ~0.13.0 + '@visactor/vdataset': ~0.13.4 + '@visactor/vgrammar': ~0.4.1 + '@visactor/vgrammar-hierarchy': ~0.4.1 + '@visactor/vgrammar-projection': ~0.4.1 + '@visactor/vgrammar-sankey': ~0.4.1 + '@visactor/vgrammar-util': ~0.4.1 + '@visactor/vgrammar-wordcloud': ~0.4.1 + '@visactor/vgrammar-wordcloud-shape': ~0.4.1 + '@visactor/vrender': ~0.13.2 + '@visactor/vrender-components': ~0.13.2 '@visactor/vscale': ~0.13.3 '@visactor/vutils': ~0.13.3 canvas: 2.11.2 @@ -242,16 +242,16 @@ importers: typescript: 4.9.5 vite: 3.2.6 dependencies: - '@visactor/vdataset': 0.13.3 - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-hierarchy': 0.4.0 - '@visactor/vgrammar-projection': 0.4.0 - '@visactor/vgrammar-sankey': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vgrammar-wordcloud': 0.4.0 - '@visactor/vgrammar-wordcloud-shape': 0.4.0 - '@visactor/vrender': 0.13.1 - '@visactor/vrender-components': 0.13.1 + '@visactor/vdataset': 0.13.4 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-hierarchy': 0.4.1 + '@visactor/vgrammar-projection': 0.4.1 + '@visactor/vgrammar-sankey': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vgrammar-wordcloud': 0.4.1 + '@visactor/vgrammar-wordcloud-shape': 0.4.1 + '@visactor/vrender': 0.13.2 + '@visactor/vrender-components': 0.13.2 '@visactor/vscale': 0.13.3 '@visactor/vutils': 0.13.3 devDependencies: @@ -1688,7 +1688,7 @@ packages: '@babel/plugin-transform-typeof-symbol': 7.22.5_@babel+core@7.20.12 '@babel/plugin-transform-unicode-escapes': 7.22.5_@babel+core@7.20.12 '@babel/plugin-transform-unicode-regex': 7.22.5_@babel+core@7.20.12 - '@babel/preset-modules': 0.1.5_@babel+core@7.20.12 + '@babel/preset-modules': 0.1.6_@babel+core@7.20.12 '@babel/types': 7.22.5 babel-plugin-polyfill-corejs2: 0.3.3_@babel+core@7.20.12 babel-plugin-polyfill-corejs3: 0.6.0_@babel+core@7.20.12 @@ -1698,10 +1698,10 @@ packages: transitivePeerDependencies: - supports-color - /@babel/preset-modules/0.1.5_@babel+core@7.20.12: - resolution: {integrity: sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==} + /@babel/preset-modules/0.1.6_@babel+core@7.20.12: + resolution: {integrity: sha512-ID2yj6K/4lKfhuU3+EX4UvNbIt7eACFbHmNUjzA+ep+B5971CknnA/9DEWKbRokfbbtblxxxXFJJrH47UEAMVg==} peerDependencies: - '@babel/core': ^7.0.0-0 + '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 dependencies: '@babel/core': 7.20.12 '@babel/helper-plugin-utils': 7.22.5 @@ -3140,7 +3140,7 @@ packages: jsonp-retry: 1.0.3 mobile-detect: 1.4.5 raf: 3.4.1 - whatwg-fetch: 3.6.16 + whatwg-fetch: 3.6.17 dev: true /@tarojs/taro-loader/3.3.17: @@ -3926,15 +3926,15 @@ packages: '@typescript-eslint/types': 5.30.0 eslint-visitor-keys: 3.4.1 - /@visactor/vdataset/0.13.3: - resolution: {integrity: sha512-QdsEHPp8GRSk7C3ohZ+XvGK+zJu3ukgzUjujfXqmZNubKXGMfDBWJ2nF0EzLNW7IS5rqpD7hnKa/myPykDttmw==} + /@visactor/vdataset/0.13.4: + resolution: {integrity: sha512-D70QAOZ3U4VletEvmw2c7pSF6yAxdyph4s7CPyIYPauyomuTmoImhkTG7BcUCC+PaKUUWsJEK7qLDbKNavIkjA==} dependencies: '@turf/flatten': 6.5.0 '@turf/helpers': 6.5.0 '@turf/rewind': 6.5.0 '@visactor/vutils': 0.13.3 d3-dsv: 3.0.1 - d3-geo: 3.1.0 + d3-geo: 1.12.1 d3-hexbin: 0.2.2 d3-hierarchy: 3.1.2 eventemitter3: 4.0.7 @@ -3948,87 +3948,87 @@ packages: topojson-client: 3.1.0 dev: false - /@visactor/vgrammar-coordinate/0.4.0: - resolution: {integrity: sha512-ZI5GOE4AzpKbEXa9gqWl3u/TBnJwHXNTGgUD1b2XzfWfDSiTlqe0i5gceecVfkqyanyIACmAIZGNug/MmaMCkQ==} + /@visactor/vgrammar-coordinate/0.4.1: + resolution: {integrity: sha512-0rVY6QEfzv0iInpOIJOcIaNabbwpGo6y2NqJbmZk8yaAlLzljWn4zWtqFbz3Ikt3dXkx/1viNY9ooaaZed2wOQ==} dependencies: - '@visactor/vgrammar-util': 0.4.0 + '@visactor/vgrammar-util': 0.4.1 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar-hierarchy/0.4.0: - resolution: {integrity: sha512-wtM6JB0kJWWBt2iGKo4O5hnsdUYWNRIbuwxO30QbHqK4F7IvLCCX/IDaWepG4oQeg9QmmnaACXv4B4FBlgcAWA==} + /@visactor/vgrammar-hierarchy/0.4.1: + resolution: {integrity: sha512-cKJzPN2BzEkcGQ9JNbQeUvZDruyanOCcyTtX6om3FdAZFlElUwOpbH599wkP0/cn74xUej21c+E90lMg3sX+6w==} dependencies: - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vrender': 0.13.1 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vrender': 0.13.2 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar-projection/0.4.0: - resolution: {integrity: sha512-5UeC8M0xTjL+VHbQgEC0HVSPb1gqIBL817BKj5TTrDvJlhoc0pgJHxEJkaZZn08pQ1vwe5nntlRyxg7Ym9r7Fw==} + /@visactor/vgrammar-projection/0.4.1: + resolution: {integrity: sha512-vK3ohorLNEBbMMQBmsH43mQ1rfNcdvIGgVU8qzct2HGdzSInlj8ZZadGpxGfb360unFURwWWRUqBBM51lilkaA==} dependencies: - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 '@visactor/vutils': 0.13.3 - d3-geo: 3.1.0 + d3-geo: 1.12.1 dev: false - /@visactor/vgrammar-sankey/0.4.0: - resolution: {integrity: sha512-ycLe2avbV1uHVtd4fST2xmJyJ5I/dgjaBdfWRj0LGyW48ZYuOY9/G0n6P3SpFAl4aE9F+fnVCTrDKLkAnLtULg==} + /@visactor/vgrammar-sankey/0.4.1: + resolution: {integrity: sha512-7qHlZbUQLESJgP3/M81/PI9VgO3YLcDBNFi39/MobPQQJMKBFb+opCekDbHo69Bp1+9f7HRDXp0e3F84VlMljA==} dependencies: - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vrender': 0.13.1 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vrender': 0.13.2 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar-util/0.4.0: - resolution: {integrity: sha512-MKDc2baSAuOH2HVFt8BoBrQO7W5Qhux/qQfwXHR/Ng7zw2it1V2QxRqegyXtpj2WiDDHIlBrd+ew2NpitgsXdQ==} + /@visactor/vgrammar-util/0.4.1: + resolution: {integrity: sha512-yBAl+P20hik9Ek/MzwAqvf8LyVY5vvA135NWmXmMrmA/N3RXih2u4YS2f4Sc0CcDJMy6dKRd8lvP0TL3ov9SSg==} dependencies: '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar-wordcloud-shape/0.4.0: - resolution: {integrity: sha512-7+6TUzmOhp7PrmbRFetomeDEDXxm+3WDWVMzNPrj6Uvw8ZcXk4SCVO7msBksemJ3u40T8ugnptO3gufNMViOCg==} + /@visactor/vgrammar-wordcloud-shape/0.4.1: + resolution: {integrity: sha512-QIqQOThRVjabfxBc74r47SH+N201SoMafZ0+VB4/XcxgmcQZkJjmkG1cK+gboZ+nC36NbsZduAD/opiAx5xBqw==} dependencies: - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vrender': 0.13.1 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vrender': 0.13.2 '@visactor/vscale': 0.13.3 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar-wordcloud/0.4.0: - resolution: {integrity: sha512-XpjKQPlsxtUilg5apkvxXdngpU3Mrkeazax/nhIHU4fKpqB9l62YvJjzOlW48Fbz3yATQ3JGjlCFpdNwEk8dsA==} + /@visactor/vgrammar-wordcloud/0.4.1: + resolution: {integrity: sha512-AWVeb2veb05LLMwAaIAL8HXl9RMY8C9zANJBdrCuwmdZ61JM2YO61U1/Qmed2jkAvAdNQ5YjQD5Bhj8nVchzFw==} dependencies: - '@visactor/vgrammar': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vrender': 0.13.1 + '@visactor/vgrammar': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vrender': 0.13.2 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vgrammar/0.4.0: - resolution: {integrity: sha512-IV5JRBKCf4ebP8FyJ3E10xvoG7Ro5St9R7SJQqNugoDuyzVC7BBXbQoDDHmHq+SldhOfAc2qU+ZGme62WIi1Vg==} + /@visactor/vgrammar/0.4.1: + resolution: {integrity: sha512-qSmkwiVGLlg85en5EhJcdYeM0JYKsr+6KBxrs8Nm8tv9OhxB9fUuaMd9JwMfheu8EMam/xWPP/1TXjytgr3ihA==} dependencies: - '@visactor/vgrammar-coordinate': 0.4.0 - '@visactor/vgrammar-util': 0.4.0 - '@visactor/vrender': 0.13.1 - '@visactor/vrender-components': 0.13.1 + '@visactor/vgrammar-coordinate': 0.4.1 + '@visactor/vgrammar-util': 0.4.1 + '@visactor/vrender': 0.13.2 + '@visactor/vrender-components': 0.13.2 '@visactor/vscale': 0.13.3 '@visactor/vutils': 0.13.3 dev: false - /@visactor/vrender-components/0.13.1: - resolution: {integrity: sha512-r25hJ5WDyxeKM3z9crn/AjG5ypE/Q1xRlVyWxWCdygdFqrB0kLVt3t7VaIn28P5s0mETv6jwMsPPXoZ7IFhc/w==} + /@visactor/vrender-components/0.13.2: + resolution: {integrity: sha512-JzMoplrRNVLwVDKQjzb1BON8j3I3EC1+iimUlmX4vSbIamwy7ZARTQ+EsLgLBQ6MZXyqv4Kv915skSt41OD16Q==} dependencies: - '@visactor/vrender': 0.13.1 + '@visactor/vrender': 0.13.2 '@visactor/vscale': 0.13.3 '@visactor/vutils': 0.13.3 inversify: 6.0.1 dev: false - /@visactor/vrender/0.13.1: - resolution: {integrity: sha512-cdTHeRW9P6Iw4XlKsd/c0J+F8RaR4hK+kzEX/RZW5ga9li3H+DX9QT3ETEpAvK7sSKRK6MsD9rPzPp3vXoYV2w==} + /@visactor/vrender/0.13.2: + resolution: {integrity: sha512-wb/Gy1v8JL/SQhrNnKVDs9zTlYDyU42eLqWTONy7+1XNcnrI/s/vwaL7hq/XdBDwNnLcDzwsds/3clOdGbY2Yw==} dependencies: '@visactor/vutils': 0.13.3 color-convert: 2.0.1 @@ -5963,7 +5963,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001517 - electron-to-chromium: 1.4.466 + electron-to-chromium: 1.4.467 dev: true /browserslist/4.21.9: @@ -5972,7 +5972,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001517 - electron-to-chromium: 1.4.466 + electron-to-chromium: 1.4.467 node-releases: 2.0.13 update-browserslist-db: 1.0.11_browserslist@4.21.9 @@ -7358,11 +7358,16 @@ packages: es5-ext: 0.10.62 type: 1.2.0 + /d3-array/1.2.4: + resolution: {integrity: sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==} + dev: false + /d3-array/3.2.3: resolution: {integrity: sha512-JRHwbQQ84XuAESWhvIPaUV4/1UYTBOLiOPGWqgFDHZS1D5QN9c57FbH3QpEnQMYiOXNzKUQyGTZf+EVO7RT5TQ==} engines: {node: '>=12'} dependencies: internmap: 2.0.3 + dev: true /d3-dsv/3.0.1: resolution: {integrity: sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==} @@ -7373,11 +7378,18 @@ packages: iconv-lite: 0.6.3 rw: 1.3.3 + /d3-geo/1.12.1: + resolution: {integrity: sha512-XG4d1c/UJSEX9NfU02KwBL6BYPj8YKHxgBEw5om2ZnTRSbIcego6dhHwcxuSR3clxh0EpE38os1DVPOmnYtTPg==} + dependencies: + d3-array: 1.2.4 + dev: false + /d3-geo/3.1.0: resolution: {integrity: sha512-JEo5HxXDdDYXCaWdwLRt79y7giK8SbhZJbFWXqbRTolCHFI5jRqteLzCsq51NKbUoX0PjBVSohxrx+NoOUujYA==} engines: {node: '>=12'} dependencies: d3-array: 3.2.3 + dev: true /d3-hexbin/0.2.2: resolution: {integrity: sha512-KS3fUT2ReD4RlGCjvCEm1RgMtp2NFZumdMu4DBzQK8AZv3fXRM6Xm8I4fSU07UXvH4xxg03NwWKWdvxfS/yc4w==} @@ -8047,8 +8059,8 @@ packages: jake: 10.8.7 dev: true - /electron-to-chromium/1.4.466: - resolution: {integrity: sha512-TSkRvbXRXD8BwhcGlZXDsbI2lRoP8dvqR7LQnqQNk9KxXBc4tG8O+rTuXgTyIpEdiqSGKEBSqrxdqEntnjNncA==} + /electron-to-chromium/1.4.467: + resolution: {integrity: sha512-2qI70O+rR4poYeF2grcuS/bCps5KJh6y1jtZMDDEteyKJQrzLOEhFyXCLcHW6DTBjKjWkk26JhWoAi+Ux9A0fg==} /electron/11.5.0: resolution: {integrity: sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==} @@ -11293,6 +11305,7 @@ packages: /internmap/2.0.3: resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} engines: {node: '>=12'} + dev: true /interpret/1.4.0: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} @@ -11912,7 +11925,7 @@ packages: resolution: {integrity: sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA==} dependencies: node-fetch: 1.7.3 - whatwg-fetch: 3.6.16 + whatwg-fetch: 3.6.17 dev: true /isstream/0.1.2: @@ -20321,8 +20334,8 @@ packages: iconv-lite: 0.4.24 dev: true - /whatwg-fetch/3.6.16: - resolution: {integrity: sha512-83avoGbZ0qtjtNrU3UTT3/Xd3uZ7DyfSYLuc1fL5iYs+93P+UkIVF6/6xpRVWeQcvbc7kSnVybSAVbd6QFW5Fg==} + /whatwg-fetch/3.6.17: + resolution: {integrity: sha512-c4ghIvG6th0eudYwKZY5keb81wtFz9/WeAHAoy8+r18kcWlitUIrmGFQ2rWEl4UCKUilD3zCLHOIPheHx5ypRQ==} dev: true /whatwg-mimetype/2.3.0: diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 8dcf5767c9..63438bbc16 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -30,8 +30,8 @@ "dependencies": { "@visactor/vchart": "workspace:1.1.0-beta.8", "@visactor/vutils": "~0.13.3", - "@visactor/vgrammar": "~0.4.0", - "@visactor/vrender": "~0.13.0", + "@visactor/vgrammar": "~0.4.1", + "@visactor/vrender": "~0.13.2", "react-is": "^18.2.0" }, "devDependencies": { diff --git a/packages/vchart/__tests__/runtime/browser/test-page/axis-label-layout.ts b/packages/vchart/__tests__/runtime/browser/test-page/axis-label-layout.ts new file mode 100644 index 0000000000..138a447044 --- /dev/null +++ b/packages/vchart/__tests__/runtime/browser/test-page/axis-label-layout.ts @@ -0,0 +1,646 @@ +import { isMobile } from 'react-device-detect'; +import { default as VChart } from '../../../../src/index'; + +const run = () => { + const cs1 = new VChart( + { + type: 'bar', + data: [ + { + id: 'event_analysis_stack', + values: [ + { + x: '0', + y: 28, + c: 0 + }, + { + x: 0.5, + y: 20, + c: 1 + }, + { + x: 1, + y: 43, + c: 0 + }, + { + x: 1.5, + y: 35, + c: 1 + }, + { + x: 2, + y: 81, + c: 0 + }, + { + x: 2.5, + y: 10, + c: 1 + }, + { + x: 3, + y: 19, + c: 0 + }, + { + x: 3.5, + y: 15, + c: 1 + }, + { + x: 4, + y: 52, + c: 0 + }, + { + x: 4.5, + y: 48, + c: 1 + }, + { + x: 5, + y: 24, + c: 0 + }, + { + x: 5.5, + y: 28, + c: 1 + }, + { + x: 6, + y: 87, + c: 0 + }, + { + x: 6.5, + y: 66, + c: 1 + }, + { + x: 7, + y: 17, + c: 0 + }, + { + x: 7.5, + y: 27, + c: 1 + }, + { + x: 8, + y: 68, + c: 0 + }, + { + x: 8.5, + y: 16, + c: 1 + }, + { + x: 9, + y: 49, + c: 0 + }, + { + x: 9.5, + y: 25, + c: 1 + }, + { + x: 10, + y: 28, + c: 0 + }, + { + x: 10.5, + y: 20, + c: 1 + }, + { + x: 11, + y: 43, + c: 0 + }, + { + x: 11.5, + y: 35, + c: 1 + }, + { + x: 12, + y: 81, + c: 0 + }, + { + x: 12.5, + y: 10, + c: 1 + }, + { + x: 13, + y: 19, + c: 0 + }, + { + x: 13.5, + y: 15, + c: 1 + }, + { + x: 14, + y: 52, + c: 0 + }, + { + x: 14.5, + y: 48, + c: 1 + }, + { + x: 15, + y: 24, + c: 0 + }, + { + x: 15.5, + y: 28, + c: 1 + }, + { + x: 16, + y: 87, + c: 0 + }, + { + x: 16.5, + y: 66, + c: 1 + }, + { + x: 17, + y: 17, + c: 0 + }, + { + x: 17.5, + y: 27, + c: 1 + }, + { + x: 18, + y: 68, + c: 0 + }, + { + x: 18.5, + y: 16, + c: 1 + }, + { + x: 19, + y: 49, + c: 0 + }, + { + x: 19.5, + y: 25, + c: 1 + }, + { + x: 20, + y: 28, + c: 0 + }, + { + x: 20.5, + y: 20, + c: 1 + }, + { + x: 21, + y: 43, + c: 0 + }, + { + x: 21.5, + y: 35, + c: 1 + }, + { + x: 22, + y: 81, + c: 0 + }, + { + x: 22.5, + y: 10, + c: 1 + }, + { + x: 23, + y: 19, + c: 0 + }, + { + x: 23.5, + y: 15, + c: 1 + }, + { + x: 24, + y: 52, + c: 0 + }, + { + x: 24.5, + y: 48, + c: 1 + }, + { + x: 25, + y: 24, + c: 0 + }, + { + x: 25.5, + y: 28, + c: 1 + }, + { + x: 26, + y: 87, + c: 0 + }, + { + x: 26.5, + y: 66, + c: 1 + }, + { + x: 27, + y: 17, + c: 0 + }, + { + x: 27.5, + y: 27, + c: 1 + }, + { + x: 28, + y: 68, + c: 0 + }, + { + x: 28.5, + y: 16, + c: 1 + }, + { + x: 29, + y: 49, + c: 0 + }, + { + x: 29.5, + y: 25, + c: 1 + }, + { + x: 30, + y: 28, + c: 0 + }, + { + x: 30.5, + y: 20, + c: 1 + }, + { + x: 31, + y: 43, + c: 0 + }, + { + x: 31.5, + y: 35, + c: 1 + }, + { + x: 32, + y: 81, + c: 0 + }, + { + x: 32.5, + y: 10, + c: 1 + }, + { + x: 33, + y: 19, + c: 0 + }, + { + x: 33.5, + y: 15, + c: 1 + }, + { + x: 34, + y: 52, + c: 0 + }, + { + x: 34.5, + y: 48, + c: 1 + }, + { + x: 35, + y: 24, + c: 0 + }, + { + x: 35.5, + y: 28, + c: 1 + }, + { + x: 36, + y: 87, + c: 0 + }, + { + x: 36.5, + y: 66, + c: 1 + }, + { + x: 37, + y: 17, + c: 0 + }, + { + x: 37.5, + y: 27, + c: 1 + }, + { + x: 38, + y: 68, + c: 0 + }, + { + x: 38.5, + y: 16, + c: 1 + }, + { + x: 39, + y: 49, + c: 0 + }, + { + x: 39.5, + y: 25, + c: 1 + } + ] + } + ], + xField: 'x', + yField: 'y', + axes: [ + { + orient: 'bottom', + sampling: false, + label: { + minGap: 19, + autoRotate: true, + autoHide: true + } + } + ] + }, + { + dom: document.getElementById('chart') as HTMLElement, + mode: isMobile ? 'mobile-browser' : 'desktop-browser' + } + ); + cs1.renderAsync(); + + const cs2 = new VChart( + { + type: 'bar', + height: 200, + // width: 100, + // padding: 0, + data: [ + { + id: 'barData', + values: [ + { month: 'Monday', sales: 22 }, + { month: 'Tuesday', sales: 13 }, + { month: 'Wednesday', sales: 25 }, + { month: 'Thursday', sales: 29 }, + { month: 'Friday', sales: 38 } + ] + } + ], + xField: 'month', + yField: 'sales', + axes: [ + { + orient: 'bottom', + sampling: false, + label: { + autoRotate: true, + autoLimit: true, + autoHide: true + } + }, + { + orient: 'left', + sampling: false, + label: { + autoRotate: true, + autoLimit: true, + autoHide: true, + formatMethod: () => 'AAAAAAAAAAA', + flush: true + } + } + ] + }, + { + dom: document.getElementById('chart') as HTMLElement, + mode: isMobile ? 'mobile-browser' : 'desktop-browser' + } + ); + cs2.renderAsync(); + + const cs3 = new VChart( + { + type: 'bar', + height: 200, + data: [ + { + name: 'bar', + fields: { + y: { + alias: '出售数量' + } + }, + values: [ + { + x: '2021-12-21 2:00', + y: 82 + }, + { + x: '2021-12-21 4:00', + y: 50 + }, + { + x: '2021-12-21 6:00', + y: 64 + }, + { + x: '2021-12-21 8:00', + y: 30 + }, + { + x: '2021-12-21 10:00', + y: 40 + }, + { + x: '2021-12-21 12:00', + y: 40 + }, + { + x: '2021-12-21 14:00', + y: 56 + }, + { + x: '2021-12-21 16:00', + y: 40 + }, + { + x: '2021-12-21 18:00', + y: 64 + }, + { + x: '2021-12-21 20:00', + y: 74 + }, + { + x: '2021-12-21 22:00', + y: 98 + } + ] + } + ], + xField: 'x', + yField: 'y', + axes: [ + { + orient: 'bottom', + sampling: false, + label: { + autoHide: true + } + } + ] + }, + { + dom: document.getElementById('chart') as HTMLElement, + mode: isMobile ? 'mobile-browser' : 'desktop-browser' + } + ); + cs3.renderAsync(); + + const cs4 = new VChart( + { + type: 'line', + axes: [ + { + orient: 'left', + label: { + style: { + fontSize: 10, + fill: '#000000' + }, + autoLimit: true, + formatMethod: val => `+++++++++_${val}_+++++++++` + } + }, + { + orient: 'bottom', + label: { + space: 4, + style: { + fontSize: 12, + fill: '#000000' + }, + autoLimit: true, + autoHide: true, + autoRotate: true, + autoRotateAngle: [0, 30, 45], + formatMethod: val => `+++++++++_${val}_+++++++++` + } + } + ], + data: [ + { + id: 'line', + fields: { + y: { + alias: '最高气温' + } + }, + values: [ + { + x: '周一', + y: 12 + }, + { + x: '周二', + y: 13 + }, + { + x: '周三', + y: 11 + }, + { + x: '周四', + y: 10 + }, + { + x: '周五', + y: 12 + }, + { + x: '周六', + y: 14 + }, + { + x: '周日', + y: 17 + } + ] + } + ], + xField: 'x', + yField: 'y' + }, + { + dom: document.getElementById('chart') as HTMLElement, + mode: isMobile ? 'mobile-browser' : 'desktop-browser' + } + ); + cs4.renderAsync(); +}; +run(); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 1e871c972b..712927d5d8 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -105,20 +105,20 @@ }, "dependencies": { "@visactor/vutils": "~0.13.3", - "@visactor/vdataset": "~0.13.3", + "@visactor/vdataset": "~0.13.4", "@visactor/vscale": "~0.13.3", - "@visactor/vgrammar": "~0.4.0", - "@visactor/vgrammar-projection": "~0.4.0", - "@visactor/vgrammar-wordcloud": "~0.4.0", - "@visactor/vgrammar-wordcloud-shape": "~0.4.0", - "@visactor/vgrammar-hierarchy": "~0.4.0", - "@visactor/vgrammar-sankey": "~0.4.0", - "@visactor/vgrammar-util": "~0.4.0", - "@visactor/vrender": "~0.13.0", - "@visactor/vrender-components": "~0.13.0" + "@visactor/vgrammar": "~0.4.1", + "@visactor/vgrammar-projection": "~0.4.1", + "@visactor/vgrammar-wordcloud": "~0.4.1", + "@visactor/vgrammar-wordcloud-shape": "~0.4.1", + "@visactor/vgrammar-hierarchy": "~0.4.1", + "@visactor/vgrammar-sankey": "~0.4.1", + "@visactor/vgrammar-util": "~0.4.1", + "@visactor/vrender": "~0.13.2", + "@visactor/vrender-components": "~0.13.2" }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" } -} \ No newline at end of file +} diff --git a/packages/vchart/src/component/axis/base-axis.ts b/packages/vchart/src/component/axis/base-axis.ts index fa5cdb4208..d3c7d318ec 100644 --- a/packages/vchart/src/component/axis/base-axis.ts +++ b/packages/vchart/src/component/axis/base-axis.ts @@ -332,6 +332,7 @@ export abstract class AxisComponent extends BaseComponent implements IAxis { } return { + orient: this.orient, select: spec.select, hover: spec.hover, line: transformAxisLineStyle(spec.domainLine), @@ -351,7 +352,15 @@ export abstract class AxisComponent extends BaseComponent implements IAxis { return spec.label.formatMethod(datum.rawValue, datum); } : null, - state: transformStateStyle(spec.label.state) + state: transformStateStyle(spec.label.state), + autoRotate: !!spec.label.autoRotate, + autoHide: !!spec.label.autoHide, + autoLimit: !!spec.label.autoLimit, + autoRotateAngle: spec.label.autoRotateAngle, + autoHideMethod: spec.label.autoHideMethod, + autoHideSeparation: spec.label.autoHideSeparation, + limitEllipsis: spec.label.limitEllipsis, + layoutFunc: spec.label.layoutFunc }, tick: { visible: spec.tick.visible, diff --git a/packages/vchart/src/component/axis/cartesian/axis.ts b/packages/vchart/src/component/axis/cartesian/axis.ts index b948b6920d..d7343127c3 100644 --- a/packages/vchart/src/component/axis/cartesian/axis.ts +++ b/packages/vchart/src/component/axis/cartesian/axis.ts @@ -90,6 +90,7 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { private _axisStyle: Partial; private _latestBounds: IBounds; + private _verticalLimitSize: number; constructor(spec: ICartesianAxisCommonSpec, options: IComponentOption) { super(spec, { @@ -116,7 +117,6 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { if (isHorizontal && !isXAxis(spec.orient)) { inverse = isValid(spec.inverse) ? !spec.inverse : true; } - return new C( { ...spec, @@ -251,6 +251,15 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { setAttrFromSpec() { super.setAttrFromSpec(); + const isX = isXAxis(this.orient); + if (isX) { + if (isNil(this._spec.maxHeight)) { + this._spec.maxHeight = '30%'; + } + } else if (isNil(this._spec.maxWidth)) { + this._spec.maxWidth = '30%'; + } + const axisStyle: any = this._getAxisAttributes(); axisStyle.label.formatMethod = this.getLabelFormatMethod(); axisStyle.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1; @@ -288,6 +297,7 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { { type: 'ticks', options: { + sampling: this._spec.sampling !== false, // default do sampling tickCount: tick.tickCount, forceTickCount: tick.forceTickCount, tickStep: tick.tickStep, @@ -516,6 +526,7 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { if (!this._visible) { return result; } + this._verticalLimitSize = isXAxis(this.orient) ? rect.height : rect.width; this.setLayoutRect(rect); this.updateScaleRange(); @@ -669,7 +680,8 @@ export abstract class CartesianAxis extends AxisComponent implements IAxis { text: this._spec.title.text || this._dataFieldText, maxWidth: this._getTitleLimit(isX) }, - items: this.getLabelItems(axisLength) + items: this.getLabelItems(axisLength), + verticalLimitSize: this._verticalLimitSize }; return attrs; diff --git a/packages/vchart/src/component/axis/cartesian/interface/common.ts b/packages/vchart/src/component/axis/cartesian/interface/common.ts index 5c31b660ab..e6d05f577e 100644 --- a/packages/vchart/src/component/axis/cartesian/interface/common.ts +++ b/packages/vchart/src/component/axis/cartesian/interface/common.ts @@ -1,4 +1,4 @@ -import type { SegmentAttributes } from '@visactor/vrender-components'; +import type { SegmentAttributes, AxisLabelOverlap } from '@visactor/vrender-components'; import type { IBaseScale } from '@visactor/vscale'; import type { IAxis, IDomainLine, ILabel, ITitle } from '../../interface'; import type { StringOrNumber } from '../../../../typings'; @@ -60,17 +60,18 @@ export type ICartesianLabel = ILabel & { * @default false */ flush?: boolean; + // /** + // * 第一个坐标轴文字是否显示。默认根据标签重叠策略自动判定。 + // * @default null + // */ + // firstVisible?: boolean | null; /** - * 第一个坐标轴文字是否显示。默认根据标签重叠策略自动判定。 - * @default null - */ - firstVisible?: boolean | null; - /** + * `sampling` 开启时生效。 * 最后一个坐标轴文字是否显示。默认根据标签重叠策略自动判定。 * @default null */ lastVisible?: boolean | null; -}; +} & AxisLabelOverlap; export interface ILinearAxis extends IAxis { readonly zero: boolean; diff --git a/packages/vchart/src/component/axis/cartesian/interface/theme.ts b/packages/vchart/src/component/axis/cartesian/interface/theme.ts index 271e0cc779..0ebb3abf3f 100644 --- a/packages/vchart/src/component/axis/cartesian/interface/theme.ts +++ b/packages/vchart/src/component/axis/cartesian/interface/theme.ts @@ -1,3 +1,4 @@ +import type { ILayoutPaddingSpec, ILayoutNumber } from '../../../../model/interface'; import type { ITick, ILabel, IGrid } from '../../interface'; import type { ICartesianDomainLine, ICartesianTitle } from './common'; import type { ICartesianAxisCommonSpec } from './spec'; @@ -21,4 +22,18 @@ export interface ICartesianAxisCommonTheme { * 轴背景配置 */ background?: ICartesianAxisCommonSpec['background']; + /** 模块的布局间距 */ + padding?: ILayoutPaddingSpec; + /** 模块的布局大小:宽度 */ + width?: ILayoutNumber; + /** 模块的布局最大宽度 */ + maxWidth?: ILayoutNumber; + /** 模块的布局最小宽度 */ + minWidth?: ILayoutNumber; + /** 模块的布局大小:高度 */ + height?: ILayoutNumber; + /** 模块的布局最大高度 */ + maxHeight?: ILayoutNumber; + /** 模块的布局最小高度 */ + minHeight?: ILayoutNumber; } diff --git a/packages/vchart/src/component/axis/cartesian/time-axis.ts b/packages/vchart/src/component/axis/cartesian/time-axis.ts index 13869e77a9..f0a410df24 100644 --- a/packages/vchart/src/component/axis/cartesian/time-axis.ts +++ b/packages/vchart/src/component/axis/cartesian/time-axis.ts @@ -61,6 +61,7 @@ export class CartesianTimeAxis extends CartesianLinearAxis { { type: 'ticks', options: { + sampling: this._spec.sampling !== false, // default do sampling tickCount: this._spec.layers?.[1]?.tickCount, forceTickCount: this._spec.layers?.[1]?.forceTickCount, tickStep: this._spec.layers?.[1]?.tickStep, diff --git a/packages/vchart/src/component/axis/interface.ts b/packages/vchart/src/component/axis/interface.ts index 4846e39a99..7d499d5961 100644 --- a/packages/vchart/src/component/axis/interface.ts +++ b/packages/vchart/src/component/axis/interface.ts @@ -6,7 +6,7 @@ import type { IComponent } from '../interface'; import type { IBaseScale } from '@visactor/vscale'; import type { IModelSpec } from '../../model/interface'; import type { IAnimationSpec } from '../../animation/spec'; -import type { AxisItemStateStyle } from '@visactor/vrender-components'; +import type { AxisItem, AxisItemStateStyle } from '@visactor/vrender-components'; import type { ICompilableData } from '../../compile/data'; export type StatisticsDomain = { @@ -92,6 +92,14 @@ export type ICommonAxisSpec = { * @default false */ hover?: boolean; + + /** + * 是否开启轴数据采样,默认开启。 + * 轴采样开启之后,会对轴数据进行采样显示,防止轴数据的重叠。 + * 通过配置 `label.minGap` 可以控制轴标签之间的间距。 + * @default true + */ + sampling?: boolean; } & Omit & IAnimationSpec; @@ -216,6 +224,12 @@ export type ITick = IAxisItem & { * 4. selected_reverse */ state?: AxisItemStateStyle; + /** + * 用于 tick 的数据过滤 + * @param data + * @returns + */ + dataFilter?: (data: AxisItem[]) => AxisItem[]; }; // 子刻度线配置 @@ -258,11 +272,11 @@ export type ILabel = IAxisItem & { * @default false */ inside?: boolean; - // /** - // * TODO: 暂未支持 - // * 标签之间的最小间距(单位为像素) - // */ - // minGap?: number; + /** + * 标签之间的最小间距(单位为像素),仅当轴采样开始时生效(`sampling: true`)。 + * 该配置会影响轴采样的结果。 + */ + minGap?: number; /** * 文本样式设置 */ @@ -275,6 +289,13 @@ export type ILabel = IAxisItem & { * 4. selected_reverse */ state?: AxisItemStateStyle; + /** + * 用于 label 的数据过滤 + * @param data + * @param layer + * @returns + */ + dataFilter?: (data: AxisItem[], layer: number) => AxisItem[]; }; // 轴线配置 diff --git a/packages/vchart/src/component/axis/polar/axis.ts b/packages/vchart/src/component/axis/polar/axis.ts index 57b4cd433e..d7b03e69b5 100644 --- a/packages/vchart/src/component/axis/polar/axis.ts +++ b/packages/vchart/src/component/axis/polar/axis.ts @@ -204,6 +204,7 @@ export abstract class PolarAxis extends AxisComponent implements IPolarAxis { { type: 'ticks', options: { + sampling: this._spec.sampling !== false, // default do sampling tickCount: tick.tickCount, forceTickCount: tick.forceTickCount, tickStep: tick.tickStep, diff --git a/packages/vchart/src/data/transforms/tick-data/continuous.ts b/packages/vchart/src/data/transforms/tick-data/continuous.ts index a7f83ce7a9..95a8c67176 100644 --- a/packages/vchart/src/data/transforms/tick-data/continuous.ts +++ b/packages/vchart/src/data/transforms/tick-data/continuous.ts @@ -32,32 +32,35 @@ export const continuousTicks = (scale: ContinuousScale, op: ITickDataOpt): ITick scaleTicks = (scale as LinearScale).ticks(tickCount ?? DEFAULT_CONTINUOUS_TICK_COUNT); } - // 判断重叠 - if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) { - const { labelGap = 4, labelFlush } = op as ICartesianTickDataOpt; - let items = getCartesianLabelBounds(scale, scaleTicks, op as ICartesianTickDataOpt).map( - (bounds, i) => - ({ - AABBBounds: bounds, - value: scaleTicks[i] - } as ILabelItem) - ); - while (items.length >= 3 && hasOverlap(items, labelGap)) { - items = methods.parity(items); - } - const ticks = items.map(item => item.value); - - if (ticks.length < 3 && labelFlush) { - if (ticks.length > 1) { - ticks.pop(); + if (op.sampling) { + // 判断重叠 + if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) { + const { labelGap = 4, labelFlush } = op as ICartesianTickDataOpt; + let items = getCartesianLabelBounds(scale, scaleTicks, op as ICartesianTickDataOpt).map( + (bounds, i) => + ({ + AABBBounds: bounds, + value: scaleTicks[i] + } as ILabelItem) + ); + while (items.length >= 3 && hasOverlap(items, labelGap)) { + items = methods.parity(items); } - if (peek(ticks) !== peek(scaleTicks)) { - ticks.push(peek(scaleTicks)); + const ticks = items.map(item => item.value); + + if (ticks.length < 3 && labelFlush) { + if (ticks.length > 1) { + ticks.pop(); + } + if (peek(ticks) !== peek(scaleTicks)) { + ticks.push(peek(scaleTicks)); + } } - } - scaleTicks = ticks; + scaleTicks = ticks; + } } + return convertDomainToTickData(scaleTicks, op); }; diff --git a/packages/vchart/src/data/transforms/tick-data/discrete/linear.ts b/packages/vchart/src/data/transforms/tick-data/discrete/linear.ts index 051963a12c..f071a0f09e 100644 --- a/packages/vchart/src/data/transforms/tick-data/discrete/linear.ts +++ b/packages/vchart/src/data/transforms/tick-data/discrete/linear.ts @@ -26,7 +26,7 @@ export const linearDiscreteTicks = (scale: BandScale, op: ICartesianTickDataOpt) scaleTicks = scale.forceTicks(forceTickCount); } else if (isValid(tickCount)) { scaleTicks = scale.ticks(tickCount); - } else { + } else if (op.sampling) { const domain = scale.domain(); const range = scale.range(); @@ -53,6 +53,8 @@ export const linearDiscreteTicks = (scale: BandScale, op: ICartesianTickDataOpt) scaleTicks = scaleTicks.slice(0, scaleTicks.length - result.delCount); scaleTicks.push(domain[domain.length - 1]); } + } else { + scaleTicks = scale.domain(); } return convertDomainToTickData(scaleTicks, op); diff --git a/packages/vchart/src/data/transforms/tick-data/discrete/polar-angle.ts b/packages/vchart/src/data/transforms/tick-data/discrete/polar-angle.ts index 025c2ce13e..ab612b9996 100644 --- a/packages/vchart/src/data/transforms/tick-data/discrete/polar-angle.ts +++ b/packages/vchart/src/data/transforms/tick-data/discrete/polar-angle.ts @@ -29,7 +29,7 @@ export const polarAngleAxisDiscreteTicks = (scale: BandScale, op: IPolarTickData scaleTicks = scale.forceTicks(forceTickCount); } else if (isValid(tickCount)) { scaleTicks = scale.ticks(tickCount); - } else { + } else if (op.sampling) { const domain = scale.domain(); const range = scale.range(); @@ -54,6 +54,8 @@ export const polarAngleAxisDiscreteTicks = (scale: BandScale, op: IPolarTickData scaleTicks = (scale as BandScale).stepTicks(step); scaleTicks = scaleTicks.slice(0, scaleTicks.length - delCount); + } else { + scaleTicks = scale.domain(); } return convertDomainToTickData(scaleTicks, op); diff --git a/packages/vchart/src/data/transforms/tick-data/interface.ts b/packages/vchart/src/data/transforms/tick-data/interface.ts index 43f5493690..4a88f30442 100644 --- a/packages/vchart/src/data/transforms/tick-data/interface.ts +++ b/packages/vchart/src/data/transforms/tick-data/interface.ts @@ -2,6 +2,10 @@ import type { IPolarAxisSpec } from '../../../component/axis/polar/interface'; import type { CoordinateType, IOrientType, IPolarOrientType, ITextMarkSpec } from '../../../typings'; export interface ITickDataOpt { + /** + * 是否进行轴采样 + */ + sampling?: boolean; tickCount?: number; forceTickCount?: number; tickStep?: number; @@ -30,5 +34,5 @@ export interface IPolarTickDataOpt extends ITickDataOpt { export interface ITickData { index: number; value: number | string; - label: string; + // label: string; } diff --git a/packages/vchart/src/data/transforms/tick-data/util.ts b/packages/vchart/src/data/transforms/tick-data/util.ts index 120eb0e82b..0af0a0e418 100644 --- a/packages/vchart/src/data/transforms/tick-data/util.ts +++ b/packages/vchart/src/data/transforms/tick-data/util.ts @@ -12,8 +12,8 @@ export const convertDomainToTickData = (domain: any[], op: ITickDataOpt): ITickD const ticks = domain.map((t: number, index: number) => { return { index, - value: t, - label: op.labelFormatter ? op.labelFormatter(t) : `${t}` + value: t + // label: op.labelFormatter ? op.labelFormatter(t) : `${t}` }; }); return ticks; diff --git a/packages/vchart/src/theme/buildin-theme/light/component/axis/cartesian-axis.ts b/packages/vchart/src/theme/buildin-theme/light/component/axis/cartesian-axis.ts index 7d14e9f2b0..db3122bde2 100644 --- a/packages/vchart/src/theme/buildin-theme/light/component/axis/cartesian-axis.ts +++ b/packages/vchart/src/theme/buildin-theme/light/component/axis/cartesian-axis.ts @@ -6,7 +6,8 @@ export const axisX: ICartesianAxisCommonTheme = { }, title: { space: 10 - } + }, + maxHeight: '30%' }; export const axisY: ICartesianAxisCommonTheme = { @@ -16,5 +17,6 @@ export const axisY: ICartesianAxisCommonTheme = { title: { space: 20, autoRotate: true - } + }, + maxWidth: '30%' }; diff --git a/packages/vchart/src/theme/buildin-theme/light/component/data-zoom.ts b/packages/vchart/src/theme/buildin-theme/light/component/data-zoom.ts index 168ce55c91..d98a3b873a 100644 --- a/packages/vchart/src/theme/buildin-theme/light/component/data-zoom.ts +++ b/packages/vchart/src/theme/buildin-theme/light/component/data-zoom.ts @@ -81,7 +81,7 @@ export const dataZoom: IDataZoomTheme = { backgroundChart: { area: { style: { - lineWidth: 1, + stroke: false, fill: '#CACFD7' } }, @@ -95,7 +95,7 @@ export const dataZoom: IDataZoomTheme = { selectedBackgroundChart: { area: { style: { - lineWidth: 1, + stroke: false, fill: '#CACFD7' } },