@visactor/vrender-components 0.15.0-alpha.5 → 0.15.0
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 +7 -3
- package/cjs/label/arc.js +66 -10
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +12 -9
- package/cjs/label/base.js +123 -137
- 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.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.js.map +1 -1
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/index.js.map +1 -1
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.js +1 -1
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.js.map +1 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/cjs/util/labelSmartInvert.d.ts +1 -0
- package/cjs/util/labelSmartInvert.js +20 -2
- package/cjs/util/labelSmartInvert.js.map +1 -1
- 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 +500 -304
- 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 +7 -3
- package/es/label/arc.js +66 -9
- 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.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.js.map +1 -1
- package/es/marker/base.js.map +1 -1
- package/es/marker/config.js.map +1 -1
- package/es/marker/index.js.map +1 -1
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.js +1 -1
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.js.map +1 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/es/util/labelSmartInvert.d.ts +1 -0
- package/es/util/labelSmartInvert.js +17 -0
- package/es/util/labelSmartInvert.js.map +1 -1
- 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 +2 -2
|
@@ -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/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.15.0
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.15.0", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.15.0\";\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,QAAA,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,QAAA,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,8CAA4B;AAC5B,yCAAuB","file":"index.js","sourcesContent":["export * from './indicator';\nexport * from './type';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yCAAuB","file":"index.js","sourcesContent":["export * from './indic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,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAC5F,CAAC;SACH;IACH,CAAC;CACF;AA3HD,8BA2HC","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"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":";;;AAIA,6CAA6E;AAC7E,uCAAiD;AACjD,kCAA0C;AAE1C,qCAAmD;AAEnD,MAAa,SAAU,SAAQ,wBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IA0HrB,CAAC;IArHW,MAAM;;QACd,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;QAEvG,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;QAE7D,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,CAAW,CAAC;QAG5G,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO;SACR;QAED,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YAClB,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,EAAE;gBAC3B,MAAM,UAAU,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,IAAA,YAAG,EAAC,gCAAuB,EAAE,aAAa,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBACvF,IAAI,CAAC,MAAM,GAAG,K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,QAAQ,mCAAI,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;YAC/E,aAAa,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACjD,aAAa,CAAC,YAAY,CACxB,YAAY,EACZ,IAAA,gBAAO,EAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAC5F,CAAC;SACH;IACH,CAAC;CACF;AA3HD,8BA2HC","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"]}
|
|
@@ -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/cjs/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,gCAA6B;AAE7B,SAAgB,IAAI,CAAC,MAAgD;IACnE,OAAO,IAAI,SAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC;AAFD,oBAEC","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,gCAA6B;AAE7B,SAAgB,IAAI,CAAC,MAAgD;IACnE,OAAO,IAAI,SAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC;AAFD,oBAEC","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/cjs/jsx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jsx/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC","file":"index.js","sourcesContent":["export * from './component-type';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/jsx/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC","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,SAAgB,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;AARD,wDAQC;AAEY,QAAA,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,SAAgB,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;AARD,wDAQC;AAEY,QAAA,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/cjs/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,6 +20,7 @@ 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;
|
|
@@ -40,6 +41,7 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
|
40
41
|
x: number;
|
|
41
42
|
y: number;
|
|
42
43
|
} | undefined;
|
|
44
|
+
protected _layout(data?: LabelItem[]): IText[];
|
|
43
45
|
protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[], data?: any, textBoundsArray?: any, ellipsisWidth?: number): ArcInfo[];
|
|
44
46
|
private _layoutInsideLabels;
|
|
45
47
|
private _layoutOutsideLabels;
|
|
@@ -59,8 +61,10 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
|
59
61
|
private _restoreY;
|
|
60
62
|
private _checkYRange;
|
|
61
63
|
private _coverLabels;
|
|
64
|
+
protected _labelLine(text: IText): ILine;
|
|
62
65
|
protected computeRadius(r: number, width?: number, height?: number, centerOffset?: number, k?: number): number;
|
|
63
66
|
protected computeLayoutRadius(width: number, height: number): number;
|
|
67
|
+
protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds): boolean;
|
|
64
68
|
private computeLayoutOuterRadius;
|
|
65
69
|
private computeDatumRadius;
|
|
66
70
|
}
|
package/cjs/label/arc.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.ArcLabel = exports.ArcInfo = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), util_1 = require("./util");
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), vrender_1 = require("@visactor/vrender"), util_1 = require("./util");
|
|
8
8
|
|
|
9
9
|
class ArcInfo {
|
|
10
10
|
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle) {
|
|
@@ -43,19 +43,40 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
43
43
|
y: 0
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
_layout(data = []) {
|
|
47
|
+
const labels = super._layout(data), textBoundsArray = labels.map((label => this.getGraphicBounds(label))), ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), {
|
|
48
|
+
text: "..."
|
|
49
|
+
}), 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);
|
|
50
|
+
for (let i = 0; i < data.length; i++) {
|
|
51
|
+
const textData = data[i], basedArc = arcs.find((arc => arc.refDatum.id === textData.id)), labelAttribute = {
|
|
52
|
+
visible: basedArc.labelVisible,
|
|
53
|
+
x: basedArc.labelPosition.x,
|
|
54
|
+
y: basedArc.labelPosition.y,
|
|
55
|
+
angle: basedArc.angle,
|
|
56
|
+
maxLineWidth: basedArc.labelLimit,
|
|
57
|
+
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,
|
|
58
|
+
line: null == basedArc ? void 0 : basedArc.labelLine
|
|
59
|
+
};
|
|
60
|
+
labels[i].setAttributes(labelAttribute);
|
|
61
|
+
}
|
|
62
|
+
return labels;
|
|
63
|
+
}
|
|
46
64
|
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
|
|
47
65
|
var _a;
|
|
48
66
|
this._arcLeft.clear(), this._arcRight.clear(), this._ellipsisWidth = ellipsisWidth;
|
|
49
|
-
const
|
|
50
|
-
|
|
67
|
+
const centerOffset = null !== (_a = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _a ? _a : 0;
|
|
68
|
+
let maxRadius = 0;
|
|
69
|
+
currentMarks.forEach((currentMarks => {
|
|
70
|
+
currentMarks.attribute.outerRadius > maxRadius && (maxRadius = currentMarks.attribute.outerRadius);
|
|
71
|
+
})), currentMarks.forEach(((currentMark, index) => {
|
|
51
72
|
var _a, _b;
|
|
52
|
-
const graphicAttribute = currentMark.attribute,
|
|
73
|
+
const graphicAttribute = currentMark.attribute, center = {
|
|
53
74
|
x: null !== (_a = null == graphicAttribute ? void 0 : graphicAttribute.x) && void 0 !== _a ? _a : 0,
|
|
54
75
|
y: null !== (_b = null == graphicAttribute ? void 0 : graphicAttribute.y) && void 0 !== _b ? _b : 0
|
|
55
76
|
}, item = data[index], textBounds = textBoundsArray[index], arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2, intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle, arcQuadrant = (0,
|
|
56
77
|
util_1.computeQuadrant)(graphicAttribute.endAngle - intervalAngle / 2), arcMiddle = (0,
|
|
57
78
|
util_1.circlePoint)(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle), outerArcMiddle = (0,
|
|
58
|
-
util_1.circlePoint)(center.x, center.y,
|
|
79
|
+
util_1.circlePoint)(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle), arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
|
|
59
80
|
arc.pointA = (0, util_1.circlePoint)(center.x, center.y, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttribute.outerRadius, centerOffset), arc.middleAngle),
|
|
60
81
|
arc.labelSize = {
|
|
61
82
|
width: textBounds.x2 - textBounds.x1,
|
|
@@ -131,13 +152,19 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
131
152
|
var _a, _b;
|
|
132
153
|
arc.labelVisible && ((0, vutils_1.isLess)(arc.pointB.x, line2MinLength + spaceWidth) || (0,
|
|
133
154
|
vutils_1.isGreater)(arc.pointB.x, width - line2MinLength - spaceWidth)) && (arc.labelVisible = !1),
|
|
134
|
-
arc.angle = null !== (_b = null === (_a = null == attribute ? void 0 : attribute.textStyle) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : 0
|
|
155
|
+
arc.angle = null !== (_b = null === (_a = null == attribute ? void 0 : attribute.textStyle) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : 0,
|
|
156
|
+
arc.labelLine = Object.assign({}, null == attribute ? void 0 : attribute.line);
|
|
135
157
|
})), arcs;
|
|
136
158
|
}
|
|
137
159
|
_computeX(arc, attribute, currentMarks) {
|
|
138
160
|
var _a, _b, _c, _d, _e, _f;
|
|
139
161
|
const center_x = null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0, centerOffset = (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y,
|
|
140
|
-
null !== (_e = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _e ? _e : 0), plotLayout_width = 2 * center_x
|
|
162
|
+
null !== (_e = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _e ? _e : 0), plotLayout_width = 2 * center_x;
|
|
163
|
+
let maxRadius = 0;
|
|
164
|
+
currentMarks.forEach((currentMark => {
|
|
165
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
166
|
+
}));
|
|
167
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = attribute.line.line1MinLength, line2MinLength = attribute.line.line2MinLength, labelLayoutAlign = null === (_f = attribute.layout) || void 0 === _f ? void 0 : _f.align, spaceWidth = attribute.spaceWidth, {labelPosition: labelPosition, quadrant: quadrant, pointB: pointB} = arc;
|
|
141
168
|
(0, vutils_1.isValidNumber)(pointB.x * pointB.y) || (arc.pointC = {
|
|
142
169
|
x: NaN,
|
|
143
170
|
y: NaN
|
|
@@ -283,7 +310,12 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
283
310
|
}
|
|
284
311
|
_computePointB(arc, r, attribute, currentMarks) {
|
|
285
312
|
var _a, _b, _c, _d, _e;
|
|
286
|
-
const labelConfig = attribute
|
|
313
|
+
const labelConfig = attribute;
|
|
314
|
+
let maxRadius = 0;
|
|
315
|
+
currentMarks.forEach((currentMark => {
|
|
316
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
317
|
+
}));
|
|
318
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = labelConfig.line.line1MinLength;
|
|
287
319
|
if ("none" === labelConfig.layout.strategy) arc.pointB = {
|
|
288
320
|
x: arc.outerCenter.x,
|
|
289
321
|
y: arc.outerCenter.y
|
|
@@ -309,7 +341,12 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
309
341
|
const plotRect = {
|
|
310
342
|
width: 2 * (null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0),
|
|
311
343
|
height: 2 * (null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0)
|
|
312
|
-
}
|
|
344
|
+
};
|
|
345
|
+
let maxRadius = 0;
|
|
346
|
+
currentMarks.forEach((currentMark => {
|
|
347
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
348
|
+
}));
|
|
349
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), line1MinLength = attribute.line.line1MinLength, {width: width, height: height} = plotRect, centerOffset = null !== (_e = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _e ? _e : 0, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset), r = this._computeLayoutRadius(height / 2, attribute, currentMarks), cx = Math.abs(arc.center.x - width / 2), cy = arc.center.y - height / 2;
|
|
313
350
|
let a, b, c;
|
|
314
351
|
if ((0, vutils_1.isNumberClose)(width / 2, cx)) a = 0, b = 1, c = -cy; else if ((0,
|
|
315
352
|
vutils_1.isNumberClose)(height / 2, cy)) a = 1, b = 0, c = -cx; else {
|
|
@@ -326,7 +363,12 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
326
363
|
}
|
|
327
364
|
_computeLayoutRadius(halfYLength, attribute, currentMarks) {
|
|
328
365
|
var _a;
|
|
329
|
-
const labelConfig = attribute, layoutArcGap = labelConfig.layoutArcGap, line1MinLength = labelConfig.line.line1MinLength
|
|
366
|
+
const labelConfig = attribute, layoutArcGap = labelConfig.layoutArcGap, line1MinLength = labelConfig.line.line1MinLength;
|
|
367
|
+
let maxRadius = 0;
|
|
368
|
+
currentMarks.forEach((currentMark => {
|
|
369
|
+
currentMark.attribute.outerRadius > maxRadius && (maxRadius = currentMark.attribute.outerRadius);
|
|
370
|
+
}));
|
|
371
|
+
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height), centerOffset = null !== (_a = null == attribute ? void 0 : attribute.centerOffset) && void 0 !== _a ? _a : 0, outerR = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset) + line1MinLength, a = outerR - layoutArcGap;
|
|
330
372
|
return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
|
|
331
373
|
}
|
|
332
374
|
_findNeighborIndex(arcs, priorityArc) {
|
|
@@ -371,6 +413,17 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
371
413
|
(0, util_1.checkBoundsOverlap)(lastBounds, bounds) ? arcs[i].labelVisible = !1 : lastBounds = bounds;
|
|
372
414
|
}
|
|
373
415
|
}
|
|
416
|
+
_labelLine(text) {
|
|
417
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
418
|
+
return (null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.points) ? (0,
|
|
419
|
+
vrender_1.createLine)({
|
|
420
|
+
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,
|
|
421
|
+
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,
|
|
422
|
+
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,
|
|
423
|
+
points: null === (_s = text.attribute) || void 0 === _s ? void 0 : _s.points,
|
|
424
|
+
curveType: (null === (_u = null === (_t = text.attribute) || void 0 === _t ? void 0 : _t.line) || void 0 === _u ? void 0 : _u.smooth) ? "basis" : null
|
|
425
|
+
}) : void 0;
|
|
426
|
+
}
|
|
374
427
|
computeRadius(r, width, height, centerOffset, k) {
|
|
375
428
|
var _a;
|
|
376
429
|
return null !== (_a = this.computeLayoutRadius(width || 0, height || 0) * r * ((0,
|
|
@@ -379,6 +432,9 @@ class ArcLabel extends base_1.LabelBase {
|
|
|
379
432
|
computeLayoutRadius(width, height) {
|
|
380
433
|
return Math.min(width / 2, height / 2);
|
|
381
434
|
}
|
|
435
|
+
_canPlaceInside(textBound, shapeBound) {
|
|
436
|
+
return "inside" === this.attribute.position;
|
|
437
|
+
}
|
|
382
438
|
computeLayoutOuterRadius(r, width, height) {
|
|
383
439
|
return r / (Math.min(width, height) / 2);
|
|
384
440
|
}
|