diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5d891a697..5f133ebb1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -59,7 +59,7 @@ body: 2. What's the spec of view 3. User interactions before the error happens. validations: - required: true + required: false - type: textarea attributes: diff --git a/.github/ISSUE_TEMPLATE/feaure_request.yml b/.github/ISSUE_TEMPLATE/feaure_request.yml index 9e813f554..1b8f9c2e1 100644 --- a/.github/ISSUE_TEMPLATE/feaure_request.yml +++ b/.github/ISSUE_TEMPLATE/feaure_request.yml @@ -35,4 +35,4 @@ body: description: Describe how you propose to solve the problem and provide code samples of how the API would work once implemented. Note that you can use [Markdown](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to format your code blocks. validations: - required: true + required: false diff --git a/.gitignore b/.gitignore index 39ebf0155..ac936b9eb 100644 --- a/.gitignore +++ b/.gitignore @@ -115,4 +115,6 @@ common/scripts/pre-commit docs/site/examples/**.js docs/site/tutorials/**.js -docs/site/api/**.js \ No newline at end of file +docs/site/api/**.js +docs/site/examples/preview-image +docs/site/examples/preview-fail.json diff --git a/README.md b/README.md index 24eb9eb19..b492663ac 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ VGrammar, not only generate charts, but also provide data visualization tools. Cross-Platform
-![image test](https://github.com/visactor/vchart/actions/workflows/bug-server.yml/badge.svg) -![unit test](https://github.com/visactor/vchart/actions/workflows/unit-test.yml/badge.svg) +![image test](https://github.com/visactor/vchart/actions/workflows/bug-server.yml/badge.svg?event=push) +![unit test](https://github.com/visactor/vchart/actions/workflows/unit-test.yml/badge.svg?event=push) [![npm Version](https://img.shields.io/npm/v/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) [![npm Download](https://img.shields.io/npm/dm/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vgrammar/blob/main/LICENSE) @@ -74,120 +74,80 @@ yarn add @visactor/vgrammar import { View } from '@visactor/vgrammar'; const spec = { - padding: { top: 5, right: 5, bottom: 30, left: 60 }, data: [ { id: 'table', values: [ { - name: 'A', - value: 214480 + value: 3676, + name: ' ~ 29' }, { - name: 'B', - value: 155506 + value: 3872, + name: '30 ~ 39' }, { - name: 'C', - value: 100764 + value: 1668, + name: '40 ~ 49' }, { - name: 'D', - value: 92715 + value: 610, + name: '50 ~' + } + ] + }, + { + id: 'pie', + source: 'table', + transform: [ + { + type: 'pie', + field: 'value', + asStartAngle: 'startAngle', + asEndAngle: 'endAngle' } ] } ], + scales: [ { - id: 'xscale', - type: 'band', + id: 'colorScale', + type: 'ordinal', domain: { data: 'table', field: 'name' }, - dependency: ['viewBox'], - range: (scale, params) => { - return [params.viewBox.x1, params.viewBox.x2]; - }, - padding: 0.05, - round: true - }, - { - id: 'yscale', - type: 'linear', - domain: { data: 'table', field: 'value' }, - dependency: ['viewBox'], - range: (scale, params) => { - return [params.viewBox.y2, params.viewBox.y1]; - }, - nice: true + range: [ + '#6690F2', + '#70D6A3', + '#B4E6E2', + '#63B5FC', + '#FF8F62', + '#FFDC83', + '#BCC5FD', + '#A29BFE', + '#63C4C7', + '#F68484' + ] } ], marks: [ { - type: 'component', - componentType: 'axis', - scale: 'xscale', - tickCount: -1, - dependency: ['viewBox'], - encode: { - update: (scale, elment, params) => { - return { - x: params.viewBox.x1, - y: params.viewBox.y2, - start: { x: 0, y: 0 }, - end: { x: params.viewBox.width(), y: 0 } - }; - } - } - }, - { - type: 'component', - componentType: 'axis', - scale: 'yscale', - dependency: ['viewBox'], - encode: { - update: (scale, elment, params) => { - return { - x: params.viewBox.x1, - y: params.viewBox.y1, - start: { x: 0, y: params.viewBox.height() }, - end: { x: 0, y: 0 }, - verticalFactor: -1 - }; - } - } - }, - { - type: 'component', - componentType: 'crosshair', - scale: 'xscale', - crosshairShape: 'rect', - crosshairType: 'x', - dependency: ['viewBox'], + type: 'arc', + from: { data: 'pie' }, + dependency: ['viewBox', 'colorScale'], encode: { - update: (scale, elment, params) => { + update: (datum, element, params) => { + const viewBox = params.viewBox; + const maxR = Math.min(viewBox.width() / 2, viewBox.height() / 2); return { - start: { y: params.viewBox.y1 }, - rectStyle: { height: params.viewBox.height() } + x: viewBox.x1 + viewBox.width() / 2, + y: viewBox.y1 + viewBox.height() / 2, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + innerRadius: 100, + outerRadius: maxR, + fill: params.colorScale.scale(datum.name) }; - } - } - }, - { - type: 'rect', - from: { data: 'table' }, - encode: { - update: { - x: { scale: 'xscale', field: 'name' }, - width: { scale: 'xscale', band: 1 }, - y: { scale: 'yscale', field: 'value' }, - y1: { - callback: (datum, element, params) => { - return params.yscale.scale(params.yscale.domain()[0]); - }, - dependency: ['yscale'] - }, - fill: '#6690F2' }, hover: { fill: 'red' @@ -199,8 +159,6 @@ const spec = { const vGrammarView = new View({ autoFit: true, - width: spec.width, - height: spec.height, container: 'chart', hover: true }); diff --git a/README.zh-CN.md b/README.zh-CN.md index a6986f30f..552dbdba5 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -20,6 +20,8 @@ VGrammar,不只是生成万千图表的可视化语法,更是化枯燥为神 跨端 +![image test](https://github.com/visactor/vchart/actions/workflows/bug-server.yml/badge.svg?event=push) +![unit test](https://github.com/visactor/vchart/actions/workflows/unit-test.yml/badge.svg?event=push) [![npm Version](https://img.shields.io/npm/v/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) [![npm Download](https://img.shields.io/npm/dm/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vgrammar/blob/main/LICENSE) @@ -69,136 +71,100 @@ yarn add @visactor/vgrammar ## 快速上手 ```javascript +import { View } from '@visactor/vgrammar'; + const spec = { - type: 'common', - data: { - values: [ - { - time: '2:00', - value: 8, - type: '抖音' - }, - { - time: '4:00', - value: 9, - type: '抖音' - }, - { - time: '6:00', - value: 11, - type: '抖音' - }, - { - time: '8:00', - value: 14, - type: '抖音' - }, - { - time: '10:00', - value: 16, - type: '抖音' - }, - { - time: '12:00', - value: 17, - type: '抖音' - }, - { - time: '14:00', - value: 17, - type: '抖音' - }, - { - time: '16:00', - value: 16, - type: '抖音' - }, - { - time: '18:00', - value: 15, - type: '抖音' - }, - - { - time: '2:00', - value: 7, - type: 'B站' - }, - { - time: '4:00', - value: 8, - type: 'B站' - }, - { - time: '6:00', - value: 9, - type: 'B站' - }, - { - time: '8:00', - value: 10, - type: 'B站' - }, - { - time: '10:00', - value: 9, - type: 'B站' - }, - { - time: '12:00', - value: 12, - type: 'B站' - }, - { - time: '14:00', - value: 14, - type: 'B站' - }, - { - time: '16:00', - value: 12, - type: 'B站' - }, - { - time: '18:00', - value: 14, - type: 'B站' - } - ] - }, - color: ['#6690F2', '#70D6A3'], - series: [ + data: [ + { + id: 'table', + values: [ + { + value: 3676, + name: ' ~ 29' + }, + { + value: 3872, + name: '30 ~ 39' + }, + { + value: 1668, + name: '40 ~ 49' + }, + { + value: 610, + name: '50 ~' + } + ] + }, { - type: 'bar', - xField: 'time', - yField: 'value', - stack: true, - seriesField: 'type' + id: 'pie', + source: 'table', + transform: [ + { + type: 'pie', + field: 'value', + asStartAngle: 'startAngle', + asEndAngle: 'endAngle' + } + ] } ], - legends: { - visible: true, - orient: 'right' - }, - axes: [ + + scales: [ { - orient: 'bottom', - type: 'band' - }, + id: 'colorScale', + type: 'ordinal', + domain: { data: 'table', field: 'name' }, + range: [ + '#6690F2', + '#70D6A3', + '#B4E6E2', + '#63B5FC', + '#FF8F62', + '#FFDC83', + '#BCC5FD', + '#A29BFE', + '#63C4C7', + '#F68484' + ] + } + ], + + marks: [ { - orient: 'left', - type: 'linear' + type: 'arc', + from: { data: 'pie' }, + dependency: ['viewBox', 'colorScale'], + encode: { + update: (datum, element, params) => { + const viewBox = params.viewBox; + const maxR = Math.min(viewBox.width() / 2, viewBox.height() / 2); + return { + x: viewBox.x1 + viewBox.width() / 2, + y: viewBox.y1 + viewBox.height() / 2, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + innerRadius: 100, + outerRadius: maxR, + fill: params.colorScale.scale(datum.name) + }; + }, + hover: { + fill: 'red' + } + } } ] }; -/** - * 图表容器 dom id: CHART_CONTAINER_DOM_ID - * ChartSpace 类: ChartSpace - * - */ -const chartSpace = new ChartSpace(spec, { dom: CHART_CONTAINER_DOM_ID }); -await chartSpace.renderAsync(); +const vGrammarView = new View({ + autoFit: true, + container: 'chart', + hover: true +}); +vGrammarView.parseSpec(spec); + +vGrammarView.runAsync(); ``` ## diff --git a/common/autoinstallers/lint/commitlint.config.js b/common/autoinstallers/lint/commitlint.config.js index cfade48be..0b66d7686 100644 --- a/common/autoinstallers/lint/commitlint.config.js +++ b/common/autoinstallers/lint/commitlint.config.js @@ -1,6 +1,7 @@ module.exports = { extends: ['@commitlint/config-conventional'], rules: { + 'header-min-length': [2, 'always', 16], 'not-allowed-chars': [2, 'always'] }, plugins: [ diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4d984a7b2..6af0b1bfd 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9,13 +9,13 @@ importers: specifiers: '@internal/eslint-config': workspace:* '@internal/ts-config': workspace:* - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-hierarchy': workspace:0.3.1 - '@visactor/vgrammar-projection': workspace:0.3.1 - '@visactor/vgrammar-sankey': workspace:0.3.1 - '@visactor/vgrammar-wordcloud': workspace:0.3.1 - '@visactor/vgrammar-wordcloud-shape': workspace:0.3.1 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-hierarchy': workspace:0.3.2 + '@visactor/vgrammar-projection': workspace:0.3.2 + '@visactor/vgrammar-sankey': workspace:0.3.2 + '@visactor/vgrammar-wordcloud': workspace:0.3.2 + '@visactor/vgrammar-wordcloud-shape': workspace:0.3.2 + '@visactor/vrender': ~0.12.0 '@visactor/vutils': ~0.11.1 d3-scale-chromatic: ^3.0.0 lodash: 4.17.21 @@ -30,7 +30,7 @@ importers: '@visactor/vgrammar-sankey': link:../../packages/vgrammar-sankey '@visactor/vgrammar-wordcloud': link:../../packages/vgrammar-wordcloud '@visactor/vgrammar-wordcloud-shape': link:../../packages/vgrammar-wordcloud-shape - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vutils': 0.11.1 d3-scale-chromatic: 3.0.0 lodash: 4.17.21 @@ -41,15 +41,16 @@ importers: specifiers: '@internal/eslint-config': workspace:* '@internal/ts-config': workspace:* - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-hierarchy': workspace:0.3.1 - '@visactor/vgrammar-projection': workspace:0.3.1 - '@visactor/vgrammar-sankey': workspace:0.3.1 - '@visactor/vgrammar-wordcloud': workspace:0.3.1 - '@visactor/vgrammar-wordcloud-shape': workspace:0.3.1 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-hierarchy': workspace:0.3.2 + '@visactor/vgrammar-projection': workspace:0.3.2 + '@visactor/vgrammar-sankey': workspace:0.3.2 + '@visactor/vgrammar-wordcloud': workspace:0.3.2 + '@visactor/vgrammar-wordcloud-shape': workspace:0.3.2 + '@visactor/vrender': ~0.12.0 '@visactor/vutils': ~0.11.1 axios: ^1.4.0 + canvas: ^2.11.2 d3-scale-chromatic: ^3.0.0 lodash: 4.17.21 markdown-it: 13.0.1 @@ -65,9 +66,10 @@ importers: '@visactor/vgrammar-sankey': link:../../packages/vgrammar-sankey '@visactor/vgrammar-wordcloud': link:../../packages/vgrammar-wordcloud '@visactor/vgrammar-wordcloud-shape': link:../../packages/vgrammar-wordcloud-shape - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vutils': 0.11.1 axios: 1.4.0 + canvas: 2.11.2 d3-scale-chromatic: 3.0.0 lodash: 4.17.21 markdown-it: 13.0.1 @@ -85,10 +87,10 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar-coordinate': workspace:0.3.0 - '@visactor/vgrammar-util': workspace:0.3.0 - '@visactor/vrender': ~0.11.1 - '@visactor/vrender-components': ~0.11.1 + '@visactor/vgrammar-coordinate': workspace:0.3.1 + '@visactor/vgrammar-util': workspace:0.3.1 + '@visactor/vrender': ~0.12.0 + '@visactor/vrender-components': ~0.12.0 '@visactor/vscale': ~0.11.1 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 @@ -101,8 +103,8 @@ importers: dependencies: '@visactor/vgrammar-coordinate': link:../vgrammar-coordinate '@visactor/vgrammar-util': link:../vgrammar-util - '@visactor/vrender': 0.11.1 - '@visactor/vrender-components': 0.11.1 + '@visactor/vrender': 0.12.0 + '@visactor/vrender-components': 0.12.0 '@visactor/vscale': 0.11.1 '@visactor/vutils': 0.11.1 devDependencies: @@ -132,7 +134,7 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar-util': workspace:0.3.0 + '@visactor/vgrammar-util': workspace:0.3.1 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 jest: ~29.5.0 @@ -167,9 +169,9 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-util': workspace:0.3.0 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-util': workspace:0.3.1 + '@visactor/vrender': ~0.12.0 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 jest: ~29.5.0 @@ -179,7 +181,7 @@ importers: dependencies: '@visactor/vgrammar': link:../vgrammar '@visactor/vgrammar-util': link:../vgrammar-util - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vutils': 0.11.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -207,8 +209,8 @@ importers: '@types/d3-geo': ^1.11.1 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-util': workspace:0.3.0 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-util': workspace:0.3.1 '@visactor/vutils': ~0.11.1 d3-geo: ^1.11.6 eslint: ~8.18.0 @@ -247,9 +249,9 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-util': workspace:0.3.0 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-util': workspace:0.3.1 + '@visactor/vrender': ~0.12.0 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 jest: ~29.5.0 @@ -259,7 +261,7 @@ importers: dependencies: '@visactor/vgrammar': link:../vgrammar '@visactor/vgrammar-util': link:../vgrammar-util - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vutils': 0.11.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -319,9 +321,9 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-util': workspace:0.3.0 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-util': workspace:0.3.1 + '@visactor/vrender': ~0.12.0 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 jest: ~29.5.0 @@ -331,7 +333,7 @@ importers: dependencies: '@visactor/vgrammar': link:../vgrammar '@visactor/vgrammar-util': link:../vgrammar-util - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vutils': 0.11.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -358,9 +360,9 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ~29.5.0 '@types/node': '*' - '@visactor/vgrammar': workspace:0.3.1 - '@visactor/vgrammar-util': workspace:0.3.0 - '@visactor/vrender': ~0.11.1 + '@visactor/vgrammar': workspace:0.3.2 + '@visactor/vgrammar-util': workspace:0.3.1 + '@visactor/vrender': ~0.12.0 '@visactor/vscale': ~0.11.1 '@visactor/vutils': ~0.11.1 eslint: ~8.18.0 @@ -371,7 +373,7 @@ importers: dependencies: '@visactor/vgrammar': link:../vgrammar '@visactor/vgrammar-util': link:../vgrammar-util - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vscale': 0.11.1 '@visactor/vutils': 0.11.1 devDependencies: @@ -2192,6 +2194,24 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true + /@mapbox/node-pre-gyp/1.0.10: + resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==} + hasBin: true + dependencies: + detect-libc: 2.0.1 + https-proxy-agent: 5.0.1 + make-dir: 3.1.0 + node-fetch: 2.6.7 + nopt: 5.0.0 + npmlog: 5.0.1 + rimraf: 3.0.2 + semver: 7.5.1 + tar: 6.1.15 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + /@nodelib/fs.scandir/2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2778,17 +2798,17 @@ packages: eslint-visitor-keys: 3.4.1 dev: false - /@visactor/vrender-components/0.11.1: - resolution: {integrity: sha512-ecfrTrH5zv6LjMgBCuvx+oqPQL42avFGuI9axKkZ+syOiV0dXCUiS7k4P1d9g7j7kpJGrHBttKu0OJJrVh5y+A==} + /@visactor/vrender-components/0.12.0: + resolution: {integrity: sha512-0sKsiCVEjrjWIhDA6uEVAvOxiQQQ0boMJgKjJhvVM4TdKlhk6RUtAtsl2B9y1j7+F1WU9xgI2+OT8XLv7yh3Ig==} dependencies: - '@visactor/vrender': 0.11.1 + '@visactor/vrender': 0.12.0 '@visactor/vscale': 0.11.1 '@visactor/vutils': 0.11.1 gl-matrix: 3.4.3 dev: false - /@visactor/vrender/0.11.1: - resolution: {integrity: sha512-EcCO/z7jtwC8WPHq+b2VQ052tHgUSprjiTYBSntVe2j4wC9dTxAJoQ4+Zyyx2HZmt2024W+ljwknynQ2LShIlQ==} + /@visactor/vrender/0.12.0: + resolution: {integrity: sha512-3LZCs4jW80xRC49zXZCH1uMHa/2HGzNJF20QYvQLwHN1YoZ0VdrOb/kgDldOKvto6iQuEOhw3ovbWKlh7ne1vA==} dependencies: '@visactor/vutils': 0.11.1 color-convert: 2.0.1 @@ -2847,6 +2867,10 @@ packages: pretty-format: 27.5.1 dev: true + /abbrev/1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + dev: true + /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2870,6 +2894,15 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + /agent-base/6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -2968,10 +3001,22 @@ packages: buffer-equal: 1.0.1 dev: false + /aproba/2.0.0: + resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} + dev: true + /archy/1.0.0: resolution: {integrity: sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==} dev: false + /are-we-there-yet/2.0.0: + resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} + engines: {node: '>=10'} + dependencies: + delegates: 1.0.0 + readable-stream: 3.6.2 + dev: true + /arg/4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} dev: true @@ -3455,6 +3500,19 @@ packages: /caniuse-lite/1.0.30001495: resolution: {integrity: sha512-F6x5IEuigtUfU5ZMQK2jsy5JqUUlEFRVZq8bO2a+ysq5K7jD6PPc9YXZj78xDNS3uNchesp1Jw47YXEqr+Viyg==} + /canvas/2.11.2: + resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} + engines: {node: '>=6'} + requiresBuild: true + dependencies: + '@mapbox/node-pre-gyp': 1.0.10 + nan: 2.17.0 + simple-get: 3.1.1 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + /chai/4.3.7: resolution: {integrity: sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==} engines: {node: '>=4'} @@ -3525,6 +3583,11 @@ packages: fsevents: 2.3.2 dev: true + /chownr/2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + dev: true + /ci-info/3.8.0: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} @@ -3643,7 +3706,6 @@ packages: /color-support/1.1.3: resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} hasBin: true - dev: false /combined-stream/1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} @@ -3690,6 +3752,10 @@ packages: well-known-symbols: 2.0.0 dev: true + /console-control-strings/1.1.0: + resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} + dev: true + /convert-source-map/1.9.0: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} @@ -3827,6 +3893,13 @@ packages: engines: {node: '>=0.10'} dev: false + /decompress-response/4.2.1: + resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==} + engines: {node: '>=8'} + dependencies: + mimic-response: 2.1.0 + dev: true + /dedent/0.7.0: resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} @@ -3891,11 +3964,20 @@ packages: engines: {node: '>=0.4.0'} dev: true + /delegates/1.0.0: + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} + dev: true + /detect-file/1.0.0: resolution: {integrity: sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==} engines: {node: '>=0.10.0'} dev: false + /detect-libc/2.0.1: + resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==} + engines: {node: '>=8'} + dev: true + /detect-newline/2.1.0: resolution: {integrity: sha512-CwffZFvlJffUg9zZA0uqrjQayUTC8ob94pnr5sFwaVv3IOmkfUHcWH+jXaQK3askE51Cqe8/9Ql/0uXNwqZ8Zg==} engines: {node: '>=0.10.0'} @@ -4850,6 +4932,13 @@ packages: universalify: 2.0.0 dev: false + /fs-minipass/2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.3.6 + dev: true + /fs-mkdirp-stream/1.0.0: resolution: {integrity: sha512-+vSd9frUnapVC2RZYfL3FCB2p3g4TBhaUmrsWlSudsGdnxIuUvBB2QM1VZeBtc49QFwrp+wQLrDs3+xxDgI5gQ==} engines: {node: '>= 0.10'} @@ -4900,6 +4989,21 @@ packages: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: false + /gauge/3.0.2: + resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} + engines: {node: '>=10'} + dependencies: + aproba: 2.0.0 + color-support: 1.1.3 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wide-align: 1.1.5 + dev: true + /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -5230,6 +5334,10 @@ packages: has-symbols: 1.0.3 dev: false + /has-unicode/2.0.1: + resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} + dev: true + /has-value/0.3.1: resolution: {integrity: sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q==} engines: {node: '>=0.10.0'} @@ -5290,6 +5398,16 @@ packages: entities: 2.2.0 dev: true + /https-proxy-agent/5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /human-signals/2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} @@ -6635,6 +6753,11 @@ packages: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} + /mimic-response/2.1.0: + resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==} + engines: {node: '>=8'} + dev: true + /minimatch/3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -6647,6 +6770,26 @@ packages: brace-expansion: 2.0.1 dev: false + /minipass/3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} + engines: {node: '>=8'} + dependencies: + yallist: 4.0.0 + dev: true + + /minipass/5.0.0: + resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} + engines: {node: '>=8'} + dev: true + + /minizlib/2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.3.6 + yallist: 4.0.0 + dev: true + /mixin-deep/1.3.2: resolution: {integrity: sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==} engines: {node: '>=0.10.0'} @@ -6655,6 +6798,12 @@ packages: is-extendable: 1.0.1 dev: false + /mkdirp/1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + dev: true + /mlly/1.3.0: resolution: {integrity: sha512-HT5mcgIQKkOrZecOjOX3DJorTikWXwsBfpcr/MGBkhfWcjiqvnaL/9ppxvIUXfjT6xt4DVIAsN9fMUz1ev4bIw==} dependencies: @@ -6682,8 +6831,6 @@ packages: /nan/2.17.0: resolution: {integrity: sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==} requiresBuild: true - dev: false - optional: true /nanoid/3.3.6: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} @@ -6743,6 +6890,14 @@ packages: /node-releases/2.0.12: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} + /nopt/5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: true + /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -6781,6 +6936,15 @@ packages: dependencies: path-key: 3.1.1 + /npmlog/5.0.1: + resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} + dependencies: + are-we-there-yet: 2.0.0 + console-control-strings: 1.1.0 + gauge: 3.0.2 + set-blocking: 2.0.0 + dev: true + /number-is-nan/1.0.1: resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} engines: {node: '>=0.10.0'} @@ -6789,7 +6953,6 @@ packages: /object-assign/4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - dev: false /object-copy/0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} @@ -7303,7 +7466,6 @@ packages: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 - dev: false /readdirp/2.2.1: resolution: {integrity: sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==} @@ -7567,7 +7729,6 @@ packages: /safe-buffer/5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - dev: false /safe-regex-test/1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} @@ -7628,7 +7789,6 @@ packages: /set-blocking/2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} - dev: false /set-value/2.0.1: resolution: {integrity: sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==} @@ -7665,6 +7825,18 @@ packages: /signal-exit/3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + /simple-concat/1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + dev: true + + /simple-get/3.1.1: + resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==} + dependencies: + decompress-response: 4.2.1 + once: 1.4.0 + simple-concat: 1.0.1 + dev: true + /sisteransi/1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -7907,7 +8079,6 @@ packages: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 - dev: false /strip-ansi/3.0.1: resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} @@ -7981,6 +8152,18 @@ packages: es6-symbol: 3.1.3 dev: false + /tar/6.1.15: + resolution: {integrity: sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==} + engines: {node: '>=10'} + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + dev: true + /ternary-stream/3.0.0: resolution: {integrity: sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==} dependencies: @@ -8382,7 +8565,6 @@ packages: /util-deprecate/1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: false /v8-compile-cache-lib/3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} @@ -8737,6 +8919,12 @@ packages: stackback: 0.0.2 dev: true + /wide-align/1.1.5: + resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} + dependencies: + string-width: 4.2.3 + dev: true + /word-wrap/1.2.3: resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} engines: {node: '>=0.10.0'} diff --git a/docs/dev-demos/package.json b/docs/dev-demos/package.json index 8e19b6819..08c43ba90 100644 --- a/docs/dev-demos/package.json +++ b/docs/dev-demos/package.json @@ -12,14 +12,14 @@ "devDependencies": { "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", - "@visactor/vgrammar": "workspace:0.3.1", - "@visactor/vgrammar-hierarchy": "workspace:0.3.1", - "@visactor/vgrammar-sankey": "workspace:0.3.1", - "@visactor/vgrammar-projection": "workspace:0.3.1", - "@visactor/vgrammar-wordcloud": "workspace:0.3.1", - "@visactor/vgrammar-wordcloud-shape": "workspace:0.3.1", + "@visactor/vgrammar": "workspace:0.3.2", + "@visactor/vgrammar-hierarchy": "workspace:0.3.2", + "@visactor/vgrammar-sankey": "workspace:0.3.2", + "@visactor/vgrammar-projection": "workspace:0.3.2", + "@visactor/vgrammar-wordcloud": "workspace:0.3.2", + "@visactor/vgrammar-wordcloud-shape": "workspace:0.3.2", "@visactor/vutils": "~0.11.1", - "@visactor/vrender": "~0.11.1", + "@visactor/vrender": "~0.12.0", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", "typescript": "4.9.5", diff --git a/docs/site/examples/3d-mark/arc3d.md b/docs/site/examples/3d-mark/arc3d.md index fb0823121..5b2bae4aa 100644 --- a/docs/site/examples/3d-mark/arc3d.md +++ b/docs/site/examples/3d-mark/arc3d.md @@ -2,7 +2,8 @@ category: examples group: 3d-mark title: 3d arc 图元 -cover: +order: 40-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/3d-mark-arc3d.png --- # 3d arc 图元 diff --git a/docs/site/examples/3d-mark/pyramid3d.md b/docs/site/examples/3d-mark/pyramid3d.md index 712242346..c2f46535b 100644 --- a/docs/site/examples/3d-mark/pyramid3d.md +++ b/docs/site/examples/3d-mark/pyramid3d.md @@ -2,7 +2,8 @@ category: examples group: 3d-mark title: pyramid3d 图元 -cover: +order: 40-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/3d-mark-pyramid3d.png --- # pyramid3d 图元 diff --git a/docs/site/examples/3d-mark/rect3d.md b/docs/site/examples/3d-mark/rect3d.md index 7ece29288..0a8e7e793 100644 --- a/docs/site/examples/3d-mark/rect3d.md +++ b/docs/site/examples/3d-mark/rect3d.md @@ -2,7 +2,8 @@ category: examples group: 3d-mark title: rect3d 图元 -cover: +order: 40-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/3d-mark-rect3d.png --- # rect3d 图元 @@ -133,7 +134,7 @@ const spec = { mode: '3d', componentType: 'axis', scale: 'xscale', - tickCount: -1, + // tickCount: -1, dependency: ['viewBox'], encode: { update: (scale, elment, params) => { @@ -174,7 +175,6 @@ const spec = { width: { scale: 'xscale', band: 1 }, y: { scale: 'yscale', field: 'value' }, y1: (datum, element, params) => { - console.log(params.yscale.domain()); return params.yscale.scale(params.yscale.domain()[0]); }, z: 0, diff --git a/docs/site/examples/animate/arrange-animate.md b/docs/site/examples/animate/arrange-animate.md index b27fa1152..b1ba54cc2 100644 --- a/docs/site/examples/animate/arrange-animate.md +++ b/docs/site/examples/animate/arrange-animate.md @@ -2,7 +2,8 @@ category: examples group: animate title: 动画编排 -cover: +order: 60-4 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-arrange-animate.gif --- # 动画编排 diff --git a/docs/site/examples/animate/basic-animate.md b/docs/site/examples/animate/basic-animate.md index 47e1753a9..c188bf175 100644 --- a/docs/site/examples/animate/basic-animate.md +++ b/docs/site/examples/animate/basic-animate.md @@ -2,7 +2,8 @@ category: examples group: animate title: 基础动画 -cover: +order: 60-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-basic-animate.gif --- # 基础动画 diff --git a/docs/site/examples/animate/custom-animate.md b/docs/site/examples/animate/custom-animate.md index 91537ab16..51db72c4e 100644 --- a/docs/site/examples/animate/custom-animate.md +++ b/docs/site/examples/animate/custom-animate.md @@ -2,7 +2,8 @@ category: examples group: animate title: 自定义动画 -cover: +order: 60-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-custom-animate.gif --- # 自定义动画 diff --git a/docs/site/examples/animate/loop-animate.md b/docs/site/examples/animate/loop-animate.md index 2b7970f2a..c456950c8 100644 --- a/docs/site/examples/animate/loop-animate.md +++ b/docs/site/examples/animate/loop-animate.md @@ -2,7 +2,8 @@ category: examples group: animate title: 循环动画 -cover: +order: 60-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-loop-animate.gif --- # 循环动画 diff --git a/docs/site/examples/animate/morph-animate.md b/docs/site/examples/animate/morph-animate.md index 4854a905b..4bfb6a0cb 100644 --- a/docs/site/examples/animate/morph-animate.md +++ b/docs/site/examples/animate/morph-animate.md @@ -2,7 +2,8 @@ category: examples group: animate title: morph 动画 -cover: +order: 60-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-morph-animate.gif --- # morph 动画 diff --git a/docs/site/examples/animate/timeline.md b/docs/site/examples/animate/timeline.md new file mode 100644 index 000000000..c06b363e9 --- /dev/null +++ b/docs/site/examples/animate/timeline.md @@ -0,0 +1,290 @@ +--- +category: examples +group: animate +title: 事件轴&动画 +order: 60-5 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/animate-basic-animate.gif +--- + +# 基础动画 + +基础动画示例,所有图元都可以配置入场/出场/更新动画 + +## 代码演示 + +```javascript livedemo template=vgrammar +VGrammar.registerGlyph('event', { + label: 'text', + event: 'text', + dot: 'symbol', + line: 'rule' +}) + .registerChannelEncoder('x', (channel, encodeValue) => { + return { + label: { x: encodeValue }, + event: { x: encodeValue }, + dot: { x: encodeValue }, + line: { x: encodeValue, x1: encodeValue } + }; + }) + .registerChannelEncoder('color', (channel, encodeValue) => { + return { + event: { fill: encodeValue }, + dot: { fill: encodeValue } + }; + }) + .registerChannelEncoder('y0', (channel, encodeValue) => { + return { + label: { y: encodeValue }, + line: { y1: encodeValue } + }; + }) + .registerChannelEncoder('y1', (channel, encodeValue) => { + return { + event: { y: encodeValue - 20 }, + dot: { y: encodeValue - 5 }, + line: { y: encodeValue } + }; + }) + .registerChannelEncoder('label', (channel, encodeValue) => { + return { + label: { text: encodeValue } + }; + }) + .registerChannelEncoder('event', (channel, encodeValue) => { + return { + event: { text: encodeValue } + }; + }) + .registerDefaultEncoder(() => { + return { + label: { + textAlign: 'center', + textBaseline: 'top', + // fontFamily: '行楷-简', + fontSize: 12, + fontStyle: 'normal', + lineHeight: 24, + fillOpacity: 0.6, + fill: '#fff' + }, + event: { textAlign: 'center', fontFamily: '行楷-简', fontSize: 20, fontStyle: 'bold', lineHeight: 16 }, + dot: { shape: 'circle', size: 10, fillOpacity: 0.5 }, + line: { lineWidth: 1, strokeOpacity: 0.3, stroke: '#fff' } + }; + }); + +const spec = { + padding: { top: 0, right: 0, bottom: 60, left: 0 }, + background: 'black', + + data: [ + { + id: 'source', + values: [ + { year: '2014-8', event: '订阅号创建', name: '玄魂', node: 'node' }, + { year: '2015', event: '沉寂', name: '玄魂', node: 'node' }, + { year: '2016-4', event: '暗网系列', name: '玄魂', node: 'node' }, + { year: '2016-5', event: 'kali Linux 系列', name: '玄魂', node: 'node1' }, + { year: '2016-6', event: '黑客编程系列', name: '玄魂', node: 'node' }, + { year: '2016-7', event: '如何学习 Python 系列', name: '玄魂', node: 'node' }, + { year: '2016-8', event: `启动'每周1书'赠送计划`, name: '玄魂', node: 'node' }, + { year: '2018-3', event: '如何学 Python 新番', name: '初音', node: 'node' }, + { year: '2018-4', event: 'linux 基础系列', name: '初音', node: 'node' }, + { year: '2018-5', event: 'CTF 实战系列', name: '初音', node: 'node1' }, + { year: '2018-7', event: 'Kali Linux Web渗透测试手册(第二版) 翻译系列', name: '掣雷小组', node: 'node1' }, + { year: '2019-8', event: 'CVE 漏洞系列', name: 'power7089', node: 'node1' }, + { year: '2020-5', event: '磐石计划 ', name: '陈殷', node: 'node1' }, + { year: '2020-12', event: '移动端逆向系列 ', name: 'WhITECat安全团队', node: 'node1' }, + { year: '2021-8', event: '炼石计划', name: 'power7089', node: 'node1' }, + { year: '2023-7', event: '玄魂工作室正式告别', name: '玄魂', node: 'node1' } + ] + }, + { + id: 'table', + source: 'source', + transform: [ + { + type: 'map', + all: true, + callback: data => { + return data.map((entry, index, arr) => { + return { + ...entry, + index, + group: index < arr.length / 2 ? 0 : 1 + }; + }); + } + } + ] + } + ], + + scales: [ + { + id: 'xscale', + type: 'band', + domain: { data: 'table', field: 'year' }, + dependency: ['viewBox'], + range: (scale, params) => { + const minWidth = params.table.length * 200; + const width = params.viewBox.width(); + + return [params.viewBox.x1, width < minWidth ? params.viewBox.x1 + minWidth : params.viewBox.x2]; + }, + + padding: 0, + round: true + }, + { + id: 'color', + type: 'ordinal', + domain: { data: 'table', field: 'year' }, + range: [ + '#5383F4', + '#7BCF8E', + '#FF9D2C', + '#FFDB26', + '#7568D9', + '#80D8FB', + '#1857A3', + '#CAB0E8', + '#FF8867', + '#B9E493', + '#2CB4A8', + '#B9E4E3' + ] + } + ], + + marks: [ + { + type: 'rule', + dependency: ['width', 'viewBox', 'color'], + encode: { + update: (datum, el, params) => { + const xScale = params.xscale; + const viewBox = params.viewBox; + + return { + x: 0, + y: viewBox.y2, + y1: viewBox.y2, + x1: params.width, + lineWidth: 1, + strokeOpacity: 0.3, + stroke: '#fff' + }; + } + } + }, + { + type: 'glyph', + glyphType: 'event', + from: { data: 'table' }, + animation: { + enter: [ + { + loop: true, + duration: 10000, + easing: 'linear', + channel: { + dx: { + from: (datum, element, params) => { + return 0; + }, + to: (datum, element, params) => { + console.log(params, datum, element); + const xScale = params.view.getScaleById('xscale').output(); + const bandWidth = xScale.bandwidth(); + const range = xScale.range(); + return -Math.abs(range[1] - range[0]); + } + } + } + } + ] + }, + dependency: ['xscale', 'viewBox', 'color'], + encode: { + update: (datum, el, params) => { + const xScale = params.xscale; + const viewBox = params.viewBox; + const x = xScale.scale(datum.year) + 0.5 * xScale.bandwidth(); + const offset = datum.index % 2 ? 40 : -40; + + return { + x: x, + y1: (viewBox.y1 + viewBox.y2) / 2 + offset, + y0: viewBox.y2, + color: params.color.scale(datum.year), + label: datum.year, + event: [datum.event, datum.name] + }; + } + } + }, + { + type: 'glyph', + glyphType: 'event', + from: { data: 'table' }, + animation: { + enter: [ + { + loop: true, + duration: 10000, + easing: 'linear', + channel: { + dx: { + from: (datum, element, params) => { + const xScale = params.view.getScaleById('xscale').output(); + const bandWidth = xScale.bandwidth(); + const range = xScale.range(); + return Math.abs(range[1] - range[0]); + }, + to: (datum, element, params) => { + return 0; + } + } + } + } + ] + }, + dependency: ['xscale', 'viewBox', 'color'], + encode: { + update: (datum, el, params) => { + const xScale = params.xscale; + const viewBox = params.viewBox; + const x = xScale.scale(datum.year) + 0.5 * xScale.bandwidth(); + const offset = datum.index % 2 ? 40 : -40; + + return { + x: x, + y1: (viewBox.y1 + viewBox.y2) / 2 + offset, + y0: viewBox.y2, + color: params.color.scale(datum.year), + label: datum.year, + event: [datum.event, datum.name] + }; + } + } + } + ] +}; + +const vGrammarView = new View({ + autoFit: true, + // autoFit: true, + container: document.getElementById(CONTAINER_ID), + hover: true +}); +vGrammarView.parseSpec(spec); + +vGrammarView.runAsync(); + +// 只为了方便控制太调试用,不要拷贝 +window.vGrammarView = vGrammarView; +``` + +## 相关教程 diff --git a/docs/site/examples/basic-mark-arc/basic-arc.md b/docs/site/examples/basic-mark-arc/basic-arc.md index 9bb545431..21b58e148 100644 --- a/docs/site/examples/basic-mark-arc/basic-arc.md +++ b/docs/site/examples/basic-mark-arc/basic-arc.md @@ -1,8 +1,9 @@ --- category: examples group: basic-mark-arc -title: 饼图 -cover: +title: 环图 +order: 3-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-arc-basic-arc.png --- # 饼图 diff --git a/docs/site/examples/basic-mark-arc/progress-arc.md b/docs/site/examples/basic-mark-arc/progress-arc.md index 8653821d2..719e6e52a 100644 --- a/docs/site/examples/basic-mark-arc/progress-arc.md +++ b/docs/site/examples/basic-mark-arc/progress-arc.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-arc title: 进度条 -cover: +order: 3-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-arc-progress-arc.png --- # 进度条 diff --git a/docs/site/examples/basic-mark-arc/radial-arc.md b/docs/site/examples/basic-mark-arc/radial-arc.md index d11036f96..b6b35c49e 100644 --- a/docs/site/examples/basic-mark-arc/radial-arc.md +++ b/docs/site/examples/basic-mark-arc/radial-arc.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-arc title: 玉玦图 -cover: +order: 3-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-arc-radial-arc.png --- # 玉玦图 diff --git a/docs/site/examples/basic-mark-arc/simple-pie.md b/docs/site/examples/basic-mark-arc/simple-pie.md new file mode 100644 index 000000000..6a49d9464 --- /dev/null +++ b/docs/site/examples/basic-mark-arc/simple-pie.md @@ -0,0 +1,111 @@ +--- +category: examples +group: basic-mark-arc +title: 饼图 +cover: +--- + +# 饼图 + +## 代码演示 + +```javascript livedemo template=vgrammar +const spec = { + data: [ + { + id: 'table', + values: [ + { + value: 3676, + name: ' ~ 29' + }, + { + value: 3872, + name: '30 ~ 39' + }, + { + value: 1668, + name: '40 ~ 49' + }, + { + value: 610, + name: '50 ~' + } + ] + }, + { + id: 'pie', + source: 'table', + transform: [ + { + type: 'pie', + field: 'value', + asStartAngle: 'startAngle', + asEndAngle: 'endAngle' + } + ] + } + ], + + scales: [ + { + id: 'colorScale', + type: 'ordinal', + domain: { data: 'table', field: 'name' }, + range: [ + '#6690F2', + '#70D6A3', + '#B4E6E2', + '#63B5FC', + '#FF8F62', + '#FFDC83', + '#BCC5FD', + '#A29BFE', + '#63C4C7', + '#F68484' + ] + } + ], + + marks: [ + { + type: 'arc', + from: { data: 'pie' }, + dependency: ['viewBox', 'angleScale', 'colorScale'], + encode: { + update: (datum, element, params) => { + const viewBox = params.viewBox; + const maxR = Math.min(viewBox.width() / 2, viewBox.height() / 2); + + return { + x: viewBox.x1 + viewBox.width() / 2, + y: viewBox.y1 + viewBox.height() / 2, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + innerRadius: 100, + outerRadius: maxR, + fill: params.colorScale.scale(datum.name) + }; + }, + hover: { + fill: 'red' + } + } + } + ] +}; + +const vGrammarView = new View({ + autoFit: true, + container: document.getElementById(CONTAINER_ID), + hover: true +}); +vGrammarView.parseSpec(spec); + +vGrammarView.runAsync(); + +// 只为了方便控制太调试用,不要拷贝 +window.vGrammarView = vGrammarView; +``` + +## 相关教程 diff --git a/docs/site/examples/basic-mark-area/basic-area.md b/docs/site/examples/basic-mark-area/basic-area.md index 324933cbf..1e2630e38 100644 --- a/docs/site/examples/basic-mark-area/basic-area.md +++ b/docs/site/examples/basic-mark-area/basic-area.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-area title: 基础面积图 -cover: +order: 2-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-area-basic-area.png --- # 基础面积图 diff --git a/docs/site/examples/basic-mark-area/percent-area.md b/docs/site/examples/basic-mark-area/percent-area.md index 67af74e44..7aa06c3f5 100644 --- a/docs/site/examples/basic-mark-area/percent-area.md +++ b/docs/site/examples/basic-mark-area/percent-area.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-area title: 百分比面积图 -cover: +order: 2-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-area-percent-area.png --- # 百分比面积图 diff --git a/docs/site/examples/basic-mark-area/stack-area.md b/docs/site/examples/basic-mark-area/stack-area.md index fbdb31605..82d2a9284 100644 --- a/docs/site/examples/basic-mark-area/stack-area.md +++ b/docs/site/examples/basic-mark-area/stack-area.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-area title: 堆积面积图 -cover: +order: 2-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-area-stack-area.png --- # 堆积面积图 diff --git a/docs/site/examples/basic-mark-area/vertical-area.md b/docs/site/examples/basic-mark-area/vertical-area.md index 7ff75266e..dcdafe208 100644 --- a/docs/site/examples/basic-mark-area/vertical-area.md +++ b/docs/site/examples/basic-mark-area/vertical-area.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-area title: 纵向面积图 -cover: +order: 2-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-area-vertical-area.png --- # 纵向面积图 diff --git a/docs/site/examples/basic-mark-circle/relation-circle.md b/docs/site/examples/basic-mark-circle/relation-circle.md index c4f18cc06..cb4daebf0 100644 --- a/docs/site/examples/basic-mark-circle/relation-circle.md +++ b/docs/site/examples/basic-mark-circle/relation-circle.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-circle title: 相关性图表 -cover: +order: 6-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-circle-relation-circle.png --- # 相关性图表 @@ -154,8 +155,6 @@ const spec = { const cx = viewBox.x1 + viewBox.width() / 2; const cy = viewBox.y1 + viewBox.height() / 2; - console.log(datum, element); - return { x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle), diff --git a/docs/site/examples/basic-mark-image/basic-image.md b/docs/site/examples/basic-mark-image/basic-image.md index 5608703ea..f7a9175da 100644 --- a/docs/site/examples/basic-mark-image/basic-image.md +++ b/docs/site/examples/basic-mark-image/basic-image.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-image title: 图像图元 -cover: +order: 9-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-image-basic-image.png --- # 图像图元 diff --git a/docs/site/examples/basic-mark-line/basic-line.md b/docs/site/examples/basic-mark-line/basic-line.md index a361c7408..f4ee5e124 100644 --- a/docs/site/examples/basic-mark-line/basic-line.md +++ b/docs/site/examples/basic-mark-line/basic-line.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-line title: 基础线图 -cover: +order: 1-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-line-basic-line.png --- # 基础线图 diff --git a/docs/site/examples/basic-mark-line/log-line.md b/docs/site/examples/basic-mark-line/log-line.md index 6be614cfc..b4e73320e 100644 --- a/docs/site/examples/basic-mark-line/log-line.md +++ b/docs/site/examples/basic-mark-line/log-line.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-line title: log轴线图 -cover: +order: 1-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-line-log-line.png --- # log 轴线图 diff --git a/docs/site/examples/basic-mark-line/segmental-line.md b/docs/site/examples/basic-mark-line/segmental-line.md index b54543095..c50933628 100644 --- a/docs/site/examples/basic-mark-line/segmental-line.md +++ b/docs/site/examples/basic-mark-line/segmental-line.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-line title: 分段曲线 -cover: +order: 1-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-line-segmental-line.png --- # 分段曲线 diff --git a/docs/site/examples/basic-mark-line/spiral.md b/docs/site/examples/basic-mark-line/spiral.md index f56717a7f..80491f7ca 100644 --- a/docs/site/examples/basic-mark-line/spiral.md +++ b/docs/site/examples/basic-mark-line/spiral.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-line title: 阿基米德螺线 -cover: +order: 1-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-line-spiral.png --- # 阿基米德螺线 diff --git a/docs/site/examples/basic-mark-polygon/basic-polygon.md b/docs/site/examples/basic-mark-polygon/basic-polygon.md index 57919a885..4f8627ac7 100644 --- a/docs/site/examples/basic-mark-polygon/basic-polygon.md +++ b/docs/site/examples/basic-mark-polygon/basic-polygon.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-polygon title: 漏斗图 -cover: +order: 5-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-polygon-basic-polygon.png --- # 漏斗图 diff --git a/docs/site/examples/basic-mark-polygon/flow-funnel.md b/docs/site/examples/basic-mark-polygon/flow-funnel.md index afe11b55e..a400f8310 100644 --- a/docs/site/examples/basic-mark-polygon/flow-funnel.md +++ b/docs/site/examples/basic-mark-polygon/flow-funnel.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-polygon title: 转化漏斗图 -cover: +order: 5-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-polygon-flow-funnel.png --- # 转化漏斗图 diff --git a/docs/site/examples/basic-mark-polygon/polygon-intersect.md b/docs/site/examples/basic-mark-polygon/polygon-intersect.md index e6fe52811..4b067c61b 100644 --- a/docs/site/examples/basic-mark-polygon/polygon-intersect.md +++ b/docs/site/examples/basic-mark-polygon/polygon-intersect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-polygon title: 多边形交集 -cover: +order: 5-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-polygon-polygon-intersect.png --- # 多边形交集 diff --git a/docs/site/examples/basic-mark-rect/api-rect.md b/docs/site/examples/basic-mark-rect/api-rect.md index 3476d7e0e..813989422 100644 --- a/docs/site/examples/basic-mark-rect/api-rect.md +++ b/docs/site/examples/basic-mark-rect/api-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: API模式创建柱图 -cover: +order: 0-6 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-api-rect.png --- # API 模式创建柱图 diff --git a/docs/site/examples/basic-mark-rect/basic-rect.md b/docs/site/examples/basic-mark-rect/basic-rect.md index b4c4557b0..9814aee9f 100644 --- a/docs/site/examples/basic-mark-rect/basic-rect.md +++ b/docs/site/examples/basic-mark-rect/basic-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 基础柱图 -cover: +order: 0-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-basic-rect.png --- # 基础柱图 diff --git a/docs/site/examples/basic-mark-rect/bi-direction-rect.md b/docs/site/examples/basic-mark-rect/bi-direction-rect.md index 5738245c8..33e947b00 100644 --- a/docs/site/examples/basic-mark-rect/bi-direction-rect.md +++ b/docs/site/examples/basic-mark-rect/bi-direction-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 双向条形图 -cover: +order: 0-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-bi-direction-rect.png --- # 双向条形图 diff --git a/docs/site/examples/basic-mark-rect/customized-shape.md b/docs/site/examples/basic-mark-rect/customized-shape.md index 2ae0aed80..d11402ba5 100644 --- a/docs/site/examples/basic-mark-rect/customized-shape.md +++ b/docs/site/examples/basic-mark-rect/customized-shape.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 柱图自定义图形 -cover: +order: 0-5 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-customized-shape.png --- # 柱图自定义图形 diff --git a/docs/site/examples/basic-mark-rect/percent-rect.md b/docs/site/examples/basic-mark-rect/percent-rect.md index 984fc1074..b2e0a5d87 100644 --- a/docs/site/examples/basic-mark-rect/percent-rect.md +++ b/docs/site/examples/basic-mark-rect/percent-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 百分比堆积柱图 -cover: +order: 0-4 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-percent-rect.png --- # 百分比堆积柱图 diff --git a/docs/site/examples/basic-mark-rect/range-rect.md b/docs/site/examples/basic-mark-rect/range-rect.md index eea0968f5..fc84cde76 100644 --- a/docs/site/examples/basic-mark-rect/range-rect.md +++ b/docs/site/examples/basic-mark-rect/range-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 区间柱图 -cover: +order: 0-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-range-rect.png --- # 区间柱图 diff --git a/docs/site/examples/basic-mark-rect/stack-rect.md b/docs/site/examples/basic-mark-rect/stack-rect.md index 5a9e310dd..b0921a2fb 100644 --- a/docs/site/examples/basic-mark-rect/stack-rect.md +++ b/docs/site/examples/basic-mark-rect/stack-rect.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rect title: 堆积柱图 -cover: +order: 0-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rect-stack-rect.png --- # 堆积柱图 @@ -342,7 +343,6 @@ const spec = { { key: '总计', value: (datum, element, params) => { - console.log(datum); return datum.sum; }, symbol: (datum, element, params) => { diff --git a/docs/site/examples/basic-mark-richtext/basic-richtext.md b/docs/site/examples/basic-mark-richtext/basic-richtext.md index e35eec1b6..be4eb541a 100644 --- a/docs/site/examples/basic-mark-richtext/basic-richtext.md +++ b/docs/site/examples/basic-mark-richtext/basic-richtext.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-richtext title: richtext基础使用 -cover: +order: 8-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-richtext-basic-richtext.png --- # richtext 基础使用 diff --git a/docs/site/examples/basic-mark-rule/basic-rule.md b/docs/site/examples/basic-mark-rule/basic-rule.md index 6c08e9ed8..1cd4e9919 100644 --- a/docs/site/examples/basic-mark-rule/basic-rule.md +++ b/docs/site/examples/basic-mark-rule/basic-rule.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rule title: rule基础使用 -cover: +order: 4-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rule-basic-rule.png --- # rule 基础使用 diff --git a/docs/site/examples/basic-mark-rule/rule-symbol.md b/docs/site/examples/basic-mark-rule/rule-symbol.md index 95b912a7a..651724b4f 100644 --- a/docs/site/examples/basic-mark-rule/rule-symbol.md +++ b/docs/site/examples/basic-mark-rule/rule-symbol.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-rule title: rule图形展示 -cover: +order: 4-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-rule-rule-symbol.png --- # rule 图形展示 diff --git a/docs/site/examples/basic-mark-symbol/basic-symbol.md b/docs/site/examples/basic-mark-symbol/basic-symbol.md index f8d0e31e8..d6e982f12 100644 --- a/docs/site/examples/basic-mark-symbol/basic-symbol.md +++ b/docs/site/examples/basic-mark-symbol/basic-symbol.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-symbol title: 基础散点图 -cover: +order: 3-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-symbol-basic-symbol.png --- # 基础散点图 diff --git a/docs/site/examples/basic-mark-symbol/bubble.md b/docs/site/examples/basic-mark-symbol/bubble.md index 30dbe3122..bb1024808 100644 --- a/docs/site/examples/basic-mark-symbol/bubble.md +++ b/docs/site/examples/basic-mark-symbol/bubble.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-symbol title: 气泡图 -cover: +order: 3-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-symbol-bubble.png --- # 气泡图 diff --git a/docs/site/examples/basic-mark-text/basic-text.md b/docs/site/examples/basic-mark-text/basic-text.md index f0be114a8..7d5032047 100644 --- a/docs/site/examples/basic-mark-text/basic-text.md +++ b/docs/site/examples/basic-mark-text/basic-text.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-text title: text 图元基础用法 -cover: +order: 7-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/basic-mark-text-basic-text.png --- # text 图元基础用法 diff --git a/docs/site/examples/component/dataZoom.md b/docs/site/examples/component/dataZoom.md index c7a915e26..a9be5acea 100644 --- a/docs/site/examples/component/dataZoom.md +++ b/docs/site/examples/component/dataZoom.md @@ -2,7 +2,8 @@ category: examples group: component title: 大数据量线图 -cover: +order: 50-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/component-dataZoom.png --- # 大数据量线图 diff --git a/docs/site/examples/component/label.md b/docs/site/examples/component/label.md index b1063641b..edac18eb0 100644 --- a/docs/site/examples/component/label.md +++ b/docs/site/examples/component/label.md @@ -2,7 +2,8 @@ category: examples group: component title: 柱图标签 -cover: +order: 50-4 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/component-label.png --- # 柱图标签 diff --git a/docs/site/examples/component/legend.md b/docs/site/examples/component/legend.md index d86199ec7..913dcdda9 100644 --- a/docs/site/examples/component/legend.md +++ b/docs/site/examples/component/legend.md @@ -2,7 +2,8 @@ category: examples group: component title: legend -cover: +order: 50-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/component-legend.png --- # legend diff --git a/docs/site/examples/component/player.md b/docs/site/examples/component/player.md index 62afec772..270d65ced 100644 --- a/docs/site/examples/component/player.md +++ b/docs/site/examples/component/player.md @@ -2,7 +2,8 @@ category: examples group: component title: 播放器 -cover: +order: 50-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/component-player.png --- # 播放器 @@ -76,7 +77,6 @@ const xAxis = vGrammarView .tickCount(-1) .depend(['viewBox']) .encode((scale, elment, params) => { - console.log('xAxis', params.viewBox); return { x: 0, y: params.viewBox.height(), diff --git a/docs/site/examples/component/slider.md b/docs/site/examples/component/slider.md index 3ef1a8a90..dd8edf82b 100644 --- a/docs/site/examples/component/slider.md +++ b/docs/site/examples/component/slider.md @@ -2,7 +2,8 @@ category: examples group: basic-mark-symbol title: 基础散点图 -cover: +order: 50-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/component-slider.png --- # 基础散点图 diff --git a/docs/site/examples/glyph-mark-boxplot/bar-boxplot.md b/docs/site/examples/glyph-mark/bar-boxplot.md similarity index 97% rename from docs/site/examples/glyph-mark-boxplot/bar-boxplot.md rename to docs/site/examples/glyph-mark/bar-boxplot.md index 786add30f..ecc096b81 100644 --- a/docs/site/examples/glyph-mark-boxplot/bar-boxplot.md +++ b/docs/site/examples/glyph-mark/bar-boxplot.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-boxplot +group: glyph-mark title: 条状箱线图 -cover: +order: 30-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-bar-boxplot.png --- # 条状箱线图 diff --git a/docs/site/examples/glyph-mark-boxplot/boxplot.md b/docs/site/examples/glyph-mark/boxplot.md similarity index 97% rename from docs/site/examples/glyph-mark-boxplot/boxplot.md rename to docs/site/examples/glyph-mark/boxplot.md index 074917d4c..ef616c877 100644 --- a/docs/site/examples/glyph-mark-boxplot/boxplot.md +++ b/docs/site/examples/glyph-mark/boxplot.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-boxplot +group: glyph-mark title: 箱线图 -cover: +order: 30-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-boxplot.png --- # 箱线图 diff --git a/docs/site/examples/glyph-mark-custom/candle.md b/docs/site/examples/glyph-mark/candle.md similarity index 97% rename from docs/site/examples/glyph-mark-custom/candle.md rename to docs/site/examples/glyph-mark/candle.md index 2db7e3587..04e684d3c 100644 --- a/docs/site/examples/glyph-mark-custom/candle.md +++ b/docs/site/examples/glyph-mark/candle.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-custom +group: glyph-mark title: K线图 -cover: +order: 30-7 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-candle.png --- # K 线图 diff --git a/docs/site/examples/glyph-mark-boxplot/horizontal-boxplot.md b/docs/site/examples/glyph-mark/horizontal-boxplot.md similarity index 97% rename from docs/site/examples/glyph-mark-boxplot/horizontal-boxplot.md rename to docs/site/examples/glyph-mark/horizontal-boxplot.md index 6021a0c46..9eecd4611 100644 --- a/docs/site/examples/glyph-mark-boxplot/horizontal-boxplot.md +++ b/docs/site/examples/glyph-mark/horizontal-boxplot.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-boxplot +group: glyph-mark title: 横向箱线图 -cover: +order: 30-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-horizontal-boxplot.png --- # 横向箱线图 diff --git a/docs/site/examples/glyph-mark-link-path/link-path.md b/docs/site/examples/glyph-mark/link-path.md similarity index 98% rename from docs/site/examples/glyph-mark-link-path/link-path.md rename to docs/site/examples/glyph-mark/link-path.md index cbe9ca5ec..8d1118e2f 100644 --- a/docs/site/examples/glyph-mark-link-path/link-path.md +++ b/docs/site/examples/glyph-mark/link-path.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-link-path +group: glyph-mark title: 桑基图 -cover: +order: 30-6 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-link-path.png --- # 桑基图 diff --git a/docs/site/examples/glyph-mark-boxplot/polar-boxplot.md b/docs/site/examples/glyph-mark/polar-boxplot.md similarity index 97% rename from docs/site/examples/glyph-mark-boxplot/polar-boxplot.md rename to docs/site/examples/glyph-mark/polar-boxplot.md index ce44c0f70..1501bb377 100644 --- a/docs/site/examples/glyph-mark-boxplot/polar-boxplot.md +++ b/docs/site/examples/glyph-mark/polar-boxplot.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-boxplot +group: glyph-mark title: 极坐标下的箱线图 -cover: +order: 30-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-polar-boxplot.png --- # 极坐标下的箱线图 diff --git a/docs/site/examples/glyph-mark-ripple/ripple.md b/docs/site/examples/glyph-mark/ripple.md similarity index 97% rename from docs/site/examples/glyph-mark-ripple/ripple.md rename to docs/site/examples/glyph-mark/ripple.md index 730fce16b..d639d2246 100644 --- a/docs/site/examples/glyph-mark-ripple/ripple.md +++ b/docs/site/examples/glyph-mark/ripple.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-ripple +group: glyph-mark title: 涟漪点折线图 -cover: +order: 30-4 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-ripple.png --- # 涟漪点折线图 diff --git a/docs/site/examples/glyph-mark-wave/wave.md b/docs/site/examples/glyph-mark/wave.md similarity index 96% rename from docs/site/examples/glyph-mark-wave/wave.md rename to docs/site/examples/glyph-mark/wave.md index 2850e781f..da5c23db8 100644 --- a/docs/site/examples/glyph-mark-wave/wave.md +++ b/docs/site/examples/glyph-mark/wave.md @@ -1,8 +1,9 @@ --- category: examples -group: glyph-mark-wave +group: glyph-mark title: 水波图 -cover: +order: 30-5 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/glyph-mark-wave.png --- # 水波图 diff --git a/docs/site/examples/hierarchy/circlepacking.md b/docs/site/examples/hierarchy/circlepacking.md index 3676f5e1b..0fd684af0 100644 --- a/docs/site/examples/hierarchy/circlepacking.md +++ b/docs/site/examples/hierarchy/circlepacking.md @@ -2,7 +2,8 @@ category: examples group: hierarchy-circlePacking title: circlePacking图 -cover: +order: 70-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/hierarchy-circlepacking.png --- # circlePacking 图 diff --git a/docs/site/examples/hierarchy/sunburst.md b/docs/site/examples/hierarchy/sunburst.md index 2f48e41e7..ce85f18e5 100644 --- a/docs/site/examples/hierarchy/sunburst.md +++ b/docs/site/examples/hierarchy/sunburst.md @@ -2,7 +2,8 @@ category: examples group: hierarchy-sunburst title: sunburst图 -cover: +order: 70-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/hierarchy-sunburst.png --- # sunburst 图 diff --git a/docs/site/examples/hierarchy/tree.md b/docs/site/examples/hierarchy/tree.md index 4dbefc027..330f6e459 100644 --- a/docs/site/examples/hierarchy/tree.md +++ b/docs/site/examples/hierarchy/tree.md @@ -2,7 +2,8 @@ category: examples group: hierarchy title: tree图 -cover: +order: 70-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/hierarchy-tree.png --- # tree 图 diff --git a/docs/site/examples/hierarchy/treemap.md b/docs/site/examples/hierarchy/treemap.md index 2440fbab5..d13e42ac5 100644 --- a/docs/site/examples/hierarchy/treemap.md +++ b/docs/site/examples/hierarchy/treemap.md @@ -2,7 +2,8 @@ category: examples group: hierarchy-sunburst title: sunburst图 -cover: +order: 70-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/hierarchy-treemap.png --- # sunburst 图 diff --git a/docs/site/examples/mark-cell/basic-cell.md b/docs/site/examples/mark-cell/basic-cell.md index 400ce89e4..1448ce0dc 100644 --- a/docs/site/examples/mark-cell/basic-cell.md +++ b/docs/site/examples/mark-cell/basic-cell.md @@ -2,7 +2,8 @@ category: examples group: mark-cell title: 色块图 -cover: +order: 20-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-cell-basic-cell.png --- # 色块图 @@ -9178,7 +9179,7 @@ const spec = { update: (scale, elment, params) => { return { x: params.viewBox.x1, - y: params.viewBox.y2, + y: params.viewBox.y1, start: { x: 0, y: 0 }, end: { x: params.viewBox.width(), y: 0 }, verticalFactor: -1 diff --git a/docs/site/examples/mark-cell/calender-cell.md b/docs/site/examples/mark-cell/calender-cell.md index ede2df03a..41a3d0258 100644 --- a/docs/site/examples/mark-cell/calender-cell.md +++ b/docs/site/examples/mark-cell/calender-cell.md @@ -2,7 +2,8 @@ category: examples group: mark-cell title: 日历色块图 -cover: +order: 20-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-cell-calender-cell.png --- # 日历色块图 @@ -121,8 +122,6 @@ const spec = { return res; }, {}); - console.log(textMap); - Object.keys(textMap).forEach(key => { const dates = textMap[key]; const columns = dates.reduce((res, entry) => { @@ -279,8 +278,6 @@ const spec = { dependency: ['xscale', 'yscale'], encode: { update: (datum, el, params) => { - console.log(datum); - return { curveType: 'stepBefore', x: params.xscale.scale(datum.column) + params.xscale.bandwidth(), diff --git a/docs/site/examples/mark-interval/basic-bar.md b/docs/site/examples/mark-interval/basic-bar.md index 9d356f7c3..57ae30bf7 100644 --- a/docs/site/examples/mark-interval/basic-bar.md +++ b/docs/site/examples/mark-interval/basic-bar.md @@ -2,7 +2,8 @@ category: examples group: mark-interval title: 条形图 -cover: +order: 21-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-interval-basic-bar.png --- # 条形图 diff --git a/docs/site/examples/mark-interval/basic-interval.md b/docs/site/examples/mark-interval/basic-interval.md index d2eb9af09..eb517287d 100644 --- a/docs/site/examples/mark-interval/basic-interval.md +++ b/docs/site/examples/mark-interval/basic-interval.md @@ -2,7 +2,8 @@ category: examples group: mark-interval title: 柱图 -cover: +order: 21-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-interval-basic-interval.png --- # 柱图 diff --git a/docs/site/examples/mark-interval/polar-interval.md b/docs/site/examples/mark-interval/polar-interval.md index b671508f1..fc9190c2d 100644 --- a/docs/site/examples/mark-interval/polar-interval.md +++ b/docs/site/examples/mark-interval/polar-interval.md @@ -2,7 +2,8 @@ category: examples group: mark-interval title: 极坐标柱图 -cover: +order: 21-2 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-interval-polar-interval.png --- # 极坐标柱图 diff --git a/docs/site/examples/mark-interval/radial-interval.md b/docs/site/examples/mark-interval/radial-interval.md index 6071dad1b..6e1dc5564 100644 --- a/docs/site/examples/mark-interval/radial-interval.md +++ b/docs/site/examples/mark-interval/radial-interval.md @@ -2,7 +2,8 @@ category: examples group: mark-interval title: 极坐标条形图 -cover: +order: 21-3 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/mark-interval-radial-interval.png --- # 极坐标条形图 diff --git a/docs/site/examples/menu.ts b/docs/site/examples/menu.ts index cfa2cd462..568d5c347 100644 --- a/docs/site/examples/menu.ts +++ b/docs/site/examples/menu.ts @@ -41,27 +41,6 @@ export const examplesMenu = [ } ], }, - { - menu: '基础图元 - symbol', - path: 'basic-mark-symbol', - children: [ - { - name: 'basic-symbol' - }, - { - name: 'bubble' - } - ], - }, - { - menu: '基础图元 - text', - path: 'basic-mark-text', - children: [ - { - name: 'basic-text' - } - ], - }, { menu: '基础图元 - area', path: 'basic-mark-area', @@ -80,6 +59,19 @@ export const examplesMenu = [ } ] }, + { + menu: '基础图元 - symbol', + path: 'basic-mark-symbol', + children: [ + { + name: 'basic-symbol' + }, + { + name: 'bubble' + } + ], + }, + { menu: '基础图元 - arc', path: 'basic-mark-arc', @@ -87,6 +79,9 @@ export const examplesMenu = [ { name: 'basic-arc' }, + { + name: 'simple-pie', + }, { name: 'radial-arc' }, @@ -95,6 +90,20 @@ export const examplesMenu = [ } ] }, + + { + menu: '基础图元 - rule', + path: 'basic-mark-rule', + children: [ + { + name: 'basic-rule' + }, + { + name: 'rule-symbol' + }, + ] + }, + { menu: '基础图元 - polygon', path: 'basic-mark-polygon', @@ -120,26 +129,24 @@ export const examplesMenu = [ ] }, { - menu: '基础图元 - richtext', - path: 'basic-mark-richtext', + menu: '基础图元 - text', + path: 'basic-mark-text', children: [ { - name: 'basic-richtext' - }, - ] + name: 'basic-text' + } + ], }, { - menu: '基础图元 - rule', - path: 'basic-mark-rule', + menu: '基础图元 - richtext', + path: 'basic-mark-richtext', children: [ { - name: 'basic-rule' - }, - { - name: 'rule-symbol' + name: 'basic-richtext' }, ] }, + { menu: '基础图元 - image', path: 'basic-mark-image', @@ -150,7 +157,7 @@ export const examplesMenu = [ ] }, { - menu: '语法图元 - cell', + menu: '语义图元 - cell', path: 'mark-cell', children: [ { @@ -162,7 +169,7 @@ export const examplesMenu = [ ] }, { - menu: '语法图元 - interval', + menu: '语义图元 - interval', path: 'mark-interval', children: [ { @@ -180,8 +187,8 @@ export const examplesMenu = [ ] }, { - menu: '组合图元 - boxplot', - path: 'glyph-mark-boxplot', + menu: '组合图元', + path: 'glyph-mark', children: [ { name: 'boxplot' @@ -194,40 +201,16 @@ export const examplesMenu = [ }, { name: 'bar-boxplot' - } - ] - }, - { - menu: '组合图元 - ripple', - path: 'glyph-mark-ripple', - children: [ + }, { name: 'ripple' - } - ] - }, - { - menu: '组合图元 - wave', - path: 'glyph-mark-wave', - children: [ + }, { name: 'wave' - } - ] - }, - { - menu: '组合图元 - linkPath', - path: 'glyph-mark-link-path', - children: [ + }, { name: 'link-path' - } - ] - }, - { - menu: '组合图元 - custom', - path: 'glyph-mark-custom', - children: [ + }, { name: 'candle' } @@ -355,6 +338,9 @@ export const examplesMenu = [ children: [ { name: 'progressive-rect' + }, + { + name: 'progressive-line' } ] diff --git a/docs/site/examples/performance/progressive-line.md b/docs/site/examples/performance/progressive-line.md new file mode 100644 index 000000000..256efc9f7 --- /dev/null +++ b/docs/site/examples/performance/progressive-line.md @@ -0,0 +1,148 @@ +--- +category: examples +group: perf +title: 大数据量线图 +order: 110-1 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/performance-progressive-line.gif +--- + +# 大数据量线图 + +当数据量比较大的时候,开启渐进渲染,来由线图的绘制性能 + +## 代码演示 + +```javascript livedemo template=vgrammar +const data = new Array(10000).fill(0).map((entry, index) => { + return { + name: `${index}`, + value: Math.floor(10000 * Math.random()) + }; +}); +const spec = { + padding: { top: 5, right: 5, bottom: 30, left: 60 }, + + data: [ + { + id: 'table', + values: data + } + ], + + scales: [ + { + id: 'xscale', + type: 'point', + domain: { data: 'table', field: 'name' }, + dependency: ['viewBox'], + range: (scale, params) => { + return [0, params.viewBox.width()]; + }, + padding: 0.05 + }, + { + id: 'yscale', + type: 'linear', + domain: { data: 'table', field: 'value' }, + dependency: ['viewBox'], + range: (scale, params) => { + return [params.viewBox.height(), 0]; + }, + nice: true + } + ], + + marks: [ + { + type: 'group', + dependency: ['viewBox'], + encode: { + update: (scale, elment, params) => { + return { + x: params.viewBox.x1, + y: params.viewBox.y1, + width: params.viewBox.width(), + height: params.viewBox.height() + }; + } + }, + + marks: [ + { + type: 'component', + componentType: 'axis', + scale: 'xscale', + // tickCount: -1, + dependency: ['viewBox'], + encode: { + update: (scale, elment, params) => { + return { + x: 0, + y: params.viewBox.height(), + start: { x: 0, y: 0 }, + end: { x: params.viewBox.width(), y: 0 } + }; + } + } + }, + { + type: 'component', + componentType: 'axis', + scale: 'yscale', + dependency: ['viewBox'], + encode: { + update: (scale, elment, params) => { + return { + x: 0, + y: 0, + start: { x: 0, y: params.viewBox.height() }, + end: { x: 0, y: 0 }, + verticalFactor: -1 + }; + } + } + }, + { + type: 'component', + componentType: 'crosshair', + scale: 'xscale', + crosshairShape: 'rect', + crosshairType: 'x' + }, + { + type: 'line', + id: 'line', + from: { data: 'table' }, + dependency: ['yscale'], + progressiveStep: 200, + progressiveThreshold: 3000, + encode: { + update: { + x: { scale: 'xscale', field: 'name' }, + y: { scale: 'yscale', field: 'value' }, + stroke: '#6690F2' + } + // hover: { + // stroke: 'red' + // } + } + } + ] + } + ] +}; + +const vGrammarView = new View({ + autoFit: true, + container: document.getElementById(CONTAINER_ID), + hover: true +}); +vGrammarView.parseSpec(spec); + +vGrammarView.runAsync(); + +// 只为了方便控制太调试用,不要拷贝 +window.vGrammarView = vGrammarView; +``` + +## 相关教程 diff --git a/docs/site/examples/performance/progressive-rect.md b/docs/site/examples/performance/progressive-rect.md index 852819aaa..5be6227dc 100644 --- a/docs/site/examples/performance/progressive-rect.md +++ b/docs/site/examples/performance/progressive-rect.md @@ -2,7 +2,8 @@ category: examples group: perf title: 大数据量柱图 -cover: +order: 110-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/performance-progressive-rect.gif --- # 大数据量柱图 diff --git a/docs/site/examples/sankey/basic-sankey.md b/docs/site/examples/sankey/basic-sankey.md index 55f27711b..bdaee7c8c 100644 --- a/docs/site/examples/sankey/basic-sankey.md +++ b/docs/site/examples/sankey/basic-sankey.md @@ -2,7 +2,8 @@ category: examples group: sankey title: sankey图 -cover: +order: 80-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/sankey-basic-sankey.png --- # sankey 图 diff --git a/docs/site/examples/wordcloud-shape/basic-wordcloud-shape.md b/docs/site/examples/wordcloud-shape/basic-wordcloud-shape.md index f4a1289b3..ffcc8bd32 100644 --- a/docs/site/examples/wordcloud-shape/basic-wordcloud-shape.md +++ b/docs/site/examples/wordcloud-shape/basic-wordcloud-shape.md @@ -2,7 +2,8 @@ category: examples group: wordcloud-shape title: 形状词云图 -cover: +order: 100-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/wordcloud-shape-basic-wordcloud-shape.png --- # 形状词云图 diff --git a/docs/site/examples/wordcloud/basic-wordcloud.md b/docs/site/examples/wordcloud/basic-wordcloud.md index 7842e577f..4a17c28bf 100644 --- a/docs/site/examples/wordcloud/basic-wordcloud.md +++ b/docs/site/examples/wordcloud/basic-wordcloud.md @@ -2,7 +2,8 @@ category: examples group: wordcloud title: 词云图 -cover: +order: 90-0 +cover: http://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/vgrammar/wordcloud-basic-wordcloud.png --- # 词云图 diff --git a/docs/site/package.json b/docs/site/package.json index 10e511f78..18e83eb57 100644 --- a/docs/site/package.json +++ b/docs/site/package.json @@ -12,20 +12,21 @@ "devDependencies": { "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", - "@visactor/vgrammar": "workspace:0.3.1", - "@visactor/vgrammar-hierarchy": "workspace:0.3.1", - "@visactor/vgrammar-sankey": "workspace:0.3.1", - "@visactor/vgrammar-projection": "workspace:0.3.1", - "@visactor/vgrammar-wordcloud": "workspace:0.3.1", - "@visactor/vgrammar-wordcloud-shape": "workspace:0.3.1", + "@visactor/vgrammar": "workspace:0.3.2", + "@visactor/vgrammar-hierarchy": "workspace:0.3.2", + "@visactor/vgrammar-sankey": "workspace:0.3.2", + "@visactor/vgrammar-projection": "workspace:0.3.2", + "@visactor/vgrammar-wordcloud": "workspace:0.3.2", + "@visactor/vgrammar-wordcloud-shape": "workspace:0.3.2", "@visactor/vutils": "~0.11.1", - "@visactor/vrender": "~0.11.1", + "@visactor/vrender": "~0.12.0", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", "typescript": "4.9.5", "vite": "3.2.6", "vite-plugin-markdown": "^2.1.0", "markdown-it": "13.0.1", - "axios": "^1.4.0" + "axios": "^1.4.0", + "canvas": "^2.11.2" } } diff --git a/docs/site/tutorials/marks/glyph-mark.md b/docs/site/tutorials/marks/glyph-mark.md index d78ff0a8b..0dcfc6c23 100644 --- a/docs/site/tutorials/marks/glyph-mark.md +++ b/docs/site/tutorials/marks/glyph-mark.md @@ -22,12 +22,12 @@ VGrammar 提供了两种箱形图元以支持箱形图可视化: - boxplot: 普通箱形图元,glyphType 为 `'boxplot'`。在使用普通箱形图元之前,需要执行 `registerBoxplotGlyph()` 对图元进行注册。示例: -