@visactor/vrender-components 1.0.32-alpha.1 → 1.0.33-alpha.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.
@@ -126,7 +126,25 @@ class CircleAxis extends base_1.AxisBase {
126
126
  separation: autoHideSeparation
127
127
  }));
128
128
  }
129
- afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {}
129
+ afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
130
+ var _a;
131
+ const {layoutRect: layoutRect, autoLabelMaxWidth: autoLabelMaxWidth} = this.attribute;
132
+ if (!autoLabelMaxWidth || !layoutRect || !labelShapes || 0 === labelShapes.length) return;
133
+ const rectRight = 0 + layoutRect.width;
134
+ for (let i = 0; i < labelShapes.length; i++) {
135
+ const label = labelShapes[i], x = label.attribute.x, align = null !== (_a = label.attribute.textAlign) && void 0 !== _a ? _a : "center";
136
+ let maxWidth = 0;
137
+ if ("left" === align) maxWidth = rectRight - x; else if ("right" === align) maxWidth = x - 0; else {
138
+ const leftDist = x - 0, rightDist = rectRight - x;
139
+ maxWidth = 2 * Math.max(0, Math.min(leftDist, rightDist));
140
+ }
141
+ maxWidth > 0 ? label.setAttributes({
142
+ maxLineWidth: maxWidth
143
+ }) : label.setAttributes({
144
+ maxLineWidth: 0
145
+ });
146
+ }
147
+ }
130
148
  getTextBaseline(vector) {
131
149
  return Math.abs(vector[1] / vector[0]) < .3 ? "middle" : vector[1] < 0 ? "bottom" : vector[1] > 0 ? "top" : "middle";
132
150
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/circle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAYA,yDAAwD;AAGxD,6CAA+G;AAC/G,0CAAiE;AAEjE,iCAAkC;AAClC,qCAA8C;AAC9C,yCAA+D;AAC/D,2CAAiD;AACjD,iCAAyD;AAEzD,yCAAqD;AACrD,mDAA+D;AAC/D,mEAA8D;AAE9D,IAAA,kCAAuB,GAAE,C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B,EACrB,KAAqC;QAErC,OAAO,KAAK,CAAC;IACf,CAAC;;AApRH,gCAqRC;AApRQ,4BAAiB,GAAG,2BAAkB,CAAC;AAsRhD,IAAA,cAAK,EAAC,UAAU,EAAE,wBAAe,CAAC,CAAC","file":"circle.js","sourcesContent":["/**\n * @description 圆弧型坐标轴\n */\nimport type {\n IGraphic,\n IGroup,\n IText,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { Point } from '@visactor/vutils';\nimport { isNil, get, merge, isNumberClose, isEmpty, mixin, isValidNumber, isFunction } from '@visactor/vutils';\nimport { POLAR_END_ANGLE, POLAR_START_ANGLE } from '../constant';\nimport type { CircleAxisAttributes, TitleAttributes, SubTickAttributes, TickLineItem, AxisItem } from './type';\nimport { AxisBase } from './base';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport { AXIS_ELEMENT_NAME, DEFAULT_STATES } from './constant';\nimport { CircleAxisMixin } from './mixin/circle';\nimport { getCirclePoints, getPolygonPath } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadCircleAxisComponent } from './register';\nimport { autoHide as autoHideFunc } from './overlap/auto-hide';\nimport { circleAutoLimit } from './overlap/circle-auto-limit';\n\nloadCircleAxisComponent();\nexport interface CircleAxis\n extends Pick<CircleAxisMixin, 'isInValidValue' | 'getTickCoord' | 'getVerticalVector' | 'getRelativeVector'>,\n AxisBase<CircleAxisAttributes> {}\n\nexport class CircleAxis extends AxisBase<CircleAxisAttributes> {\n static defaultAttributes = DEFAULT_AXIS_THEME;\n\n constructor(attributes: CircleAxisAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));\n }\n\n protected renderLine(container: IGroup): void {\n const {\n startAngle = POLAR_START_ANGLE,\n endAngle = POLAR_END_ANGLE,\n radius,\n center,\n innerRadius = 0,\n line = {},\n inside = false,\n sides\n } = this.attribute as CircleAxisAttributes;\n\n let arcRadius = radius;\n let arcInnerRadius = innerRadius;\n if (inside && innerRadius > 0) {\n arcRadius = innerRadius;\n arcInnerRadius = 0;\n }\n\n let lineGraphic: IGraphic;\n if (isValidNumber(sides) && sides >= 3) {\n const gridPoints = getCirclePoints(center as Point, sides as number, arcRadius, startAngle, endAngle);\n\n lineGraphic = graphicCreator.path({\n ...line.style,\n path: getPolygonPath(gridPoints, true)\n });\n } else {\n const arcAttrs = {\n ...center,\n startAngle,\n endAngle,\n radius: arcRadius,\n innerRadius: arcInnerRadius,\n ...line.style\n };\n lineGraphic = graphicCreator.circle(arcAttrs);\n }\n\n lineGraphic.name = AXIS_ELEMENT_NAME.line;\n lineGraphic.id = this._getNodeId('line');\n\n if (!isEmpty(line.state)) {\n lineGraphic.states = merge({}, DEFAULT_STATES, line.state);\n }\n container.add(lineGraphic);\n }\n\n protected getTitleAttribute() {\n const { center, radius, innerRadius = 0 } = this.attribute as CircleAxisAttributes;\n const {\n space = 4,\n textStyle = {},\n shape,\n background,\n state = {},\n ...restAttrs\n } = this.attribute.title as TitleAttributes;\n let titlePoint = center;\n let labelHeight = 0;\n if (this.attribute.label?.visible && this.attribute.label.inside === false) {\n // 这里取 label 的最大长度\n labelHeight = get(this.attribute.label, 'style.fontSize', 12) + get(this.attribute.label, 'space', 4);\n }\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === false) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === false) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n const offset = radius + tickLength + labelHeight + space;\n let textBaseline: TextBaselineType = 'middle';\n let { position } = this.attribute.title as TitleAttributes;\n if (isNil(position)) {\n position = innerRadius === 0 ? 'end' : 'middle';\n }\n if (position === 'start') {\n textBaseline = 'bottom';\n titlePoint = {\n x: center.x,\n y: center.y - offset\n };\n } else if (position === 'end') {\n textBaseline = 'top';\n titlePoint = {\n x: center.x,\n y: center.y + offset\n };\n }\n const attrs: any = {\n ...titlePoint,\n ...restAttrs,\n textStyle: {\n textBaseline,\n textAlign: 'center',\n ...textStyle\n },\n state: {\n text: merge({}, DEFAULT_STATES, state.text),\n shape: merge({}, DEFAULT_STATES, state.shape),\n panel: merge({}, DEFAULT_STATES, state.background)\n }\n };\n\n const { angle } = restAttrs; // 用户设置的是角度\n attrs.angle = angle;\n\n if (shape && shape.visible) {\n attrs.shape = {\n visible: true,\n ...shape.style\n };\n if (shape.space) {\n attrs.space = shape.space;\n }\n }\n\n if (background && background.visible) {\n attrs.panel = {\n visible: true,\n ...background.style\n };\n }\n\n return attrs;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as CircleAxisAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n // 刻度线的数量大于 2 时,才绘制子刻度\n if (tickLineCount >= 2) {\n const tickSegment = this.data[1].value - this.data[0].value;\n const isAlignWithLable = this.attribute?.tick?.alignWithLabel;\n for (let i = 0; i < tickLineCount; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value =\n (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n protected beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n protected handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n if (isEmpty(labelShapes)) {\n return;\n }\n\n const { inside, radius, center, size, label, orient } = this.attribute;\n // 宽高为0的异常情况,还是以圆心进行布局\n const bounds = size\n ? {\n x1: 0,\n y1: 0,\n x2: size.width,\n y2: size.height\n }\n : {\n x1: center.x - radius,\n y1: center.y - radius,\n x2: center.x + radius,\n y2: center.y + radius\n };\n const { layoutFunc, autoLimit, limitEllipsis, autoHide, autoHideMethod, autoHideSeparation, autoWrap } = label;\n\n if (isFunction(layoutFunc)) {\n // 自定义布局\n layoutFunc(labelShapes, labelData, layer, this);\n } else {\n // autoWrap has computed width & height limit\n if (autoLimit || autoWrap) {\n circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });\n }\n if (autoHide) {\n autoHideFunc(labelShapes, {\n orient,\n method: autoHideMethod,\n separation: autoHideSeparation\n });\n }\n }\n }\n protected afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n\n protected getTextBaseline(vector: [number, number]) {\n if (Math.abs(vector[1] / vector[0]) < 0.3) {\n return 'middle';\n } else if (vector[1] < 0) {\n return 'bottom';\n } else if (vector[1] > 0) {\n return 'top';\n }\n\n return 'middle';\n }\n\n protected getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType } {\n if (isNumberClose(vector[0], 0)) {\n return {\n textAlign: 'center',\n textBaseline: vector[1] > 0 ? 'top' : 'bottom'\n };\n } else if (vector[0] < 0) {\n return {\n textAlign: 'right',\n textBaseline: this.getTextBaseline(vector)\n };\n } else if (vector[0] > 0) {\n return {\n textAlign: 'left',\n textBaseline: this.getTextBaseline(vector)\n };\n }\n\n return {\n textAlign: 'center', //'left',\n textBaseline: 'middle' //'top'\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }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C,MAAM,CAAC;aAC3C,CAAC;SACH;aAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO;gBACL,SAAS,EAAE,MAAM;gBACjB,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;aAC3C,CAAC;SACH;QAED,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,QAAQ;SACvB,CAAC;IACJ,CAAC;IAES,gBAAgB,CACxB,KAAY,EACZ,MAAwB,EACxB,IAAqB,EACrB,KAAqC;QAErC,OAAO,KAAK,CAAC;IACf,CAAC;;AAzTH,gCA0TC;AAzTQ,4BAAiB,GAAG,2BAAkB,CAAC;AA2ThD,IAAA,cAAK,EAAC,UAAU,EAAE,wBAAe,CAAC,CAAC","file":"circle.js","sourcesContent":["/**\n * @description 圆弧型坐标轴\n */\nimport type {\n IGraphic,\n IGroup,\n IText,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { Point } from '@visactor/vutils';\nimport { isNil, get, merge, isNumberClose, isEmpty, mixin, isValidNumber, isFunction } from '@visactor/vutils';\nimport { POLAR_END_ANGLE, POLAR_START_ANGLE } from '../constant';\nimport type { CircleAxisAttributes, TitleAttributes, SubTickAttributes, TickLineItem, AxisItem } from './type';\nimport { AxisBase } from './base';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport { AXIS_ELEMENT_NAME, DEFAULT_STATES } from './constant';\nimport { CircleAxisMixin } from './mixin/circle';\nimport { getCirclePoints, getPolygonPath } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadCircleAxisComponent } from './register';\nimport { autoHide as autoHideFunc } from './overlap/auto-hide';\nimport { circleAutoLimit } from './overlap/circle-auto-limit';\n\nloadCircleAxisComponent();\nexport interface CircleAxis\n extends Pick<CircleAxisMixin, 'isInValidValue' | 'getTickCoord' | 'getVerticalVector' | 'getRelativeVector'>,\n AxisBase<CircleAxisAttributes> {}\n\nexport class CircleAxis extends AxisBase<CircleAxisAttributes> {\n static defaultAttributes = DEFAULT_AXIS_THEME;\n\n constructor(attributes: CircleAxisAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));\n }\n\n protected renderLine(container: IGroup): void {\n const {\n startAngle = POLAR_START_ANGLE,\n endAngle = POLAR_END_ANGLE,\n radius,\n center,\n innerRadius = 0,\n line = {},\n inside = false,\n sides\n } = this.attribute as CircleAxisAttributes;\n\n let arcRadius = radius;\n let arcInnerRadius = innerRadius;\n if (inside && innerRadius > 0) {\n arcRadius = innerRadius;\n arcInnerRadius = 0;\n }\n\n let lineGraphic: IGraphic;\n if (isValidNumber(sides) && sides >= 3) {\n const gridPoints = getCirclePoints(center as Point, sides as number, arcRadius, startAngle, endAngle);\n\n lineGraphic = graphicCreator.path({\n ...line.style,\n path: getPolygonPath(gridPoints, true)\n });\n } else {\n const arcAttrs = {\n ...center,\n startAngle,\n endAngle,\n radius: arcRadius,\n innerRadius: arcInnerRadius,\n ...line.style\n };\n lineGraphic = graphicCreator.circle(arcAttrs);\n }\n\n lineGraphic.name = AXIS_ELEMENT_NAME.line;\n lineGraphic.id = this._getNodeId('line');\n\n if (!isEmpty(line.state)) {\n lineGraphic.states = merge({}, DEFAULT_STATES, line.state);\n }\n container.add(lineGraphic);\n }\n\n protected getTitleAttribute() {\n const { center, radius, innerRadius = 0 } = this.attribute as CircleAxisAttributes;\n const {\n space = 4,\n textStyle = {},\n shape,\n background,\n state = {},\n ...restAttrs\n } = this.attribute.title as TitleAttributes;\n let titlePoint = center;\n let labelHeight = 0;\n if (this.attribute.label?.visible && this.attribute.label.inside === false) {\n // 这里取 label 的最大长度\n labelHeight = get(this.attribute.label, 'style.fontSize', 12) + get(this.attribute.label, 'space', 4);\n }\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === false) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === false) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n const offset = radius + tickLength + labelHeight + space;\n let textBaseline: TextBaselineType = 'middle';\n let { position } = this.attribute.title as TitleAttributes;\n if (isNil(position)) {\n position = innerRadius === 0 ? 'end' : 'middle';\n }\n if (position === 'start') {\n textBaseline = 'bottom';\n titlePoint = {\n x: center.x,\n y: center.y - offset\n };\n } else if (position === 'end') {\n textBaseline = 'top';\n titlePoint = {\n x: center.x,\n y: center.y + offset\n };\n }\n const attrs: any = {\n ...titlePoint,\n ...restAttrs,\n textStyle: {\n textBaseline,\n textAlign: 'center',\n ...textStyle\n },\n state: {\n text: merge({}, DEFAULT_STATES, state.text),\n shape: merge({}, DEFAULT_STATES, state.shape),\n panel: merge({}, DEFAULT_STATES, state.background)\n }\n };\n\n const { angle } = restAttrs; // 用户设置的是角度\n attrs.angle = angle;\n\n if (shape && shape.visible) {\n attrs.shape = {\n visible: true,\n ...shape.style\n };\n if (shape.space) {\n attrs.space = shape.space;\n }\n }\n\n if (background && background.visible) {\n attrs.panel = {\n visible: true,\n ...background.style\n };\n }\n\n return attrs;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as CircleAxisAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n // 刻度线的数量大于 2 时,才绘制子刻度\n if (tickLineCount >= 2) {\n const tickSegment = this.data[1].value - this.data[0].value;\n const isAlignWithLable = this.attribute?.tick?.alignWithLabel;\n for (let i = 0; i < tickLineCount; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value =\n (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n protected beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n protected handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n if (isEmpty(labelShapes)) {\n return;\n }\n\n const { inside, radius, center, size, label, orient } = this.attribute;\n // 宽高为0的异常情况,还是以圆心进行布局\n const bounds = size\n ? {\n x1: 0,\n y1: 0,\n x2: size.width,\n y2: size.height\n }\n : {\n x1: center.x - radius,\n y1: center.y - radius,\n x2: center.x + radius,\n y2: center.y + radius\n };\n const { layoutFunc, autoLimit, limitEllipsis, autoHide, autoHideMethod, autoHideSeparation, autoWrap } = label;\n\n if (isFunction(layoutFunc)) {\n // 自定义布局\n layoutFunc(labelShapes, labelData, layer, this);\n } else {\n // autoWrap has computed width & height limit\n if (autoLimit || autoWrap) {\n circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });\n }\n if (autoHide) {\n autoHideFunc(labelShapes, {\n orient,\n method: autoHideMethod,\n separation: autoHideSeparation\n });\n }\n }\n }\n protected afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n /**\n * 基于布局矩形与文本对齐方式设置标签最大行宽:\n * - left:可用宽度为到矩形右边界的水平距离(rectRight - x)\n * - right:可用宽度为到矩形左边界的水平距离(x - rectLeft)\n * - center:取左右两侧最小距离的两倍(2 * min(x - rectLeft, rectRight - x))\n */\n const { layoutRect, autoLabelMaxWidth } = this.attribute as CircleAxisAttributes;\n if (!autoLabelMaxWidth || !layoutRect || !labelShapes || labelShapes.length === 0) {\n return;\n }\n\n const rectLeft = 0;\n const rectRight = 0 + layoutRect.width;\n\n for (let i = 0; i < labelShapes.length; i++) {\n const label = labelShapes[i];\n const x = label.attribute.x;\n const align = (label.attribute.textAlign as TextAlignType) ?? 'center';\n\n let maxWidth = 0;\n if (align === 'left') {\n maxWidth = rectRight - x;\n } else if (align === 'right') {\n maxWidth = x - rectLeft;\n } else {\n const leftDist = x - rectLeft;\n const rightDist = rectRight - x;\n maxWidth = 2 * Math.max(0, Math.min(leftDist, rightDist));\n }\n\n if (maxWidth > 0) {\n label.setAttributes({ maxLineWidth: maxWidth });\n } else {\n label.setAttributes({ maxLineWidth: 0 });\n }\n }\n\n return;\n }\n\n protected getTextBaseline(vector: [number, number]) {\n if (Math.abs(vector[1] / vector[0]) < 0.3) {\n return 'middle';\n } else if (vector[1] < 0) {\n return 'bottom';\n } else if (vector[1] > 0) {\n return 'top';\n }\n\n return 'middle';\n }\n\n protected getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType } {\n if (isNumberClose(vector[0], 0)) {\n return {\n textAlign: 'center',\n textBaseline: vector[1] > 0 ? 'top' : 'bottom'\n };\n } else if (vector[0] < 0) {\n return {\n textAlign: 'right',\n textBaseline: this.getTextBaseline(vector)\n };\n } else if (vector[0] > 0) {\n return {\n textAlign: 'left',\n textBaseline: this.getTextBaseline(vector)\n };\n }\n\n return {\n textAlign: 'center', //'left',\n textBaseline: 'middle' //'top'\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }\n}\n\nmixin(CircleAxis, CircleAxisMixin);\n"]}
@@ -96,6 +96,13 @@ export interface CircleAxisAttributes extends AxisBaseAttributes {
96
96
  radius: number;
97
97
  innerRadius?: number;
98
98
  sides?: number;
99
+ layoutRect?: {
100
+ x: number;
101
+ y: number;
102
+ width: number;
103
+ height: number;
104
+ };
105
+ autoLabelMaxWidth?: boolean;
99
106
  }
100
107
  export type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {
101
108
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启动画\n * @default false\n */\n animation?: boolean;\n /**\n * 标签入场动画配置\n */\n animationEnter?: boolean;\n /**\n * 标签更新动画配置\n */\n animationUpdate?: boolean;\n /**\n * 标签离场动画配置\n */\n animationExit?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴上悬浮label标签配置\n */\n labelHoverOnAxis?: LabelHoverOnAxisAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n /**\n * 左侧扩充空间的大小\n */\n left?: number;\n /**\n * 右侧扩充空间的大小\n */\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type LabelHoverOnAxisAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示悬浮标签\n */\n visible?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 悬浮标签的位置 ,与轴的方位有关系,如果是水平轴,则position代表x的位置,如果是垂直轴,则position代表y的位置\n */\n position?: number;\n /**\n * 是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n /**\n * 格式化文本回调\n * @param value 文本原始值\n * @returns 格式化文本\n */\n formatMethod?: (value: string) => string;\n};\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启动画\n * @default false\n */\n animation?: boolean;\n /**\n * 标签入场动画配置\n */\n animationEnter?: boolean;\n /**\n * 标签更新动画配置\n */\n animationUpdate?: boolean;\n /**\n * 标签离场动画配置\n */\n animationExit?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴上悬浮label标签配置\n */\n labelHoverOnAxis?: LabelHoverOnAxisAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n\n /**\n * 坐标轴可用布局区域的大小\n */\n layoutRect?: { x: number; y: number; width: number; height: number };\n /**\n * 是否自动调整标签宽度以适应布局区域\n */\n autoLabelMaxWidth?: boolean;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n /**\n * 左侧扩充空间的大小\n */\n left?: number;\n /**\n * 右侧扩充空间的大小\n */\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type LabelHoverOnAxisAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示悬浮标签\n */\n visible?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 悬浮标签的位置 ,与轴的方位有关系,如果是水平轴,则position代表x的位置,如果是垂直轴,则position代表y的位置\n */\n position?: number;\n /**\n * 是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n /**\n * 格式化文本回调\n * @param value 文本原始值\n * @returns 格式化文本\n */\n formatMethod?: (value: string) => string;\n};\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
@@ -27,5 +27,4 @@ exports.DEFAULT_BRUSH_ATTRIBUTES = {
27
27
  minX: -1 / 0,
28
28
  maxX: 1 / 0
29
29
  }
30
- }, exports.DEFAULT_SIZE_THRESHOLD = 5;
31
- //# sourceMappingURL=config.js.map
30
+ }, exports.DEFAULT_SIZE_THRESHOLD = 5;
@@ -17,4 +17,5 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), __exportStar(require("./checkbox"), exports), __exportStar(require("./type"), exports);
20
+ }), __exportStar(require("./checkbox"), exports), __exportStar(require("./type"), exports);
21
+ //# sourceMappingURL=index.js.map
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "1.0.32-alpha.1";
1
+ export declare const version = "1.0.33-alpha.0";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
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 = "1.0.32-alpha.1", __exportStar(require("./core/base"), exports),
20
+ }), exports.version = void 0, exports.version = "1.0.33-alpha.0", __exportStar(require("./core/base"), exports),
21
21
  __exportStar(require("./core/type"), exports), __exportStar(require("./scrollbar"), exports),
22
22
  __exportStar(require("./tag"), exports), __exportStar(require("./poptip"), exports),
23
23
  __exportStar(require("./crosshair"), exports), __exportStar(require("./label"), exports),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,8CAA4B;AAC5B,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,6CAA2B;AAC3B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wDAAsC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.0.32-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\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 './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,8CAA4B;AAC5B,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,6CAA2B;AAC3B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wDAAsC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.0.33-alpha.0\";\n\nexport * from './core/base';\nexport * from './core/type';\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 './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
package/cjs/label/arc.js CHANGED
@@ -516,4 +516,4 @@ const registerArcDataLabel = () => {
516
516
  };
517
517
 
518
518
  exports.registerArcDataLabel = registerArcDataLabel;
519
- //# sourceMappingURL=arc.js.map
519
+ //# sourceMappingURL=arc.js.map
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./label-item"), exports), __exportStar(require("./type"), exports);
21
- //# sourceMappingURL=index.js.map
21
+ //# sourceMappingURL=index.js.map
package/dist/index.es.js CHANGED
@@ -19540,6 +19540,10 @@ class AnimationTransitionRegistry {
19540
19540
  }
19541
19541
  AnimationTransitionRegistry.getInstance();
19542
19542
 
19543
+ function getCustomType(custom) {
19544
+ return custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
19545
+ }
19546
+
19543
19547
  class AnimateExecutor {
19544
19548
  static registerBuiltInAnimate(name, animate) {
19545
19549
  AnimateExecutor.builtInAnimateMap[name] = animate;
@@ -19604,7 +19608,7 @@ class AnimateExecutor {
19604
19608
  effects: effects.map(effect => {
19605
19609
  var _a, _b;
19606
19610
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
19607
- customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
19611
+ customType = getCustomType(custom);
19608
19612
  return Object.assign(Object.assign({}, effect), {
19609
19613
  custom: custom,
19610
19614
  customType: customType
@@ -19618,7 +19622,7 @@ class AnimateExecutor {
19618
19622
  duration = this.resolveValue(params.duration, child, 300);
19619
19623
  let oneByOneDelay = 0;
19620
19624
  oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? delay + delayAfter + duration : 0), parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
19621
- const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
19625
+ const customType = getCustomType(parsedParams.custom);
19622
19626
  if (parsedParams.customType = customType, totalTime) {
19623
19627
  const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
19624
19628
  scale = totalTime ? totalTime / _totalTime : 1;
@@ -19692,6 +19696,7 @@ class AnimateExecutor {
19692
19696
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
19693
19697
  var _a, _b, _c, _d, _e, _f, _g, _h;
19694
19698
  if (custom && customType) {
19699
+ customType = getCustomType(custom);
19695
19700
  let customParams = this.resolveValue(customParameters, graphic);
19696
19701
  "function" == typeof customParams && (customParams = customParams(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {})), customParams = Object.assign({
19697
19702
  width: (null === (_c = graphic.stage) || void 0 === _c ? void 0 : _c.width) || 0,
@@ -19747,7 +19752,7 @@ class AnimateExecutor {
19747
19752
  from = effect.from;
19748
19753
  props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
19749
19754
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
19750
- customType = effect.customType;
19755
+ customType = effect.custom ? effect.customType : getCustomType(custom);
19751
19756
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
19752
19757
  }), delayAfterValue > 0 && animate.wait(delayAfterValue);
19753
19758
  }
@@ -21205,6 +21210,36 @@ class CircleAxis extends AxisBase {
21205
21210
  }
21206
21211
  }
21207
21212
  afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
21213
+ var _a;
21214
+ const { layoutRect, autoLabelMaxWidth } = this.attribute;
21215
+ if (!autoLabelMaxWidth || !layoutRect || !labelShapes || labelShapes.length === 0) {
21216
+ return;
21217
+ }
21218
+ const rectLeft = 0;
21219
+ const rectRight = 0 + layoutRect.width;
21220
+ for (let i = 0; i < labelShapes.length; i++) {
21221
+ const label = labelShapes[i];
21222
+ const x = label.attribute.x;
21223
+ const align = (_a = label.attribute.textAlign) !== null && _a !== void 0 ? _a : 'center';
21224
+ let maxWidth = 0;
21225
+ if (align === 'left') {
21226
+ maxWidth = rectRight - x;
21227
+ }
21228
+ else if (align === 'right') {
21229
+ maxWidth = x - rectLeft;
21230
+ }
21231
+ else {
21232
+ const leftDist = x - rectLeft;
21233
+ const rightDist = rectRight - x;
21234
+ maxWidth = 2 * Math.max(0, Math.min(leftDist, rightDist));
21235
+ }
21236
+ if (maxWidth > 0) {
21237
+ label.setAttributes({ maxLineWidth: maxWidth });
21238
+ }
21239
+ else {
21240
+ label.setAttributes({ maxLineWidth: 0 });
21241
+ }
21242
+ }
21208
21243
  return;
21209
21244
  }
21210
21245
  getTextBaseline(vector) {
@@ -34800,6 +34835,6 @@ TableSeriesNumber.defaultAttributes = {
34800
34835
  select: true
34801
34836
  };
34802
34837
 
34803
- const version = "1.0.32-alpha.1";
34838
+ const version = "1.0.33-alpha.0";
34804
34839
 
34805
34840
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IDataZoomEvent, IDataZoomInteractiveEvent, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/axis/circle.js CHANGED
@@ -138,7 +138,25 @@ export class CircleAxis extends AxisBase {
138
138
  separation: autoHideSeparation
139
139
  }));
140
140
  }
141
- afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {}
141
+ afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
142
+ var _a;
143
+ const {layoutRect: layoutRect, autoLabelMaxWidth: autoLabelMaxWidth} = this.attribute;
144
+ if (!autoLabelMaxWidth || !layoutRect || !labelShapes || 0 === labelShapes.length) return;
145
+ const rectRight = 0 + layoutRect.width;
146
+ for (let i = 0; i < labelShapes.length; i++) {
147
+ const label = labelShapes[i], x = label.attribute.x, align = null !== (_a = label.attribute.textAlign) && void 0 !== _a ? _a : "center";
148
+ let maxWidth = 0;
149
+ if ("left" === align) maxWidth = rectRight - x; else if ("right" === align) maxWidth = x - 0; else {
150
+ const leftDist = x - 0, rightDist = rectRight - x;
151
+ maxWidth = 2 * Math.max(0, Math.min(leftDist, rightDist));
152
+ }
153
+ maxWidth > 0 ? label.setAttributes({
154
+ maxLineWidth: maxWidth
155
+ }) : label.setAttributes({
156
+ maxLineWidth: 0
157
+ });
158
+ }
159
+ }
142
160
  getTextBaseline(vector) {
143
161
  return Math.abs(vector[1] / vector[0]) < .3 ? "middle" : vector[1] < 0 ? "bottom" : vector[1] > 0 ? "top" : "middle";
144
162
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/circle.ts"],"names":[],"mappings":";;;;;;;;;;;AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGx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C,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;aAC/C,CAAC;SACH;aAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO;gBACL,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;aAC3C,CAAC;SACH;aAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO;gBACL,SAAS,EAAE,MAAM;gBACjB,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;aAC3C,CAAC;SACH;QAED,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,QAAQ;SACvB,CAAC;IACJ,CAAC;IAES,gBAAgB,CACxB,KAAY,EACZ,MAAwB,EACxB,IAAqB,EACrB,KAAqC;QAErC,OAAO,KAAK,CAAC;IACf,CAAC;;AAnRM,4BAAiB,GAAG,kBAAkB,CAAC;AAsRhD,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC","file":"circle.js","sourcesContent":["/**\n * @description 圆弧型坐标轴\n */\nimport type {\n IGraphic,\n IGroup,\n IText,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { Point } from '@visactor/vutils';\nimport { isNil, get, merge, isNumberClose, isEmpty, mixin, isValidNumber, isFunction } from '@visactor/vutils';\nimport { POLAR_END_ANGLE, POLAR_START_ANGLE } from '../constant';\nimport type { CircleAxisAttributes, TitleAttributes, SubTickAttributes, TickLineItem, AxisItem } from './type';\nimport { AxisBase } from './base';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport { AXIS_ELEMENT_NAME, DEFAULT_STATES } from './constant';\nimport { CircleAxisMixin } from './mixin/circle';\nimport { getCirclePoints, getPolygonPath } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadCircleAxisComponent } from './register';\nimport { autoHide as autoHideFunc } from './overlap/auto-hide';\nimport { circleAutoLimit } from './overlap/circle-auto-limit';\n\nloadCircleAxisComponent();\nexport interface CircleAxis\n extends Pick<CircleAxisMixin, 'isInValidValue' | 'getTickCoord' | 'getVerticalVector' | 'getRelativeVector'>,\n AxisBase<CircleAxisAttributes> {}\n\nexport class CircleAxis extends AxisBase<CircleAxisAttributes> {\n static defaultAttributes = DEFAULT_AXIS_THEME;\n\n constructor(attributes: CircleAxisAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));\n }\n\n protected renderLine(container: IGroup): void {\n const {\n startAngle = POLAR_START_ANGLE,\n endAngle = POLAR_END_ANGLE,\n radius,\n center,\n innerRadius = 0,\n line = {},\n inside = false,\n sides\n } = this.attribute as CircleAxisAttributes;\n\n let arcRadius = radius;\n let arcInnerRadius = innerRadius;\n if (inside && innerRadius > 0) {\n arcRadius = innerRadius;\n arcInnerRadius = 0;\n }\n\n let lineGraphic: IGraphic;\n if (isValidNumber(sides) && sides >= 3) {\n const gridPoints = getCirclePoints(center as Point, sides as number, arcRadius, startAngle, endAngle);\n\n lineGraphic = graphicCreator.path({\n ...line.style,\n path: getPolygonPath(gridPoints, true)\n });\n } else {\n const arcAttrs = {\n ...center,\n startAngle,\n endAngle,\n radius: arcRadius,\n innerRadius: arcInnerRadius,\n ...line.style\n };\n lineGraphic = graphicCreator.circle(arcAttrs);\n }\n\n lineGraphic.name = AXIS_ELEMENT_NAME.line;\n lineGraphic.id = this._getNodeId('line');\n\n if (!isEmpty(line.state)) {\n lineGraphic.states = merge({}, DEFAULT_STATES, line.state);\n }\n container.add(lineGraphic);\n }\n\n protected getTitleAttribute() {\n const { center, radius, innerRadius = 0 } = this.attribute as CircleAxisAttributes;\n const {\n space = 4,\n textStyle = {},\n shape,\n background,\n state = {},\n ...restAttrs\n } = this.attribute.title as TitleAttributes;\n let titlePoint = center;\n let labelHeight = 0;\n if (this.attribute.label?.visible && this.attribute.label.inside === false) {\n // 这里取 label 的最大长度\n labelHeight = get(this.attribute.label, 'style.fontSize', 12) + get(this.attribute.label, 'space', 4);\n }\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === false) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === false) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n const offset = radius + tickLength + labelHeight + space;\n let textBaseline: TextBaselineType = 'middle';\n let { position } = this.attribute.title as TitleAttributes;\n if (isNil(position)) {\n position = innerRadius === 0 ? 'end' : 'middle';\n }\n if (position === 'start') {\n textBaseline = 'bottom';\n titlePoint = {\n x: center.x,\n y: center.y - offset\n };\n } else if (position === 'end') {\n textBaseline = 'top';\n titlePoint = {\n x: center.x,\n y: center.y + offset\n };\n }\n const attrs: any = {\n ...titlePoint,\n ...restAttrs,\n textStyle: {\n textBaseline,\n textAlign: 'center',\n ...textStyle\n },\n state: {\n text: merge({}, DEFAULT_STATES, state.text),\n shape: merge({}, DEFAULT_STATES, state.shape),\n panel: merge({}, DEFAULT_STATES, state.background)\n }\n };\n\n const { angle } = restAttrs; // 用户设置的是角度\n attrs.angle = angle;\n\n if (shape && shape.visible) {\n attrs.shape = {\n visible: true,\n ...shape.style\n };\n if (shape.space) {\n attrs.space = shape.space;\n }\n }\n\n if (background && background.visible) {\n attrs.panel = {\n visible: true,\n ...background.style\n };\n }\n\n return attrs;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as CircleAxisAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n // 刻度线的数量大于 2 时,才绘制子刻度\n if (tickLineCount >= 2) {\n const tickSegment = this.data[1].value - this.data[0].value;\n const isAlignWithLable = this.attribute?.tick?.alignWithLabel;\n for (let i = 0; i < tickLineCount; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value =\n (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n protected beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n protected handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n if (isEmpty(labelShapes)) {\n return;\n }\n\n const { inside, radius, center, size, label, orient } = this.attribute;\n // 宽高为0的异常情况,还是以圆心进行布局\n const bounds = size\n ? {\n x1: 0,\n y1: 0,\n x2: size.width,\n y2: size.height\n }\n : {\n x1: center.x - radius,\n y1: center.y - radius,\n x2: center.x + radius,\n y2: center.y + radius\n };\n const { layoutFunc, autoLimit, limitEllipsis, autoHide, autoHideMethod, autoHideSeparation, autoWrap } = label;\n\n if (isFunction(layoutFunc)) {\n // 自定义布局\n layoutFunc(labelShapes, labelData, layer, this);\n } else {\n // autoWrap has computed width & height limit\n if (autoLimit || autoWrap) {\n circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });\n }\n if (autoHide) {\n autoHideFunc(labelShapes, {\n orient,\n method: autoHideMethod,\n separation: autoHideSeparation\n });\n }\n }\n }\n protected afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n\n protected getTextBaseline(vector: [number, number]) {\n if (Math.abs(vector[1] / vector[0]) < 0.3) {\n return 'middle';\n } else if (vector[1] < 0) {\n return 'bottom';\n } else if (vector[1] > 0) {\n return 'top';\n }\n\n return 'middle';\n }\n\n protected getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType } {\n if (isNumberClose(vector[0], 0)) {\n return {\n textAlign: 'center',\n textBaseline: vector[1] > 0 ? 'top' : 'bottom'\n };\n } else if (vector[0] < 0) {\n return {\n textAlign: 'right',\n textBaseline: this.getTextBaseline(vector)\n };\n } else if (vector[0] > 0) {\n return {\n textAlign: 'left',\n textBaseline: this.getTextBaseline(vector)\n };\n }\n\n return {\n textAlign: 'center', //'left',\n textBaseline: 'middle' //'top'\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }\n}\n\nmixin(CircleAxis, CircleAxisMixin);\n"]}
1
+ {"version":3,"sources":["../src/axis/circle.ts"],"names":[],"mappings":";;;;;;;;;;;AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ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AAY,EACZ,MAAwB,EACxB,IAAqB,EACrB,KAAqC;QAErC,OAAO,KAAK,CAAC;IACf,CAAC;;AAxTM,4BAAiB,GAAG,kBAAkB,CAAC;AA2ThD,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC","file":"circle.js","sourcesContent":["/**\n * @description 圆弧型坐标轴\n */\nimport type {\n IGraphic,\n IGroup,\n IText,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { Point } from '@visactor/vutils';\nimport { isNil, get, merge, isNumberClose, isEmpty, mixin, isValidNumber, isFunction } from '@visactor/vutils';\nimport { POLAR_END_ANGLE, POLAR_START_ANGLE } from '../constant';\nimport type { CircleAxisAttributes, TitleAttributes, SubTickAttributes, TickLineItem, AxisItem } from './type';\nimport { AxisBase } from './base';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport { AXIS_ELEMENT_NAME, DEFAULT_STATES } from './constant';\nimport { CircleAxisMixin } from './mixin/circle';\nimport { getCirclePoints, getPolygonPath } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadCircleAxisComponent } from './register';\nimport { autoHide as autoHideFunc } from './overlap/auto-hide';\nimport { circleAutoLimit } from './overlap/circle-auto-limit';\n\nloadCircleAxisComponent();\nexport interface CircleAxis\n extends Pick<CircleAxisMixin, 'isInValidValue' | 'getTickCoord' | 'getVerticalVector' | 'getRelativeVector'>,\n AxisBase<CircleAxisAttributes> {}\n\nexport class CircleAxis extends AxisBase<CircleAxisAttributes> {\n static defaultAttributes = DEFAULT_AXIS_THEME;\n\n constructor(attributes: CircleAxisAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));\n }\n\n protected renderLine(container: IGroup): void {\n const {\n startAngle = POLAR_START_ANGLE,\n endAngle = POLAR_END_ANGLE,\n radius,\n center,\n innerRadius = 0,\n line = {},\n inside = false,\n sides\n } = this.attribute as CircleAxisAttributes;\n\n let arcRadius = radius;\n let arcInnerRadius = innerRadius;\n if (inside && innerRadius > 0) {\n arcRadius = innerRadius;\n arcInnerRadius = 0;\n }\n\n let lineGraphic: IGraphic;\n if (isValidNumber(sides) && sides >= 3) {\n const gridPoints = getCirclePoints(center as Point, sides as number, arcRadius, startAngle, endAngle);\n\n lineGraphic = graphicCreator.path({\n ...line.style,\n path: getPolygonPath(gridPoints, true)\n });\n } else {\n const arcAttrs = {\n ...center,\n startAngle,\n endAngle,\n radius: arcRadius,\n innerRadius: arcInnerRadius,\n ...line.style\n };\n lineGraphic = graphicCreator.circle(arcAttrs);\n }\n\n lineGraphic.name = AXIS_ELEMENT_NAME.line;\n lineGraphic.id = this._getNodeId('line');\n\n if (!isEmpty(line.state)) {\n lineGraphic.states = merge({}, DEFAULT_STATES, line.state);\n }\n container.add(lineGraphic);\n }\n\n protected getTitleAttribute() {\n const { center, radius, innerRadius = 0 } = this.attribute as CircleAxisAttributes;\n const {\n space = 4,\n textStyle = {},\n shape,\n background,\n state = {},\n ...restAttrs\n } = this.attribute.title as TitleAttributes;\n let titlePoint = center;\n let labelHeight = 0;\n if (this.attribute.label?.visible && this.attribute.label.inside === false) {\n // 这里取 label 的最大长度\n labelHeight = get(this.attribute.label, 'style.fontSize', 12) + get(this.attribute.label, 'space', 4);\n }\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === false) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === false) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n const offset = radius + tickLength + labelHeight + space;\n let textBaseline: TextBaselineType = 'middle';\n let { position } = this.attribute.title as TitleAttributes;\n if (isNil(position)) {\n position = innerRadius === 0 ? 'end' : 'middle';\n }\n if (position === 'start') {\n textBaseline = 'bottom';\n titlePoint = {\n x: center.x,\n y: center.y - offset\n };\n } else if (position === 'end') {\n textBaseline = 'top';\n titlePoint = {\n x: center.x,\n y: center.y + offset\n };\n }\n const attrs: any = {\n ...titlePoint,\n ...restAttrs,\n textStyle: {\n textBaseline,\n textAlign: 'center',\n ...textStyle\n },\n state: {\n text: merge({}, DEFAULT_STATES, state.text),\n shape: merge({}, DEFAULT_STATES, state.shape),\n panel: merge({}, DEFAULT_STATES, state.background)\n }\n };\n\n const { angle } = restAttrs; // 用户设置的是角度\n attrs.angle = angle;\n\n if (shape && shape.visible) {\n attrs.shape = {\n visible: true,\n ...shape.style\n };\n if (shape.space) {\n attrs.space = shape.space;\n }\n }\n\n if (background && background.visible) {\n attrs.panel = {\n visible: true,\n ...background.style\n };\n }\n\n return attrs;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as CircleAxisAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n // 刻度线的数量大于 2 时,才绘制子刻度\n if (tickLineCount >= 2) {\n const tickSegment = this.data[1].value - this.data[0].value;\n const isAlignWithLable = this.attribute?.tick?.alignWithLabel;\n for (let i = 0; i < tickLineCount; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value =\n (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n protected beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n return;\n }\n protected handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n if (isEmpty(labelShapes)) {\n return;\n }\n\n const { inside, radius, center, size, label, orient } = this.attribute;\n // 宽高为0的异常情况,还是以圆心进行布局\n const bounds = size\n ? {\n x1: 0,\n y1: 0,\n x2: size.width,\n y2: size.height\n }\n : {\n x1: center.x - radius,\n y1: center.y - radius,\n x2: center.x + radius,\n y2: center.y + radius\n };\n const { layoutFunc, autoLimit, limitEllipsis, autoHide, autoHideMethod, autoHideSeparation, autoWrap } = label;\n\n if (isFunction(layoutFunc)) {\n // 自定义布局\n layoutFunc(labelShapes, labelData, layer, this);\n } else {\n // autoWrap has computed width & height limit\n if (autoLimit || autoWrap) {\n circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });\n }\n if (autoHide) {\n autoHideFunc(labelShapes, {\n orient,\n method: autoHideMethod,\n separation: autoHideSeparation\n });\n }\n }\n }\n protected afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void {\n /**\n * 基于布局矩形与文本对齐方式设置标签最大行宽:\n * - left:可用宽度为到矩形右边界的水平距离(rectRight - x)\n * - right:可用宽度为到矩形左边界的水平距离(x - rectLeft)\n * - center:取左右两侧最小距离的两倍(2 * min(x - rectLeft, rectRight - x))\n */\n const { layoutRect, autoLabelMaxWidth } = this.attribute as CircleAxisAttributes;\n if (!autoLabelMaxWidth || !layoutRect || !labelShapes || labelShapes.length === 0) {\n return;\n }\n\n const rectLeft = 0;\n const rectRight = 0 + layoutRect.width;\n\n for (let i = 0; i < labelShapes.length; i++) {\n const label = labelShapes[i];\n const x = label.attribute.x;\n const align = (label.attribute.textAlign as TextAlignType) ?? 'center';\n\n let maxWidth = 0;\n if (align === 'left') {\n maxWidth = rectRight - x;\n } else if (align === 'right') {\n maxWidth = x - rectLeft;\n } else {\n const leftDist = x - rectLeft;\n const rightDist = rectRight - x;\n maxWidth = 2 * Math.max(0, Math.min(leftDist, rightDist));\n }\n\n if (maxWidth > 0) {\n label.setAttributes({ maxLineWidth: maxWidth });\n } else {\n label.setAttributes({ maxLineWidth: 0 });\n }\n }\n\n return;\n }\n\n protected getTextBaseline(vector: [number, number]) {\n if (Math.abs(vector[1] / vector[0]) < 0.3) {\n return 'middle';\n } else if (vector[1] < 0) {\n return 'bottom';\n } else if (vector[1] > 0) {\n return 'top';\n }\n\n return 'middle';\n }\n\n protected getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType } {\n if (isNumberClose(vector[0], 0)) {\n return {\n textAlign: 'center',\n textBaseline: vector[1] > 0 ? 'top' : 'bottom'\n };\n } else if (vector[0] < 0) {\n return {\n textAlign: 'right',\n textBaseline: this.getTextBaseline(vector)\n };\n } else if (vector[0] > 0) {\n return {\n textAlign: 'left',\n textBaseline: this.getTextBaseline(vector)\n };\n }\n\n return {\n textAlign: 'center', //'left',\n textBaseline: 'middle' //'top'\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }\n}\n\nmixin(CircleAxis, CircleAxisMixin);\n"]}
package/es/axis/type.d.ts CHANGED
@@ -96,6 +96,13 @@ export interface CircleAxisAttributes extends AxisBaseAttributes {
96
96
  radius: number;
97
97
  innerRadius?: number;
98
98
  sides?: number;
99
+ layoutRect?: {
100
+ x: number;
101
+ y: number;
102
+ width: number;
103
+ height: number;
104
+ };
105
+ autoLabelMaxWidth?: boolean;
99
106
  }
100
107
  export type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {
101
108
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启动画\n * @default false\n */\n animation?: boolean;\n /**\n * 标签入场动画配置\n */\n animationEnter?: boolean;\n /**\n * 标签更新动画配置\n */\n animationUpdate?: boolean;\n /**\n * 标签离场动画配置\n */\n animationExit?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴上悬浮label标签配置\n */\n labelHoverOnAxis?: LabelHoverOnAxisAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n /**\n * 左侧扩充空间的大小\n */\n left?: number;\n /**\n * 右侧扩充空间的大小\n */\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type LabelHoverOnAxisAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示悬浮标签\n */\n visible?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 悬浮标签的位置 ,与轴的方位有关系,如果是水平轴,则position代表x的位置,如果是垂直轴,则position代表y的位置\n */\n position?: number;\n /**\n * 是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n /**\n * 格式化文本回调\n * @param value 文本原始值\n * @returns 格式化文本\n */\n formatMethod?: (value: string) => string;\n};\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启动画\n * @default false\n */\n animation?: boolean;\n /**\n * 标签入场动画配置\n */\n animationEnter?: boolean;\n /**\n * 标签更新动画配置\n */\n animationUpdate?: boolean;\n /**\n * 标签离场动画配置\n */\n animationExit?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴上悬浮label标签配置\n */\n labelHoverOnAxis?: LabelHoverOnAxisAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n\n /**\n * 坐标轴可用布局区域的大小\n */\n layoutRect?: { x: number; y: number; width: number; height: number };\n /**\n * 是否自动调整标签宽度以适应布局区域\n */\n autoLabelMaxWidth?: boolean;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n /**\n * 左侧扩充空间的大小\n */\n left?: number;\n /**\n * 右侧扩充空间的大小\n */\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type LabelHoverOnAxisAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示悬浮标签\n */\n visible?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 悬浮标签的位置 ,与轴的方位有关系,如果是水平轴,则position代表x的位置,如果是垂直轴,则position代表y的位置\n */\n position?: number;\n /**\n * 是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n /**\n * 格式化文本回调\n * @param value 文本原始值\n * @returns 格式化文本\n */\n formatMethod?: (value: string) => string;\n};\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
@@ -24,5 +24,4 @@ export const DEFAULT_BRUSH_ATTRIBUTES = {
24
24
  }
25
25
  };
26
26
 
27
- export const DEFAULT_SIZE_THRESHOLD = 5;
28
- //# sourceMappingURL=config.js.map
27
+ export const DEFAULT_SIZE_THRESHOLD = 5;
@@ -1,3 +1,4 @@
1
1
  export * from "./checkbox";
2
2
 
3
- export * from "./type";
3
+ export * from "./type";
4
+ //# sourceMappingURL=index.js.map
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "1.0.32-alpha.1";
1
+ export declare const version = "1.0.33-alpha.0";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "1.0.32-alpha.1";
1
+ export const version = "1.0.33-alpha.0";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,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,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.0.32-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\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 './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,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,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.0.33-alpha.0\";\n\nexport * from './core/base';\nexport * from './core/type';\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 './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
package/es/label/arc.js CHANGED
@@ -503,4 +503,4 @@ ArcLabel.defaultAttributes = {
503
503
  export const registerArcDataLabel = () => {
504
504
  registerLabelComponent("arc", ArcLabel);
505
505
  };
506
- //# sourceMappingURL=arc.js.map
506
+ //# sourceMappingURL=arc.js.map
@@ -1,4 +1,4 @@
1
1
  export * from "./label-item";
2
2
 
3
3
  export * from "./type";
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "1.0.32-alpha.1",
3
+ "version": "1.0.33-alpha.0",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "@visactor/vutils": "~1.0.12",
16
16
  "@visactor/vscale": "~1.0.12",
17
- "@visactor/vrender-core": "1.0.32-alpha.1",
18
- "@visactor/vrender-kits": "1.0.32-alpha.1",
19
- "@visactor/vrender-animate": "1.0.32-alpha.1"
17
+ "@visactor/vrender-core": "1.0.33-alpha.0",
18
+ "@visactor/vrender-kits": "1.0.33-alpha.0",
19
+ "@visactor/vrender-animate": "1.0.33-alpha.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@rushstack/eslint-patch": "~1.1.4",
@@ -31,8 +31,8 @@
31
31
  "typescript": "4.9.5",
32
32
  "cross-env": "^7.0.3",
33
33
  "@internal/bundler": "0.0.1",
34
- "@internal/ts-config": "0.0.1",
35
- "@internal/eslint-config": "0.0.1"
34
+ "@internal/eslint-config": "0.0.1",
35
+ "@internal/ts-config": "0.0.1"
36
36
  },
37
37
  "keywords": [
38
38
  "VisActor",