@visactor/vchart 1.4.0-alpha.7 → 1.4.0-beta.1
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 +1045 -672
- 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 +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/handler/utils/position.ts"],"names":[],"mappings":";;;AAAA,2CAAiE;AAE1D,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACjB,EAAE;IACF,IAAI,MAAM,CAAC;IACX,IAAI,IAAA,cAAO,EAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,IAAA,eAAQ,EAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAQ,CAAC;SACnB;aAAM,IAAI,IAAA,iBAAU,EAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAExC,IAAI,IAAA,eAAQ,EAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,6BAA6B,iCAkBxC","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,iDAA2D;AAC3D,2CAAiE;AAE1D,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACjB,EAAE;IACF,IAAI,MAAM,CAAC;IACX,IAAI,IAAA,cAAO,EAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,IAAA,eAAQ,EAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAQ,CAAC;SACnB;aAAM,IAAI,IAAA,iBAAU,EAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAExC,IAAI,IAAA,eAAQ,EAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,6BAA6B,iCAkBxC;AAKW,QAAA,YAAY,GACvB;IACE,CAAC,8BAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC/C,CAAC,8BAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACjD,CAAC,8BAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACnD,CAAC,8BAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC7C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IAC1C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAC3C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAC3C,CAAC,8BAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACnD,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC7C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC7C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC9C,CAAC,8BAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;CAC/C,CAAC;AAEG,MAAM,yBAAyB,GAAG,CACvC,QAA8B,EAC9B,WAA2C,EACZ,EAAE,eAAC,OAAA,MAAA,MAAA,oBAAY,CAAC,QAAQ,CAAC,0CAAG,CAAC,CAAC,mCAAI,WAAW,CAAA,EAAA,CAAC;AAHlE,QAAA,yBAAyB,6BAGyC;AAExE,MAAM,uBAAuB,GAAG,CACrC,QAA8B,EAC9B,WAAyC,EACZ,EAAE,eAAC,OAAA,MAAA,MAAA,oBAAY,CAAC,QAAQ,CAAC,0CAAG,CAAC,CAAC,mCAAI,WAAW,CAAA,EAAA,CAAC;AAHhE,QAAA,uBAAuB,2BAGyC","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/cjs/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.1";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export * from '../event/interface';
|
|
7
7
|
export * from '../typings/spec/common';
|
package/cjs/core/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const region_1 = require("../region/region"), base_layout_1 = require("../layout
|
|
|
41
41
|
|
|
42
42
|
vchart_1.VChart.useMark([ component_1.ComponentMark, group_1.GroupMark, image_1.ImageMark ]),
|
|
43
43
|
factory_1.Factory.registerRegion("region", region_1.Region), factory_1.Factory.registerLayout("base", base_layout_1.Layout),
|
|
44
|
-
exports.version = "1.4.0-
|
|
44
|
+
exports.version = "1.4.0-beta.1", __exportStar(require("../event/interface"), exports),
|
|
45
45
|
__exportStar(require("../typings/spec/common"), exports), __exportStar(require("../theme/interface"), exports),
|
|
46
46
|
vutils_1.Logger.getInstance(vutils_1.LoggerLevel.Error);
|
|
47
47
|
//# sourceMappingURL=index.js.map
|
package/cjs/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAuD;AAKvD,qCAAkC;AAiBzB,uFAjBA,eAAM,OAiBA;AAhBf,uCAAoC;AAgBnB,wFAhBR,iBAAO,OAgBQ;AAfxB,6CAA0C;AAC1C,uDAA+C;AAC/C,yCAA0C;AAC1C,iDAAkD;AAClD,yCAA0C;AAG1C,eAAM,CAAC,OAAO,CAAC,CAAC,yBAAa,EAAE,iBAAS,EAAE,iBAAS,CAAC,CAAC,CAAC;AAGtD,iBAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAa,CAAC,CAAC;AAGhD,iBAAO,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAa,CAAC,CAAC;AAKjC,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAuD;AAKvD,qCAAkC;AAiBzB,uFAjBA,eAAM,OAiBA;AAhBf,uCAAoC;AAgBnB,wFAhBR,iBAAO,OAgBQ;AAfxB,6CAA0C;AAC1C,uDAA+C;AAC/C,yCAA0C;AAC1C,iDAAkD;AAClD,yCAA0C;AAG1C,eAAM,CAAC,OAAO,CAAC,CAAC,yBAAa,EAAE,iBAAS,EAAE,iBAAS,CAAC,CAAC,CAAC;AAGtD,iBAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAa,CAAC,CAAC;AAGhD,iBAAO,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAa,CAAC,CAAC;AAKjC,QAAA,OAAO,GAAG,cAAc,CAAC;AAKtC,qDAAmC;AACnC,yDAAuC;AAEvC,qDAAmC;AAGnC,eAAM,CAAC,WAAW,CAAC,oBAAW,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.1\";\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/cjs/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/cjs/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/cjs/core/vchart.js
CHANGED
|
@@ -92,8 +92,7 @@ class VChart {
|
|
|
92
92
|
throw new Error(msg);
|
|
93
93
|
}
|
|
94
94
|
}, this._observer = null, this._context = {}, this._onResize = (0, util_1.debounce)(((...args) => {
|
|
95
|
-
|
|
96
|
-
const {width: containerWidth, height: containerHeight} = (0, vutils_1.getContainerSize)(this._container, constant_1.DEFAULT_CHART_WIDTH, constant_1.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;
|
|
95
|
+
const {width: width, height: height} = this._getCurSize();
|
|
97
96
|
this._curSize.width === width && this._curSize.height === height || (this.resize(width, height),
|
|
98
97
|
this._curSize = {
|
|
99
98
|
width: width,
|
|
@@ -132,22 +131,9 @@ class VChart {
|
|
|
132
131
|
_setSpec(spec) {
|
|
133
132
|
spec && (this._spec = (0, util_1.specTransform)((0, util_1.isString)(spec) ? JSON.parse(spec) : spec));
|
|
134
133
|
}
|
|
135
|
-
_initData() {
|
|
136
|
-
var _a;
|
|
137
|
-
if ((0, util_1.isNil)(this._dataSet)) return void (0, util_1.warn)("dataSet is not initialized");
|
|
138
|
-
const specData = (0, util_1.array)(this._spec.data), dataViewArr = [];
|
|
139
|
-
for (let i = 0; i < specData.length; i++) {
|
|
140
|
-
const curSpecData = specData[i];
|
|
141
|
-
dataViewArr.push((0, initialize_1.dataToDataView)(curSpecData, this._dataSet, dataViewArr, {
|
|
142
|
-
onError: null === (_a = this._option) || void 0 === _a ? void 0 : _a.onError
|
|
143
|
-
}));
|
|
144
|
-
}
|
|
145
|
-
this._spec.data = dataViewArr;
|
|
146
|
-
}
|
|
147
134
|
_initChart(spec) {
|
|
148
135
|
var _a, _b;
|
|
149
136
|
if (!this._compiler) return void (null === (_a = this._option) || void 0 === _a || _a.onError("compiler is not initialized"));
|
|
150
|
-
this._initData();
|
|
151
137
|
const chart = factory_1.Factory.createChart(spec.type, spec, {
|
|
152
138
|
globalInstance: this,
|
|
153
139
|
eventDispatcher: this._eventDispatcher,
|
|
@@ -192,6 +178,14 @@ class VChart {
|
|
|
192
178
|
this._autoSize && (window.removeEventListener("resize", this._onResize), this._observer && (this._observer.disconnect(),
|
|
193
179
|
this._observer = null));
|
|
194
180
|
}
|
|
181
|
+
_getCurSize() {
|
|
182
|
+
var _a, _b;
|
|
183
|
+
const {width: containerWidth, height: containerHeight} = (0, vutils_1.getContainerSize)(this._container, constant_1.DEFAULT_CHART_WIDTH, constant_1.DEFAULT_CHART_HEIGHT);
|
|
184
|
+
return {
|
|
185
|
+
width: null !== (_a = this._spec.width) && void 0 !== _a ? _a : containerWidth,
|
|
186
|
+
height: null !== (_b = this._spec.height) && void 0 !== _b ? _b : containerHeight
|
|
187
|
+
};
|
|
188
|
+
}
|
|
195
189
|
_initDataSet(dataSet) {
|
|
196
190
|
dataSet instanceof vdataset_1.DataSet ? this._dataSet = dataSet : this._dataSet = new vdataset_1.DataSet,
|
|
197
191
|
(0, register_1.registerDataSetInstanceParser)(this._dataSet, "dataview", vdataset_1.dataViewParser),
|
|
@@ -214,19 +208,22 @@ class VChart {
|
|
|
214
208
|
this) : this;
|
|
215
209
|
}
|
|
216
210
|
_reCompile(updateResult) {
|
|
217
|
-
var _a, _b, _c;
|
|
218
|
-
updateResult.reMake
|
|
211
|
+
var _a, _b, _c, _d, _e;
|
|
212
|
+
if (updateResult.reMake) this._releaseData(), this._initDataSet(), this._chart.release(),
|
|
219
213
|
this._chart = null, null === (_a = this._compiler) || void 0 === _a || _a.releaseGrammar(),
|
|
220
214
|
this._userEvents.forEach((e => {
|
|
221
215
|
var _a;
|
|
222
216
|
return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
|
|
223
|
-
})))
|
|
217
|
+
})), updateResult.reSize && this._onResize(); else if (updateResult.reCompile && (null === (_b = this._compiler) || void 0 === _b || _b.clear({
|
|
224
218
|
chart: this._chart,
|
|
225
219
|
vChart: this
|
|
226
220
|
}), null === (_c = this._compiler) || void 0 === _c || _c.compile({
|
|
227
221
|
chart: this._chart,
|
|
228
222
|
vChart: this
|
|
229
|
-
}, {}))
|
|
223
|
+
}, {})), updateResult.reSize) {
|
|
224
|
+
const {width: width, height: height} = this._getCurSize();
|
|
225
|
+
this._chart.onResize(width, height), null === (_e = (_d = this._compiler).resize) || void 0 === _e || _e.call(_d, width, height, !1);
|
|
226
|
+
}
|
|
230
227
|
}
|
|
231
228
|
renderSync(morphConfig) {
|
|
232
229
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -300,9 +297,11 @@ class VChart {
|
|
|
300
297
|
}
|
|
301
298
|
updateDataInBatches(list) {
|
|
302
299
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
303
|
-
return this._chart ? (list.
|
|
304
|
-
|
|
305
|
-
|
|
300
|
+
return this._chart ? (this._chart.updateFullData(list.map((({id: id, data: data, options: options}) => ({
|
|
301
|
+
id: id,
|
|
302
|
+
values: data,
|
|
303
|
+
parser: options
|
|
304
|
+
})))), this._chart.updateGlobalScaleDomain(), yield this._compiler.renderAsync(),
|
|
306
305
|
this) : (list.forEach((({id: id, data: data, options: options}) => {
|
|
307
306
|
const preDV = this._spec.data.find((dv => dv.name === id));
|
|
308
307
|
if (preDV) preDV.parse(data, options); else {
|
|
@@ -362,10 +361,17 @@ class VChart {
|
|
|
362
361
|
return spec ? ((0, util_1.isString)(spec) && (spec = JSON.parse(spec)), forceMerge && (spec = (0,
|
|
363
362
|
util_1.mergeSpec)({}, this._spec, spec)), yield this.updateCustomConfigAndRerender((() => {
|
|
364
363
|
var _a, _b, _c;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
this.
|
|
364
|
+
spec = (0, util_1.specTransform)(spec);
|
|
365
|
+
const lastSpec = this._spec;
|
|
366
|
+
this._spec = spec, this._updateCurrentTheme(), null === (_a = this._chart) || void 0 === _a || _a.setCurrentTheme(this._currentTheme, !0);
|
|
367
|
+
const reSize = this._updateChartConfiguration(lastSpec);
|
|
368
|
+
return null === (_c = null === (_b = this._compiler) || void 0 === _b ? void 0 : _b.getVGrammarView()) || void 0 === _c || _c.updateLayoutTag(),
|
|
369
|
+
(0, util_2.mergeUpdateResult)(this._chart.updateSpec(spec, morphConfig), {
|
|
370
|
+
change: reSize,
|
|
371
|
+
reMake: !1,
|
|
372
|
+
reCompile: !1,
|
|
373
|
+
reSize: reSize
|
|
374
|
+
});
|
|
369
375
|
}), morphConfig), this) : this;
|
|
370
376
|
}));
|
|
371
377
|
}
|
|
@@ -373,9 +379,17 @@ class VChart {
|
|
|
373
379
|
return spec ? ((0, util_1.isString)(spec) && (spec = JSON.parse(spec)), forceMerge && (spec = (0,
|
|
374
380
|
util_1.mergeSpec)({}, this._spec, spec)), this.updateCustomConfigAndRerenderSync((() => {
|
|
375
381
|
var _a, _b, _c;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
this.
|
|
382
|
+
(spec = (0, util_1.specTransform)(spec)).data = null !== (_a = spec.data) && void 0 !== _a ? _a : [];
|
|
383
|
+
const lastSpec = this._spec;
|
|
384
|
+
this._spec = spec;
|
|
385
|
+
const reSize = this._updateChartConfiguration(lastSpec);
|
|
386
|
+
return null === (_c = null === (_b = this._compiler) || void 0 === _b ? void 0 : _b.getVGrammarView()) || void 0 === _c || _c.updateLayoutTag(),
|
|
387
|
+
(0, util_2.mergeUpdateResult)(this._chart.updateSpec(spec, morphConfig), {
|
|
388
|
+
change: reSize,
|
|
389
|
+
reMake: !1,
|
|
390
|
+
reCompile: !1,
|
|
391
|
+
reSize: reSize
|
|
392
|
+
});
|
|
379
393
|
}), morphConfig), this) : this;
|
|
380
394
|
}
|
|
381
395
|
updateModelSpec(filter, spec, forceMerge = !1, morphConfig) {
|
|
@@ -402,7 +416,7 @@ class VChart {
|
|
|
402
416
|
forceMerge && (spec = (0, util_1.mergeSpec)({}, model.getSpec(), spec));
|
|
403
417
|
const modifyConfig = () => {
|
|
404
418
|
const result = model.updateSpec(spec);
|
|
405
|
-
return model.reInit(), (result.change || result.reCompile || result.reMake || result.
|
|
419
|
+
return model.reInit(), (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) && this._chart.reDataFlow(),
|
|
406
420
|
result;
|
|
407
421
|
};
|
|
408
422
|
return sync ? this.updateCustomConfigAndRerenderSync(modifyConfig, morphConfig) : this.updateCustomConfigAndRerender(modifyConfig, morphConfig);
|
|
@@ -473,6 +487,14 @@ class VChart {
|
|
|
473
487
|
util_1.mergeSpec)({}, null === (_b = this._currentTheme.component) || void 0 === _b ? void 0 : _b.poptip))),
|
|
474
488
|
null === (_c = this._compiler) || void 0 === _c || _c.setBackground(this._getBackground());
|
|
475
489
|
}
|
|
490
|
+
_updateChartConfiguration(oldSpec) {
|
|
491
|
+
var _a, _b;
|
|
492
|
+
let resize = !1;
|
|
493
|
+
this._spec.width === oldSpec.width && this._spec.height === oldSpec.height || (resize = !0);
|
|
494
|
+
const lasAutoSize = this._autoSize;
|
|
495
|
+
return this._autoSize = !!(0, util_1.isTrueBrowser)(this._option.mode) && (null === (_b = null !== (_a = this._spec.autoFit) && void 0 !== _a ? _a : this._option.autoFit) || void 0 === _b || _b),
|
|
496
|
+
this._autoSize !== lasAutoSize && (resize = !0), this._updateCurrentTheme(), resize;
|
|
497
|
+
}
|
|
476
498
|
_getBackground() {
|
|
477
499
|
return ("string" == typeof this._spec.background ? this._spec.background : null) || this._currentTheme.background || this._option.background;
|
|
478
500
|
}
|