@visactor/vchart 1.4.0-alpha.7 → 1.4.0-beta.2
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/build/es5/index.js +1 -1
- package/build/index.js +1058 -677
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base-chart.d.ts +7 -5
- package/cjs/chart/base-chart.js +42 -71
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/chart-meta/data.d.ts +15 -0
- package/cjs/chart/chart-meta/data.js +52 -0
- package/cjs/chart/chart-meta/data.js.map +1 -0
- package/cjs/chart/interface/chart.d.ts +0 -1
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/progress/circular/circular.js +2 -1
- package/cjs/chart/progress/circular/circular.js.map +1 -1
- package/cjs/chart/sequence/sequence.d.ts +1 -0
- package/cjs/chart/sequence/sequence.js +24 -20
- package/cjs/chart/sequence/sequence.js.map +1 -1
- package/cjs/chart/util.d.ts +2 -0
- package/cjs/chart/util.js +8 -2
- package/cjs/chart/util.js.map +1 -1
- package/cjs/compile/compiler.d.ts +1 -1
- package/cjs/compile/compiler.js +3 -3
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/data/compilable-data.js +2 -2
- package/cjs/compile/data/compilable-data.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +1 -2
- package/cjs/component/axis/base-axis.js +3 -3
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +1 -8
- package/cjs/component/axis/cartesian/axis.js +3 -6
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/interface.d.ts +1 -0
- package/cjs/component/axis/interface.js.map +1 -1
- package/cjs/component/base/base-component.d.ts +2 -2
- package/cjs/component/base/base-component.js +10 -6
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/brush/brush.d.ts +1 -2
- package/cjs/component/brush/brush.js +3 -3
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +1 -2
- package/cjs/component/crosshair/base.js +4 -3
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/crosshair/interface/spec.d.ts +1 -1
- package/cjs/component/crosshair/interface/spec.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.d.ts +1 -2
- package/cjs/component/custom-mark/custom-mark.js +4 -4
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -2
- package/cjs/component/data-zoom/data-filter-base-component.js +4 -3
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -0
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +5 -0
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/cjs/component/label/base-label.d.ts +1 -2
- package/cjs/component/label/base-label.js +5 -4
- package/cjs/component/label/base-label.js.map +1 -1
- package/cjs/component/label/label.js +3 -2
- package/cjs/component/label/label.js.map +1 -1
- package/cjs/component/legend/base-legend.d.ts +1 -2
- package/cjs/component/legend/base-legend.js +5 -4
- package/cjs/component/legend/base-legend.js.map +1 -1
- package/cjs/component/legend/interface.d.ts +1 -0
- package/cjs/component/legend/interface.js.map +1 -1
- package/cjs/component/title/title.d.ts +1 -2
- package/cjs/component/title/title.js +4 -4
- package/cjs/component/title/title.js.map +1 -1
- package/cjs/component/tooltip/handler/base.d.ts +2 -1
- package/cjs/component/tooltip/handler/base.js +127 -49
- package/cjs/component/tooltip/handler/base.js.map +1 -1
- package/cjs/component/tooltip/handler/utils/position.d.ts +6 -0
- package/cjs/component/tooltip/handler/utils/position.js +31 -3
- package/cjs/component/tooltip/handler/utils/position.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interface.d.ts +4 -4
- package/cjs/core/interface.js.map +1 -1
- package/cjs/core/vchart.d.ts +3 -2
- package/cjs/core/vchart.js +52 -30
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/initialize.d.ts +1 -0
- package/cjs/data/initialize.js +6 -2
- package/cjs/data/initialize.js.map +1 -1
- package/cjs/data/transforms/link-dot-info.d.ts +13 -0
- package/cjs/data/transforms/link-dot-info.js +26 -0
- package/cjs/data/transforms/link-dot-info.js.map +1 -0
- package/cjs/data/transforms/obj-flat.js +2 -1
- package/cjs/data/transforms/obj-flat.js.map +1 -1
- package/cjs/event/events/dimension/util/common.js +16 -6
- package/cjs/event/events/dimension/util/common.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +0 -1
- package/cjs/mark/base/base-mark.js +1 -4
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/model/base-model.d.ts +8 -1
- package/cjs/model/base-model.js +14 -9
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +0 -1
- package/cjs/model/interface.js.map +1 -1
- package/cjs/region/region.d.ts +1 -2
- package/cjs/region/region.js +4 -4
- package/cjs/region/region.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +0 -8
- package/cjs/series/bar/bar.js +0 -5
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +4 -2
- package/cjs/series/base/base-series.js +26 -17
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/cartesian/cartesian.d.ts +0 -8
- package/cjs/series/cartesian/cartesian.js +0 -5
- package/cjs/series/cartesian/cartesian.js.map +1 -1
- package/cjs/series/dot/dot.d.ts +2 -0
- package/cjs/series/dot/dot.js +8 -3
- package/cjs/series/dot/dot.js.map +1 -1
- package/cjs/series/funnel/funnel.d.ts +0 -8
- package/cjs/series/funnel/funnel.js +0 -15
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/cjs/series/heatmap/heatmap.d.ts +0 -8
- package/cjs/series/heatmap/heatmap.js +0 -5
- package/cjs/series/heatmap/heatmap.js.map +1 -1
- package/cjs/series/interface/common.d.ts +1 -0
- package/cjs/series/interface/common.js.map +1 -1
- package/cjs/series/link/link.d.ts +1 -0
- package/cjs/series/link/link.js +18 -20
- package/cjs/series/link/link.js.map +1 -1
- package/cjs/series/map/map.d.ts +0 -8
- package/cjs/series/map/map.js +0 -5
- package/cjs/series/map/map.js.map +1 -1
- package/cjs/series/pie/pie.d.ts +3 -2
- package/cjs/series/pie/pie.js +9 -3
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/series/polar/polar.d.ts +0 -8
- package/cjs/series/polar/polar.js +0 -5
- package/cjs/series/polar/polar.js.map +1 -1
- package/cjs/series/polar/progress-like/progress-like.js +18 -24
- package/cjs/series/polar/progress-like/progress-like.js.map +1 -1
- package/cjs/series/sankey/interface.d.ts +1 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.d.ts +2 -0
- package/cjs/series/sankey/sankey.js +25 -13
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/series/word-cloud/base.d.ts +0 -8
- package/cjs/series/word-cloud/base.js +2 -7
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/series/word-cloud/config.d.ts +1 -1
- package/cjs/series/word-cloud/config.js +1 -1
- package/cjs/series/word-cloud/config.js.map +1 -1
- package/cjs/theme/builtin/common/component/tooltip.js +1 -0
- package/cjs/theme/builtin/common/component/tooltip.js.map +1 -1
- package/cjs/theme/builtin/common/series/circular-progress.js +6 -0
- package/cjs/theme/builtin/common/series/circular-progress.js.map +1 -1
- package/cjs/theme/builtin/common/series/gauge.js +6 -0
- package/cjs/theme/builtin/common/series/gauge.js.map +1 -1
- package/cjs/theme/builtin/common/series/pie.js +1 -0
- package/cjs/theme/builtin/common/series/pie.js.map +1 -1
- package/cjs/theme/builtin/common/series/rose.js +1 -0
- package/cjs/theme/builtin/common/series/rose.js.map +1 -1
- package/cjs/typings/tooltip/position.d.ts +13 -1
- package/cjs/typings/tooltip/position.js +11 -5
- package/cjs/typings/tooltip/position.js.map +1 -1
- package/cjs/typings/tooltip/tooltip.d.ts +2 -1
- package/cjs/typings/tooltip/tooltip.js.map +1 -1
- package/cjs/typings/visual.d.ts +1 -0
- package/cjs/typings/visual.js.map +1 -1
- package/esm/chart/base-chart.d.ts +7 -5
- package/esm/chart/base-chart.js +44 -74
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/chart-meta/data.d.ts +15 -0
- package/esm/chart/chart-meta/data.js +48 -0
- package/esm/chart/chart-meta/data.js.map +1 -0
- package/esm/chart/interface/chart.d.ts +0 -1
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/progress/circular/circular.js +2 -1
- package/esm/chart/progress/circular/circular.js.map +1 -1
- package/esm/chart/sequence/sequence.d.ts +1 -0
- package/esm/chart/sequence/sequence.js +25 -21
- package/esm/chart/sequence/sequence.js.map +1 -1
- package/esm/chart/util.d.ts +2 -0
- package/esm/chart/util.js +6 -0
- package/esm/chart/util.js.map +1 -1
- package/esm/compile/compiler.d.ts +1 -1
- package/esm/compile/compiler.js +3 -3
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/data/compilable-data.js +2 -2
- package/esm/compile/data/compilable-data.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +1 -2
- package/esm/component/axis/base-axis.js +3 -3
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +1 -8
- package/esm/component/axis/cartesian/axis.js +3 -6
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/interface.d.ts +1 -0
- package/esm/component/axis/interface.js.map +1 -1
- package/esm/component/base/base-component.d.ts +2 -2
- package/esm/component/base/base-component.js +11 -5
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/brush/brush.d.ts +1 -2
- package/esm/component/brush/brush.js +3 -3
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +1 -2
- package/esm/component/crosshair/base.js +5 -4
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/crosshair/interface/spec.d.ts +1 -1
- package/esm/component/crosshair/interface/spec.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.d.ts +1 -2
- package/esm/component/custom-mark/custom-mark.js +3 -3
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -2
- package/esm/component/data-zoom/data-filter-base-component.js +5 -4
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -0
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js +5 -0
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/esm/component/label/base-label.d.ts +1 -2
- package/esm/component/label/base-label.js +6 -3
- package/esm/component/label/base-label.js.map +1 -1
- package/esm/component/label/label.js +4 -3
- package/esm/component/label/label.js.map +1 -1
- package/esm/component/legend/base-legend.d.ts +1 -2
- package/esm/component/legend/base-legend.js +4 -4
- package/esm/component/legend/base-legend.js.map +1 -1
- package/esm/component/legend/interface.d.ts +1 -0
- package/esm/component/legend/interface.js.map +1 -1
- package/esm/component/title/title.d.ts +1 -2
- package/esm/component/title/title.js +4 -4
- package/esm/component/title/title.js.map +1 -1
- package/esm/component/tooltip/handler/base.d.ts +2 -1
- package/esm/component/tooltip/handler/base.js +122 -49
- package/esm/component/tooltip/handler/base.js.map +1 -1
- package/esm/component/tooltip/handler/utils/position.d.ts +6 -0
- package/esm/component/tooltip/handler/utils/position.js +28 -0
- package/esm/component/tooltip/handler/utils/position.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/interface.d.ts +4 -4
- package/esm/core/interface.js.map +1 -1
- package/esm/core/vchart.d.ts +3 -2
- package/esm/core/vchart.js +53 -31
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/initialize.d.ts +1 -0
- package/esm/data/initialize.js +4 -0
- package/esm/data/initialize.js.map +1 -1
- package/esm/data/transforms/link-dot-info.d.ts +13 -0
- package/esm/data/transforms/link-dot-info.js +18 -0
- package/esm/data/transforms/link-dot-info.js.map +1 -0
- package/esm/data/transforms/obj-flat.js +2 -1
- package/esm/data/transforms/obj-flat.js.map +1 -1
- package/esm/event/events/dimension/util/common.js +17 -7
- package/esm/event/events/dimension/util/common.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +0 -1
- package/esm/mark/base/base-mark.js +2 -5
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/model/base-model.d.ts +8 -1
- package/esm/model/base-model.js +13 -8
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +0 -1
- package/esm/model/interface.js.map +1 -1
- package/esm/region/region.d.ts +1 -2
- package/esm/region/region.js +5 -5
- package/esm/region/region.js.map +1 -1
- package/esm/series/bar/bar.d.ts +0 -8
- package/esm/series/bar/bar.js +0 -5
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +4 -2
- package/esm/series/base/base-series.js +24 -17
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/cartesian/cartesian.d.ts +0 -8
- package/esm/series/cartesian/cartesian.js +1 -6
- package/esm/series/cartesian/cartesian.js.map +1 -1
- package/esm/series/dot/dot.d.ts +2 -0
- package/esm/series/dot/dot.js +8 -3
- package/esm/series/dot/dot.js.map +1 -1
- package/esm/series/funnel/funnel.d.ts +0 -8
- package/esm/series/funnel/funnel.js +1 -16
- package/esm/series/funnel/funnel.js.map +1 -1
- package/esm/series/heatmap/heatmap.d.ts +0 -8
- package/esm/series/heatmap/heatmap.js +0 -5
- package/esm/series/heatmap/heatmap.js.map +1 -1
- package/esm/series/interface/common.d.ts +1 -0
- package/esm/series/interface/common.js.map +1 -1
- package/esm/series/link/link.d.ts +1 -0
- package/esm/series/link/link.js +19 -19
- package/esm/series/link/link.js.map +1 -1
- package/esm/series/map/map.d.ts +0 -8
- package/esm/series/map/map.js +0 -5
- package/esm/series/map/map.js.map +1 -1
- package/esm/series/pie/pie.d.ts +3 -2
- package/esm/series/pie/pie.js +9 -3
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/series/polar/polar.d.ts +0 -8
- package/esm/series/polar/polar.js +1 -6
- package/esm/series/polar/polar.js.map +1 -1
- package/esm/series/polar/progress-like/progress-like.js +18 -25
- package/esm/series/polar/progress-like/progress-like.js.map +1 -1
- package/esm/series/sankey/interface.d.ts +1 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.d.ts +2 -0
- package/esm/series/sankey/sankey.js +22 -12
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/series/word-cloud/base.d.ts +0 -8
- package/esm/series/word-cloud/base.js +3 -8
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/series/word-cloud/config.d.ts +1 -1
- package/esm/series/word-cloud/config.js +1 -1
- package/esm/series/word-cloud/config.js.map +1 -1
- package/esm/theme/builtin/common/component/tooltip.js +1 -0
- package/esm/theme/builtin/common/component/tooltip.js.map +1 -1
- package/esm/theme/builtin/common/series/circular-progress.js +6 -0
- package/esm/theme/builtin/common/series/circular-progress.js.map +1 -1
- package/esm/theme/builtin/common/series/gauge.js +6 -0
- package/esm/theme/builtin/common/series/gauge.js.map +1 -1
- package/esm/theme/builtin/common/series/pie.js +1 -0
- package/esm/theme/builtin/common/series/pie.js.map +1 -1
- package/esm/theme/builtin/common/series/rose.js +1 -0
- package/esm/theme/builtin/common/series/rose.js.map +1 -1
- package/esm/typings/tooltip/position.d.ts +13 -1
- package/esm/typings/tooltip/position.js +11 -2
- package/esm/typings/tooltip/position.js.map +1 -1
- package/esm/typings/tooltip/tooltip.d.ts +2 -1
- package/esm/typings/tooltip/tooltip.js.map +1 -1
- package/esm/typings/visual.d.ts +1 -0
- package/esm/typings/visual.js.map +1 -1
- package/package.json +19 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/handler/utils/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACjB,EAAE;IACF,IAAI,MAAM,CAAC;IACX,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAQ,CAAC;SACnB;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAExC,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"position.js","sourcesContent":["import { isFunction, isNumber, isValid } from '../../../../util';\n\nexport const getActualTooltipPositionValue = (\n position: number | ((event: MouseEvent) => number) | null | undefined,\n event: MouseEvent\n) => {\n let result;\n if (isValid(position)) {\n if (isNumber(position)) {\n result = position;\n } else if (isFunction(position)) {\n // 这里额外判断下是否合法\n const tooltipPosition = position(event);\n\n if (isNumber(tooltipPosition)) {\n result = tooltipPosition;\n }\n }\n }\n return result;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/tooltip/handler/utils/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACjB,EAAE;IACF,IAAI,MAAM,CAAC;IACX,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAQ,CAAC;SACnB;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAExC,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAKF,MAAM,CAAC,MAAM,YAAY,GACvB;IACE,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC/C,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACjD,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACnD,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC7C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAC3C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAC3C,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACnD,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC7C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC7C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC9C,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC/C,CAAC;AAEJ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,QAA8B,EAC9B,WAA2C,EACZ,EAAE,eAAC,OAAA,MAAA,MAAA,YAAY,CAAC,QAAQ,CAAC,0CAAG,CAAC,CAAC,mCAAI,WAAW,CAAA,EAAA,CAAC;AAE/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,QAA8B,EAC9B,WAAyC,EACZ,EAAE,eAAC,OAAA,MAAA,MAAA,YAAY,CAAC,QAAQ,CAAC,0CAAG,CAAC,CAAC,mCAAI,WAAW,CAAA,EAAA,CAAC","file":"position.js","sourcesContent":["import { TooltipFixedPosition } from '../../../../typings';\nimport { isFunction, isNumber, isValid } from '../../../../util';\n\nexport const getActualTooltipPositionValue = (\n position: number | ((event: MouseEvent) => number) | null | undefined,\n event: MouseEvent\n) => {\n let result;\n if (isValid(position)) {\n if (isNumber(position)) {\n result = position;\n } else if (isFunction(position)) {\n // 这里额外判断下是否合法\n const tooltipPosition = position(event);\n\n if (isNumber(tooltipPosition)) {\n result = tooltipPosition;\n }\n }\n }\n return result;\n};\n\nexport type TooltipHorizontalPositionType = 'left' | 'right' | 'middle';\nexport type TooltipVerticalPositionType = 'top' | 'bottom' | 'middle';\n\nexport const positionType: Record<TooltipFixedPosition, [TooltipHorizontalPositionType, TooltipVerticalPositionType]> =\n {\n [TooltipFixedPosition.left]: ['left', 'middle'],\n [TooltipFixedPosition.right]: ['right', 'middle'],\n [TooltipFixedPosition.inside]: ['middle', 'middle'],\n [TooltipFixedPosition.top]: ['middle', 'top'],\n [TooltipFixedPosition.lt]: ['left', 'top'],\n [TooltipFixedPosition.tl]: ['left', 'top'],\n [TooltipFixedPosition.rt]: ['right', 'top'],\n [TooltipFixedPosition.tr]: ['right', 'top'],\n [TooltipFixedPosition.bottom]: ['middle', 'bottom'],\n [TooltipFixedPosition.bl]: ['left', 'bottom'],\n [TooltipFixedPosition.lb]: ['left', 'bottom'],\n [TooltipFixedPosition.br]: ['right', 'bottom'],\n [TooltipFixedPosition.rb]: ['right', 'bottom']\n };\n\nexport const getHorizontalPositionType = (\n position: TooltipFixedPosition,\n defaultCase?: TooltipHorizontalPositionType\n): TooltipHorizontalPositionType => positionType[position]?.[0] ?? defaultCase;\n\nexport const getVerticalPositionType = (\n position: TooltipFixedPosition,\n defaultCase?: TooltipVerticalPositionType\n): TooltipVerticalPositionType => positionType[position]?.[1] ?? defaultCase;\n"]}
|
package/esm/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.4.0-
|
|
4
|
+
export declare const version = "1.4.0-beta.2";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export * from '../event/interface';
|
|
7
7
|
export * from '../typings/spec/common';
|
package/esm/core/index.js
CHANGED
package/esm/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGtD,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAa,CAAC,CAAC;AAGhD,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAa,CAAC,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGtD,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAa,CAAC,CAAC;AAGhD,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAa,CAAC,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC;AAKtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AAGnC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC","file":"index.js","sourcesContent":["import { Logger, LoggerLevel } from '@visactor/vutils';\n/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\nimport { Region } from '../region/region';\nimport { Layout } from '../layout/base-layout';\nimport { GroupMark } from '../mark/group';\nimport { ComponentMark } from '../mark/component';\nimport { ImageMark } from '../mark/image';\n\n// register groupMark and componentMark\nVChart.useMark([ComponentMark, GroupMark, ImageMark]);\n\n// install region module\nFactory.registerRegion('region', Region as any);\n\n// install layout module\nFactory.registerLayout('base', Layout as any);\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.4.0-beta.2\";\n\n// export necessary types\nexport type { IVChart } from './interface';\n// the event types\nexport * from '../event/interface';\nexport * from '../typings/spec/common';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport * from '../theme/interface';\n\n// set default logger level to Level.error\nLogger.getInstance(LoggerLevel.Error);\n"]}
|
package/esm/core/interface.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DataSet
|
|
1
|
+
import type { DataSet } from '@visactor/vdataset';
|
|
2
2
|
import type { IParserOptions } from '@visactor/vdataset/es/parser';
|
|
3
3
|
import type { Datum, IMarkStateSpec, IPoint, IRegionQuerier, IShowTooltipOption, ISpec, ITooltipHandler, Maybe, MaybeArray, StringOrNumber } from '../typings';
|
|
4
4
|
import type { IMorphConfig } from '../animation/spec';
|
|
@@ -24,13 +24,13 @@ export interface IVChart {
|
|
|
24
24
|
readonly id: number;
|
|
25
25
|
renderSync: (morphConfig?: IMorphConfig) => IVChart;
|
|
26
26
|
renderAsync: (morphConfig?: IMorphConfig) => Promise<IVChart>;
|
|
27
|
-
updateData: (id: StringOrNumber, data:
|
|
27
|
+
updateData: (id: StringOrNumber, data: Datum[] | string, options?: IParserOptions) => Promise<IVChart>;
|
|
28
28
|
updateDataInBatches: (list: {
|
|
29
29
|
id: string;
|
|
30
|
-
data:
|
|
30
|
+
data: Datum[];
|
|
31
31
|
options?: IParserOptions;
|
|
32
32
|
}[]) => Promise<IVChart>;
|
|
33
|
-
updateDataSync: (id: StringOrNumber, data:
|
|
33
|
+
updateDataSync: (id: StringOrNumber, data: Datum[], options?: IParserOptions) => IVChart;
|
|
34
34
|
updateSpec: (spec: ISpec, forceMerge?: boolean, morphConfig?: IMorphConfig) => Promise<IVChart>;
|
|
35
35
|
updateModelSpecSync: (filter: string | {
|
|
36
36
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { DataSet, DataView } from '@visactor/vdataset';\n\nimport type { IParserOptions } from '@visactor/vdataset/es/parser';\nimport type {\n Datum,\n IMarkStateSpec,\n IPoint,\n IRegionQuerier,\n IShowTooltipOption,\n ISpec,\n ITooltipHandler,\n Maybe,\n MaybeArray,\n StringOrNumber\n} from '../typings';\nimport type { IMorphConfig } from '../animation/spec';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type { EventCallback, EventParams, EventQuery, EventType } from '../event/interface';\nimport type { IMark } from '../mark/interface';\nimport type { ISeries } from '../series/interface/series';\nimport type { ITheme } from '../theme';\nimport type { IComponent } from '../component/interface';\nimport type { LayoutCallBack } from '../layout/interface';\nimport type { Compiler } from '../compile/compiler';\nimport type { IChart } from '../chart/interface';\nimport type { Stage } from '@visactor/vrender';\n\nexport type DataLinkSeries = {\n /**\n * 关联的系列 id\n * the binding series id\n */\n seriesId?: StringOrNumber;\n /**\n * 关联的系列索引\n * the binding series index\n */\n seriesIndex?: number;\n};\n\nexport type DataLinkAxis = {\n /**\n * 关联的轴 id,目前仅支持直角坐标轴\n * the binding axis id\n */\n axisId?: StringOrNumber;\n /**\n * 关联的轴索引,目前仅支持直角坐标轴\n * the binding axis index\n */\n axisIndex?: number;\n};\n\nexport interface IVChart {\n readonly id: number;\n\n /**\n * **同步**渲染图表。\n * @param morphConfig 图表 morph 动画配置,可选\n * @returns VChart 实例\n */\n renderSync: (morphConfig?: IMorphConfig) => IVChart;\n\n /**\n * **异步**渲染图表。\n * @async\n * @param morphConfig 图表 morph 动画配置,可选\n * @returns VChart 实例\n */\n renderAsync: (morphConfig?: IMorphConfig) => Promise<IVChart>;\n\n /**\n * **异步**更新数据。\n * @param id 数据 id\n * @param data 数据值\n * @param options 数据参数\n * @returns VChart 实例\n */\n updateData: (id: StringOrNumber, data:
|
|
1
|
+
{"version":3,"sources":["../src/core/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { DataSet, DataView } from '@visactor/vdataset';\n\nimport type { IParserOptions } from '@visactor/vdataset/es/parser';\nimport type {\n Datum,\n IMarkStateSpec,\n IPoint,\n IRegionQuerier,\n IShowTooltipOption,\n ISpec,\n ITooltipHandler,\n Maybe,\n MaybeArray,\n StringOrNumber\n} from '../typings';\nimport type { IMorphConfig } from '../animation/spec';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type { EventCallback, EventParams, EventQuery, EventType } from '../event/interface';\nimport type { IMark } from '../mark/interface';\nimport type { ISeries } from '../series/interface/series';\nimport type { ITheme } from '../theme';\nimport type { IComponent } from '../component/interface';\nimport type { LayoutCallBack } from '../layout/interface';\nimport type { Compiler } from '../compile/compiler';\nimport type { IChart } from '../chart/interface';\nimport type { Stage } from '@visactor/vrender';\n\nexport type DataLinkSeries = {\n /**\n * 关联的系列 id\n * the binding series id\n */\n seriesId?: StringOrNumber;\n /**\n * 关联的系列索引\n * the binding series index\n */\n seriesIndex?: number;\n};\n\nexport type DataLinkAxis = {\n /**\n * 关联的轴 id,目前仅支持直角坐标轴\n * the binding axis id\n */\n axisId?: StringOrNumber;\n /**\n * 关联的轴索引,目前仅支持直角坐标轴\n * the binding axis index\n */\n axisIndex?: number;\n};\n\nexport interface IVChart {\n readonly id: number;\n\n /**\n * **同步**渲染图表。\n * @param morphConfig 图表 morph 动画配置,可选\n * @returns VChart 实例\n */\n renderSync: (morphConfig?: IMorphConfig) => IVChart;\n\n /**\n * **异步**渲染图表。\n * @async\n * @param morphConfig 图表 morph 动画配置,可选\n * @returns VChart 实例\n */\n renderAsync: (morphConfig?: IMorphConfig) => Promise<IVChart>;\n\n /**\n * **异步**更新数据。\n * @param id 数据 id\n * @param data 数据值\n * @param options 数据参数\n * @returns VChart 实例\n */\n updateData: (id: StringOrNumber, data: Datum[] | string, options?: IParserOptions) => Promise<IVChart>;\n\n /**\n * **异步**批量更新数据。\n * @param list 待更新的数据列表\n * @returns VChart 实例\n */\n updateDataInBatches: (list: { id: string; data: Datum[]; options?: IParserOptions }[]) => Promise<IVChart>;\n\n /**\n * **同步**更新数据。\n * @param id 数据 id\n * @param data 数据值\n * @param options 数据参数\n * @returns VChart 实例\n */\n updateDataSync: (id: StringOrNumber, data: Datum[], options?: IParserOptions) => IVChart;\n\n /**\n * **异步**spec 更新。\n * @param spec\n * @param forceMerge\n * @returns\n */\n updateSpec: (spec: ISpec, forceMerge?: boolean, morphConfig?: IMorphConfig) => Promise<IVChart>;\n\n /**\n * **同步方法** 模块 spec 更新\n * @param filter\n * @param spec\n * @param forceMerge\n * @returns\n * @sync 1.4.0\n */\n updateModelSpecSync: (\n filter: string | { type: string; index: number },\n spec: unknown,\n forceMerge?: boolean,\n morphConfig?: IMorphConfig\n ) => IVChart;\n\n /**\n * **异步方法** 模块 spec 更新\n * @param filter\n * @param spec\n * @param forceMerge\n * @returns\n * @sync 1.4.0\n */\n updateModelSpec: (\n filter: string | { type: string; index: number },\n spec: unknown,\n forceMerge?: boolean,\n morphConfig?: IMorphConfig\n ) => Promise<IVChart>;\n\n /**\n * 更新绘制区域。\n * @param viewBox 绘制区域\n * @param reRender 是否重新渲染,默认为 true\n * @returns\n */\n updateViewBox: (viewBox: IBoundsLike, reRender?: boolean) => IVChart;\n\n /**\n * **异步方法**,图表尺寸更新方法。\n * @param width 宽度\n * @param height 高度\n * @returns VChart 当前实例\n */\n resize: (width: number, height: number) => Promise<IVChart>;\n\n /**\n * 销毁图表。\n */\n release: () => void;\n\n /**\n * 事件监听\n */\n on: ((eType: EventType, handler: EventCallback<EventParams>) => void) &\n ((eType: EventType, query: EventQuery, handler: EventCallback<EventParams>) => void);\n off: (eType: EventType, handler?: EventCallback<EventParams>) => void;\n\n /**\n * 更新或设置图元状态。\n * @param state 状态筛选器\n * @param filter 筛选器\n */\n updateState: (\n state: Record<string, Omit<IMarkStateSpec<unknown>, 'style'>>,\n filter?: (series: ISeries, mark: IMark, stateKey: string) => boolean //series + mark 筛选\n ) => void;\n\n /**\n * 更新图元选中状态。\n * @param datum hover 图元数据\n * @param filter 筛选器 用来筛选系列与mark\n * @param region region 筛选器\n */\n setSelected: (\n datum: MaybeArray<any> | null,\n filter?: (series: ISeries, mark: IMark) => boolean,\n region?: IRegionQuerier\n ) => void;\n\n /**\n * 更新图元 hover 状态\n * @param datum hover 图元数据\n * @param filter 筛选器 用来筛选系列与mark\n * @param region region 筛选器\n */\n setHovered: (\n datum: MaybeArray<Datum> | null,\n filter?: (series: ISeries, mark: IMark) => boolean,\n region?: IRegionQuerier\n ) => void;\n\n /**\n * 获取当前主题,会返回完整的主题配置\n * */\n getCurrentTheme: () => ITheme;\n\n /**\n * 获取当前主题名称(只能获取用户通过`setCurrentTheme`方法设置过的主题,默认值为`ThemeManager`统一设置的主题)\n */\n getCurrentThemeName: () => string;\n\n /**\n * **异步方法**, 设置当前主题。\n * @param name 主题名称\n * @returns\n */\n setCurrentTheme: (name: string) => Promise<IVChart>;\n\n /**\n * 自定义 TooltipHandler。\n * @param tooltipHandler\n */\n setTooltipHandler: (tooltipHandler: ITooltipHandler) => void;\n\n /**\n * 获取用户定义的 TooltipHandler\n * @returns ITooltipHandler\n */\n getTooltipHandlerByUser: () => ITooltipHandler | undefined;\n\n /**\n * 获取 TooltipHandler\n * @returns\n */\n getTooltipHandler: () => ITooltipHandler | undefined;\n\n /**\n * 手动调用展示 tooltip\n * @param datum 原始数据\n * @param options\n * @returns\n */\n showTooltip: (datum: Datum, options: IShowTooltipOption) => boolean;\n\n /**\n * 手动调用,关闭 tooltip\n * @returns\n */\n hideTooltip: () => boolean;\n\n // 图例相关 api\n /**\n * 根据图例组件 id 获取图例数据\n * @param id 组件 id\n * @returns\n */\n getLegendDataById: (id: string) => Datum[];\n\n /**\n * 根据图例组件索引获取图例数据\n * @param index 图例索引,默认为 0\n * @returns\n */\n getLegendDataByIndex: (index?: number) => Datum[];\n\n /**\n * 根据图例组件 id 获取当前图例的选中项\n * @param id 组件 id\n * @returns\n */\n getLegendSelectedDataById: (id: string) => StringOrNumber[];\n\n /**\n * 根据图例组件索引获取当前图例的选中项\n * @param index 图例索引,默认为 0\n * @returns\n */\n getLegendSelectedDataByIndex: (index?: number) => StringOrNumber[];\n\n /**\n * 根据图例组件 id 更新图例选中数据\n * @param id\n * @returns\n */\n setLegendSelectedDataById: (id: string, selectedData: StringOrNumber[]) => void;\n\n /**\n * 根据图例组件索引更新图例选中数据\n * @param index 图例索引,默认为 0\n * @returns\n */\n setLegendSelectedDataByIndex: (index: number, selectedData: StringOrNumber[]) => void;\n\n /**\n * **异步方法**返回一个包含图片展示的 data URI。\n * @returns data URI\n */\n getDataURL: () => Promise<any>;\n\n /**\n * **异步方法** 导出图表图片,只支持浏览器端。\n * @param name 保存的图片名称\n * @returns\n */\n exportImg: (name?: string) => Promise<void>;\n\n /**\n * 目前仅支持 node 环境,用于 node 端的图片导出\n * @returns\n */\n getImageBuffer: () => void;\n /**\n * 设置自定义布局\n */\n setLayout: (layout: LayoutCallBack) => void;\n /**\n * 强制重新布局\n */\n reLayout: () => void;\n\n /**\n * 获取编译器实例\n * @returns\n */\n getCompiler: () => Compiler;\n\n /**\n * Get the chart instance\n * 获取 Chart 图表实例。\n * @returns Chart 实例\n */\n getChart: () => Maybe<IChart>;\n\n /**\n * Get the renderer instance.\n * 获取渲染引擎实例。\n * @returns the instance of VRender Stage\n */\n getStage: () => Stage;\n\n /**\n * 获取 canvas dom\n * @returns HTMLCanvasElement | undefined\n */\n getCanvas: () => HTMLCanvasElement | undefined;\n\n /**\n * 获取图表的 dom 容器\n * @returns\n */\n getContainer: () => Maybe<HTMLElement>;\n\n /**\n * 获取图表所有的组件实例\n * @returns 组件实例\n */\n getComponents: () => IComponent[];\n\n /**\n * 获取图表的 DataSet 实例\n * @returns DataSet 实例\n */\n getDataSet: () => Maybe<DataSet>;\n\n // 数据转换相关的 api\n /**\n * Convert the data to coordinate position\n * @param datum the datum to convert\n * @param dataLinkInfo the data link info, could be seriesId or seriesIndex, default is { seriesIndex: 0 }\n * @param isRelativeToCanvas 是否相对画布坐标,默认为 false Whether relative to canvas coordinates, default is false\n * @returns\n */\n convertDatumToPosition: (datum: Datum, dataLinkInfo?: DataLinkSeries, isRelativeToCanvas?: boolean) => IPoint | null;\n\n /**\n * Convert the value to coordinate position\n * @param value number | [number, number], the value to convert\n * @param dataLinkInfo the data link info, could be seriesId,seriesIndex,axisId,axisIndex\n * @param isRelativeToCanvas 是否相对画布坐标,默认为 false Whether relative to canvas coordinates, default is false\n * returns\n */\n convertValueToPosition: ((\n value: StringOrNumber,\n dataLinkInfo: DataLinkAxis,\n isRelativeToCanvas?: boolean\n ) => number | null) &\n ((\n value: [StringOrNumber, StringOrNumber],\n dataLinkInfo: DataLinkSeries,\n isRelativeToCanvas?: boolean\n ) => IPoint | null);\n\n /** 停止正在进行的所有动画 */\n stopAnimation: () => void;\n\n /** 暂停正在进行的所有动画 */\n pauseAnimation: () => void;\n\n /** 恢复暂停时正在进行的所有动画 */\n resumeAnimation: () => void;\n}\n\nexport interface IGlobalConfig {\n /** 是否全局显示唯一 tooltip */\n uniqueTooltip?: boolean;\n /** 是否监测图表 dom 变化自动 release */\n // TODO\n // autoRelease?: boolean;\n}\n"]}
|
package/esm/core/vchart.d.ts
CHANGED
|
@@ -60,12 +60,12 @@ export declare class VChart implements IVChart {
|
|
|
60
60
|
private _context;
|
|
61
61
|
constructor(spec: ISpec, options: IInitOption);
|
|
62
62
|
private _setSpec;
|
|
63
|
-
private _initData;
|
|
64
63
|
private _initChart;
|
|
65
64
|
private _releaseData;
|
|
66
65
|
private _bindVGrammarViewEvent;
|
|
67
66
|
private _bindResizeEvent;
|
|
68
67
|
private _unBindResizeEvent;
|
|
68
|
+
private _getCurSize;
|
|
69
69
|
private _onResize;
|
|
70
70
|
private _initDataSet;
|
|
71
71
|
updateCustomConfigAndRerender(modifyConfig: () => IUpdateSpecResult | undefined, morphConfig?: IMorphConfig): Promise<IVChart>;
|
|
@@ -77,7 +77,7 @@ export declare class VChart implements IVChart {
|
|
|
77
77
|
updateData(id: StringOrNumber, data: DataView | Datum[] | string, options?: IParserOptions): Promise<IVChart>;
|
|
78
78
|
updateDataInBatches(list: {
|
|
79
79
|
id: string;
|
|
80
|
-
data:
|
|
80
|
+
data: Datum[];
|
|
81
81
|
options?: IParserOptions;
|
|
82
82
|
}[]): Promise<IVChart>;
|
|
83
83
|
updateDataSync(id: StringOrNumber, data: DataView | Datum[], options?: IParserOptions): IVChart;
|
|
@@ -103,6 +103,7 @@ export declare class VChart implements IVChart {
|
|
|
103
103
|
setSelected(datum: MaybeArray<any> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void;
|
|
104
104
|
setHovered(datum: MaybeArray<Datum> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void;
|
|
105
105
|
private _updateCurrentTheme;
|
|
106
|
+
private _updateChartConfiguration;
|
|
106
107
|
private _getBackground;
|
|
107
108
|
getCurrentTheme(): ITheme;
|
|
108
109
|
getCurrentThemeName(): string;
|
package/esm/core/vchart.js
CHANGED
|
@@ -74,7 +74,7 @@ import { InstanceManager } from "./instance-manager";
|
|
|
74
74
|
|
|
75
75
|
import { setPoptipTheme } from "@visactor/vrender-components";
|
|
76
76
|
|
|
77
|
-
import { calculateChartSize } from "../chart/util";
|
|
77
|
+
import { calculateChartSize, mergeUpdateResult } from "../chart/util";
|
|
78
78
|
|
|
79
79
|
export class VChart {
|
|
80
80
|
static useChart(charts) {
|
|
@@ -128,8 +128,7 @@ export class VChart {
|
|
|
128
128
|
throw new Error(msg);
|
|
129
129
|
}
|
|
130
130
|
}, this._observer = null, this._context = {}, this._onResize = debounce(((...args) => {
|
|
131
|
-
|
|
132
|
-
const {width: containerWidth, height: containerHeight} = getContainerSize(this._container, DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT), width = null !== (_a = this._spec.width) && void 0 !== _a ? _a : containerWidth, height = null !== (_b = this._spec.height) && void 0 !== _b ? _b : containerHeight;
|
|
131
|
+
const {width: width, height: height} = this._getCurSize();
|
|
133
132
|
this._curSize.width === width && this._curSize.height === height || (this.resize(width, height),
|
|
134
133
|
this._curSize = {
|
|
135
134
|
width: width,
|
|
@@ -168,22 +167,9 @@ export class VChart {
|
|
|
168
167
|
_setSpec(spec) {
|
|
169
168
|
spec && (this._spec = specTransform(isString(spec) ? JSON.parse(spec) : spec));
|
|
170
169
|
}
|
|
171
|
-
_initData() {
|
|
172
|
-
var _a;
|
|
173
|
-
if (isNil(this._dataSet)) return void warn("dataSet is not initialized");
|
|
174
|
-
const specData = array(this._spec.data), dataViewArr = [];
|
|
175
|
-
for (let i = 0; i < specData.length; i++) {
|
|
176
|
-
const curSpecData = specData[i];
|
|
177
|
-
dataViewArr.push(dataToDataView(curSpecData, this._dataSet, dataViewArr, {
|
|
178
|
-
onError: null === (_a = this._option) || void 0 === _a ? void 0 : _a.onError
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
this._spec.data = dataViewArr;
|
|
182
|
-
}
|
|
183
170
|
_initChart(spec) {
|
|
184
171
|
var _a, _b;
|
|
185
172
|
if (!this._compiler) return void (null === (_a = this._option) || void 0 === _a || _a.onError("compiler is not initialized"));
|
|
186
|
-
this._initData();
|
|
187
173
|
const chart = Factory.createChart(spec.type, spec, {
|
|
188
174
|
globalInstance: this,
|
|
189
175
|
eventDispatcher: this._eventDispatcher,
|
|
@@ -228,6 +214,14 @@ export class VChart {
|
|
|
228
214
|
this._autoSize && (window.removeEventListener("resize", this._onResize), this._observer && (this._observer.disconnect(),
|
|
229
215
|
this._observer = null));
|
|
230
216
|
}
|
|
217
|
+
_getCurSize() {
|
|
218
|
+
var _a, _b;
|
|
219
|
+
const {width: containerWidth, height: containerHeight} = getContainerSize(this._container, DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT);
|
|
220
|
+
return {
|
|
221
|
+
width: null !== (_a = this._spec.width) && void 0 !== _a ? _a : containerWidth,
|
|
222
|
+
height: null !== (_b = this._spec.height) && void 0 !== _b ? _b : containerHeight
|
|
223
|
+
};
|
|
224
|
+
}
|
|
231
225
|
_initDataSet(dataSet) {
|
|
232
226
|
this._dataSet = dataSet instanceof DataSet ? dataSet : new DataSet, registerDataSetInstanceParser(this._dataSet, "dataview", dataViewParser),
|
|
233
227
|
registerDataSetInstanceParser(this._dataSet, "array", arrayParser), registerDataSetInstanceTransform(this._dataSet, "stackSplit", stackSplit),
|
|
@@ -248,19 +242,22 @@ export class VChart {
|
|
|
248
242
|
this) : this;
|
|
249
243
|
}
|
|
250
244
|
_reCompile(updateResult) {
|
|
251
|
-
var _a, _b, _c;
|
|
252
|
-
updateResult.reMake
|
|
245
|
+
var _a, _b, _c, _d, _e;
|
|
246
|
+
if (updateResult.reMake) this._releaseData(), this._initDataSet(), this._chart.release(),
|
|
253
247
|
this._chart = null, null === (_a = this._compiler) || void 0 === _a || _a.releaseGrammar(),
|
|
254
248
|
this._userEvents.forEach((e => {
|
|
255
249
|
var _a;
|
|
256
250
|
return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
|
|
257
|
-
})))
|
|
251
|
+
})), updateResult.reSize && this._onResize(); else if (updateResult.reCompile && (null === (_b = this._compiler) || void 0 === _b || _b.clear({
|
|
258
252
|
chart: this._chart,
|
|
259
253
|
vChart: this
|
|
260
254
|
}), null === (_c = this._compiler) || void 0 === _c || _c.compile({
|
|
261
255
|
chart: this._chart,
|
|
262
256
|
vChart: this
|
|
263
|
-
}, {}))
|
|
257
|
+
}, {})), updateResult.reSize) {
|
|
258
|
+
const {width: width, height: height} = this._getCurSize();
|
|
259
|
+
this._chart.onResize(width, height), null === (_e = (_d = this._compiler).resize) || void 0 === _e || _e.call(_d, width, height, !1);
|
|
260
|
+
}
|
|
264
261
|
}
|
|
265
262
|
renderSync(morphConfig) {
|
|
266
263
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -333,9 +330,11 @@ export class VChart {
|
|
|
333
330
|
}
|
|
334
331
|
updateDataInBatches(list) {
|
|
335
332
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
336
|
-
return this._chart ? (list.
|
|
337
|
-
|
|
338
|
-
|
|
333
|
+
return this._chart ? (this._chart.updateFullData(list.map((({id: id, data: data, options: options}) => ({
|
|
334
|
+
id: id,
|
|
335
|
+
values: data,
|
|
336
|
+
parser: options
|
|
337
|
+
})))), this._chart.updateGlobalScaleDomain(), yield this._compiler.renderAsync(),
|
|
339
338
|
this) : (list.forEach((({id: id, data: data, options: options}) => {
|
|
340
339
|
const preDV = this._spec.data.find((dv => dv.name === id));
|
|
341
340
|
if (preDV) preDV.parse(data, options); else {
|
|
@@ -395,10 +394,17 @@ export class VChart {
|
|
|
395
394
|
return spec ? (isString(spec) && (spec = JSON.parse(spec)), forceMerge && (spec = mergeSpec({}, this._spec, spec)),
|
|
396
395
|
yield this.updateCustomConfigAndRerender((() => {
|
|
397
396
|
var _a, _b, _c;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
this.
|
|
397
|
+
spec = specTransform(spec);
|
|
398
|
+
const lastSpec = this._spec;
|
|
399
|
+
this._spec = spec, this._updateCurrentTheme(), null === (_a = this._chart) || void 0 === _a || _a.setCurrentTheme(this._currentTheme, !0);
|
|
400
|
+
const reSize = this._updateChartConfiguration(lastSpec);
|
|
401
|
+
return null === (_c = null === (_b = this._compiler) || void 0 === _b ? void 0 : _b.getVGrammarView()) || void 0 === _c || _c.updateLayoutTag(),
|
|
402
|
+
mergeUpdateResult(this._chart.updateSpec(spec, morphConfig), {
|
|
403
|
+
change: reSize,
|
|
404
|
+
reMake: !1,
|
|
405
|
+
reCompile: !1,
|
|
406
|
+
reSize: reSize
|
|
407
|
+
});
|
|
402
408
|
}), morphConfig), this) : this;
|
|
403
409
|
}));
|
|
404
410
|
}
|
|
@@ -406,9 +412,17 @@ export class VChart {
|
|
|
406
412
|
return spec ? (isString(spec) && (spec = JSON.parse(spec)), forceMerge && (spec = mergeSpec({}, this._spec, spec)),
|
|
407
413
|
this.updateCustomConfigAndRerenderSync((() => {
|
|
408
414
|
var _a, _b, _c;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
this.
|
|
415
|
+
(spec = specTransform(spec)).data = null !== (_a = spec.data) && void 0 !== _a ? _a : [];
|
|
416
|
+
const lastSpec = this._spec;
|
|
417
|
+
this._spec = spec;
|
|
418
|
+
const reSize = this._updateChartConfiguration(lastSpec);
|
|
419
|
+
return null === (_c = null === (_b = this._compiler) || void 0 === _b ? void 0 : _b.getVGrammarView()) || void 0 === _c || _c.updateLayoutTag(),
|
|
420
|
+
mergeUpdateResult(this._chart.updateSpec(spec, morphConfig), {
|
|
421
|
+
change: reSize,
|
|
422
|
+
reMake: !1,
|
|
423
|
+
reCompile: !1,
|
|
424
|
+
reSize: reSize
|
|
425
|
+
});
|
|
412
426
|
}), morphConfig), this) : this;
|
|
413
427
|
}
|
|
414
428
|
updateModelSpec(filter, spec, forceMerge = !1, morphConfig) {
|
|
@@ -435,7 +449,7 @@ export class VChart {
|
|
|
435
449
|
forceMerge && (spec = mergeSpec({}, model.getSpec(), spec));
|
|
436
450
|
const modifyConfig = () => {
|
|
437
451
|
const result = model.updateSpec(spec);
|
|
438
|
-
return model.reInit(), (result.change || result.reCompile || result.reMake || result.
|
|
452
|
+
return model.reInit(), (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) && this._chart.reDataFlow(),
|
|
439
453
|
result;
|
|
440
454
|
};
|
|
441
455
|
return sync ? this.updateCustomConfigAndRerenderSync(modifyConfig, morphConfig) : this.updateCustomConfigAndRerender(modifyConfig, morphConfig);
|
|
@@ -501,6 +515,14 @@ export class VChart {
|
|
|
501
515
|
setPoptipTheme(preprocessSpecOrTheme("mark-theme", mergeSpec({}, null === (_b = this._currentTheme.component) || void 0 === _b ? void 0 : _b.poptip))),
|
|
502
516
|
null === (_c = this._compiler) || void 0 === _c || _c.setBackground(this._getBackground());
|
|
503
517
|
}
|
|
518
|
+
_updateChartConfiguration(oldSpec) {
|
|
519
|
+
var _a, _b;
|
|
520
|
+
let resize = !1;
|
|
521
|
+
this._spec.width === oldSpec.width && this._spec.height === oldSpec.height || (resize = !0);
|
|
522
|
+
const lasAutoSize = this._autoSize;
|
|
523
|
+
return this._autoSize = !!isTrueBrowser(this._option.mode) && (null === (_b = null !== (_a = this._spec.autoFit) && void 0 !== _a ? _a : this._option.autoFit) || void 0 === _b || _b),
|
|
524
|
+
this._autoSize !== lasAutoSize && (resize = !0), this._updateCurrentTheme(), resize;
|
|
525
|
+
}
|
|
504
526
|
_getBackground() {
|
|
505
527
|
return ("string" == typeof this._spec.background ? this._spec.background : null) || this._currentTheme.background || this._option.background;
|
|
506
528
|
}
|