@antv/g2plot 2.4.20 → 2.4.22
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 +1626 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/dist/g2plot.min.js +2 -2
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/common.js +2 -11
- package/esm/adaptor/common.js.map +1 -1
- package/esm/adaptor/geometries/base.d.ts +2 -2
- package/esm/adaptor/geometries/base.js +3 -1
- package/esm/adaptor/geometries/base.js.map +1 -1
- package/esm/adaptor/pattern.d.ts +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/box/adaptor.js +2 -2
- package/esm/plots/box/adaptor.js.map +1 -1
- package/esm/plots/chord/adaptor.js +2 -13
- package/esm/plots/chord/adaptor.js.map +1 -1
- package/esm/plots/chord/constant.d.ts +4 -4
- package/esm/plots/chord/constant.js +4 -4
- package/esm/plots/chord/constant.js.map +1 -1
- package/esm/plots/column/adaptor.js +3 -1
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/facet/types.d.ts +1 -2
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/facet/utils.js +2 -11
- package/esm/plots/facet/utils.js.map +1 -1
- package/esm/plots/funnel/adaptor.d.ts +5 -0
- package/esm/plots/funnel/adaptor.js +31 -2
- package/esm/plots/funnel/adaptor.js.map +1 -1
- package/esm/plots/funnel/geometries/basic.d.ts +5 -0
- package/esm/plots/funnel/geometries/basic.js +8 -4
- package/esm/plots/funnel/geometries/basic.js.map +1 -1
- package/esm/plots/funnel/geometries/common.d.ts +1 -0
- package/esm/plots/funnel/geometries/common.js +5 -2
- package/esm/plots/funnel/geometries/common.js.map +1 -1
- package/esm/plots/funnel/geometries/compare.d.ts +1 -0
- package/esm/plots/funnel/geometries/compare.js +37 -30
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/index.d.ts +1 -0
- package/esm/plots/funnel/index.js +1 -0
- package/esm/plots/funnel/index.js.map +1 -1
- package/esm/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js +57 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/esm/plots/funnel/interactions/index.d.ts +5 -0
- package/esm/plots/funnel/interactions/index.js +10 -0
- package/esm/plots/funnel/interactions/index.js.map +1 -0
- package/esm/plots/funnel/types.d.ts +1 -0
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/utils.js +6 -5
- package/esm/plots/gauge/utils.js.map +1 -1
- package/esm/plots/heatmap/adaptor.js +9 -11
- package/esm/plots/heatmap/adaptor.js.map +1 -1
- package/esm/plots/histogram/adaptor.js +3 -0
- package/esm/plots/histogram/adaptor.js.map +1 -1
- package/esm/plots/pie/adaptor.js +3 -1
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/types.d.ts +6 -1
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -2
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/progress/utils.d.ts +1 -0
- package/esm/plots/progress/utils.js +4 -1
- package/esm/plots/progress/utils.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +2 -11
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/stock/utils.d.ts +3 -1
- package/esm/plots/stock/utils.js +4 -2
- package/esm/plots/stock/utils.js.map +1 -1
- package/esm/plots/violin/adaptor.js +2 -10
- package/esm/plots/violin/adaptor.js.map +1 -1
- package/esm/types/common.d.ts +4 -3
- package/esm/types/common.js.map +1 -1
- package/esm/utils/conversion.js +4 -3
- package/esm/utils/conversion.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/view.d.ts +8 -1
- package/esm/utils/view.js +27 -0
- package/esm/utils/view.js.map +1 -1
- package/lib/adaptor/common.js +1 -10
- package/lib/adaptor/common.js.map +1 -1
- package/lib/adaptor/geometries/base.d.ts +2 -2
- package/lib/adaptor/geometries/base.js +3 -1
- package/lib/adaptor/geometries/base.js.map +1 -1
- package/lib/adaptor/pattern.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/box/adaptor.js +1 -1
- package/lib/plots/box/adaptor.js.map +1 -1
- package/lib/plots/chord/adaptor.js +1 -12
- package/lib/plots/chord/adaptor.js.map +1 -1
- package/lib/plots/chord/constant.d.ts +4 -4
- package/lib/plots/chord/constant.js +4 -4
- package/lib/plots/chord/constant.js.map +1 -1
- package/lib/plots/column/adaptor.js +3 -1
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/facet/types.d.ts +1 -2
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/facet/utils.js +1 -10
- package/lib/plots/facet/utils.js.map +1 -1
- package/lib/plots/funnel/adaptor.d.ts +5 -0
- package/lib/plots/funnel/adaptor.js +32 -2
- package/lib/plots/funnel/adaptor.js.map +1 -1
- package/lib/plots/funnel/geometries/basic.d.ts +5 -0
- package/lib/plots/funnel/geometries/basic.js +8 -3
- package/lib/plots/funnel/geometries/basic.js.map +1 -1
- package/lib/plots/funnel/geometries/common.d.ts +1 -0
- package/lib/plots/funnel/geometries/common.js +6 -3
- package/lib/plots/funnel/geometries/common.js.map +1 -1
- package/lib/plots/funnel/geometries/compare.d.ts +1 -0
- package/lib/plots/funnel/geometries/compare.js +38 -30
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/index.d.ts +1 -0
- package/lib/plots/funnel/index.js +1 -0
- package/lib/plots/funnel/index.js.map +1 -1
- package/lib/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js +60 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/lib/plots/funnel/interactions/index.d.ts +5 -0
- package/lib/plots/funnel/interactions/index.js +13 -0
- package/lib/plots/funnel/interactions/index.js.map +1 -0
- package/lib/plots/funnel/types.d.ts +1 -0
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/utils.js +5 -4
- package/lib/plots/gauge/utils.js.map +1 -1
- package/lib/plots/heatmap/adaptor.js +8 -10
- package/lib/plots/heatmap/adaptor.js.map +1 -1
- package/lib/plots/histogram/adaptor.js +3 -0
- package/lib/plots/histogram/adaptor.js.map +1 -1
- package/lib/plots/pie/adaptor.js +3 -1
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/types.d.ts +6 -1
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -2
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/utils.d.ts +1 -0
- package/lib/plots/progress/utils.js +4 -1
- package/lib/plots/progress/utils.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +2 -11
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/stock/utils.d.ts +3 -1
- package/lib/plots/stock/utils.js +4 -2
- package/lib/plots/stock/utils.js.map +1 -1
- package/lib/plots/violin/adaptor.js +2 -10
- package/lib/plots/violin/adaptor.js.map +1 -1
- package/lib/types/common.d.ts +4 -3
- package/lib/types/common.js.map +1 -1
- package/lib/utils/conversion.js +4 -3
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/view.d.ts +8 -1
- package/lib/utils/view.js +29 -1
- package/lib/utils/view.js.map +1 -1
- package/package.json +4 -2
- package/src/adaptor/common.ts +2 -11
- package/src/adaptor/geometries/base.ts +5 -3
- package/src/index.ts +1 -1
- package/src/plots/box/adaptor.ts +2 -2
- package/src/plots/chord/adaptor.ts +2 -14
- package/src/plots/chord/constant.ts +4 -4
- package/src/plots/column/adaptor.ts +3 -1
- package/src/plots/facet/types.ts +1 -1
- package/src/plots/facet/utils.ts +4 -12
- package/src/plots/funnel/adaptor.ts +32 -2
- package/src/plots/funnel/geometries/basic.ts +10 -5
- package/src/plots/funnel/geometries/common.ts +6 -3
- package/src/plots/funnel/geometries/compare.ts +50 -41
- package/src/plots/funnel/index.ts +1 -0
- package/src/plots/funnel/interactions/funnel-conversion-tag.ts +57 -0
- package/src/plots/funnel/interactions/index.ts +11 -0
- package/src/plots/funnel/types.ts +1 -0
- package/src/plots/gauge/utils.ts +5 -4
- package/src/plots/heatmap/adaptor.ts +10 -11
- package/src/plots/histogram/adaptor.ts +2 -0
- package/src/plots/pie/adaptor.ts +3 -1
- package/src/plots/pie/types.ts +6 -1
- package/src/plots/progress/adaptor.ts +1 -2
- package/src/plots/progress/utils.ts +4 -1
- package/src/plots/sankey/adaptor.ts +2 -11
- package/src/plots/stock/utils.ts +4 -3
- package/src/plots/violin/adaptor.ts +2 -11
- package/src/types/common.ts +5 -3
- package/src/utils/conversion.ts +6 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/view.ts +34 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/violin/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,O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AAC,KAAK,EAAE,UAAC,IAAI;QACrB,mBAAmB;QACnB,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACpB;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAC,CAAW;YAChC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,MAA6B;IACnD,OAAO,IAAI,CACT,KAAK,EACL,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,CACV,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { get, set, omit, each } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { interaction, theme, tooltip, annotation as baseAnnotation } from '../../adaptor/common';\nimport { interval, point, violin } from '../../adaptor/geometries';\nimport { flow, pick, deepAssign, findViewById } from '../../utils';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { ViolinOptions } from './types';\nimport { transformViolinData } from './utils';\nimport {\n MEDIAN_FIELD,\n MEDIAN_VIEW_ID,\n MIN_MAX_FIELD,\n MIN_MAX_VIEW_ID,\n QUANTILE_FIELD,\n QUANTILE_VIEW_ID,\n VIOLIN_SIZE_FIELD,\n VIOLIN_VIEW_ID,\n VIOLIN_Y_FIELD,\n X_FIELD,\n} from './constant';\n\nconst TOOLTIP_FIELDS = ['low', 'high', 'q1', 'q3', 'median'];\n\nconst adjustCfg = [\n {\n type: 'dodge',\n marginRatio: 1 / 32,\n } as const,\n];\n\n/** 处理数据 */\nfunction data(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n chart.data(transformViolinData(options));\n return params;\n}\n\n/** 小提琴轮廓 */\nfunction violinView(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { seriesField, color, shape = 'violin', violinStyle, tooltip, state } = options;\n\n const view = chart.createView({ id: VIOLIN_VIEW_ID });\n violin({\n chart: view,\n options: {\n xField: X_FIELD,\n yField: VIOLIN_Y_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n sizeField: VIOLIN_SIZE_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n violin: {\n style: violinStyle,\n color,\n shape,\n },\n state,\n },\n });\n view.geometries[0].adjust(adjustCfg);\n\n return params;\n}\n\n/** 箱线 */\nfunction boxView(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { seriesField, color, tooltip, box } = options;\n\n // 如果配置 `box` 为 false ,不渲染内部箱线图\n if (box === false) return params;\n\n // 边缘线\n const minMaxView = chart.createView({ id: MIN_MAX_VIEW_ID });\n interval({\n chart: minMaxView,\n options: {\n xField: X_FIELD,\n yField: MIN_MAX_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n interval: {\n color,\n size: 1,\n style: {\n lineWidth: 0,\n },\n },\n },\n });\n minMaxView.geometries[0].adjust(adjustCfg);\n\n // 四分点位\n const quantileView = chart.createView({ id: QUANTILE_VIEW_ID });\n interval({\n chart: quantileView,\n options: {\n xField: X_FIELD,\n yField: QUANTILE_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n interval: {\n color,\n size: 8,\n style: {\n fillOpacity: 1,\n },\n },\n },\n });\n quantileView.geometries[0].adjust(adjustCfg);\n\n // 中位值\n const medianView = chart.createView({ id: MEDIAN_VIEW_ID });\n point({\n chart: medianView,\n options: {\n xField: X_FIELD,\n yField: MEDIAN_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n point: {\n color,\n size: 1,\n style: {\n fill: 'white',\n lineWidth: 0,\n },\n },\n },\n });\n medianView.geometries[0].adjust(adjustCfg);\n\n // 关闭辅助 view 的轴\n quantileView.axis(false);\n minMaxView.axis(false);\n medianView.axis(false);\n\n // 关闭辅助 view 的图例\n medianView.legend(false);\n minMaxView.legend(false);\n quantileView.legend(false);\n\n return params;\n}\n\n/**\n * meta 配置\n */\nfunction meta(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { meta, xAxis, yAxis } = options;\n\n const baseMeta = {};\n\n const scales = deepAssign(baseMeta, meta, {\n [X_FIELD]: {\n sync: true,\n ...pick(xAxis, AXIS_META_CONFIG_KEYS),\n // fix: dodge is not support linear attribute, please use category attribute!\n // 强制 x 轴类型为分类类型\n type: 'cat',\n },\n [VIOLIN_Y_FIELD]: {\n sync: true,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [MIN_MAX_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [QUANTILE_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [MEDIAN_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n });\n\n chart.scale(scales);\n\n return params;\n}\n\n/**\n * axis 配置\n */\nfunction axis(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis } = options;\n\n const view = findViewById(chart, VIOLIN_VIEW_ID);\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n view.axis(X_FIELD, false);\n } else {\n view.axis(X_FIELD, xAxis);\n }\n\n if (yAxis === false) {\n view.axis(VIOLIN_Y_FIELD, false);\n } else {\n view.axis(VIOLIN_Y_FIELD, yAxis);\n }\n\n chart.axis(false);\n\n return params;\n}\n\n/**\n *\n * @param params\n * @returns\n */\nfunction legend(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { legend, seriesField, shape } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else {\n const legendField = seriesField ? seriesField : X_FIELD;\n // fixme 暂不明为啥有描边\n const legendOptions = omit(legend as any, ['selected']);\n if (!shape || !shape.startsWith('hollow')) {\n if (!get(legendOptions, ['marker', 'style', 'lineWidth'])) {\n set(legendOptions, ['marker', 'style', 'lineWidth'], 0);\n }\n }\n chart.legend(legendField, legendOptions);\n // 特殊的处理 fixme G2 层得解决这个问题\n if (get(legend, 'selected')) {\n each(chart.views, (view) => view.legend(legendField, legend));\n }\n }\n\n return params;\n}\n\n/**\n * annotation, apply to violin view.\n * @param params\n * @returns\n */\nfunction annotation(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart } = params;\n\n const violinView = findViewById(chart, VIOLIN_VIEW_ID);\n baseAnnotation()({ ...params, chart: violinView });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.views, (view) => {\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n view.animate(animation);\n } else {\n view.animate(true);\n }\n\n each(view.geometries, (g: Geometry) => {\n g.animate(animation);\n });\n });\n\n return params;\n}\n\n/**\n * 小提琴图适配器\n * @param params\n */\nexport function adaptor(params: Params<ViolinOptions>) {\n return flow(\n theme,\n data,\n violinView,\n boxView,\n meta,\n tooltip,\n axis,\n legend,\n interaction,\n annotation,\n animation\n )(params);\n}\n"]}
|
|
1
|
+
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AgC,CAAC,CAAC;SAC/D;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,MAA6B;IACvC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,IAAM,UAAU,GAAG,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACvD,cAAc,EAAE,uBAAM,MAAM,KAAE,KAAK,EAAE,UAAU,IAAG,CAAC;IAEnD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAA6B;IAC7C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,SAAS,GAAK,OAAO,UAAZ,CAAa;IAE9B,sCAAsC;IACtC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,UAAC,IAAI;QACrB,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,MAA6B;IACnD,OAAO,IAAI,CACT,KAAK,EACL,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,CACV,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { get, set, omit, each } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { interaction, theme, tooltip, annotation as baseAnnotation } from '../../adaptor/common';\nimport { interval, point, violin } from '../../adaptor/geometries';\nimport { flow, pick, deepAssign, findViewById } from '../../utils';\nimport { addViewAnimation } from '../../utils/view';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { ViolinOptions } from './types';\nimport { transformViolinData } from './utils';\nimport {\n MEDIAN_FIELD,\n MEDIAN_VIEW_ID,\n MIN_MAX_FIELD,\n MIN_MAX_VIEW_ID,\n QUANTILE_FIELD,\n QUANTILE_VIEW_ID,\n VIOLIN_SIZE_FIELD,\n VIOLIN_VIEW_ID,\n VIOLIN_Y_FIELD,\n X_FIELD,\n} from './constant';\n\nconst TOOLTIP_FIELDS = ['low', 'high', 'q1', 'q3', 'median'];\n\nconst adjustCfg = [\n {\n type: 'dodge',\n marginRatio: 1 / 32,\n } as const,\n];\n\n/** 处理数据 */\nfunction data(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n chart.data(transformViolinData(options));\n return params;\n}\n\n/** 小提琴轮廓 */\nfunction violinView(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { seriesField, color, shape = 'violin', violinStyle, tooltip, state } = options;\n\n const view = chart.createView({ id: VIOLIN_VIEW_ID });\n violin({\n chart: view,\n options: {\n xField: X_FIELD,\n yField: VIOLIN_Y_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n sizeField: VIOLIN_SIZE_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n violin: {\n style: violinStyle,\n color,\n shape,\n },\n state,\n },\n });\n view.geometries[0].adjust(adjustCfg);\n\n return params;\n}\n\n/** 箱线 */\nfunction boxView(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { seriesField, color, tooltip, box } = options;\n\n // 如果配置 `box` 为 false ,不渲染内部箱线图\n if (box === false) return params;\n\n // 边缘线\n const minMaxView = chart.createView({ id: MIN_MAX_VIEW_ID });\n interval({\n chart: minMaxView,\n options: {\n xField: X_FIELD,\n yField: MIN_MAX_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n interval: {\n color,\n size: 1,\n style: {\n lineWidth: 0,\n },\n },\n },\n });\n minMaxView.geometries[0].adjust(adjustCfg);\n\n // 四分点位\n const quantileView = chart.createView({ id: QUANTILE_VIEW_ID });\n interval({\n chart: quantileView,\n options: {\n xField: X_FIELD,\n yField: QUANTILE_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n interval: {\n color,\n size: 8,\n style: {\n fillOpacity: 1,\n },\n },\n },\n });\n quantileView.geometries[0].adjust(adjustCfg);\n\n // 中位值\n const medianView = chart.createView({ id: MEDIAN_VIEW_ID });\n point({\n chart: medianView,\n options: {\n xField: X_FIELD,\n yField: MEDIAN_FIELD,\n seriesField: seriesField ? seriesField : X_FIELD,\n tooltip: {\n fields: TOOLTIP_FIELDS,\n ...tooltip,\n },\n state: typeof box === 'object' ? box.state : {},\n point: {\n color,\n size: 1,\n style: {\n fill: 'white',\n lineWidth: 0,\n },\n },\n },\n });\n medianView.geometries[0].adjust(adjustCfg);\n\n // 关闭辅助 view 的轴\n quantileView.axis(false);\n minMaxView.axis(false);\n medianView.axis(false);\n\n // 关闭辅助 view 的图例\n medianView.legend(false);\n minMaxView.legend(false);\n quantileView.legend(false);\n\n return params;\n}\n\n/**\n * meta 配置\n */\nfunction meta(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { meta, xAxis, yAxis } = options;\n\n const baseMeta = {};\n\n const scales = deepAssign(baseMeta, meta, {\n [X_FIELD]: {\n sync: true,\n ...pick(xAxis, AXIS_META_CONFIG_KEYS),\n // fix: dodge is not support linear attribute, please use category attribute!\n // 强制 x 轴类型为分类类型\n type: 'cat',\n },\n [VIOLIN_Y_FIELD]: {\n sync: true,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [MIN_MAX_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [QUANTILE_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n [MEDIAN_FIELD]: {\n sync: VIOLIN_Y_FIELD,\n ...pick(yAxis, AXIS_META_CONFIG_KEYS),\n },\n });\n\n chart.scale(scales);\n\n return params;\n}\n\n/**\n * axis 配置\n */\nfunction axis(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis } = options;\n\n const view = findViewById(chart, VIOLIN_VIEW_ID);\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n view.axis(X_FIELD, false);\n } else {\n view.axis(X_FIELD, xAxis);\n }\n\n if (yAxis === false) {\n view.axis(VIOLIN_Y_FIELD, false);\n } else {\n view.axis(VIOLIN_Y_FIELD, yAxis);\n }\n\n chart.axis(false);\n\n return params;\n}\n\n/**\n *\n * @param params\n * @returns\n */\nfunction legend(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { legend, seriesField, shape } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else {\n const legendField = seriesField ? seriesField : X_FIELD;\n // fixme 暂不明为啥有描边\n const legendOptions = omit(legend as any, ['selected']);\n if (!shape || !shape.startsWith('hollow')) {\n if (!get(legendOptions, ['marker', 'style', 'lineWidth'])) {\n set(legendOptions, ['marker', 'style', 'lineWidth'], 0);\n }\n }\n chart.legend(legendField, legendOptions);\n // 特殊的处理 fixme G2 层得解决这个问题\n if (get(legend, 'selected')) {\n each(chart.views, (view) => view.legend(legendField, legend));\n }\n }\n\n return params;\n}\n\n/**\n * annotation, apply to violin view.\n * @param params\n * @returns\n */\nfunction annotation(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart } = params;\n\n const violinView = findViewById(chart, VIOLIN_VIEW_ID);\n baseAnnotation()({ ...params, chart: violinView });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation(params: Params<ViolinOptions>): Params<ViolinOptions> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.views, (view) => {\n addViewAnimation(view, animation);\n });\n\n return params;\n}\n\n/**\n * 小提琴图适配器\n * @param params\n */\nexport function adaptor(params: Params<ViolinOptions>) {\n return flow(\n theme,\n data,\n violinView,\n boxView,\n meta,\n tooltip,\n axis,\n legend,\n interaction,\n annotation,\n animation\n )(params);\n}\n"]}
|
package/esm/types/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Types } from '@antv/g2';
|
|
1
|
+
import { Geometry, Types } from '@antv/g2';
|
|
2
2
|
import { Axis } from './axis';
|
|
3
3
|
import { Label } from './label';
|
|
4
4
|
import { Tooltip } from './tooltip';
|
|
@@ -99,7 +99,7 @@ export declare type Options = {
|
|
|
99
99
|
readonly padding?: number[] | number | 'auto';
|
|
100
100
|
/**
|
|
101
101
|
* @title 画布宽度
|
|
102
|
-
* @description
|
|
102
|
+
* @description 额外增加的 padding 值
|
|
103
103
|
*/
|
|
104
104
|
readonly appendPadding?: number[] | number;
|
|
105
105
|
/**
|
|
@@ -206,7 +206,7 @@ export declare type Options = {
|
|
|
206
206
|
* @title 动画
|
|
207
207
|
* @description 设置图表动画
|
|
208
208
|
*/
|
|
209
|
-
readonly animation?: Animation;
|
|
209
|
+
readonly animation?: Animation | ((type: string, g: Geometry) => Animation) | boolean;
|
|
210
210
|
/**
|
|
211
211
|
* @title 交互
|
|
212
212
|
* @description 设置画布交互行为
|
|
@@ -234,3 +234,4 @@ export declare type Options = {
|
|
|
234
234
|
*/
|
|
235
235
|
readonly defaultInteractions?: string[];
|
|
236
236
|
};
|
|
237
|
+
export declare type RawFields = string[] | ((type: string, field: 'color' | 'shape' | 'size' | 'style') => string[] | never);
|
package/esm/types/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Axis } from './axis';\nimport { Label } from './label';\nimport { Tooltip } from './tooltip';\nimport { Legend } from './legend';\nimport { Interaction } from './interaction';\nimport { Animation } from './animation';\nimport { Annotation } from './annotation';\nimport { State } from './state';\nimport { Slider } from './slider';\nimport { Scrollbar } from './scrollbar';\nimport { ColorAttr, PatternAttr } from './attr';\nimport { Meta } from './meta';\n\n/** annotation position */\nexport type AnnotationPosition = Types.AnnotationPosition;\nexport type RegionPositionBaseOption = Types.RegionPositionBaseOption;\nexport type TextOption = Types.TextOption;\n\n/** 一条数据记录 */\nexport type Datum = Record<string, any>;\n\n/** 一个数据序列 */\nexport type Data = Datum[];\n\n/** 点位置信息 */\nexport type Point = {\n readonly x: number;\n readonly y: number;\n};\n\n/** 描述一个点 x y 位置 */\nexport type Position = [number, number];\n\n/** 一个区域描述 */\nexport type Region = {\n /**\n * @title 开始位置\n * @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly start: Point;\n /**\n * @title 结束位置\n * @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly end: Point;\n};\n\n/** 位置 */\nexport type BBox = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\n\n/** 文字 */\nexport type TextStyle = {\n /**\n * @title 文本大小\n */\n readonly fontSize?: number;\n /**\n * @title 字体系列\n */\n readonly fontFamily?: string;\n /**\n * @title 文本粗细\n */\n readonly fontWeight?: number;\n /**\n * @title 文本行高\n */\n readonly lineHeight?: number;\n /**\n * @title 文本对齐方式\n */\n readonly textAlign?: 'center' | 'left' | 'right';\n /**\n * @title 文本基线\n */\n readonly textBaseline?: 'middle' | 'top' | 'bottom';\n};\n\nexport type Size = {\n readonly width: number;\n readonly height: number;\n};\n\n/** 基础的 Options 配置 */\nexport type Options = {\n /**\n * @title 画布宽度\n */\n readonly width?: number;\n /**\n * @title 画布高度\n */\n readonly height?: number;\n /**\n * @title 自适应\n * @description 画布是否自动适配容器大小,默认为 true\n */\n readonly autoFit?: boolean;\n /**\n * @title 内填充\n * @description 画布的 padding 值,或者开启 'auto'\n */\n readonly padding?: number[] | number | 'auto';\n /**\n * @title 画布宽度\n * @description
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { Axis } from './axis';\nimport { Label } from './label';\nimport { Tooltip } from './tooltip';\nimport { Legend } from './legend';\nimport { Interaction } from './interaction';\nimport { Animation } from './animation';\nimport { Annotation } from './annotation';\nimport { State } from './state';\nimport { Slider } from './slider';\nimport { Scrollbar } from './scrollbar';\nimport { ColorAttr, PatternAttr } from './attr';\nimport { Meta } from './meta';\n\n/** annotation position */\nexport type AnnotationPosition = Types.AnnotationPosition;\nexport type RegionPositionBaseOption = Types.RegionPositionBaseOption;\nexport type TextOption = Types.TextOption;\n\n/** 一条数据记录 */\nexport type Datum = Record<string, any>;\n\n/** 一个数据序列 */\nexport type Data = Datum[];\n\n/** 点位置信息 */\nexport type Point = {\n readonly x: number;\n readonly y: number;\n};\n\n/** 描述一个点 x y 位置 */\nexport type Position = [number, number];\n\n/** 一个区域描述 */\nexport type Region = {\n /**\n * @title 开始位置\n * @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly start: Point;\n /**\n * @title 结束位置\n * @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly end: Point;\n};\n\n/** 位置 */\nexport type BBox = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\n\n/** 文字 */\nexport type TextStyle = {\n /**\n * @title 文本大小\n */\n readonly fontSize?: number;\n /**\n * @title 字体系列\n */\n readonly fontFamily?: string;\n /**\n * @title 文本粗细\n */\n readonly fontWeight?: number;\n /**\n * @title 文本行高\n */\n readonly lineHeight?: number;\n /**\n * @title 文本对齐方式\n */\n readonly textAlign?: 'center' | 'left' | 'right';\n /**\n * @title 文本基线\n */\n readonly textBaseline?: 'middle' | 'top' | 'bottom';\n};\n\nexport type Size = {\n readonly width: number;\n readonly height: number;\n};\n\n/** 基础的 Options 配置 */\nexport type Options = {\n /**\n * @title 画布宽度\n */\n readonly width?: number;\n /**\n * @title 画布高度\n */\n readonly height?: number;\n /**\n * @title 自适应\n * @description 画布是否自动适配容器大小,默认为 true\n */\n readonly autoFit?: boolean;\n /**\n * @title 内填充\n * @description 画布的 padding 值,或者开启 'auto'\n */\n readonly padding?: number[] | number | 'auto';\n /**\n * @title 画布宽度\n * @description 额外增加的 padding 值\n */\n readonly appendPadding?: number[] | number;\n /**\n * @title 额外填充\n * @description 是否同步子 view 的 padding\n */\n readonly syncViewPadding?: boolean | Types.SyncViewPaddingFn;\n\n /**\n * @title 国际化\n * @description 语言配置\n */\n readonly locale?: string;\n\n /**\n * @title 渲染引擎\n * @description 设置渲染引擎,'svg' | 'canvas'\n * @default \"canvas\"\n */\n readonly renderer?: 'svg' | 'canvas';\n /**\n * @title 屏幕像素比\n * @description 默认为 window.devicePixelRatio\n */\n readonly pixelRatio?: number;\n /**\n * @title 是否启局部渲染\n * @description 是否开启局部渲染,默认为 true\n * @default true\n */\n readonly localRefresh?: boolean;\n /**\n * @title 是否支持 CSS transform\n * @description 开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。\n * @default false\n */\n readonly supportCSSTransform?: boolean;\n /**\n * @title 是否开启 label 延迟渲染\n * @description 开启后 label 渲染会在浏览器空闲时机执行。可制定具体 number 数值,来限定 timeout 时间 (建议开启时,指定 timeout 时间)\n * @default false\n */\n readonly useDeferredLabel?: boolean | number;\n\n /**\n * @title 数据\n * @description 设置画布具体的数据\n */\n readonly data: Record<string, any>[];\n /**\n * @title 数据字段元信息\n * @description 设置数据字段元信息\n */\n readonly meta?: Record<string, Meta>;\n\n // G2 相关\n /**\n * @title 主题\n * @description G2 主题,字符串或者 theme object\n * @default \"light\"\n */\n readonly theme?: string | object;\n /**\n * @title 颜色色板\n * @description 设置颜色色板\n */\n readonly color?: ColorAttr;\n /**\n * @title pattern 配置\n * @description 设置图表 pattern\n */\n readonly pattern?: PatternAttr;\n /**\n * @title 横坐标\n * @description 设置画布横坐标的配置项\n */\n readonly xAxis?: Axis;\n /**\n * @title 纵坐标\n * @description 设置画布纵坐标的配置项\n */\n readonly yAxis?: Axis;\n /**\n * @title 数据标签\n * @description 设置数据标签\n */\n readonly label?: Label;\n /**\n * @title tooltip 提示\n * @description 设置画布 tooltip 的配置项\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例\n * @description 设置画布图例 legend 的配置项\n */\n readonly legend?: Legend;\n /**\n * @title 缩略轴\n * @description 设置缩略轴 slider 的配置项\n */\n readonly slider?: Slider;\n /**\n * @title 滚动条\n * @description 设置画布缩略轴 scrollbar 的配置项\n */\n readonly scrollbar?: Scrollbar;\n /**\n * @title 动画\n * @description 设置图表动画\n */\n readonly animation?: Animation | ((type: string, g: Geometry) => Animation) | boolean;\n /**\n * @title 交互\n * @description 设置画布交互行为\n */\n readonly interactions?: Interaction[];\n /**\n * @title 注解\n * @description 设置画布注解\n */\n readonly annotations?: Annotation[];\n /**\n * @title 图表状态\n * @description 设置画布配置 active,inactive,selected 三种状态的样式,也可在 Theme 主题中配置\n */\n readonly state?: State;\n /**\n * @title 是否裁剪\n * @description 是否对超出坐标系范围的 Geometry 进行剪切\n */\n readonly limitInPlot?: boolean;\n /**\n * @title 内置交互\n * @description 内置注册的交互\n * @deprecated false\n */\n readonly defaultInteractions?: string[];\n};\n\nexport type RawFields = string[] | ((type: string, field: 'color' | 'shape' | 'size' | 'style') => string[] | never);\n"]}
|
package/esm/utils/conversion.js
CHANGED
|
@@ -8,15 +8,16 @@ export function conversionTagFormatter(prev, next) {
|
|
|
8
8
|
if (!isNumber(prev) || !isNumber(next)) {
|
|
9
9
|
return '-';
|
|
10
10
|
}
|
|
11
|
+
// 0 / 0 没有意义
|
|
12
|
+
if (prev === 0 && next === 0) {
|
|
13
|
+
return '-';
|
|
14
|
+
}
|
|
11
15
|
if (prev === next) {
|
|
12
16
|
return '100%';
|
|
13
17
|
}
|
|
14
18
|
if (prev === 0) {
|
|
15
19
|
return '∞';
|
|
16
20
|
}
|
|
17
|
-
if (next === 0) {
|
|
18
|
-
return '-∞';
|
|
19
|
-
}
|
|
20
21
|
return ((100 * next) / prev).toFixed(2) + "%";
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=conversion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,IAAY;IAC/D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACtC,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,IAAI,KAAK,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,IAAY;IAC/D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACtC,OAAO,GAAG,CAAC;KACZ;IAED,aAAa;IACb,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,IAAI,KAAK,CAAC,EAAE;QACd,OAAO,GAAG,CAAC;KACZ;IAED,OAAU,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,CAAC;AAChD,CAAC","sourcesContent":["import { isNumber } from '@antv/util';\n/**\n * 转化率的计算方式\n * @param prev\n * @param next\n */\nexport function conversionTagFormatter(prev: number, next: number): string {\n if (!isNumber(prev) || !isNumber(next)) {\n return '-';\n }\n\n // 0 / 0 没有意义\n if (prev === 0 && next === 0) {\n return '-';\n }\n\n if (prev === next) {\n return '100%';\n }\n\n if (prev === 0) {\n return '∞';\n }\n\n return `${((100 * next) / prev).toFixed(2)}%`;\n}\n"]}
|
package/esm/utils/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export { kebabCase } from './kebab-case';
|
|
|
12
12
|
export { renderStatistic, renderGaugeStatistic } from './statistic';
|
|
13
13
|
export { measureTextWidth } from './measure-text';
|
|
14
14
|
export { isBetween, isRealNumber } from './number';
|
|
15
|
+
export { addViewAnimation } from './view';
|
|
15
16
|
export * from './data';
|
|
16
17
|
export * from './padding';
|
package/esm/utils/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { kebabCase } from './kebab-case';
|
|
|
12
12
|
export { renderStatistic, renderGaugeStatistic } from './statistic';
|
|
13
13
|
export { measureTextWidth } from './measure-text';
|
|
14
14
|
export { isBetween, isRealNumber } from './number';
|
|
15
|
+
export { addViewAnimation } from './view';
|
|
15
16
|
export * from './data';
|
|
16
17
|
export * from './padding';
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/esm/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC","sourcesContent":["export { flow } from './flow';\nexport { pick } from './pick';\nexport { template } from './template';\nexport { log, invariant, LEVEL } from './invariant';\nexport { getContainerSize } from './dom';\nexport * from './geometry';\nexport { findViewById, getViews, getSiblingViews } from './view';\nexport { transformLabel } from './label';\nexport { getSplinePath } from './path';\nexport { deepAssign } from './deep-assign';\nexport { kebabCase } from './kebab-case';\nexport { renderStatistic, renderGaugeStatistic } from './statistic';\nexport { measureTextWidth } from './measure-text';\nexport { isBetween, isRealNumber } from './number';\nexport * from './data';\nexport * from './padding';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC","sourcesContent":["export { flow } from './flow';\nexport { pick } from './pick';\nexport { template } from './template';\nexport { log, invariant, LEVEL } from './invariant';\nexport { getContainerSize } from './dom';\nexport * from './geometry';\nexport { findViewById, getViews, getSiblingViews } from './view';\nexport { transformLabel } from './label';\nexport { getSplinePath } from './path';\nexport { deepAssign } from './deep-assign';\nexport { kebabCase } from './kebab-case';\nexport { renderStatistic, renderGaugeStatistic } from './statistic';\nexport { measureTextWidth } from './measure-text';\nexport { isBetween, isRealNumber } from './number';\nexport { addViewAnimation } from './view';\nexport * from './data';\nexport * from './padding';\n"]}
|
package/esm/utils/view.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { View } from '@antv/g2';
|
|
1
|
+
import { Geometry, View, Types } from '@antv/g2';
|
|
2
|
+
import { Options } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* 在 Chart 中查找特定 id 的子 View
|
|
4
5
|
* @param chart
|
|
@@ -19,3 +20,9 @@ export declare function getViews(view: View): View[];
|
|
|
19
20
|
* @ignore
|
|
20
21
|
*/
|
|
21
22
|
export declare function getSiblingViews(view: View): View[];
|
|
23
|
+
/**
|
|
24
|
+
* 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调
|
|
25
|
+
* @param view View
|
|
26
|
+
* @param animation 动画配置
|
|
27
|
+
*/
|
|
28
|
+
export declare function addViewAnimation(view: View, animation: Options['animation'], geometries?: Geometry<Types.ShapePoint>[]): void;
|
package/esm/utils/view.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { each, isFunction } from '@antv/util';
|
|
1
2
|
/**
|
|
2
3
|
* 在 Chart 中查找特定 id 的子 View
|
|
3
4
|
* @param chart
|
|
@@ -25,4 +26,30 @@ export function getViews(view) {
|
|
|
25
26
|
export function getSiblingViews(view) {
|
|
26
27
|
return getViews(view).filter(function (sub) { return sub !== view; });
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调
|
|
31
|
+
* @param view View
|
|
32
|
+
* @param animation 动画配置
|
|
33
|
+
*/
|
|
34
|
+
export function addViewAnimation(view, animation, geometries) {
|
|
35
|
+
if (geometries === void 0) { geometries = view.geometries; }
|
|
36
|
+
// 同时设置整个 view 动画选项
|
|
37
|
+
if (typeof animation === 'boolean') {
|
|
38
|
+
view.animate(animation);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
view.animate(true);
|
|
42
|
+
}
|
|
43
|
+
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
44
|
+
each(geometries, function (g) {
|
|
45
|
+
var animationCfg;
|
|
46
|
+
if (isFunction(animation)) {
|
|
47
|
+
animationCfg = animation(g.type || g.shapeType, g) || true;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
animationCfg = animation;
|
|
51
|
+
}
|
|
52
|
+
g.animate(animationCfg);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
28
55
|
//# sourceMappingURL=view.js.map
|
package/esm/utils/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAW,EAAE,EAAU;IAClD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,IAAU,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU;IACjC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,KAAK,IAAI,EAAZ,CAAY,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAU,EACV,SAA+B,EAC/B,UAA0D;IAA1D,2BAAA,EAAA,aAA2C,IAAI,CAAC,UAAU;IAE1D,mBAAmB;IACnB,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE;QAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACzB;SAAM;QACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,sCAAsC;IACtC,IAAI,CAAC,UAAU,EAAE,UAAC,CAAW;QAC3B,IAAI,YAAY,CAAC;QACjB,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE;YACzB,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;SAC5D;aAAM;YACL,YAAY,GAAG,SAAS,CAAC;SAC1B;QAED,CAAC,CAAC,OAAO,CAAC,YAAyB,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Geometry, View, Types } from '@antv/g2';\nimport { each, isFunction } from '@antv/util';\nimport { Options } from '../types';\nimport { Animation } from '../types/animation';\n\n/**\n * 在 Chart 中查找特定 id 的子 View\n * @param chart\n * @param id\n */\nexport function findViewById(chart: View, id: string): View {\n return chart.views.find((view: View) => view.id === id);\n}\n\n/**\n * 获取同 view 同一级的所有 views\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getViews(view: View): View[] {\n const parent = view.parent;\n return parent ? parent.views : [];\n}\n\n/**\n * 获取同 view 同一级的 views,不包括自身\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getSiblingViews(view: View): View[] {\n return getViews(view).filter((sub) => sub !== view);\n}\n\n/**\n * 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调\n * @param view View\n * @param animation 动画配置\n */\nexport function addViewAnimation(\n view: View,\n animation: Options['animation'],\n geometries: Geometry<Types.ShapePoint>[] = view.geometries\n) {\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n view.animate(animation);\n } else {\n view.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(geometries, (g: Geometry) => {\n let animationCfg;\n if (isFunction(animation)) {\n animationCfg = animation(g.type || g.shapeType, g) || true;\n } else {\n animationCfg = animation;\n }\n\n g.animate(animationCfg as Animation);\n });\n}\n"]}
|
package/lib/adaptor/common.js
CHANGED
|
@@ -59,17 +59,8 @@ exports.interaction = interaction;
|
|
|
59
59
|
function animation(params) {
|
|
60
60
|
var chart = params.chart, options = params.options;
|
|
61
61
|
var animation = options.animation;
|
|
62
|
-
// 同时设置整个 view 动画选项
|
|
63
|
-
if (typeof animation === 'boolean') {
|
|
64
|
-
chart.animate(animation);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
chart.animate(true);
|
|
68
|
-
}
|
|
69
62
|
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
70
|
-
|
|
71
|
-
g.animate(animation);
|
|
72
|
-
});
|
|
63
|
+
utils_1.addViewAnimation(chart, animation);
|
|
73
64
|
return params;
|
|
74
65
|
}
|
|
75
66
|
exports.animation = animation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAMnD,wCAAoD;AACpD,kCAA4C;AAE5C;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,IAAI,WAAW,EAAE;QACpC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,WAAW,EAAE,MAAM,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAqC,MAAiB;IACnE,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACxB;I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AO,SAAA,EAAE,CAAC,CAAC;SACrD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,0CAqBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Transformations } from '../types/coordinate';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\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 // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.geometries, (g: Geometry) => {\n g.animate(animation);\n });\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\n/**\n * 坐标系转换\n */\nexport function transformations(coordinateType: Types.CoordinateOption['type'] = 'rect') {\n return (params: Params<Options & { coordinate: Transformations }>) => {\n const { chart, options } = params;\n const { coordinate } = options;\n\n const actions: Types.CoordinateActions[] = Array.from(coordinate || [])\n .map((cfg) => {\n if (cfg.type === 'reflectX') return ['reflect', 'x'] as Types.CoordinateActions;\n if (cfg.type === 'reflectY') return ['reflect', 'y'] as Types.CoordinateActions;\n if (cfg.type === 'transpose') return ['transpose'] as Types.CoordinateActions;\n\n return null;\n })\n .filter((d) => !!d);\n\n if (actions.length !== 0) {\n chart.coordinate({ type: coordinateType, actions });\n }\n\n return params;\n };\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAMnD,wCAAoD;AACpD,kCAA8D;AAE9D;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,I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C,CAAC,CAAC,EAAH,CAAG,CAAC,CAAC;QAEtB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;SACrD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,0CAqBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Transformations } from '../types/coordinate';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign, addViewAnimation } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n addViewAnimation(chart, animation);\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\n/**\n * 坐标系转换\n */\nexport function transformations(coordinateType: Types.CoordinateOption['type'] = 'rect') {\n return (params: Params<Options & { coordinate: Transformations }>) => {\n const { chart, options } = params;\n const { coordinate } = options;\n\n const actions: Types.CoordinateActions[] = Array.from(coordinate || [])\n .map((cfg) => {\n if (cfg.type === 'reflectX') return ['reflect', 'x'] as Types.CoordinateActions;\n if (cfg.type === 'reflectY') return ['reflect', 'y'] as Types.CoordinateActions;\n if (cfg.type === 'transpose') return ['transpose'] as Types.CoordinateActions;\n\n return null;\n })\n .filter((d) => !!d);\n\n if (actions.length !== 0) {\n chart.coordinate({ type: coordinateType, actions });\n }\n\n return params;\n };\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Params } from '../../core/adaptor';
|
|
2
|
-
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum } from '../../types';
|
|
2
|
+
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum, RawFields } from '../../types';
|
|
3
3
|
import { Label } from '../../types/label';
|
|
4
4
|
import { State } from '../../types/state';
|
|
5
5
|
/**
|
|
@@ -39,7 +39,7 @@ export declare type Geometry = {
|
|
|
39
39
|
/** tooltip 的映射字段 */
|
|
40
40
|
readonly tooltipFields?: string[] | false;
|
|
41
41
|
/** 其他原始字段, 用于 mapping 回调参数 */
|
|
42
|
-
readonly rawFields?:
|
|
42
|
+
readonly rawFields?: RawFields;
|
|
43
43
|
/** 图形映射规则 */
|
|
44
44
|
readonly mapping?: MappingOptions;
|
|
45
45
|
/** label 映射通道,因为历史原因导致实现略有区别 */
|
|
@@ -10,8 +10,10 @@ var utils_1 = require("../../utils");
|
|
|
10
10
|
* @param field
|
|
11
11
|
*/
|
|
12
12
|
function getMappingField(o, field) {
|
|
13
|
-
var type = o.type, xField = o.xField, yField = o.yField, colorField = o.colorField, shapeField = o.shapeField, sizeField = o.sizeField, styleField = o.styleField
|
|
13
|
+
var type = o.type, xField = o.xField, yField = o.yField, colorField = o.colorField, shapeField = o.shapeField, sizeField = o.sizeField, styleField = o.styleField;
|
|
14
|
+
var rawFields = o.rawFields;
|
|
14
15
|
var fields = [];
|
|
16
|
+
rawFields = (util_1.isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];
|
|
15
17
|
// 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效
|
|
16
18
|
// 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields
|
|
17
19
|
// shape, size 同理
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;AAAA,mCAAqF;AAKrF,qCAA6C;AA0D7C;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoF,CAAC,KAArF,EAAE,MAAM,GAA4E,CAAC,OAA7E,EAAE,MAAM,GAAoE,CAAC,OAArE,EAAE,UAAU,GAAwD,CAAC,WAAzD,EAAE,UAAU,GAA4C,CAAC,WAA7C,EAAE,SAAS,GAAiC,CAAC,UAAlC,EAAE,UAAU,GAAqB,CAAC,WAAtB,EAAE,KAAmB,CAAC,UAAN,EAAd,SAAS,mBAAG,EAAE,KAAA,CAA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AC,EAAE,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;KACvF;IAED;;OAEG;IACH,IAAI,KAAK,KAAK,KAAK,EAAE;QACnB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;SAAM,IAAI,KAAK,EAAE;QACR,IAAA,QAAQ,GAAqB,KAAK,SAA1B,EAAE,MAAM,GAAa,KAAK,OAAlB,EAAK,GAAG,kBAAK,KAAK,EAApC,sBAA4B,CAAF,CAAW;QAC3C,QAAQ,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC;YAC1B,QAAQ,UAAA;YACR,GAAG,EAAE,sBAAc,CAAC,GAAG,CAAC;SACzB,CAAC,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,KAAK,EAAE;QACT,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;IAED;;OAEG;IACH,IAAI,UAAU,EAAE;QACd,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACjC;IAED,2BAA2B;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AAzID,4BAyIC","sourcesContent":["import { uniq, isFunction, isObject, isString, isNumber, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: string[];\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField, rawFields = [] } = o;\n\n let fields = [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;AAAA,mCAAqF;AAKrF,qCAA6C;AA0D7C;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoE,CAAC,KAArE,EAAE,MAAM,GAA4D,CAAC,OAA7D,EAAE,MAAM,GAAoD,CAAC,OAArD,EAAE,UAAU,GAAwC,CAAC,WAAzC,EAAE,UAAU,GAA4B,CAAC,WAA7B,EAAE,SAAS,GAAiB,CAAC,UAAlB,EAAE,UAAU,GAAK,CAAC,WAAN,CAAO;IAC5E,IAAA,SAAS,GAAK,CAAC,UAAN,CAAO;IAEtB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,SAAS,GAAG,CAAC,iBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAE/E,4DAA4D;IAC5D,gDAAgD;IAChD,iBAAiB;IACjB,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,MAAM,2BAAI,UAAU,IAAI,MAAM,GAAK,SAAS,CAAC,CAAC;KAC/C;SAAM,IAAI,KAAK,KAAK,OAAO,EAAE;QAC5B,MAAM,2BAAI,UAAU,IAAI,MAAM,GAAK,SAAS,CAAC,CAAC;KAC/C;SAAM,IAAI,KAAK,KAAK,MAAM,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Q,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC;YAC1B,QAAQ,UAAA;YACR,GAAG,EAAE,sBAAc,CAAC,GAAG,CAAC;SACzB,CAAC,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,KAAK,EAAE;QACT,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;IAED;;OAEG;IACH,IAAI,UAAU,EAAE;QACd,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACjC;IAED,2BAA2B;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AAzID,4BAyIC","sourcesContent":["import { uniq, isFunction, isObject, isString, isNumber, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum, RawFields } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
|
package/lib/adaptor/pattern.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ import { Options } from '../types';
|
|
|
7
7
|
* @param key key of style property
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "
|
|
10
|
+
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "color" | "animation" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state"> = Pick<Options, "label" | "legend" | "meta" | "padding" | "color" | "animation" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state">>(params: Params<O>) => Params<O>;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.adaptors = exports.registerLocale = exports.G2 = exports.version = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
exports.version = '2.4.
|
|
5
|
+
exports.version = '2.4.22';
|
|
6
6
|
// G2 自定义能力透出
|
|
7
7
|
var G2 = tslib_1.__importStar(require("@antv/g2"));
|
|
8
8
|
exports.G2 = G2;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,Q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tC,gGAAA,GAAG,OAAa;AAEzB,oBAAoB;AACpB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.20';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAElB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAKb,SAAS;AACT,kDAAwB;AAExB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uDAAuD;AACvD,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,0DAA0D;AAC1D,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,uEAAuE;AACvE,qCAAoC;AAA3B,4FAAA,IAAI,OAAA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2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
package/lib/plots/box/adaptor.js
CHANGED
|
@@ -149,7 +149,7 @@ exports.legend = legend;
|
|
|
149
149
|
* @param params
|
|
150
150
|
*/
|
|
151
151
|
function adaptor(params) {
|
|
152
|
-
return utils_1.flow(field, outliersPoint, meta, axis, legend, common_1.tooltip, common_1.interaction, common_1.animation, common_1.theme)(params);
|
|
152
|
+
return utils_1.flow(field, outliersPoint, meta, axis, legend, common_1.tooltip, common_1.annotation(), common_1.interaction, common_1.animation, common_1.theme)(params);
|
|
153
153
|
}
|
|
154
154
|
exports.adaptor = adaptor;
|
|
155
155
|
//# sourceMappingURL=adaptor.js.map
|