@antv/g2plot 2.4.5 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +1 -1
- package/dist/g2plot.min.js +4 -4
- package/dist/g2plot.min.js.map +1 -1
- package/esm/core/plot.d.ts +2 -2
- package/esm/core/plot.js +4 -3
- package/esm/core/plot.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/plots/area/constants.js +1 -0
- package/esm/plots/area/constants.js.map +1 -1
- package/esm/plots/area/types.d.ts +35 -10
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/constants.js +3 -0
- package/esm/plots/bar/constants.js.map +1 -1
- package/esm/plots/bar/types.d.ts +16 -3
- package/esm/plots/bar/types.js.map +1 -1
- package/esm/plots/bidirectional-bar/types.d.ts +21 -6
- package/esm/plots/bidirectional-bar/types.js.map +1 -1
- package/esm/plots/box/types.d.ts +20 -6
- package/esm/plots/box/types.js.map +1 -1
- package/esm/plots/bullet/types.d.ts +36 -9
- package/esm/plots/bullet/types.js.map +1 -1
- package/esm/plots/chord/types.d.ts +14 -10
- package/esm/plots/chord/types.js.map +1 -1
- package/esm/plots/circle-packing/types.d.ts +25 -8
- package/esm/plots/circle-packing/types.js.map +1 -1
- package/esm/plots/column/constants.js +3 -0
- package/esm/plots/column/constants.js.map +1 -1
- package/esm/plots/column/types.d.ts +57 -16
- package/esm/plots/column/types.js.map +1 -1
- package/esm/plots/dual-axes/types.d.ts +31 -6
- package/esm/plots/dual-axes/types.js.map +1 -1
- package/esm/plots/dual-axes/util/render-sider.js +1 -1
- package/esm/plots/dual-axes/util/render-sider.js.map +1 -1
- package/esm/plots/facet/types.d.ts +54 -34
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/funnel/types.d.ts +40 -11
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/adaptor.js +1 -0
- package/esm/plots/gauge/adaptor.js.map +1 -1
- package/esm/plots/gauge/types.d.ts +83 -21
- package/esm/plots/gauge/types.js.map +1 -1
- package/esm/plots/heatmap/types.d.ts +47 -12
- package/esm/plots/heatmap/types.js.map +1 -1
- package/esm/plots/histogram/types.d.ts +17 -6
- package/esm/plots/histogram/types.js.map +1 -1
- package/esm/plots/line/adaptor.js +2 -2
- package/esm/plots/line/adaptor.js.map +1 -1
- package/esm/plots/line/constants.js +1 -0
- package/esm/plots/line/constants.js.map +1 -1
- package/esm/plots/line/types.d.ts +42 -12
- package/esm/plots/line/types.js.map +1 -1
- package/esm/plots/liquid/adaptor.js +2 -1
- package/esm/plots/liquid/adaptor.js.map +1 -1
- package/esm/plots/liquid/index.d.ts +1 -0
- package/esm/plots/liquid/index.js +1 -0
- package/esm/plots/liquid/index.js.map +1 -1
- package/esm/plots/liquid/shapes/liquid.d.ts +16 -1
- package/esm/plots/liquid/shapes/liquid.js +17 -10
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +57 -16
- package/esm/plots/liquid/types.js.map +1 -1
- package/esm/plots/mix/types.d.ts +31 -22
- package/esm/plots/mix/types.js.map +1 -1
- package/esm/plots/pie/adaptor.js +2 -0
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/contants.js +1 -0
- package/esm/plots/pie/contants.js.map +1 -1
- package/esm/plots/pie/types.d.ts +27 -10
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -0
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/progress/types.d.ts +13 -4
- package/esm/plots/progress/types.js.map +1 -1
- package/esm/plots/radar/types.d.ts +39 -12
- package/esm/plots/radar/types.js.map +1 -1
- package/esm/plots/radial-bar/types.d.ts +39 -12
- package/esm/plots/radial-bar/types.js.map +1 -1
- package/esm/plots/ring-progress/types.d.ts +18 -6
- package/esm/plots/ring-progress/types.js.map +1 -1
- package/esm/plots/rose/constant.js +1 -0
- package/esm/plots/rose/constant.js.map +1 -1
- package/esm/plots/rose/types.d.ts +32 -12
- package/esm/plots/rose/types.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +31 -2
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/sankey/types.d.ts +57 -30
- package/esm/plots/sankey/types.js.map +1 -1
- package/esm/plots/scatter/adaptor.d.ts +1 -1
- package/esm/plots/scatter/adaptor.js +2 -2
- package/esm/plots/scatter/adaptor.js.map +1 -1
- package/esm/plots/scatter/types.d.ts +76 -22
- package/esm/plots/scatter/types.js.map +1 -1
- package/esm/plots/stock/types.d.ts +20 -7
- package/esm/plots/stock/types.js.map +1 -1
- package/esm/plots/sunburst/types.d.ts +40 -12
- package/esm/plots/sunburst/types.js.map +1 -1
- package/esm/plots/tiny-area/types.d.ts +16 -5
- package/esm/plots/tiny-area/types.js.map +1 -1
- package/esm/plots/tiny-column/types.d.ts +10 -3
- package/esm/plots/tiny-column/types.js.map +1 -1
- package/esm/plots/tiny-line/types.d.ts +17 -5
- package/esm/plots/tiny-line/types.js.map +1 -1
- package/esm/plots/treemap/types.d.ts +17 -6
- package/esm/plots/treemap/types.js.map +1 -1
- package/esm/plots/venn/types.d.ts +20 -6
- package/esm/plots/venn/types.js.map +1 -1
- package/esm/plots/violin/types.d.ts +52 -17
- package/esm/plots/violin/types.js.map +1 -1
- package/esm/plots/waterfall/types.d.ts +42 -10
- package/esm/plots/waterfall/types.js.map +1 -1
- package/esm/plots/word-cloud/types.d.ts +91 -44
- package/esm/plots/word-cloud/types.js.map +1 -1
- package/esm/types/button.d.ts +8 -4
- package/esm/types/button.js.map +1 -1
- package/esm/types/common.d.ts +145 -33
- package/esm/types/common.js.map +1 -1
- package/esm/types/drill-down.d.ts +28 -7
- package/esm/types/drill-down.js.map +1 -1
- package/esm/types/interaction.d.ts +26 -6
- package/esm/types/interaction.js.map +1 -1
- package/esm/types/label.d.ts +11 -3
- package/esm/types/label.js.map +1 -1
- package/esm/types/meta.d.ts +4 -7
- package/esm/types/meta.js.map +1 -1
- package/esm/types/pattern.d.ts +58 -18
- package/esm/types/pattern.js.map +1 -1
- package/esm/types/state.d.ts +11 -3
- package/esm/types/state.js.map +1 -1
- package/esm/types/statistic.d.ts +38 -6
- package/esm/types/statistic.js.map +1 -1
- package/esm/types/tooltip.d.ts +7 -2
- package/esm/types/tooltip.js.map +1 -1
- package/esm/utils/transform/percent.js +2 -2
- package/esm/utils/transform/percent.js.map +1 -1
- package/lib/core/plot.d.ts +2 -2
- package/lib/core/plot.js +4 -3
- package/lib/core/plot.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/constants.js +1 -0
- package/lib/plots/area/constants.js.map +1 -1
- package/lib/plots/area/types.d.ts +35 -10
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/constants.js +3 -0
- package/lib/plots/bar/constants.js.map +1 -1
- package/lib/plots/bar/types.d.ts +16 -3
- package/lib/plots/bar/types.js.map +1 -1
- package/lib/plots/bidirectional-bar/types.d.ts +21 -6
- package/lib/plots/bidirectional-bar/types.js.map +1 -1
- package/lib/plots/box/types.d.ts +20 -6
- package/lib/plots/box/types.js.map +1 -1
- package/lib/plots/bullet/types.d.ts +36 -9
- package/lib/plots/bullet/types.js.map +1 -1
- package/lib/plots/chord/types.d.ts +14 -10
- package/lib/plots/chord/types.js.map +1 -1
- package/lib/plots/circle-packing/types.d.ts +25 -8
- package/lib/plots/circle-packing/types.js.map +1 -1
- package/lib/plots/column/constants.js +3 -0
- package/lib/plots/column/constants.js.map +1 -1
- package/lib/plots/column/types.d.ts +57 -16
- package/lib/plots/column/types.js.map +1 -1
- package/lib/plots/dual-axes/types.d.ts +31 -6
- package/lib/plots/dual-axes/types.js.map +1 -1
- package/lib/plots/dual-axes/util/render-sider.js +1 -1
- package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
- package/lib/plots/facet/types.d.ts +54 -34
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/funnel/types.d.ts +40 -11
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/adaptor.js +1 -0
- package/lib/plots/gauge/adaptor.js.map +1 -1
- package/lib/plots/gauge/types.d.ts +83 -21
- package/lib/plots/gauge/types.js.map +1 -1
- package/lib/plots/heatmap/types.d.ts +47 -12
- package/lib/plots/heatmap/types.js.map +1 -1
- package/lib/plots/histogram/types.d.ts +17 -6
- package/lib/plots/histogram/types.js.map +1 -1
- package/lib/plots/line/adaptor.js +1 -1
- package/lib/plots/line/adaptor.js.map +1 -1
- package/lib/plots/line/constants.js +1 -0
- package/lib/plots/line/constants.js.map +1 -1
- package/lib/plots/line/types.d.ts +42 -12
- package/lib/plots/line/types.js.map +1 -1
- package/lib/plots/liquid/adaptor.js +2 -1
- package/lib/plots/liquid/adaptor.js.map +1 -1
- package/lib/plots/liquid/index.d.ts +1 -0
- package/lib/plots/liquid/index.js +2 -0
- package/lib/plots/liquid/index.js.map +1 -1
- package/lib/plots/liquid/shapes/liquid.d.ts +16 -1
- package/lib/plots/liquid/shapes/liquid.js +19 -10
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +57 -16
- package/lib/plots/liquid/types.js.map +1 -1
- package/lib/plots/mix/types.d.ts +31 -22
- package/lib/plots/mix/types.js.map +1 -1
- package/lib/plots/pie/adaptor.js +2 -0
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/contants.js +1 -0
- package/lib/plots/pie/contants.js.map +1 -1
- package/lib/plots/pie/types.d.ts +27 -10
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -0
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/types.d.ts +13 -4
- package/lib/plots/progress/types.js.map +1 -1
- package/lib/plots/radar/types.d.ts +39 -12
- package/lib/plots/radar/types.js.map +1 -1
- package/lib/plots/radial-bar/types.d.ts +39 -12
- package/lib/plots/radial-bar/types.js.map +1 -1
- package/lib/plots/ring-progress/types.d.ts +18 -6
- package/lib/plots/ring-progress/types.js.map +1 -1
- package/lib/plots/rose/constant.js +1 -0
- package/lib/plots/rose/constant.js.map +1 -1
- package/lib/plots/rose/types.d.ts +32 -12
- package/lib/plots/rose/types.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +30 -1
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/sankey/types.d.ts +57 -30
- package/lib/plots/sankey/types.js.map +1 -1
- package/lib/plots/scatter/adaptor.d.ts +1 -1
- package/lib/plots/scatter/adaptor.js +1 -1
- package/lib/plots/scatter/adaptor.js.map +1 -1
- package/lib/plots/scatter/types.d.ts +76 -22
- package/lib/plots/scatter/types.js.map +1 -1
- package/lib/plots/stock/types.d.ts +20 -7
- package/lib/plots/stock/types.js.map +1 -1
- package/lib/plots/sunburst/types.d.ts +40 -12
- package/lib/plots/sunburst/types.js.map +1 -1
- package/lib/plots/tiny-area/types.d.ts +16 -5
- package/lib/plots/tiny-area/types.js.map +1 -1
- package/lib/plots/tiny-column/types.d.ts +10 -3
- package/lib/plots/tiny-column/types.js.map +1 -1
- package/lib/plots/tiny-line/types.d.ts +17 -5
- package/lib/plots/tiny-line/types.js.map +1 -1
- package/lib/plots/treemap/types.d.ts +17 -6
- package/lib/plots/treemap/types.js.map +1 -1
- package/lib/plots/venn/types.d.ts +20 -6
- package/lib/plots/venn/types.js.map +1 -1
- package/lib/plots/violin/types.d.ts +52 -17
- package/lib/plots/violin/types.js.map +1 -1
- package/lib/plots/waterfall/types.d.ts +42 -10
- package/lib/plots/waterfall/types.js.map +1 -1
- package/lib/plots/word-cloud/types.d.ts +91 -44
- package/lib/plots/word-cloud/types.js.map +1 -1
- package/lib/types/button.d.ts +8 -4
- package/lib/types/button.js.map +1 -1
- package/lib/types/common.d.ts +145 -33
- package/lib/types/common.js.map +1 -1
- package/lib/types/drill-down.d.ts +28 -7
- package/lib/types/drill-down.js.map +1 -1
- package/lib/types/interaction.d.ts +26 -6
- package/lib/types/interaction.js.map +1 -1
- package/lib/types/label.d.ts +11 -3
- package/lib/types/label.js.map +1 -1
- package/lib/types/meta.d.ts +4 -7
- package/lib/types/meta.js.map +1 -1
- package/lib/types/pattern.d.ts +58 -18
- package/lib/types/pattern.js.map +1 -1
- package/lib/types/state.d.ts +11 -3
- package/lib/types/state.js.map +1 -1
- package/lib/types/statistic.d.ts +38 -6
- package/lib/types/statistic.js.map +1 -1
- package/lib/types/tooltip.d.ts +7 -2
- package/lib/types/tooltip.js.map +1 -1
- package/lib/utils/transform/percent.js +2 -2
- package/lib/utils/transform/percent.js.map +1 -1
- package/package.json +2 -2
- package/src/core/plot.ts +5 -4
- package/src/index.ts +2 -2
- package/src/plots/area/constants.ts +1 -0
- package/src/plots/area/types.ts +35 -10
- package/src/plots/bar/constants.ts +3 -0
- package/src/plots/bar/types.ts +16 -3
- package/src/plots/bidirectional-bar/types.ts +21 -6
- package/src/plots/box/types.ts +20 -6
- package/src/plots/bullet/types.ts +36 -17
- package/src/plots/chord/types.ts +14 -11
- package/src/plots/circle-packing/types.ts +25 -14
- package/src/plots/column/constants.ts +3 -0
- package/src/plots/column/types.ts +57 -20
- package/src/plots/dual-axes/types.ts +31 -16
- package/src/plots/dual-axes/util/render-sider.ts +1 -1
- package/src/plots/facet/types.ts +54 -49
- package/src/plots/funnel/types.ts +40 -13
- package/src/plots/gauge/adaptor.ts +1 -0
- package/src/plots/gauge/types.ts +86 -27
- package/src/plots/heatmap/types.ts +49 -14
- package/src/plots/histogram/types.ts +17 -9
- package/src/plots/line/adaptor.ts +12 -1
- package/src/plots/line/constants.ts +1 -0
- package/src/plots/line/types.ts +42 -14
- package/src/plots/liquid/adaptor.ts +2 -1
- package/src/plots/liquid/index.ts +2 -0
- package/src/plots/liquid/shapes/liquid.ts +22 -11
- package/src/plots/liquid/types.ts +57 -16
- package/src/plots/mix/types.ts +31 -35
- package/src/plots/pie/adaptor.ts +2 -0
- package/src/plots/pie/contants.ts +1 -0
- package/src/plots/pie/types.ts +27 -10
- package/src/plots/progress/adaptor.ts +1 -0
- package/src/plots/progress/types.ts +13 -4
- package/src/plots/radar/types.ts +39 -12
- package/src/plots/radial-bar/types.ts +39 -12
- package/src/plots/ring-progress/types.ts +18 -6
- package/src/plots/rose/constant.ts +1 -0
- package/src/plots/rose/types.ts +32 -12
- package/src/plots/sankey/adaptor.ts +35 -2
- package/src/plots/sankey/types.ts +58 -30
- package/src/plots/scatter/adaptor.ts +3 -1
- package/src/plots/scatter/types.ts +77 -24
- package/src/plots/stock/types.ts +21 -8
- package/src/plots/sunburst/types.ts +42 -12
- package/src/plots/tiny-area/types.ts +16 -5
- package/src/plots/tiny-column/types.ts +10 -3
- package/src/plots/tiny-line/types.ts +17 -5
- package/src/plots/treemap/types.ts +17 -7
- package/src/plots/venn/types.ts +21 -6
- package/src/plots/violin/types.ts +52 -17
- package/src/plots/waterfall/types.ts +42 -10
- package/src/plots/word-cloud/types.ts +91 -44
- package/src/types/button.ts +8 -4
- package/src/types/common.ts +145 -37
- package/src/types/drill-down.ts +28 -7
- package/src/types/interaction.ts +26 -6
- package/src/types/label.ts +11 -3
- package/src/types/meta.ts +4 -7
- package/src/types/pattern.ts +58 -18
- package/src/types/state.ts +11 -3
- package/src/types/statistic.ts +38 -6
- package/src/types/tooltip.ts +7 -2
- package/src/utils/transform/percent.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/sankey/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAkC;AAClC,+
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/sankey/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAkC;AAClC,+CAA6C;AAE7C,qCAA6D;AAC7D,uDAAyD;AACzD,mCAAgD;AAEhD,uCAAyF;AAEzF;;;GAGG;AACH,SAAS,cA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AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA6B;IACnD,0BAA0B;IAC1B,OAAO,YAAI,CACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAXD,0BAWC","sourcesContent":["import { uniq } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, findViewById, flow } from '../../utils';\nimport { polygon, edge } from '../../adaptor/geometries';\nimport { transformToViewsData } from './helper';\nimport { SankeyOptions } from './types';\nimport { X_FIELD, Y_FIELD, COLOR_FIELD, EDGES_VIEW_ID, NODES_VIEW_ID } from './constant';\n\n/**\n * 默认配置项 处理\n * @param params\n */\nfunction defaultOptions(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { options } = params;\n const { rawFields = [] } = options;\n\n return deepAssign(\n {},\n {\n options: {\n tooltip: {\n fields: uniq(['name', 'source', 'target', 'value', 'isNode', ...rawFields]),\n },\n label: {\n fields: uniq(['x', 'name', ...rawFields]),\n },\n },\n },\n params\n );\n}\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { color, nodeStyle, edgeStyle, label, tooltip, nodeState, edgeState } = options;\n\n // 1. 组件,优先设置,因为子 view 会继承配置\n chart.legend(false);\n chart.tooltip(tooltip);\n chart.axis(false);\n // y 镜像一下,防止图形顺序和数据顺序反了\n chart.coordinate().reflect('y');\n\n // 2. node edge views\n // @ts-ignore\n const { nodes, edges } = transformToViewsData(options, chart.width, chart.height);\n\n // edge view\n const edgeView = chart.createView({ id: EDGES_VIEW_ID });\n edgeView.data(edges);\n\n edge({\n chart: edgeView,\n // @ts-ignore\n options: {\n xField: X_FIELD,\n yField: Y_FIELD,\n seriesField: COLOR_FIELD,\n edge: {\n color,\n style: edgeStyle,\n shape: 'arc',\n },\n tooltip,\n state: edgeState,\n },\n });\n\n const nodeView = chart.createView({ id: NODES_VIEW_ID });\n nodeView.data(nodes);\n\n polygon({\n chart: nodeView,\n options: {\n xField: X_FIELD,\n yField: Y_FIELD,\n seriesField: COLOR_FIELD,\n polygon: {\n color,\n style: nodeStyle,\n },\n label,\n tooltip,\n state: nodeState,\n },\n });\n\n chart.interaction('element-active');\n\n // scale\n chart.scale({\n x: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },\n y: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },\n name: { sync: 'color', type: 'cat' },\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n chart.animate(animation);\n } else {\n chart.animate(true);\n }\n\n const geometries = [...chart.views[0].geometries, ...chart.views[1].geometries];\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n geometries.forEach((g) => {\n g.animate(animation);\n });\n\n return params;\n}\n\n/**\n * 节点拖动\n * @param params\n */\nexport function nodeDraggable(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { nodeDraggable } = options;\n\n const DRAG_INTERACTION = 'sankey-node-draggable';\n\n if (nodeDraggable) {\n chart.interaction(DRAG_INTERACTION);\n } else {\n chart.removeInteraction(DRAG_INTERACTION);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nfunction interaction(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { interactions = [] } = options;\n\n const nodeInteractions = [].concat(interactions, options.nodeInteractions || []);\n const edgeInteractions = [].concat(interactions, options.edgeInteractions || []);\n\n const nodeView = findViewById(chart, NODES_VIEW_ID);\n const edgeView = findViewById(chart, EDGES_VIEW_ID);\n\n nodeInteractions.forEach((i) => {\n if (i?.enable === false) {\n nodeView.removeInteraction(i.type);\n } else {\n nodeView.interaction(i.type, i.cfg || {});\n }\n });\n\n edgeInteractions.forEach((i) => {\n if (i?.enable === false) {\n edgeView.removeInteraction(i.type);\n } else {\n edgeView.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<SankeyOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n defaultOptions,\n geometry,\n interaction,\n nodeDraggable,\n animation,\n theme\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
|
|
@@ -1,116 +1,143 @@
|
|
|
1
1
|
import { Data, Options, State, StyleAttr } from '../../types';
|
|
2
2
|
import { NodeDepth, NodeSort } from './layout';
|
|
3
3
|
/**
|
|
4
|
-
* node-link 数据类型的结构
|
|
4
|
+
* @title node-link 数据类型的结构
|
|
5
5
|
*/
|
|
6
6
|
export declare type NodeLinkData = {
|
|
7
7
|
/**
|
|
8
|
-
* 节点数据
|
|
8
|
+
* @title 节点数据
|
|
9
9
|
*/
|
|
10
10
|
readonly nodes: {
|
|
11
11
|
/**
|
|
12
|
-
* id
|
|
12
|
+
* @title id
|
|
13
|
+
* @description 唯一即可,一般可以直接等于 name
|
|
13
14
|
*/
|
|
14
15
|
readonly id: string;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* @title 节点的名称
|
|
18
|
+
* @description 用于 UI 上的现实
|
|
17
19
|
*/
|
|
18
20
|
readonly name: string;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* @title 节点的值
|
|
23
|
+
* @description 不传则节点大小有来源求和决定
|
|
21
24
|
*/
|
|
22
25
|
readonly fixedValue?: number;
|
|
23
26
|
}[];
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
27
|
readonly links: {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* @title 来源节点
|
|
30
|
+
* @description 在 nodes 中的 index
|
|
30
31
|
*/
|
|
31
32
|
readonly source: number;
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
+
* @title 目标节点
|
|
35
|
+
* @description 在 nodes 中的 index
|
|
34
36
|
*/
|
|
35
37
|
readonly target: number;
|
|
36
38
|
/**
|
|
37
|
-
* 边的值
|
|
39
|
+
* @title 边的值
|
|
38
40
|
*/
|
|
39
41
|
readonly value: number;
|
|
40
42
|
}[];
|
|
41
43
|
};
|
|
42
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @title 配置类型定义
|
|
46
|
+
*/
|
|
43
47
|
export interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {
|
|
44
48
|
/**
|
|
45
|
-
*
|
|
49
|
+
* @title 数据集的类型
|
|
50
|
+
* @description 数据集的类型 'node-link' | 'detail'
|
|
51
|
+
* @default "detail"
|
|
46
52
|
*/
|
|
47
53
|
readonly dataType?: 'node-link' | 'detail';
|
|
48
54
|
/**
|
|
49
|
-
*
|
|
55
|
+
* @title 来源字段
|
|
56
|
+
* @description dataType = 'node-link' 的时候,不用传
|
|
50
57
|
*/
|
|
51
58
|
readonly sourceField?: string;
|
|
52
59
|
/**
|
|
53
|
-
*
|
|
60
|
+
* @title 去向字段
|
|
61
|
+
* @description dataType = 'node-link' 的时候,不用传
|
|
54
62
|
*/
|
|
55
63
|
readonly targetField?: string;
|
|
56
64
|
/**
|
|
57
|
-
*
|
|
65
|
+
* @title 权重字段
|
|
66
|
+
* @description dataType = 'node-link' 的时候,不用传
|
|
58
67
|
*/
|
|
59
68
|
readonly weightField?: string;
|
|
60
69
|
/**
|
|
61
|
-
*
|
|
70
|
+
* @title 附加的元字段
|
|
62
71
|
*/
|
|
63
72
|
readonly rawFields?: string[];
|
|
64
73
|
/**
|
|
65
|
-
* 数据
|
|
74
|
+
* @title 数据
|
|
66
75
|
*/
|
|
67
76
|
readonly data: Data | NodeLinkData;
|
|
68
77
|
/**
|
|
69
|
-
*
|
|
78
|
+
* @title 节点宽度
|
|
79
|
+
* @description 参考画布的宽度
|
|
80
|
+
* @default 0.008
|
|
70
81
|
*/
|
|
71
82
|
readonly nodeWidthRatio?: number;
|
|
72
83
|
/**
|
|
73
|
-
*
|
|
84
|
+
* @title 节点宽度的像素设置
|
|
85
|
+
* @description 优先级高于 nodeWidthRatio
|
|
74
86
|
*/
|
|
75
87
|
readonly nodeWidth?: number;
|
|
76
88
|
/**
|
|
77
|
-
*
|
|
89
|
+
* @title 节点之间的间距比例
|
|
90
|
+
* @description 参考画布高度
|
|
91
|
+
* @default 0.03
|
|
78
92
|
*/
|
|
79
93
|
readonly nodePaddingRatio?: number;
|
|
80
94
|
/**
|
|
81
|
-
*
|
|
95
|
+
* @title 节点间距的像素设置
|
|
96
|
+
* @description 优先级高于 nodePaddingRatio
|
|
82
97
|
*/
|
|
83
98
|
readonly nodePadding?: number;
|
|
84
99
|
/**
|
|
85
|
-
*
|
|
100
|
+
* @title 节点对齐的方式
|
|
101
|
+
* @description 节点对齐的方式 'left' | 'right' | 'center' | 'justify'
|
|
102
|
+
* @default "justify"
|
|
86
103
|
*/
|
|
87
104
|
readonly nodeAlign?: 'left' | 'right' | 'center' | 'justify';
|
|
88
105
|
/**
|
|
89
|
-
*
|
|
106
|
+
* @title 节点排序方式
|
|
90
107
|
*/
|
|
91
108
|
readonly nodeSort?: NodeSort;
|
|
92
109
|
/**
|
|
93
|
-
*
|
|
110
|
+
* @title 节点排放分层的顺序
|
|
111
|
+
* @description 从 0 开始,并且返回值需要保证所有的层级都有节点
|
|
94
112
|
*/
|
|
95
113
|
readonly nodeDepth?: NodeDepth;
|
|
96
114
|
/**
|
|
97
|
-
* 节点样式
|
|
115
|
+
* @title 节点样式
|
|
98
116
|
*/
|
|
99
117
|
readonly nodeStyle?: StyleAttr;
|
|
100
118
|
/**
|
|
101
|
-
* 节点状态样式
|
|
119
|
+
* @title 节点状态样式
|
|
102
120
|
*/
|
|
103
121
|
readonly nodeState?: State;
|
|
104
122
|
/**
|
|
105
|
-
* 边样式
|
|
123
|
+
* @title 边样式
|
|
106
124
|
*/
|
|
107
125
|
readonly edgeStyle?: StyleAttr;
|
|
108
126
|
/**
|
|
109
|
-
* 边状态样式
|
|
127
|
+
* @title 边状态样式
|
|
110
128
|
*/
|
|
111
129
|
readonly edgeState?: State;
|
|
112
130
|
/**
|
|
113
|
-
*
|
|
131
|
+
* @title 节点位置是否可以拖拽
|
|
132
|
+
* @default false
|
|
114
133
|
*/
|
|
115
134
|
readonly nodeDraggable?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* @title 边交互
|
|
137
|
+
*/
|
|
138
|
+
readonly edgeInteractions?: Options['interactions'];
|
|
139
|
+
/**
|
|
140
|
+
* @title 节点交互
|
|
141
|
+
*/
|
|
142
|
+
readonly nodeInteractions?: Options['interactions'];
|
|
116
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/**\n * node-link 数据类型的结构\n */\nexport type NodeLinkData = {\n /**\n * 节点数据\n */\n readonly nodes: {\n /**\n * id 唯一即可,一般可以直接等于 name\n */\n readonly id: string;\n /**\n *
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/**\n * @title node-link 数据类型的结构\n */\nexport type NodeLinkData = {\n /**\n * @title 节点数据\n */\n readonly nodes: {\n /**\n * @title id\n * @description 唯一即可,一般可以直接等于 name\n */\n readonly id: string;\n /**\n * @title 节点的名称\n * @description 用于 UI 上的现实\n */\n readonly name: string;\n /**\n * @title 节点的值\n * @description 不传则节点大小有来源求和决定\n */\n readonly fixedValue?: number;\n }[];\n\n readonly links: {\n /**\n * @title 来源节点\n * @description 在 nodes 中的 index\n */\n readonly source: number;\n /**\n * @title 目标节点\n * @description 在 nodes 中的 index\n */\n readonly target: number;\n /**\n * @title 边的值\n */\n readonly value: number;\n }[];\n};\n\n/**\n * @title 配置类型定义\n */\nexport interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {\n /**\n * @title 数据集的类型\n * @description 数据集的类型 'node-link' | 'detail'\n * @default \"detail\"\n */\n readonly dataType?: 'node-link' | 'detail';\n /**\n * @title 来源字段\n * @description dataType = 'node-link' 的时候,不用传\n */\n readonly sourceField?: string;\n /**\n * @title 去向字段\n * @description dataType = 'node-link' 的时候,不用传\n */\n readonly targetField?: string;\n /**\n * @title 权重字段\n * @description dataType = 'node-link' 的时候,不用传\n */\n readonly weightField?: string;\n /**\n * @title 附加的元字段\n */\n readonly rawFields?: string[];\n /**\n * @title 数据\n */\n readonly data: Data | NodeLinkData;\n /**\n * @title 节点宽度\n * @description 参考画布的宽度\n * @default 0.008\n */\n readonly nodeWidthRatio?: number;\n /**\n * @title 节点宽度的像素设置\n * @description 优先级高于 nodeWidthRatio\n */\n readonly nodeWidth?: number;\n /**\n * @title 节点之间的间距比例\n * @description 参考画布高度\n * @default 0.03\n */\n readonly nodePaddingRatio?: number;\n /**\n * @title 节点间距的像素设置\n * @description 优先级高于 nodePaddingRatio\n */\n readonly nodePadding?: number;\n /**\n * @title 节点对齐的方式\n * @description 节点对齐的方式 'left' | 'right' | 'center' | 'justify'\n * @default \"justify\"\n */\n readonly nodeAlign?: 'left' | 'right' | 'center' | 'justify';\n /**\n * @title 节点排序方式\n */\n readonly nodeSort?: NodeSort;\n /**\n * @title 节点排放分层的顺序\n * @description 从 0 开始,并且返回值需要保证所有的层级都有节点\n */\n readonly nodeDepth?: NodeDepth;\n /**\n * @title 节点样式\n */\n readonly nodeStyle?: StyleAttr;\n /**\n * @title 节点状态样式\n */\n readonly nodeState?: State;\n /**\n * @title 边样式\n */\n readonly edgeStyle?: StyleAttr;\n /**\n * @title 边状态样式\n */\n readonly edgeState?: State;\n /**\n * @title 节点位置是否可以拖拽\n * @default false\n */\n readonly nodeDraggable?: boolean;\n /**\n * @title 边交互\n */\n readonly edgeInteractions?: Options['interactions'];\n /**\n * @title 节点交互\n */\n readonly nodeInteractions?: Options['interactions'];\n}\n"]}
|
|
@@ -22,4 +22,4 @@ export declare function tooltip(params: Params<ScatterOptions>): Params<ScatterO
|
|
|
22
22
|
* @param chart
|
|
23
23
|
* @param options
|
|
24
24
|
*/
|
|
25
|
-
export declare function adaptor(params: Params<ScatterOptions>): Params<
|
|
25
|
+
export declare function adaptor(params: Params<ScatterOptions>): Params<import("../..").Options>;
|
|
@@ -257,7 +257,7 @@ function adaptor(params) {
|
|
|
257
257
|
// flow 的方式处理所有的配置到 G2 API
|
|
258
258
|
return utils_1.flow(geometry, meta, axis, legend, tooltip, label,
|
|
259
259
|
// 需要在 interaction 前面
|
|
260
|
-
brush_1.brushInteraction, common_1.interaction, scatterAnnotation, common_1.animation, common_1.theme, regressionLine)(params);
|
|
260
|
+
brush_1.brushInteraction, common_1.slider, common_1.scrollbar, common_1.interaction, scatterAnnotation, common_1.animation, common_1.theme, regressionLine)(params);
|
|
261
261
|
}
|
|
262
262
|
exports.adaptor = adaptor;
|
|
263
263
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/scatter/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAsC;AAEtC,qCAAqD;AACrD,uDAAiD;AACjD,6CAAuD;AACvD,+CAAwF;AACxF,qCAA2D;AAC3D,+BAAoE;AAGpE;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAuB;IAC9C,IAAA,KAA8B,OAAO,KAA5B,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,MAAM,GAAa,OAAO,OAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,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nimport { Params } from '../../core/adaptor';\nimport { flow, deepAssign, pick } from '../../utils';\nimport { point } from '../../adaptor/geometries';\nimport { brushInteraction } from '../../adaptor/brush';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { findGeometry, transformLabel } from '../../utils';\nimport { getQuadrantDefaultConfig, getPath, getMeta } from './util';\nimport { ScatterOptions } from './types';\n\n/**\n * 散点图默认美观\n * ① data.length === 1 ② 所有数据 y 值相等 ③ 所有数据 x 值相等\n * @param params\n * @returns params\n */\nexport function transformOptions(options: ScatterOptions): ScatterOptions {\n const { data = [], xField, yField } = options;\n\n if (data.length) {\n // x y 字段知否只有一个值,如果只有一个值,则进行优化\n let isOneX = true;\n let isOneY = true;\n\n let prev = data[0];\n let curr;\n\n for (let i = 1; i < data.length; i++) {\n curr = data[i];\n\n if (prev[xField] !== curr[xField]) {\n isOneX = false;\n }\n\n if (prev[yField] !== curr[yField]) {\n isOneY = false;\n }\n\n // 如果都不是 oneValue,那么可提前跳出循环\n if (!isOneX && !isOneY) {\n break;\n }\n\n prev = curr;\n }\n\n const keys = [];\n isOneX && keys.push(xField);\n isOneY && keys.push(yField);\n\n const meta = pick(getMeta(options), keys);\n\n return deepAssign({}, options, { meta });\n }\n\n return options;\n}\n\n/**\n * 字段\n * @param params\n */\nfunction geometry(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { data, type, color, shape, pointStyle, shapeField, colorField, xField, yField, sizeField } = options;\n let { size } = options;\n\n let { tooltip } = options;\n\n if (sizeField) {\n if (!size) {\n size = [2, 8];\n }\n if (isNumber(size)) {\n size = [size, size];\n }\n }\n\n if (tooltip && !tooltip.fields) {\n tooltip = {\n ...tooltip,\n fields: [xField, yField, colorField, sizeField, shapeField],\n };\n }\n // 数据\n chart.data(data);\n\n // geometry\n point(\n deepAssign({}, params, {\n options: {\n seriesField: colorField,\n point: {\n color,\n shape,\n size,\n style: pointStyle,\n },\n tooltip,\n },\n })\n );\n\n const geometry = findGeometry(chart, 'point');\n\n // 数据调整\n if (type) {\n geometry.adjust(type);\n }\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nexport function meta(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n const newOptions = transformOptions(options);\n return flow(\n scale({\n [xField]: xAxis,\n [yField]: yAxis,\n })\n )(deepAssign({}, params, { options: newOptions }));\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n chart.axis(xField, xAxis);\n chart.axis(yField, yAxis);\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nfunction legend(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { legend, colorField, shapeField, sizeField, shapeLegend, sizeLegend } = options;\n\n /** legend 不为 false, 则展示图例, 优先展示 color 分类图例 */\n const showLegend = legend !== false;\n\n if (colorField) {\n chart.legend(colorField, showLegend ? legend : false);\n }\n\n // 优先取 shapeLegend, 否则取 legend\n if (shapeField) {\n if (shapeLegend) {\n chart.legend(shapeField, shapeLegend);\n } else {\n chart.legend(shapeField, shapeLegend === false ? false : legend);\n }\n }\n\n if (sizeField) {\n chart.legend(sizeField, sizeLegend ? sizeLegend : false);\n }\n\n /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */\n /** 默认没有 sizeField,则隐藏连续图例 */\n if (!showLegend && !shapeLegend && !sizeLegend) {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * 数据标签\n * @param params\n */\nfunction label(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { label, yField } = options;\n\n const scatterGeometry = findGeometry(chart, 'point');\n\n // label 为 false, 空 则不显示 label\n if (!label) {\n scatterGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n scatterGeometry.label({\n fields: [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n return params;\n}\n\n/**\n * annotation 配置\n * - 特殊 annotation: quadrant(四象限)\n * @param params\n */\nfunction scatterAnnotation(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options } = params;\n const { quadrant } = options;\n\n const annotationOptions = [];\n\n if (quadrant) {\n const { xBaseline = 0, yBaseline = 0, labels, regionStyle, lineStyle } = quadrant;\n const defaultConfig = getQuadrantDefaultConfig(xBaseline, yBaseline);\n // 仅支持四象限\n const quadrants = new Array(4).join(',').split(',');\n quadrants.forEach((_: string, index: number) => {\n annotationOptions.push(\n {\n type: 'region',\n top: false,\n ...defaultConfig.regionStyle[index].position,\n style: deepAssign({}, defaultConfig.regionStyle[index].style, regionStyle?.[index]),\n },\n {\n type: 'text',\n top: true,\n ...deepAssign({}, defaultConfig.labelStyle[index], labels?.[index]),\n }\n );\n });\n // 生成坐标轴\n annotationOptions.push(\n {\n type: 'line',\n top: false,\n start: ['min', yBaseline],\n end: ['max', yBaseline],\n style: deepAssign({}, defaultConfig.lineStyle, lineStyle),\n },\n {\n type: 'line',\n top: false,\n start: [xBaseline, 'min'],\n end: [xBaseline, 'max'],\n style: deepAssign({}, defaultConfig.lineStyle, lineStyle),\n }\n );\n }\n\n return flow(annotation(annotationOptions))(params);\n}\n\n// 趋势线\nfunction regressionLine(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options, chart } = params;\n const { regressionLine } = options;\n if (regressionLine) {\n const { style, top = false } = regressionLine;\n const defaultStyle = {\n stroke: '#9ba29a',\n lineWidth: 2,\n opacity: 0.5,\n };\n chart.annotation().shape({\n top,\n render: (container, view) => {\n const group = container.addGroup({\n id: `${chart.id}-regression-line`,\n name: 'regression-line-group',\n });\n const path = getPath({\n view,\n options,\n });\n group.addShape('path', {\n name: 'regression-line',\n attrs: {\n path,\n ...defaultStyle,\n ...style,\n },\n });\n },\n });\n }\n\n return params;\n}\n\n/**\n * tooltip 配置\n * @param params\n */\nexport function tooltip(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip) {\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.tooltip(false);\n }\n\n return params;\n}\n\n/**\n * 散点图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<ScatterOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n geometry,\n meta,\n axis,\n legend,\n tooltip,\n label,\n // 需要在 interaction 前面\n brushInteraction,\n interaction,\n scatterAnnotation,\n animation,\n theme,\n regressionLine\n )(params);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/scatter/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAsC;AAEtC,qCAAqD;AACrD,uDAAiD;AACjD,6CAAuD;AACvD,+CAA2G;AAC3G,qCAA2D;AAC3D,+BAAoE;AAGpE;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAuB;IAC9C,IAAA,KAA8B,OAAO,KAA5B,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,MAAM,GAAa,OAAO,OAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAE9C,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,8BAA8B;QAC9B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,MAAM,GAAG,IAAI,CAAC;QAElB,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,IAAI,SAAA,CAAC;QAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEf,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE;gBACjC,MAAM,GAAG,KAAK,CAAC;aAChB;YAED,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,I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M,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,MAA8B;IAC5C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACxB;SAAM,IAAI,OAAO,KAAK,KAAK,EAAE;QAC5B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,0BAWC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA8B;IACpD,0BAA0B;IAC1B,OAAO,YAAI,CACT,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK;IACL,qBAAqB;IACrB,wBAAgB,EAChB,eAAM,EACN,kBAAS,EACT,oBAAW,EACX,iBAAiB,EACjB,kBAAS,EACT,cAAK,EACL,cAAc,CACf,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAnBD,0BAmBC","sourcesContent":["import { isNumber } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { flow, deepAssign, pick } from '../../utils';\nimport { point } from '../../adaptor/geometries';\nimport { brushInteraction } from '../../adaptor/brush';\nimport { interaction, animation, theme, scale, annotation, slider, scrollbar } from '../../adaptor/common';\nimport { findGeometry, transformLabel } from '../../utils';\nimport { getQuadrantDefaultConfig, getPath, getMeta } from './util';\nimport { ScatterOptions } from './types';\n\n/**\n * 散点图默认美观\n * ① data.length === 1 ② 所有数据 y 值相等 ③ 所有数据 x 值相等\n * @param params\n * @returns params\n */\nexport function transformOptions(options: ScatterOptions): ScatterOptions {\n const { data = [], xField, yField } = options;\n\n if (data.length) {\n // x y 字段知否只有一个值,如果只有一个值,则进行优化\n let isOneX = true;\n let isOneY = true;\n\n let prev = data[0];\n let curr;\n\n for (let i = 1; i < data.length; i++) {\n curr = data[i];\n\n if (prev[xField] !== curr[xField]) {\n isOneX = false;\n }\n\n if (prev[yField] !== curr[yField]) {\n isOneY = false;\n }\n\n // 如果都不是 oneValue,那么可提前跳出循环\n if (!isOneX && !isOneY) {\n break;\n }\n\n prev = curr;\n }\n\n const keys = [];\n isOneX && keys.push(xField);\n isOneY && keys.push(yField);\n\n const meta = pick(getMeta(options), keys);\n\n return deepAssign({}, options, { meta });\n }\n\n return options;\n}\n\n/**\n * 字段\n * @param params\n */\nfunction geometry(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { data, type, color, shape, pointStyle, shapeField, colorField, xField, yField, sizeField } = options;\n let { size } = options;\n\n let { tooltip } = options;\n\n if (sizeField) {\n if (!size) {\n size = [2, 8];\n }\n if (isNumber(size)) {\n size = [size, size];\n }\n }\n\n if (tooltip && !tooltip.fields) {\n tooltip = {\n ...tooltip,\n fields: [xField, yField, colorField, sizeField, shapeField],\n };\n }\n // 数据\n chart.data(data);\n\n // geometry\n point(\n deepAssign({}, params, {\n options: {\n seriesField: colorField,\n point: {\n color,\n shape,\n size,\n style: pointStyle,\n },\n tooltip,\n },\n })\n );\n\n const geometry = findGeometry(chart, 'point');\n\n // 数据调整\n if (type) {\n geometry.adjust(type);\n }\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nexport function meta(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n const newOptions = transformOptions(options);\n return flow(\n scale({\n [xField]: xAxis,\n [yField]: yAxis,\n })\n )(deepAssign({}, params, { options: newOptions }));\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n chart.axis(xField, xAxis);\n chart.axis(yField, yAxis);\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nfunction legend(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { legend, colorField, shapeField, sizeField, shapeLegend, sizeLegend } = options;\n\n /** legend 不为 false, 则展示图例, 优先展示 color 分类图例 */\n const showLegend = legend !== false;\n\n if (colorField) {\n chart.legend(colorField, showLegend ? legend : false);\n }\n\n // 优先取 shapeLegend, 否则取 legend\n if (shapeField) {\n if (shapeLegend) {\n chart.legend(shapeField, shapeLegend);\n } else {\n chart.legend(shapeField, shapeLegend === false ? false : legend);\n }\n }\n\n if (sizeField) {\n chart.legend(sizeField, sizeLegend ? sizeLegend : false);\n }\n\n /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */\n /** 默认没有 sizeField,则隐藏连续图例 */\n if (!showLegend && !shapeLegend && !sizeLegend) {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * 数据标签\n * @param params\n */\nfunction label(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { label, yField } = options;\n\n const scatterGeometry = findGeometry(chart, 'point');\n\n // label 为 false, 空 则不显示 label\n if (!label) {\n scatterGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n scatterGeometry.label({\n fields: [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n return params;\n}\n\n/**\n * annotation 配置\n * - 特殊 annotation: quadrant(四象限)\n * @param params\n */\nfunction scatterAnnotation(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options } = params;\n const { quadrant } = options;\n\n const annotationOptions = [];\n\n if (quadrant) {\n const { xBaseline = 0, yBaseline = 0, labels, regionStyle, lineStyle } = quadrant;\n const defaultConfig = getQuadrantDefaultConfig(xBaseline, yBaseline);\n // 仅支持四象限\n const quadrants = new Array(4).join(',').split(',');\n quadrants.forEach((_: string, index: number) => {\n annotationOptions.push(\n {\n type: 'region',\n top: false,\n ...defaultConfig.regionStyle[index].position,\n style: deepAssign({}, defaultConfig.regionStyle[index].style, regionStyle?.[index]),\n },\n {\n type: 'text',\n top: true,\n ...deepAssign({}, defaultConfig.labelStyle[index], labels?.[index]),\n }\n );\n });\n // 生成坐标轴\n annotationOptions.push(\n {\n type: 'line',\n top: false,\n start: ['min', yBaseline],\n end: ['max', yBaseline],\n style: deepAssign({}, defaultConfig.lineStyle, lineStyle),\n },\n {\n type: 'line',\n top: false,\n start: [xBaseline, 'min'],\n end: [xBaseline, 'max'],\n style: deepAssign({}, defaultConfig.lineStyle, lineStyle),\n }\n );\n }\n\n return flow(annotation(annotationOptions))(params);\n}\n\n// 趋势线\nfunction regressionLine(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { options, chart } = params;\n const { regressionLine } = options;\n if (regressionLine) {\n const { style, top = false } = regressionLine;\n const defaultStyle = {\n stroke: '#9ba29a',\n lineWidth: 2,\n opacity: 0.5,\n };\n chart.annotation().shape({\n top,\n render: (container, view) => {\n const group = container.addGroup({\n id: `${chart.id}-regression-line`,\n name: 'regression-line-group',\n });\n const path = getPath({\n view,\n options,\n });\n group.addShape('path', {\n name: 'regression-line',\n attrs: {\n path,\n ...defaultStyle,\n ...style,\n },\n });\n },\n });\n }\n\n return params;\n}\n\n/**\n * tooltip 配置\n * @param params\n */\nexport function tooltip(params: Params<ScatterOptions>): Params<ScatterOptions> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip) {\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.tooltip(false);\n }\n\n return params;\n}\n\n/**\n * 散点图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<ScatterOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n geometry,\n meta,\n axis,\n legend,\n tooltip,\n label,\n // 需要在 interaction 前面\n brushInteraction,\n slider,\n scrollbar,\n interaction,\n scatterAnnotation,\n animation,\n theme,\n regressionLine\n )(params);\n}\n"]}
|
|
@@ -3,54 +3,108 @@ interface Labels extends Omit<TextOption, 'position'> {
|
|
|
3
3
|
position?: AnnotationPosition;
|
|
4
4
|
}
|
|
5
5
|
interface QuadrantOptions {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @title x 基准线
|
|
8
|
+
* @description x 方向上的象限分割基准线
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
7
11
|
readonly xBaseline?: number;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title y 基准线
|
|
14
|
+
* @description y 方向上的象限分割基准线
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
9
17
|
readonly yBaseline?: number;
|
|
10
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 配置象限分割线的样式
|
|
20
|
+
*/
|
|
11
21
|
readonly lineStyle?: RegionPositionBaseOption;
|
|
12
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @title 象限样式
|
|
24
|
+
*/
|
|
13
25
|
readonly regionStyle?: RegionPositionBaseOption[];
|
|
14
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 象限文本
|
|
28
|
+
*/
|
|
15
29
|
readonly labels?: Labels[];
|
|
16
30
|
}
|
|
17
31
|
export interface RegressionLineOptions {
|
|
18
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @title 是否顶层显示
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
19
36
|
readonly top?: boolean;
|
|
20
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @title 回归线类型
|
|
39
|
+
*/
|
|
21
40
|
readonly type?: string;
|
|
22
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @title 配置回归线样式
|
|
43
|
+
*/
|
|
23
44
|
readonly style?: ShapeStyle;
|
|
24
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @title 自定义算法
|
|
47
|
+
* @description [[0,0],[100,100]]
|
|
48
|
+
*/
|
|
25
49
|
readonly algorithm?: Array<[number, number]> | ((data: any) => Array<[number, number]>);
|
|
26
50
|
}
|
|
27
51
|
export interface ScatterOptions extends Options {
|
|
28
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* @title x 轴字段
|
|
54
|
+
*/
|
|
29
55
|
readonly xField: string;
|
|
30
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* @title y 轴字段
|
|
58
|
+
*/
|
|
31
59
|
readonly yField: string;
|
|
32
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* @title 数据调整类型
|
|
62
|
+
* @description 数据调整类型 'jitter' | 'stack' | 'symmetric' | 'dodge'
|
|
63
|
+
*/
|
|
33
64
|
readonly type?: 'jitter' | 'stack' | 'symmetric' | 'dodge';
|
|
34
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* @title 点大小映射对应的数据字段名
|
|
67
|
+
*/
|
|
35
68
|
readonly sizeField?: string;
|
|
36
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* @title size 对应的图例
|
|
71
|
+
*/
|
|
37
72
|
readonly sizeLegend?: Options['legend'];
|
|
38
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @title 散点图大小
|
|
75
|
+
*/
|
|
39
76
|
readonly size?: SizeAttr;
|
|
40
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @title 点形状映射对应的数据字段名
|
|
79
|
+
*/
|
|
41
80
|
readonly shapeField?: string;
|
|
42
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* @title shape 对应的图例
|
|
83
|
+
*/
|
|
43
84
|
readonly shapeLegend?: Options['legend'];
|
|
44
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* @title 散点图形状
|
|
87
|
+
*/
|
|
45
88
|
readonly shape?: ShapeAttr;
|
|
46
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* @title 散点图样式
|
|
91
|
+
*/
|
|
47
92
|
readonly pointStyle?: StyleAttr;
|
|
48
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* @title 点颜色映射对应的数据字段名
|
|
95
|
+
*/
|
|
49
96
|
readonly colorField?: string;
|
|
50
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* @title 四象限组件
|
|
99
|
+
*/
|
|
51
100
|
readonly quadrant?: QuadrantOptions;
|
|
52
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* @title 归曲线
|
|
103
|
+
*/
|
|
53
104
|
readonly regressionLine?: RegressionLineOptions;
|
|
105
|
+
/**
|
|
106
|
+
* @title 图表交互
|
|
107
|
+
*/
|
|
54
108
|
readonly brush?: BrushCfg;
|
|
55
109
|
}
|
|
56
110
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/scatter/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Options,\n RegionPositionBaseOption,\n TextOption,\n AnnotationPosition,\n ShapeStyle,\n StyleAttr,\n ShapeAttr,\n SizeAttr,\n BrushCfg,\n} from '../../types';\n\ninterface Labels extends Omit<TextOption, 'position'> {\n position?: AnnotationPosition;\n}\n\ninterface QuadrantOptions {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/scatter/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Options,\n RegionPositionBaseOption,\n TextOption,\n AnnotationPosition,\n ShapeStyle,\n StyleAttr,\n ShapeAttr,\n SizeAttr,\n BrushCfg,\n} from '../../types';\n\ninterface Labels extends Omit<TextOption, 'position'> {\n position?: AnnotationPosition;\n}\n\ninterface QuadrantOptions {\n /**\n * @title x 基准线\n * @description x 方向上的象限分割基准线\n * @default 0\n */\n readonly xBaseline?: number;\n /**\n * @title y 基准线\n * @description y 方向上的象限分割基准线\n * @default 0\n */\n readonly yBaseline?: number;\n /**\n * @title 配置象限分割线的样式\n */\n readonly lineStyle?: RegionPositionBaseOption;\n /**\n * @title 象限样式\n */\n readonly regionStyle?: RegionPositionBaseOption[];\n /**\n * @title 象限文本\n */\n readonly labels?: Labels[];\n}\n\nexport interface RegressionLineOptions {\n /**\n * @title 是否顶层显示\n * @default false\n */\n readonly top?: boolean;\n /**\n * @title 回归线类型\n */\n readonly type?: string;\n /**\n * @title 配置回归线样式\n */\n readonly style?: ShapeStyle;\n /**\n * @title 自定义算法\n * @description [[0,0],[100,100]]\n */\n readonly algorithm?: Array<[number, number]> | ((data: any) => Array<[number, number]>);\n}\n\nexport interface ScatterOptions extends Options {\n /**\n * @title x 轴字段\n */\n readonly xField: string;\n /**\n * @title y 轴字段\n */\n readonly yField: string;\n /**\n * @title 数据调整类型\n * @description 数据调整类型 'jitter' | 'stack' | 'symmetric' | 'dodge'\n */\n readonly type?: 'jitter' | 'stack' | 'symmetric' | 'dodge';\n /**\n * @title 点大小映射对应的数据字段名\n */\n readonly sizeField?: string;\n /**\n * @title size 对应的图例\n */\n readonly sizeLegend?: Options['legend'];\n /**\n * @title 散点图大小\n */\n readonly size?: SizeAttr;\n /**\n * @title 点形状映射对应的数据字段名\n */\n readonly shapeField?: string;\n /**\n * @title shape 对应的图例\n */\n readonly shapeLegend?: Options['legend'];\n /**\n * @title 散点图形状\n */\n readonly shape?: ShapeAttr;\n /**\n * @title 散点图样式\n */\n readonly pointStyle?: StyleAttr;\n /**\n * @title 点颜色映射对应的数据字段名\n */\n readonly colorField?: string;\n\n // 图表标注组件\n\n /**\n * @title 四象限组件\n */\n readonly quadrant?: QuadrantOptions;\n /**\n * @title 归曲线\n */\n readonly regressionLine?: RegressionLineOptions;\n /**\n * @title 图表交互\n */\n readonly brush?: BrushCfg;\n}\n"]}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { Options, StyleAttr } from '../../types';
|
|
2
2
|
export interface StockOptions extends Options {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @title x 轴字段 日期
|
|
5
|
+
*/
|
|
4
6
|
readonly xField: string;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
+
/**
|
|
8
|
+
* @title y 轴映射
|
|
9
|
+
* @description range 【开盘价/收盘价/最高价/最低价】,设置一个指定 [open, close, high, low]【开盘价/收盘价/最高价/最低价】字段的数组
|
|
10
|
+
*/
|
|
7
11
|
readonly yField: [string, string, string, string];
|
|
8
|
-
/**
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @title 颜色配置
|
|
14
|
+
* @description 不支持 color 配置
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @title 上涨色
|
|
18
|
+
*/
|
|
10
19
|
readonly risingFill?: string;
|
|
11
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @title 下跌色
|
|
22
|
+
*/
|
|
12
23
|
readonly fallingFill?: string;
|
|
13
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @title 样式配置
|
|
26
|
+
*/
|
|
14
27
|
readonly stockStyle?: StyleAttr;
|
|
15
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/stock/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface StockOptions extends Options {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/stock/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface StockOptions extends Options {\n /**\n * @title x 轴字段 日期\n */\n readonly xField: string;\n /**\n * @title y 轴映射\n * @description range 【开盘价/收盘价/最高价/最低价】,设置一个指定 [open, close, high, low]【开盘价/收盘价/最高价/最低价】字段的数组\n */\n readonly yField: [string, string, string, string];\n\n /**\n * @title 颜色配置\n * @description 不支持 color 配置\n */\n\n /**\n * @title 上涨色\n */\n readonly risingFill?: string;\n /**\n * @title 下跌色\n */\n readonly fallingFill?: string;\n /**\n * @title 样式配置\n */\n readonly stockStyle?: StyleAttr;\n}\n"]}
|
|
@@ -2,31 +2,59 @@ import { ColorAttr, Options, StyleAttr } from '../../types';
|
|
|
2
2
|
import { DrillDownCfg } from '../../types/drill-down';
|
|
3
3
|
import { HierarchyOption } from '../../utils/hierarchy/types';
|
|
4
4
|
export interface SunburstOptions extends Omit<Options, 'data' | 'slider' | 'scrollbar' | 'xAxis' | 'yAxis'> {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @title 旭日图数据
|
|
7
|
+
*/
|
|
6
8
|
readonly data: any;
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @title 径向类型
|
|
11
|
+
* @description 径向类型'x' | 'y'
|
|
12
|
+
*/
|
|
8
13
|
readonly reflect?: 'x' | 'y';
|
|
9
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @title 内径
|
|
16
|
+
*/
|
|
10
17
|
readonly innerRadius?: number;
|
|
11
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 半经
|
|
20
|
+
*/
|
|
12
21
|
readonly radius?: number;
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @title 颜色映射
|
|
24
|
+
*/
|
|
14
25
|
readonly colorField?: string;
|
|
15
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 颜色
|
|
28
|
+
*/
|
|
16
29
|
readonly color?: ColorAttr;
|
|
17
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @title 旭日图形样式
|
|
32
|
+
*/
|
|
18
33
|
readonly sunburstStyle?: StyleAttr;
|
|
19
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* @title 层级布局
|
|
36
|
+
*/
|
|
20
37
|
readonly hierarchyConfig?: Omit<HierarchyOption, 'as' | 'type'> & {
|
|
21
38
|
/** default: 'value', required data to be like: { name: 'xx', [field]: 12, children: [] } */
|
|
22
39
|
readonly field?: string;
|
|
23
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @title 是否忽略父节点的权重
|
|
42
|
+
* @description 其父节点的权重不由子节点权重总和决定
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
24
45
|
readonly ignoreParentValue?: boolean;
|
|
25
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @title 展示的层级深度
|
|
48
|
+
* @description 取值 > 0 默认空, 代表全部展示
|
|
49
|
+
*/
|
|
26
50
|
readonly activeDepth?: number;
|
|
27
51
|
};
|
|
28
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* @title 额外的原始字段
|
|
54
|
+
*/
|
|
29
55
|
readonly rawFields?: string[];
|
|
30
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* @title 下钻交互
|
|
58
|
+
*/
|
|
31
59
|
readonly drilldown?: DrillDownCfg;
|
|
32
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sunburst/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorAttr, Options, StyleAttr } from '../../types';\nimport { DrillDownCfg } from '../../types/drill-down';\nimport { HierarchyOption } from '../../utils/hierarchy/types';\n\nexport interface SunburstOptions extends Omit<Options, 'data' | 'slider' | 'scrollbar' | 'xAxis' | 'yAxis'> {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sunburst/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorAttr, Options, StyleAttr } from '../../types';\nimport { DrillDownCfg } from '../../types/drill-down';\nimport { HierarchyOption } from '../../utils/hierarchy/types';\n\nexport interface SunburstOptions extends Omit<Options, 'data' | 'slider' | 'scrollbar' | 'xAxis' | 'yAxis'> {\n /**\n * @title 旭日图数据\n */\n readonly data: any;\n /**\n * @title 径向类型\n * @description 径向类型'x' | 'y'\n */\n readonly reflect?: 'x' | 'y';\n\n // 样式\n\n /**\n * @title 内径\n */\n readonly innerRadius?: number;\n /**\n * @title 半经\n */\n readonly radius?: number;\n /**\n * @title 颜色映射\n */\n readonly colorField?: string;\n /**\n * @title 颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 旭日图形样式\n */\n readonly sunburstStyle?: StyleAttr;\n\n /**\n * @title 层级布局\n */\n readonly hierarchyConfig?: Omit<HierarchyOption, 'as' | 'type'> & {\n /** default: 'value', required data to be like: { name: 'xx', [field]: 12, children: [] } */\n readonly field?: string;\n /**\n * @title 是否忽略父节点的权重\n * @description 其父节点的权重不由子节点权重总和决定\n * @default false\n */\n readonly ignoreParentValue?: boolean;\n /**\n * @title 展示的层级深度\n * @description 取值 > 0 默认空, 代表全部展示\n */\n readonly activeDepth?: number;\n };\n\n // 其他\n\n /**\n * @title 额外的原始字段\n */\n readonly rawFields?: string[];\n /**\n * @title 下钻交互\n */\n readonly drilldown?: DrillDownCfg;\n}\n"]}
|