@visactor/vrender-components 0.15.0-alpha.6 → 0.15.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/cjs/axis/animate/group-fade.js.map +1 -1
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/animate/index.js.map +1 -1
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/config.js.map +1 -1
- package/cjs/axis/constant.js.map +1 -1
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/grid/circle.js.map +1 -1
- package/cjs/axis/grid/index.js.map +1 -1
- package/cjs/axis/grid/line.js.map +1 -1
- package/cjs/axis/grid/type.js.map +1 -1
- package/cjs/axis/index.js.map +1 -1
- package/cjs/axis/line.js +50 -1
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/mixin/circle.js.map +1 -1
- package/cjs/axis/mixin/line.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/overlap/auto-rotate.js +2 -2
- package/cjs/axis/overlap/auto-rotate.js.map +1 -1
- package/cjs/axis/type.d.ts +1 -0
- package/cjs/axis/type.js.map +1 -1
- package/cjs/brush/brush.d.ts +1 -0
- package/cjs/brush/brush.js +5 -0
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/brush/config.js.map +1 -1
- package/cjs/brush/index.js.map +1 -1
- package/cjs/brush/type.js.map +1 -1
- package/cjs/constant.js.map +1 -1
- package/cjs/core/base.d.ts +2 -1
- package/cjs/core/base.js +4 -2
- package/cjs/core/base.js.map +1 -1
- package/cjs/core/type.js.map +1 -1
- package/cjs/crosshair/base.js.map +1 -1
- package/cjs/crosshair/circle.js.map +1 -1
- package/cjs/crosshair/index.js.map +1 -1
- package/cjs/crosshair/line.js.map +1 -1
- package/cjs/crosshair/polygon.js.map +1 -1
- package/cjs/crosshair/rect.js.map +1 -1
- package/cjs/crosshair/sector.js.map +1 -1
- package/cjs/crosshair/type.js.map +1 -1
- package/cjs/data-zoom/config.js.map +1 -1
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/index.js.map +1 -1
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/config.js.map +1 -1
- package/cjs/indicator/index.js.map +1 -1
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/interface.js.map +1 -1
- package/cjs/jsx/component-type.js.map +1 -1
- package/cjs/jsx/index.js.map +1 -1
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/animate/index.js.map +1 -1
- package/cjs/label/arc.d.ts +12 -5
- package/cjs/label/arc.js +83 -41
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +12 -9
- package/cjs/label/base.js +126 -140
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +4 -4
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/overlap/bitmap.js.map +1 -1
- package/cjs/label/overlap/index.js.map +1 -1
- package/cjs/label/overlap/place.d.ts +2 -2
- package/cjs/label/overlap/place.js +15 -8
- package/cjs/label/overlap/place.js.map +1 -1
- package/cjs/label/overlap/scaler.js.map +1 -1
- package/cjs/label/polygon.d.ts +12 -0
- package/cjs/label/polygon.js +35 -0
- package/cjs/label/polygon.js.map +1 -0
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/label/type.d.ts +9 -5
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.js.map +1 -1
- package/cjs/legend/base.js.map +1 -1
- package/cjs/legend/color/color.js.map +1 -1
- package/cjs/legend/color/index.js.map +1 -1
- package/cjs/legend/color/type.js.map +1 -1
- package/cjs/legend/constant.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +28 -27
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/index.js.map +1 -1
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/legend/index.js.map +1 -1
- package/cjs/legend/size/index.js.map +1 -1
- package/cjs/legend/size/size.d.ts +2 -2
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/legend/size/type.js.map +1 -1
- package/cjs/legend/type.js.map +1 -1
- package/cjs/link-path/index.js +1 -2
- package/cjs/link-path/index.js.map +1 -1
- package/cjs/link-path/link-path.js +2 -1
- package/cjs/link-path/link-path.js.map +1 -1
- package/cjs/link-path/type.js.map +1 -1
- package/cjs/marker/area.d.ts +1 -20
- package/cjs/marker/area.js +37 -37
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +1 -0
- package/cjs/marker/base.js +28 -18
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/config.d.ts +1 -1
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/index.js.map +1 -1
- package/cjs/marker/line.js +31 -16
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +7 -7
- package/cjs/marker/point.js +6 -5
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +8 -5
- package/cjs/marker/type.js.map +1 -1
- package/cjs/marker/util.d.ts +1 -0
- package/cjs/marker/util.js +3 -0
- package/cjs/marker/util.js.map +1 -0
- package/cjs/pager/index.js.map +1 -1
- package/cjs/pager/pager.js +4 -2
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/pager/type.js.map +1 -1
- package/cjs/player/base-player.d.ts +9 -1
- package/cjs/player/base-player.js +25 -22
- package/cjs/player/base-player.js.map +1 -1
- package/cjs/player/constant.d.ts +1 -0
- package/cjs/player/constant.js +1 -0
- package/cjs/player/constant.js.map +1 -1
- package/cjs/player/continuous-player.js +6 -6
- package/cjs/player/continuous-player.js.map +1 -1
- package/cjs/player/controller/assets/index.js.map +1 -1
- package/cjs/player/controller/constant.js.map +1 -1
- package/cjs/player/controller/controller.d.ts +2 -2
- package/cjs/player/controller/controller.js +15 -7
- package/cjs/player/controller/controller.js.map +1 -1
- package/cjs/player/controller/icon/icon.js.map +1 -1
- package/cjs/player/controller/icon/index.js.map +1 -1
- package/cjs/player/controller/icon/type.js.map +1 -1
- package/cjs/player/controller/index.js.map +1 -1
- package/cjs/player/controller/type.d.ts +14 -6
- package/cjs/player/controller/type.js.map +1 -1
- package/cjs/player/discrete-player.js +11 -11
- package/cjs/player/discrete-player.js.map +1 -1
- package/cjs/player/index.js.map +1 -1
- package/cjs/player/type/base.js.map +1 -1
- package/cjs/player/type/continuous-player.d.ts +2 -2
- package/cjs/player/type/continuous-player.js.map +1 -1
- package/cjs/player/type/direction.js.map +1 -1
- package/cjs/player/type/discrete-player.js.map +1 -1
- package/cjs/player/type/event.d.ts +12 -6
- package/cjs/player/type/event.js +5 -3
- package/cjs/player/type/event.js.map +1 -1
- package/cjs/player/type/index.js.map +1 -1
- package/cjs/player/type/layout.d.ts +5 -2
- package/cjs/player/type/layout.js.map +1 -1
- package/cjs/player/utils.js.map +1 -1
- package/cjs/poptip/contribution.js +3 -1
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/index.js.map +1 -1
- package/cjs/poptip/poptip-plugin.js.map +1 -1
- package/cjs/poptip/poptip.js +30 -11
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/poptip/register.d.ts +1 -1
- package/cjs/poptip/register.js +8 -6
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/poptip/theme.js.map +1 -1
- package/cjs/poptip/type.d.ts +3 -0
- package/cjs/poptip/type.js.map +1 -1
- package/cjs/scrollbar/index.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/scrollbar/type.js.map +1 -1
- package/cjs/segment/index.js.map +1 -1
- package/cjs/segment/segment.d.ts +11 -6
- package/cjs/segment/segment.js +82 -40
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +5 -3
- package/cjs/segment/type.js.map +1 -1
- package/cjs/slider/constant.js.map +1 -1
- package/cjs/slider/index.js.map +1 -1
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/slider/type.js.map +1 -1
- package/cjs/tag/index.js.map +1 -1
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tag/type.js.map +1 -1
- package/cjs/title/index.js.map +1 -1
- package/cjs/title/title.js.map +1 -1
- package/cjs/title/type.js.map +1 -1
- package/cjs/tooltip/config.js.map +1 -1
- package/cjs/tooltip/index.js.map +1 -1
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.js.map +1 -1
- package/cjs/tooltip/util.js.map +1 -1
- package/cjs/util/align.js.map +1 -1
- package/cjs/util/common.js.map +1 -1
- package/cjs/util/index.d.ts +1 -1
- package/cjs/util/index.js +1 -1
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/{labelSmartInvert.d.ts → label-smartInvert.d.ts} +1 -0
- package/cjs/util/{labelSmartInvert.js → label-smartInvert.js} +21 -3
- package/cjs/util/label-smartInvert.js.map +1 -0
- package/cjs/util/limit-shape.d.ts +3 -0
- package/cjs/util/limit-shape.js +14 -0
- package/cjs/util/limit-shape.js.map +1 -0
- package/cjs/util/matrix.js.map +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/dist/index.js +787 -484
- package/dist/index.min.js +1 -1
- package/es/axis/animate/group-fade.js.map +1 -1
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/animate/index.js.map +1 -1
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.js.map +1 -1
- package/es/axis/config.js.map +1 -1
- package/es/axis/constant.js.map +1 -1
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/grid/circle.js.map +1 -1
- package/es/axis/grid/index.js.map +1 -1
- package/es/axis/grid/line.js.map +1 -1
- package/es/axis/grid/type.js.map +1 -1
- package/es/axis/index.js.map +1 -1
- package/es/axis/line.js +50 -2
- package/es/axis/line.js.map +1 -1
- package/es/axis/mixin/circle.js.map +1 -1
- package/es/axis/mixin/line.js.map +1 -1
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/overlap/auto-rotate.js +2 -2
- package/es/axis/overlap/auto-rotate.js.map +1 -1
- package/es/axis/type.d.ts +1 -0
- package/es/axis/type.js.map +1 -1
- package/es/brush/brush.d.ts +1 -0
- package/es/brush/brush.js +5 -0
- package/es/brush/brush.js.map +1 -1
- package/es/brush/config.js.map +1 -1
- package/es/brush/index.js.map +1 -1
- package/es/brush/type.js.map +1 -1
- package/es/constant.js.map +1 -1
- package/es/core/base.d.ts +2 -1
- package/es/core/base.js +3 -3
- package/es/core/base.js.map +1 -1
- package/es/core/type.js.map +1 -1
- package/es/crosshair/base.js.map +1 -1
- package/es/crosshair/circle.js.map +1 -1
- package/es/crosshair/index.js.map +1 -1
- package/es/crosshair/line.js.map +1 -1
- package/es/crosshair/polygon.js.map +1 -1
- package/es/crosshair/rect.js.map +1 -1
- package/es/crosshair/sector.js.map +1 -1
- package/es/crosshair/type.js.map +1 -1
- package/es/data-zoom/config.js.map +1 -1
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/index.js.map +1 -1
- package/es/data-zoom/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/config.js.map +1 -1
- package/es/indicator/index.js.map +1 -1
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.js.map +1 -1
- package/es/interface.js.map +1 -1
- package/es/jsx/component-type.js.map +1 -1
- package/es/jsx/index.js.map +1 -1
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/animate/index.js.map +1 -1
- package/es/label/arc.d.ts +12 -5
- package/es/label/arc.js +83 -39
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +12 -9
- package/es/label/base.js +124 -135
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +5 -3
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.js.map +1 -1
- package/es/label/line.js.map +1 -1
- package/es/label/overlap/bitmap.js.map +1 -1
- package/es/label/overlap/index.js.map +1 -1
- package/es/label/overlap/place.d.ts +2 -2
- package/es/label/overlap/place.js +15 -8
- package/es/label/overlap/place.js.map +1 -1
- package/es/label/overlap/scaler.js.map +1 -1
- package/es/label/polygon.d.ts +12 -0
- package/es/label/polygon.js +31 -0
- package/es/label/polygon.js.map +1 -0
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.js.map +1 -1
- package/es/label/type.d.ts +9 -5
- package/es/label/type.js.map +1 -1
- package/es/label/util.js.map +1 -1
- package/es/legend/base.js.map +1 -1
- package/es/legend/color/color.js.map +1 -1
- package/es/legend/color/index.js.map +1 -1
- package/es/legend/color/type.js.map +1 -1
- package/es/legend/constant.js.map +1 -1
- package/es/legend/discrete/discrete.js +26 -25
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/index.js.map +1 -1
- package/es/legend/discrete/type.js.map +1 -1
- package/es/legend/index.js.map +1 -1
- package/es/legend/size/index.js.map +1 -1
- package/es/legend/size/size.d.ts +2 -2
- package/es/legend/size/size.js.map +1 -1
- package/es/legend/size/type.js.map +1 -1
- package/es/legend/type.js.map +1 -1
- package/es/link-path/index.js +1 -2
- package/es/link-path/index.js.map +1 -1
- package/es/link-path/link-path.js +2 -1
- package/es/link-path/link-path.js.map +1 -1
- package/es/link-path/type.js.map +1 -1
- package/es/marker/area.d.ts +1 -20
- package/es/marker/area.js +38 -36
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +1 -0
- package/es/marker/base.js +27 -19
- package/es/marker/base.js.map +1 -1
- package/es/marker/config.d.ts +1 -1
- package/es/marker/config.js.map +1 -1
- package/es/marker/index.js.map +1 -1
- package/es/marker/line.js +32 -15
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +7 -7
- package/es/marker/point.js +6 -5
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +8 -5
- package/es/marker/type.js.map +1 -1
- package/es/marker/util.d.ts +1 -0
- package/es/marker/util.js +3 -0
- package/es/marker/util.js.map +1 -0
- package/es/pager/index.js.map +1 -1
- package/es/pager/pager.js +4 -2
- package/es/pager/pager.js.map +1 -1
- package/es/pager/type.js.map +1 -1
- package/es/player/base-player.d.ts +9 -1
- package/es/player/base-player.js +25 -22
- package/es/player/base-player.js.map +1 -1
- package/es/player/constant.d.ts +1 -0
- package/es/player/constant.js +1 -0
- package/es/player/constant.js.map +1 -1
- package/es/player/continuous-player.js +6 -6
- package/es/player/continuous-player.js.map +1 -1
- package/es/player/controller/assets/index.js.map +1 -1
- package/es/player/controller/constant.js.map +1 -1
- package/es/player/controller/controller.d.ts +2 -2
- package/es/player/controller/controller.js +15 -7
- package/es/player/controller/controller.js.map +1 -1
- package/es/player/controller/icon/icon.js.map +1 -1
- package/es/player/controller/icon/index.js.map +1 -1
- package/es/player/controller/icon/type.js.map +1 -1
- package/es/player/controller/index.js.map +1 -1
- package/es/player/controller/type.d.ts +14 -6
- package/es/player/controller/type.js.map +1 -1
- package/es/player/discrete-player.js +10 -10
- package/es/player/discrete-player.js.map +1 -1
- package/es/player/index.js.map +1 -1
- package/es/player/type/base.js.map +1 -1
- package/es/player/type/continuous-player.d.ts +2 -2
- package/es/player/type/continuous-player.js.map +1 -1
- package/es/player/type/direction.js.map +1 -1
- package/es/player/type/discrete-player.js.map +1 -1
- package/es/player/type/event.d.ts +12 -6
- package/es/player/type/event.js +5 -3
- package/es/player/type/event.js.map +1 -1
- package/es/player/type/index.js.map +1 -1
- package/es/player/type/layout.d.ts +5 -2
- package/es/player/type/layout.js.map +1 -1
- package/es/player/utils.js.map +1 -1
- package/es/poptip/contribution.js +3 -1
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/index.js.map +1 -1
- package/es/poptip/poptip-plugin.js.map +1 -1
- package/es/poptip/poptip.js +31 -9
- package/es/poptip/poptip.js.map +1 -1
- package/es/poptip/register.d.ts +1 -1
- package/es/poptip/register.js +7 -6
- package/es/poptip/register.js.map +1 -1
- package/es/poptip/theme.js.map +1 -1
- package/es/poptip/type.d.ts +3 -0
- package/es/poptip/type.js.map +1 -1
- package/es/scrollbar/index.js.map +1 -1
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/scrollbar/type.js.map +1 -1
- package/es/segment/index.js.map +1 -1
- package/es/segment/segment.d.ts +11 -6
- package/es/segment/segment.js +81 -41
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +5 -3
- package/es/segment/type.js.map +1 -1
- package/es/slider/constant.js.map +1 -1
- package/es/slider/index.js.map +1 -1
- package/es/slider/slider.js.map +1 -1
- package/es/slider/type.js.map +1 -1
- package/es/tag/index.js.map +1 -1
- package/es/tag/tag.js.map +1 -1
- package/es/tag/type.js.map +1 -1
- package/es/title/index.js.map +1 -1
- package/es/title/title.js.map +1 -1
- package/es/title/type.js.map +1 -1
- package/es/tooltip/config.js.map +1 -1
- package/es/tooltip/index.js.map +1 -1
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.js.map +1 -1
- package/es/tooltip/util.js.map +1 -1
- package/es/util/align.js.map +1 -1
- package/es/util/common.js.map +1 -1
- package/es/util/index.d.ts +1 -1
- package/es/util/index.js +1 -1
- package/es/util/index.js.map +1 -1
- package/es/util/{labelSmartInvert.d.ts → label-smartInvert.d.ts} +1 -0
- package/es/util/{labelSmartInvert.js → label-smartInvert.js} +18 -1
- package/es/util/label-smartInvert.js.map +1 -0
- package/es/util/limit-shape.d.ts +3 -0
- package/es/util/limit-shape.js +8 -0
- package/es/util/limit-shape.js.map +1 -0
- package/es/util/matrix.js.map +1 -1
- package/es/util/text.js +3 -3
- package/es/util/text.js.map +1 -1
- package/package.json +4 -4
- package/cjs/util/labelSmartInvert.js.map +0 -1
- package/es/util/labelSmartInvert.js.map +0 -1
package/es/data-zoom/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["data-zoom/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IAreaGraphicAttribute,\n ICurveType,\n IGroupGraphicAttribute,\n ILineGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { OrientType } from '../interface';\nimport type { TagAttributes } from '../tag';\n\nexport interface DataZoomAttributes extends IGroupGraphicAttribute {\n /**\n * DataZoom位置\n */\n position: IPointLike;\n /**\n * DataZoom 尺寸\n */\n size: {\n width: number;\n height: number;\n };\n /**\n * DataZoom方向\n * @default 'bottom'\n */\n orient?: OrientType;\n\n /**\n * 起点配置(比例):范围[0, 1]\n * @default 0\n */\n start?: number;\n\n /**\n * 终点配置(比例):范围[0, 1]\n * @default 1\n */\n end?: number;\n\n /**\n * 背景样式\n */\n backgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 起点手柄样式\n */\n startHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 中间手柄样式\n */\n middleHandlerStyle?: {\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 中间手柄的中间symbol样式\n */\n icon?: ISymbolGraphicAttribute;\n /**\n * 中间手柄的背景rect样式\n */\n background?: {\n style?: IRectGraphicAttribute;\n size?: number;\n };\n };\n\n /**\n * 终点手柄样式\n */\n endHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 起点文字样式\n */\n startTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 终点文字样式\n */\n endTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 选中背景样式\n */\n selectedBackgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 拖拽进行中的选中背景样式\n */\n dragMaskStyle?: IRectGraphicAttribute;\n\n /**\n * 背景图表样式\n */\n backgroundChartStyle?: {\n line?: {\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 选中的背景图表样式\n */\n selectedBackgroundChartStyle?: {\n line?: {\n /**\n * @default true\n */\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 是否显示startText和endText\n * @default 'auto' 鼠标hover在选中区域时才显示startText和endText\n */\n showDetail?: 'auto' | boolean;\n\n /**\n * 是否开启框选, 如果不开启则支持selectedBackground拖拽(框选和拖拽两者互斥)\n * @default true\n */\n brushSelect?: boolean;\n\n /**\n * todo: 是否锁定选择区域(或叫做数据窗口)的大小\n */\n zoomLock?: boolean;\n\n /**\n * 绘制背景图表的数据 & 映射函数\n */\n previewData?: any[];\n previewCallbackX?: (datum: any) => number;\n previewCallbackY?: (datum: any) => number;\n previewCallbackX1?: (datum: any) => number;\n previewCallbackY1?: (datum: any) => number;\n updateStateCallback?: (start: number, end: number) => any;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/data-zoom/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IAreaGraphicAttribute,\n ICurveType,\n IGroupGraphicAttribute,\n ILineGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { OrientType } from '../interface';\nimport type { TagAttributes } from '../tag';\n\nexport interface DataZoomAttributes extends IGroupGraphicAttribute {\n /**\n * DataZoom位置\n */\n position: IPointLike;\n /**\n * DataZoom 尺寸\n */\n size: {\n width: number;\n height: number;\n };\n /**\n * DataZoom方向\n * @default 'bottom'\n */\n orient?: OrientType;\n\n /**\n * 起点配置(比例):范围[0, 1]\n * @default 0\n */\n start?: number;\n\n /**\n * 终点配置(比例):范围[0, 1]\n * @default 1\n */\n end?: number;\n\n /**\n * 背景样式\n */\n backgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 起点手柄样式\n */\n startHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 中间手柄样式\n */\n middleHandlerStyle?: {\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 中间手柄的中间symbol样式\n */\n icon?: ISymbolGraphicAttribute;\n /**\n * 中间手柄的背景rect样式\n */\n background?: {\n style?: IRectGraphicAttribute;\n size?: number;\n };\n };\n\n /**\n * 终点手柄样式\n */\n endHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 起点文字样式\n */\n startTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 终点文字样式\n */\n endTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 选中背景样式\n */\n selectedBackgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 拖拽进行中的选中背景样式\n */\n dragMaskStyle?: IRectGraphicAttribute;\n\n /**\n * 背景图表样式\n */\n backgroundChartStyle?: {\n line?: {\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 选中的背景图表样式\n */\n selectedBackgroundChartStyle?: {\n line?: {\n /**\n * @default true\n */\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 是否显示startText和endText\n * @default 'auto' 鼠标hover在选中区域时才显示startText和endText\n */\n showDetail?: 'auto' | boolean;\n\n /**\n * 是否开启框选, 如果不开启则支持selectedBackground拖拽(框选和拖拽两者互斥)\n * @default true\n */\n brushSelect?: boolean;\n\n /**\n * todo: 是否锁定选择区域(或叫做数据窗口)的大小\n */\n zoomLock?: boolean;\n\n /**\n * 绘制背景图表的数据 & 映射函数\n */\n previewData?: any[];\n previewCallbackX?: (datum: any) => number;\n previewCallbackY?: (datum: any) => number;\n previewCallbackX1?: (datum: any) => number;\n previewCallbackY1?: (datum: any) => number;\n updateStateCallback?: (start: number, end: number) => any;\n}\n"]}
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.15.1\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["indicator/config.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC","file":"config.js","sourcesContent":["import { IndicatorAttributes } from './type';\nexport const DEFAULT_INDICATOR_THEME: Partial<IndicatorAttributes> = {\n title: {\n style: {\n text: '',\n fontSize: 20,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n },\n content: {\n style: {\n text: '',\n fontSize: 16,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n }\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/config.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC","file":"config.js","sourcesContent":["import { IndicatorAttributes } from './type';\nexport const DEFAULT_INDICATOR_THEME: Partial<IndicatorAttributes> = {\n title: {\n style: {\n text: '',\n fontSize: 20,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n },\n content: {\n style: {\n text: '',\n fontSize: 16,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["indicator/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './indicator';\nexport * from './type';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './indicator';\nexport * from './type';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,E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IText } from '@visactor/vrender';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { measureTextSize } from '../util';\nimport { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\n\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n const titleHeight = this._title ? this._title.AABBBounds.height() : 0;\n\n if (isValid(content)) {\n const titleSpace = this._title ? (title?.space ? title.space : 0) : 0;\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n let lastContentHeight = 0;\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n const contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n const contentSpace = contentItem?.space ? contentItem.space : 0;\n lastContentHeight += contentComponent.AABBBounds.height() + contentSpace;\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n const originWidth = measureTextSize(indicatorItemSpec.style?.text ?? '', indicatorItemSpec.style ?? {}).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicat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AAQ,CAAC,CAAC;YACjD,aAAa,CAAC,YAAY,CACxB,YAAY,EACZ,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAC5F,CAAC;SACH;IACH,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport { IGroup, INode, IText } from '@visactor/vrender';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { measureTextSize } from '../util';\nimport { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\n\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n const titleHeight = this._title ? this._title.AABBBounds.height() : 0;\n\n if (isValid(content)) {\n const titleSpace = this._title ? (title?.space ? title.space : 0) : 0;\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n let lastContentHeight = 0;\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n const contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n const contentSpace = contentItem?.space ? contentItem.space : 0;\n lastContentHeight += contentComponent.AABBBounds.height() + contentSpace;\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n const originWidth = measureTextSize(indicatorItemSpec.style?.text ?? '', indicatorItemSpec.style ?? {}).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n}\n"]}
|
package/es/indicator/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["indicator/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGroupGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';\n\nexport interface IndicatorAttributes extends IGroupGraphicAttribute {\n /**\n * 是否显示指标卡组件\n * @default true\n */\n visible?: boolean;\n /**\n * 内容尺寸\n */\n size: { width: number; height: number };\n /**\n * 指标卡 x 方向偏移\n * @default 0\n */\n dx?: number;\n /**\n * 指标卡 y 方向偏移\n * @default 0\n */\n dy?: number;\n /**\n * 指标卡宽度占内容区域的最大比值(从0到1)\n */\n limitRatio?: number;\n /**\n * 指标卡标题文字配置\n */\n title?: IndicatorItemSpec;\n /**\n * 指标卡内容文字配置\n */\n content?: IndicatorItemSpec[] | IndicatorItemSpec;\n}\n\nexport interface IndicatorItemSpec {\n /**\n * 是否显示当前项\n * @default true\n */\n visible?: boolean;\n /**\n * title.space: title 和 content 之间的间距\n * contentItem.space: content 之间的间距\n */\n space?: number;\n /**\n * 是否自适应文字空间进行缩略\n * 按照原字体大小,根据空间大小缩略文字\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 是否自适应文字空间缩放文字大小\n * 不缩略文字,改变字体大小以适应空间\n * @default false\n */\n autoFit?: boolean;\n /**\n * 自适应文字宽度与可用空间的比例\n * @default 0.5\n */\n fitPercent?: number;\n /**\n * 文字样式\n */\n style?: ITextGraphicAttribute;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGroupGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';\n\nexport interface IndicatorAttributes extends IGroupGraphicAttribute {\n /**\n * 是否显示指标卡组件\n * @default true\n */\n visible?: boolean;\n /**\n * 内容尺寸\n */\n size: { width: number; height: number };\n /**\n * 指标卡 x 方向偏移\n * @default 0\n */\n dx?: number;\n /**\n * 指标卡 y 方向偏移\n * @default 0\n */\n dy?: number;\n /**\n * 指标卡宽度占内容区域的最大比值(从0到1)\n */\n limitRatio?: number;\n /**\n * 指标卡标题文字配置\n */\n title?: IndicatorItemSpec;\n /**\n * 指标卡内容文字配置\n */\n content?: IndicatorItemSpec[] | IndicatorItemSpec;\n}\n\nexport interface IndicatorItemSpec {\n /**\n * 是否显示当前项\n * @default true\n */\n visible?: boolean;\n /**\n * title.space: title 和 content 之间的间距\n * contentItem.space: content 之间的间距\n */\n space?: number;\n /**\n * 是否自适应文字空间进行缩略\n * 按照原字体大小,根据空间大小缩略文字\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 是否自适应文字空间缩放文字大小\n * 不缩略文字,改变字体大小以适应空间\n * @default false\n */\n autoFit?: boolean;\n /**\n * 自适应文字宽度与可用空间的比例\n * @default 0.5\n */\n fitPercent?: number;\n /**\n * 文字样式\n */\n style?: ITextGraphicAttribute;\n}\n"]}
|
package/es/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import { IRectGraphicAttribute } from '@visactor/vrender';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import { IRectGraphicAttribute } from '@visactor/vrender';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jsx/component-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,MAAM,UAAU,IAAI,CAAC,MAAgD;IACnE,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC","file":"component-type.js","sourcesContent":["import type { IDefaultGraphicParamsType } from '@visactor/vrender';\nimport type { TagAttributes } from '../tag';\nimport { Tag } from '../tag';\n\nexport function VTag(params: IDefaultGraphicParamsType<TagAttributes>) {\n return new Tag(params ? params.attribute : {});\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/jsx/component-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,MAAM,UAAU,IAAI,CAAC,MAAgD;IACnE,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC","file":"component-type.js","sourcesContent":["import type { IDefaultGraphicParamsType } from '@visactor/vrender';\nimport type { TagAttributes } from '../tag';\nimport { Tag } from '../tag';\n\nexport function VTag(params: IDefaultGraphicParamsType<TagAttributes>) {\n return new Tag(params ? params.attribute : {});\n}\n"]}
|
package/es/jsx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jsx/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","file":"index.js","sourcesContent":["export * from './component-type';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/jsx/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","file":"index.js","sourcesContent":["export * from './component-type';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/animate/animate.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC5D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;QACD,EAAE,EAAE;YACF,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAE7C,MAAM,UAAU,sBAAsB,CACpC,aAAoC,EACpC,IAA0B;;IAK1B,OAAO,MAAA,MAAA,gBAAgB,CAAC,IAAI,CAAC,iEAAG,aAAa,CAAC,mCAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAsB;CAC/B,CAAC","file":"animate.js","sourcesContent":["import { EasingType, ITextGraphicAttribute } from '@visactor/vrender';\nimport { ILabelAnimation } from '../type';\n\nconst fadeIn = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n },\n to: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n }\n };\n};\n\nconst fadeOut = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n },\n to: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n }\n };\n};\n\nconst animationEffects = { fadeIn, fadeOut };\n\nexport function getAnimationAttributes(\n textAttribute: ITextGraphicAttribute,\n type: 'fadeIn' | 'fadeOut'\n): {\n from: any;\n to: any;\n} {\n return animationEffects[type]?.(textAttribute) ?? { from: {}, to: {} };\n}\n\nexport const DefaultLabelAnimation: ILabelAnimation = {\n mode: 'same-time',\n duration: 300,\n easing: 'linear' as EasingType\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/label/animate/animate.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC5D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;QACD,EAAE,EAAE;YACF,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAE7C,MAAM,UAAU,sBAAsB,CACpC,aAAoC,EACpC,IAA0B;;IAK1B,OAAO,MAAA,MAAA,gBAAgB,CAAC,IAAI,CAAC,iEAAG,aAAa,CAAC,mCAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAsB;CAC/B,CAAC","file":"animate.js","sourcesContent":["import { EasingType, ITextGraphicAttribute } from '@visactor/vrender';\nimport { ILabelAnimation } from '../type';\n\nconst fadeIn = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n },\n to: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n }\n };\n};\n\nconst fadeOut = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n },\n to: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n }\n };\n};\n\nconst animationEffects = { fadeIn, fadeOut };\n\nexport function getAnimationAttributes(\n textAttribute: ITextGraphicAttribute,\n type: 'fadeIn' | 'fadeOut'\n): {\n from: any;\n to: any;\n} {\n return animationEffects[type]?.(textAttribute) ?? { from: {}, to: {} };\n}\n\nexport const DefaultLabelAnimation: ILabelAnimation = {\n mode: 'same-time',\n duration: 300,\n easing: 'linear' as EasingType\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/animate/index.ts"],"names":[],"mappings":"","file":"index.js","sourcesContent":[""]}
|
|
1
|
+
{"version":3,"sources":["../src/label/animate/index.ts"],"names":[],"mappings":"","file":"index.js","sourcesContent":[""]}
|
package/es/label/arc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
1
|
+
import type { IAABBBounds, IBoundsLike } from '@visactor/vutils';
|
|
2
2
|
import { LabelBase } from './base';
|
|
3
|
-
import type { ArcLabelAttrs, IPoint, Quadrant, BaseLabelAttrs } from './type';
|
|
4
|
-
import type
|
|
3
|
+
import type { ArcLabelAttrs, IPoint, Quadrant, BaseLabelAttrs, LabelItem, IArcLabelLineSpec } from './type';
|
|
4
|
+
import { type IText, type IGraphic, type ILine } from '@visactor/vrender';
|
|
5
5
|
export declare class ArcInfo {
|
|
6
6
|
key: string;
|
|
7
7
|
refDatum: any;
|
|
@@ -20,12 +20,16 @@ export declare class ArcInfo {
|
|
|
20
20
|
pointA: IPoint;
|
|
21
21
|
pointB: IPoint;
|
|
22
22
|
pointC: IPoint;
|
|
23
|
+
labelLine: IArcLabelLineSpec;
|
|
23
24
|
quadrant: Quadrant;
|
|
24
25
|
radian: number;
|
|
25
26
|
middleAngle: number;
|
|
27
|
+
innerRadius: number;
|
|
28
|
+
outerRadius: number;
|
|
29
|
+
circleCenter: IPoint;
|
|
26
30
|
k: number;
|
|
27
31
|
angle: number;
|
|
28
|
-
constructor(refDatum: any, center: IPoint, outerCenter: IPoint, quadrant: Quadrant, radian: number, middleAngle: number);
|
|
32
|
+
constructor(refDatum: any, center: IPoint, outerCenter: IPoint, quadrant: Quadrant, radian: number, middleAngle: number, innerRadius: number, outerRadius: number, circleCenter: IPoint);
|
|
29
33
|
getLabelBounds(): IBoundsLike;
|
|
30
34
|
}
|
|
31
35
|
export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
@@ -40,6 +44,7 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
|
40
44
|
x: number;
|
|
41
45
|
y: number;
|
|
42
46
|
} | undefined;
|
|
47
|
+
protected _layout(data?: LabelItem[]): IText[];
|
|
43
48
|
protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[], data?: any, textBoundsArray?: any, ellipsisWidth?: number): ArcInfo[];
|
|
44
49
|
private _layoutInsideLabels;
|
|
45
50
|
private _layoutOutsideLabels;
|
|
@@ -59,8 +64,10 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
|
59
64
|
private _restoreY;
|
|
60
65
|
private _checkYRange;
|
|
61
66
|
private _coverLabels;
|
|
62
|
-
protected
|
|
67
|
+
protected _labelLine(text: IText): ILine;
|
|
68
|
+
protected computeRadius(r: number, width?: number, height?: number, k?: number): number;
|
|
63
69
|
protected computeLayoutRadius(width: number, height: number): number;
|
|
70
|
+
protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds): boolean;
|
|
64
71
|
private computeLayoutOuterRadius;
|
|
65
72
|
private computeDatumRadius;
|
|
66
73
|
}
|
package/es/label/arc.js
CHANGED
|
@@ -2,12 +2,15 @@ import { merge, isValidNumber, isNil, isLess, isGreater, isNumberClose as isClos
|
|
|
2
2
|
|
|
3
3
|
import { LabelBase } from "./base";
|
|
4
4
|
|
|
5
|
+
import { createLine } from "@visactor/vrender";
|
|
6
|
+
|
|
5
7
|
import { circlePoint, isQuadrantRight, isQuadrantLeft, lineCirclePoints, connectLineRadian, checkBoundsOverlap, computeQuadrant } from "./util";
|
|
6
8
|
|
|
7
9
|
export class ArcInfo {
|
|
8
|
-
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle) {
|
|
10
|
+
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle, innerRadius, outerRadius, circleCenter) {
|
|
9
11
|
this.refDatum = refDatum, this.center = center, this.outerCenter = outerCenter,
|
|
10
12
|
this.quadrant = quadrant, this.radian = radian, this.middleAngle = middleAngle,
|
|
13
|
+
this.innerRadius = innerRadius, this.outerRadius = outerRadius, this.circleCenter = circleCenter,
|
|
11
14
|
this.labelVisible = !0, this.labelLimit = 0;
|
|
12
15
|
}
|
|
13
16
|
getLabelBounds() {
|
|
@@ -39,17 +42,36 @@ export class ArcLabel extends LabelBase {
|
|
|
39
42
|
y: 0
|
|
40
43
|
};
|
|
41
44
|
}
|
|
45
|
+
_layout(data = []) {
|
|
46
|
+
const labels = super._layout(data), textBoundsArray = labels.map((label => this.getGraphicBounds(label))), ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), {
|
|
47
|
+
text: "..."
|
|
48
|
+
}), ellipsisText = this._createLabelText(ellipsisLabelAttribute), ellipsisTextBounds = this.getGraphicBounds(ellipsisText), ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1, arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
|
|
49
|
+
for (let i = 0; i < data.length; i++) {
|
|
50
|
+
const textData = data[i], basedArc = arcs.find((arc => arc.refDatum.id === textData.id)), labelAttribute = {
|
|
51
|
+
visible: basedArc.labelVisible,
|
|
52
|
+
x: basedArc.labelPosition.x,
|
|
53
|
+
y: basedArc.labelPosition.y,
|
|
54
|
+
angle: basedArc.angle,
|
|
55
|
+
maxLineWidth: basedArc.labelLimit,
|
|
56
|
+
points: (null == basedArc ? void 0 : basedArc.pointA) && (null == basedArc ? void 0 : basedArc.pointB) && (null == basedArc ? void 0 : basedArc.pointC) ? [ basedArc.pointA, basedArc.pointB, basedArc.pointC ] : void 0,
|
|
57
|
+
line: null == basedArc ? void 0 : basedArc.labelLine
|
|
58
|
+
};
|
|
59
|
+
labels[i].setAttributes(labelAttribute);
|
|
60
|
+
}
|
|
61
|
+
return labels;
|
|
62
|
+
}
|
|
42
63
|
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
|
|
43
|
-
var _a;
|
|
44
64
|
this._arcLeft.clear(), this._arcRight.clear(), this._ellipsisWidth = ellipsisWidth;
|
|
45
|
-
|
|
46
|
-
currentMarks.forEach((
|
|
65
|
+
let maxRadius = 0;
|
|
66
|
+
currentMarks.forEach((currentMarks => {
|
|
67
|
+
currentMarks.attribute.outerRadius > maxRadius && (maxRadius = currentMarks.attribute.outerRadius);
|
|
68
|
+
})), currentMarks.forEach(((currentMark, index) => {
|
|
47
69
|
var _a, _b;
|
|
48
|
-
const graphicAttribute = currentMark.attribute,
|
|
70
|
+
const graphicAttribute = currentMark.attribute, center = {
|
|
49
71
|
x: null !== (_a = null == graphicAttribute ? void 0 : graphicAttribute.x) && void 0 !== _a ? _a : 0,
|
|
50
72
|
y: null !== (_b = null == graphicAttribute ? void 0 : graphicAttribute.y) && void 0 !== _b ? _b : 0
|
|
51
|
-
}, item = data[index], textBounds = textBoundsArray[index], arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2, intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle, arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2), arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle), outerArcMiddle = circlePoint(center.x, center.y,
|
|
52
|
-
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttribute.outerRadius
|
|
73
|
+
}, item = data[index], textBounds = textBoundsArray[index], arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2, intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle, arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2), arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle), outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle), arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
|
|
74
|
+
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttribute.outerRadius), arc.middleAngle),
|
|
53
75
|
arc.labelSize = {
|
|
54
76
|
width: textBounds.x2 - textBounds.x1,
|
|
55
77
|
height: textBounds.y2 - textBounds.y1
|
|
@@ -61,14 +83,10 @@ export class ArcLabel extends LabelBase {
|
|
|
61
83
|
arcs.push(...this._layoutOutsideLabels(leftArcs, attribute, currentMarks))), arcs;
|
|
62
84
|
}
|
|
63
85
|
_layoutInsideLabels(arcs, attribute, currentMarks) {
|
|
64
|
-
|
|
65
|
-
const center = {
|
|
66
|
-
x: null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0,
|
|
67
|
-
y: null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0
|
|
68
|
-
}, centerOffset = null !== (_e = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _e ? _e : 0, innerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.innerRadius, attribute.width, attribute.height), outerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height), labelConfig = attribute, spaceWidth = labelConfig.spaceWidth;
|
|
86
|
+
const labelConfig = attribute, spaceWidth = labelConfig.spaceWidth;
|
|
69
87
|
return arcs.forEach((arc => {
|
|
70
88
|
var _a, _b;
|
|
71
|
-
const {labelSize: labelSize, radian: radian} = arc, innerRadius =
|
|
89
|
+
const {labelSize: labelSize, radian: radian} = arc, innerRadius = arc.innerRadius, outerRadius = arc.outerRadius;
|
|
72
90
|
let limit;
|
|
73
91
|
if (radian < connectLineRadian(outerRadius, labelSize.height)) limit = 0; else {
|
|
74
92
|
let minRadius;
|
|
@@ -79,7 +97,7 @@ export class ArcLabel extends LabelBase {
|
|
|
79
97
|
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
80
98
|
arc.labelText = text;
|
|
81
99
|
const labelWidth = Math.min(limit, arc.labelSize.width), align = this._computeAlign(arc, attribute), labelRadius = outerRadius - spaceWidth - ("left" === align ? labelWidth : "right" === align ? 0 : labelWidth / 2);
|
|
82
|
-
arc.labelPosition = circlePoint(
|
|
100
|
+
arc.labelPosition = circlePoint(arc.circleCenter.x, arc.circleCenter.y, labelRadius, arc.middleAngle),
|
|
83
101
|
arc.labelLimit = labelWidth, isGreater(labelWidth, 0) || (arc.labelVisible = !1),
|
|
84
102
|
arc.angle = null !== (_b = null === (_a = null == attribute ? void 0 : attribute.textStyle) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : arc.middleAngle;
|
|
85
103
|
})), arcs;
|
|
@@ -122,21 +140,27 @@ export class ArcLabel extends LabelBase {
|
|
|
122
140
|
return arcs.forEach((arc => {
|
|
123
141
|
var _a, _b;
|
|
124
142
|
arc.labelVisible && (isLess(arc.pointB.x, line2MinLength + spaceWidth) || isGreater(arc.pointB.x, width - line2MinLength - spaceWidth)) && (arc.labelVisible = !1),
|
|
125
|
-
arc.angle = null !== (_b = null === (_a = null == attribute ? void 0 : attribute.textStyle) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : 0
|
|
143
|
+
arc.angle = null !== (_b = null === (_a = null == attribute ? void 0 : attribute.textStyle) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : 0,
|
|
144
|
+
arc.labelLine = Object.assign({}, null == attribute ? void 0 : attribute.line);
|
|
126
145
|
})), arcs;
|
|
127
146
|
}
|
|
128
147
|
_computeX(arc, attribute, currentMarks) {
|
|
129
|
-
var _a
|
|
130
|
-
const
|
|
131
|
-
|
|
148
|
+
var _a;
|
|
149
|
+
const center = arc.circleCenter, plotLayout_width = 2 * center.x;
|
|
150
|
+
center.y;
|
|
151
|
+
let maxRadius = 0;
|
|
152
|
+
currentMarks.forEach((currentMark => {
|
|
153
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
154
|
+
}));
|
|
155
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = attribute.line.line1MinLength, line2MinLength = attribute.line.line2MinLength, labelLayoutAlign = null === (_a = attribute.layout) || void 0 === _a ? void 0 : _a.align, spaceWidth = attribute.spaceWidth, {labelPosition: labelPosition, quadrant: quadrant, pointB: pointB} = arc;
|
|
132
156
|
isValidNumber(pointB.x * pointB.y) || (arc.pointC = {
|
|
133
157
|
x: NaN,
|
|
134
158
|
y: NaN
|
|
135
159
|
}, labelPosition.x = NaN, arc.labelLimit = 0);
|
|
136
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height
|
|
160
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
137
161
|
let cx = 0;
|
|
138
162
|
let limit = (flag > 0 ? plotLayout_width - pointB.x : pointB.x) - line2MinLength - spaceWidth;
|
|
139
|
-
"labelLine" === labelLayoutAlign && (cx = (radius + line1MinLength + line2MinLength) * flag +
|
|
163
|
+
"labelLine" === labelLayoutAlign && (cx = (radius + line1MinLength + line2MinLength) * flag + center.x,
|
|
140
164
|
limit = (flag > 0 ? plotLayout_width - cx : cx) - spaceWidth);
|
|
141
165
|
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
142
166
|
arc.labelText = text;
|
|
@@ -270,16 +294,17 @@ export class ArcLabel extends LabelBase {
|
|
|
270
294
|
return -1;
|
|
271
295
|
}
|
|
272
296
|
_computePointB(arc, r, attribute, currentMarks) {
|
|
273
|
-
|
|
274
|
-
|
|
297
|
+
const labelConfig = attribute;
|
|
298
|
+
let maxRadius = 0;
|
|
299
|
+
currentMarks.forEach((currentMark => {
|
|
300
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
301
|
+
}));
|
|
302
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = labelConfig.line.line1MinLength;
|
|
275
303
|
if ("none" === labelConfig.layout.strategy) arc.pointB = {
|
|
276
304
|
x: arc.outerCenter.x,
|
|
277
305
|
y: arc.outerCenter.y
|
|
278
306
|
}; else {
|
|
279
|
-
const center = {
|
|
280
|
-
x: null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0,
|
|
281
|
-
y: null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0
|
|
282
|
-
}, centerOffset = null !== (_e = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _e ? _e : 0, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset), {labelPosition: labelPosition, quadrant: quadrant} = arc, rd = r - Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius), x = Math.sqrt(r ** 2 - Math.abs(center.y - labelPosition.y) ** 2) - rd;
|
|
307
|
+
const center = arc.circleCenter, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), {labelPosition: labelPosition, quadrant: quadrant} = arc, rd = r - Math.max(radius + line1MinLength, arc.outerRadius), x = Math.sqrt(r ** 2 - Math.abs(center.y - labelPosition.y) ** 2) - rd;
|
|
283
308
|
isValidNumber(x) ? arc.pointB = {
|
|
284
309
|
x: center.x + x * (isQuadrantLeft(quadrant) ? -1 : 1),
|
|
285
310
|
y: labelPosition.y
|
|
@@ -293,11 +318,15 @@ export class ArcLabel extends LabelBase {
|
|
|
293
318
|
for (const arc of arcs) arc.labelVisible && (arc.lastLabelY = arc.labelPosition.y);
|
|
294
319
|
}
|
|
295
320
|
_computeYRange(arc, attribute, currentMarks) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
321
|
+
const center = arc.circleCenter, plotRect = {
|
|
322
|
+
width: 2 * center.x,
|
|
323
|
+
height: 2 * center.y
|
|
324
|
+
};
|
|
325
|
+
let maxRadius = 0;
|
|
326
|
+
currentMarks.forEach((currentMark => {
|
|
327
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
328
|
+
}));
|
|
329
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = attribute.line.line1MinLength, {width: width, height: height} = plotRect, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), r = this._computeLayoutRadius(height / 2, attribute, currentMarks), cx = Math.abs(arc.center.x - width / 2), cy = arc.center.y - height / 2;
|
|
301
330
|
let a, b, c;
|
|
302
331
|
if (isClose(width / 2, cx)) a = 0, b = 1, c = -cy; else if (isClose(height / 2, cy)) a = 1,
|
|
303
332
|
b = 0, c = -cx; else {
|
|
@@ -313,8 +342,12 @@ export class ArcLabel extends LabelBase {
|
|
|
313
342
|
max = Math.max(points[0].y, points[1].y) + height / 2), arc.labelYRange = [ min, max ];
|
|
314
343
|
}
|
|
315
344
|
_computeLayoutRadius(halfYLength, attribute, currentMarks) {
|
|
316
|
-
|
|
317
|
-
|
|
345
|
+
const labelConfig = attribute, layoutArcGap = labelConfig.layoutArcGap, line1MinLength = labelConfig.line.line1MinLength;
|
|
346
|
+
let maxRadius = 0;
|
|
347
|
+
currentMarks.forEach((currentMark => {
|
|
348
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
349
|
+
}));
|
|
350
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), outerR = this.computeRadius(radiusRatio, attribute.width, attribute.height) + line1MinLength, a = outerR - layoutArcGap;
|
|
318
351
|
return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
|
|
319
352
|
}
|
|
320
353
|
_findNeighborIndex(arcs, priorityArc) {
|
|
@@ -358,20 +391,31 @@ export class ArcLabel extends LabelBase {
|
|
|
358
391
|
checkBoundsOverlap(lastBounds, bounds) ? arcs[i].labelVisible = !1 : lastBounds = bounds;
|
|
359
392
|
}
|
|
360
393
|
}
|
|
361
|
-
|
|
362
|
-
var _a;
|
|
363
|
-
return null
|
|
394
|
+
_labelLine(text) {
|
|
395
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
396
|
+
return (null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.points) ? createLine({
|
|
397
|
+
visible: null === (_g = null !== (_e = (null === (_c = null === (_b = text.attribute) || void 0 === _b ? void 0 : _b.line) || void 0 === _c ? void 0 : _c.visible) && (null === (_d = text.attribute) || void 0 === _d ? void 0 : _d.visible)) && void 0 !== _e ? _e : null === (_f = text.attribute) || void 0 === _f ? void 0 : _f.visible) || void 0 === _g || _g,
|
|
398
|
+
stroke: null !== (_l = null === (_k = null === (_j = null === (_h = text.attribute) || void 0 === _h ? void 0 : _h.line) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.stroke) && void 0 !== _l ? _l : null === (_m = text.attribute) || void 0 === _m ? void 0 : _m.fill,
|
|
399
|
+
lineWidth: null !== (_r = null === (_q = null === (_p = null === (_o = text.attribute) || void 0 === _o ? void 0 : _o.line) || void 0 === _p ? void 0 : _p.style) || void 0 === _q ? void 0 : _q.lineWidth) && void 0 !== _r ? _r : 1,
|
|
400
|
+
points: null === (_s = text.attribute) || void 0 === _s ? void 0 : _s.points,
|
|
401
|
+
curveType: (null === (_u = null === (_t = text.attribute) || void 0 === _t ? void 0 : _t.line) || void 0 === _u ? void 0 : _u.smooth) ? "basis" : null
|
|
402
|
+
}) : void 0;
|
|
403
|
+
}
|
|
404
|
+
computeRadius(r, width, height, k) {
|
|
405
|
+
return this.computeLayoutRadius(width || 0, height || 0) * r * (isNil(k) ? 1 : k);
|
|
364
406
|
}
|
|
365
407
|
computeLayoutRadius(width, height) {
|
|
366
408
|
return Math.min(width / 2, height / 2);
|
|
367
409
|
}
|
|
410
|
+
_canPlaceInside(textBound, shapeBound) {
|
|
411
|
+
return "inside" === this.attribute.position;
|
|
412
|
+
}
|
|
368
413
|
computeLayoutOuterRadius(r, width, height) {
|
|
369
414
|
return r / (Math.min(width, height) / 2);
|
|
370
415
|
}
|
|
371
|
-
computeDatumRadius(width, height, outerRadius
|
|
372
|
-
var _a;
|
|
416
|
+
computeDatumRadius(width, height, outerRadius) {
|
|
373
417
|
const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height);
|
|
374
|
-
return
|
|
418
|
+
return this.computeLayoutRadius(width || 0, height || 0) * outerRadiusRatio;
|
|
375
419
|
}
|
|
376
420
|
}
|
|
377
421
|
|