@visactor/vchart 1.13.9 → 1.13.10-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.
- package/build/es5/index.js +1 -1
- package/build/index.es.js +16 -2
- package/build/index.js +16 -2
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/constant/funnel.js +1 -2
- package/cjs/constant/sunburst.js +2 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +2 -3
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.js +2 -1
- package/cjs/plugin/components/tooltip-handler/base.js +8 -0
- package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/position.d.ts +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/position.js +9 -1
- package/cjs/plugin/components/tooltip-handler/utils/position.js.map +1 -1
- package/cjs/series/sankey/interface.d.ts +0 -1
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/typings/tooltip/position.d.ts +1 -1
- package/cjs/typings/tooltip/position.js.map +1 -1
- package/esm/constant/funnel.js +1 -2
- package/esm/constant/sunburst.js +2 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +2 -3
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.js +2 -1
- package/esm/plugin/components/tooltip-handler/base.js +8 -0
- package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/position.d.ts +1 -1
- package/esm/plugin/components/tooltip-handler/utils/position.js +9 -1
- package/esm/plugin/components/tooltip-handler/utils/position.js.map +1 -1
- package/esm/series/sankey/interface.d.ts +0 -1
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/typings/tooltip/position.d.ts +1 -1
- package/esm/typings/tooltip/position.js.map +1 -1
- package/package.json +2 -2
package/cjs/constant/funnel.js
CHANGED
|
@@ -12,5 +12,4 @@ exports.FUNNEL_LAST_VALUE_RATIO = `${base_1.PREFIX}_FUNNEL_LAST_VALUE_RATIO`, ex
|
|
|
12
12
|
exports.FUNNEL_LAST_VALUE = `${base_1.PREFIX}_FUNNEL_LAST_VALUE`, exports.FUNNEL_CURRENT_VALUE = `${base_1.PREFIX}_FUNNEL_CURRENT_VALUE`,
|
|
13
13
|
exports.FUNNEL_NEXT_VALUE = `${base_1.PREFIX}_FUNNEL_NEXT_VALUE`, exports.FUNNEL_TRANSFORM_LEVEL = `${base_1.PREFIX}_FUNNEL_TRANSFORM_LEVEL`,
|
|
14
14
|
exports.FUNNEL_LABEL_LINE_LENGTH = 20, exports.FUNNEL_LABEL_SPACE_WIDTH = 5, exports.FUNNEL_MAX_SIZE = "80%",
|
|
15
|
-
exports.FUNNEL_MIN_SIZE = 0;
|
|
16
|
-
//# sourceMappingURL=funnel.js.map
|
|
15
|
+
exports.FUNNEL_MIN_SIZE = 0;
|
package/cjs/constant/sunburst.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = void 0, exports.SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = 10;
|
|
5
|
+
}), exports.SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = void 0, exports.SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = 10;
|
|
6
|
+
//# sourceMappingURL=sunburst.js.map
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.13.
|
|
4
|
+
export declare const version = "1.13.10-alpha.0";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export type { IRegion } from '../region/interface';
|
package/cjs/core/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "Factory", {
|
|
|
35
35
|
get: function() {
|
|
36
36
|
return factory_1.Factory;
|
|
37
37
|
}
|
|
38
|
-
}), exports.version = "1.13.
|
|
38
|
+
}), exports.version = "1.13.10-alpha.0", __exportStar(require("../typings/spec/common"), exports),
|
|
39
39
|
__exportStar(require("../event/interface"), exports), __exportStar(require("../theme/interface"), exports),
|
|
40
40
|
__exportStar(require("./interface"), exports), __exportStar(require("../constant/base"), exports),
|
|
41
41
|
__exportStar(require("../constant/data"), exports), __exportStar(require("../typings/spec/index"), exports),
|
|
@@ -88,5 +88,4 @@ Object.defineProperty(exports, "vglobal", {
|
|
|
88
88
|
get: function() {
|
|
89
89
|
return vrender_core_1.createSymbol;
|
|
90
90
|
}
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=index.js.map
|
|
91
|
+
});
|
package/cjs/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAOzC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAG5B,mDAAiC;AACjC,mDAAiC;AAKjC,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAUgC;AAT9B,uGAAA,OAAO,OAAA;AACP,2GAAA,WAAW,OAAA;AACX,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AACV,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.10-alpha.0\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '@visactor/vrender-core';\n"]}
|
package/cjs/core/vchart.js
CHANGED
|
@@ -913,4 +913,5 @@ const registerVChartCore = () => {
|
|
|
913
913
|
(0, builtin_1.registerTheme)(builtin_1.darkTheme.name, builtin_1.darkTheme), vutils_1.Logger.getInstance(vutils_1.LoggerLevel.Error);
|
|
914
914
|
};
|
|
915
915
|
|
|
916
|
-
exports.registerVChartCore = registerVChartCore, (0, exports.registerVChartCore)();
|
|
916
|
+
exports.registerVChartCore = registerVChartCore, (0, exports.registerVChartCore)();
|
|
917
|
+
//# sourceMappingURL=vchart.js.map
|
|
@@ -91,6 +91,10 @@ class BaseTooltipHandler extends base_plugin_1.BasePlugin {
|
|
|
91
91
|
calcPos[posKey] = dim1 - boxSize * tooltipSizeScale - dimOffset;
|
|
92
92
|
break;
|
|
93
93
|
|
|
94
|
+
case -1.5:
|
|
95
|
+
calcPos[posKey] = dim1 + dimOffset;
|
|
96
|
+
break;
|
|
97
|
+
|
|
94
98
|
case 0:
|
|
95
99
|
calcPos[posKey] = (dim1 + dim2) / 2 - boxSize * tooltipSizeScale / 2;
|
|
96
100
|
break;
|
|
@@ -103,6 +107,10 @@ class BaseTooltipHandler extends base_plugin_1.BasePlugin {
|
|
|
103
107
|
calcPos[posKey] = (dim1 + dim2) / 2 + dimOffset;
|
|
104
108
|
break;
|
|
105
109
|
|
|
110
|
+
case 1.5:
|
|
111
|
+
calcPos[posKey] = dim2 - boxSize * tooltipSizeScale - dimOffset;
|
|
112
|
+
break;
|
|
113
|
+
|
|
106
114
|
case 2:
|
|
107
115
|
calcPos[posKey] = dim2 + dimOffset;
|
|
108
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/base.ts"],"names":[],"mappings":";;;AAAA,iDAAmF;AAEnF,2CAA8C;AAK9C,2CAAkD;AAWlD,2CAA0C;AAC1C,+CAM0B;AAI1B,6CAA0F;AAS1F,wDAAoD;AACpD,4DAA0E;AAY1E,MAAsB,kBAAmB,SAAQ,wBAAU;IAA3D;;QAOY,aAAQ,GAAG,IAAI,CAAC;QAqBhB,gBAAW,GAAY,KAAK,CAAC;QAavC,gBAAW,GAAG,CAAC,UAA6B,EAAE,IAAiB,EAAE,MAA4B,EAAE,EAAE;YAC/F,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;YAEtC,IAAI,kBAAkB,EAAE;gBACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACjD;YACD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;QAGQ,kBAAa,GAAsB,CAAC,OAAgB,EAAE,MAA4B,EAAE,IAAkB,EAAE,EAAE;YAClH,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,SAA4B;aAC7B;YAED,IAAI,CAAC,OAAO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AAC,UAAU,CAAC;IACzB,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AA/ZH,gDAgaC;AA9ZiB,0BAAO,GAAG,SAAS,CAAC","file":"base.js","sourcesContent":["import { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT } from '../../../constant/base';\n// eslint-disable-next-line no-duplicate-imports\nimport { DEFAULT_OPTIONS } from './constants';\nimport type { Maybe, IPoint, RenderMode } from '../../../typings';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ITooltipPositionFixedValue, TooltipPositionKeys } from '../../../typings/tooltip/position';\n// eslint-disable-next-line no-duplicate-imports\nimport { isTrueBrowser } from '../../../util/env';\nimport type {\n TooltipData,\n ITooltipActual,\n TooltipActiveType,\n ITooltipHandler,\n ITooltipPositionActual,\n IGlobalTooltipPositionPattern\n} from '../../../typings/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TooltipFixedPosition } from '../../../typings/tooltip';\nimport { getScale } from './utils/common';\nimport {\n getActualTooltipPositionValue,\n getCartesianCrosshairRect,\n getPositionType,\n isFixedTooltipPositionPattern,\n isGlobalTooltipPositionPattern\n} from './utils/position';\nimport type { IGroup } from '@visactor/vrender-core';\nimport type { AABBBounds } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNumber, isObject, isValidNumber, isValid, isFunction } from '@visactor/vutils';\nimport type { IElement } from '@visactor/vgrammar-core';\nimport type { ILayoutModel } from '../../../model/interface';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport type { IChartOption } from '../../../chart/interface';\nimport type { ITooltipSpec, Tooltip, TooltipHandlerParams } from '../../../component/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport { TooltipResult } from '../../../component/tooltip';\nimport type { IComponentPlugin, IComponentPluginService } from '../interface';\nimport { BasePlugin } from '../../base/base-plugin';\nimport { getTooltipPatternValue } from '../../../component/tooltip/utils';\nimport type { IDimensionData, IDimensionInfo } from '../../../event/events/dimension/interface';\nimport type { ITooltipHandlerOptions } from './interface';\nimport type { ICompiler } from '../../../compile/interface/compilable-item';\n\ntype ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => TooltipResult;\n\ntype ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => TooltipResult;\n\n/**\n * The tooltip handler class.\n */\nexport abstract class BaseTooltipHandler extends BasePlugin implements ITooltipHandler, IComponentPlugin {\n static readonly pluginType: 'component';\n static readonly specKey = 'tooltip';\n\n readonly type: string;\n\n /** 是否可见 */\n protected _visible = true;\n\n // protected _style: ITooltipStyle = {};\n\n protected _option: ITooltipHandlerOptions;\n\n protected _chartOption: IChartOption;\n\n protected _env: RenderMode;\n public get env() {\n return this._env;\n }\n\n protected _component: Tooltip;\n\n protected _chartContainer: Maybe<HTMLElement>;\n protected _compiler: ICompiler;\n\n // tooltip 容器\n protected _container!: Maybe<IGroup | HTMLElement>;\n\n protected _isReleased: boolean = false;\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n const component = service.component as Tooltip;\n this._component = component;\n this._chartOption = component.getOption() as any;\n this._env = this._chartOption.mode;\n this._chartContainer = this._chartOption.globalInstance.getContainer();\n this._compiler = component.getCompiler();\n this._initFromSpec();\n }\n\n showTooltip = (activeType: TooltipActiveType, data: TooltipData, params: TooltipHandlerParams) => {\n const { changePositionOnly } = params;\n\n if (changePositionOnly) {\n return this.changeTooltipPosition(params, data);\n }\n return this.changeTooltip(true, params, data);\n };\n\n /** 改变 tooltip 内容和位置(不带 throttle 版本),返回是否遇到异常 */\n protected changeTooltip: ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n if (!visible) {\n /** 关闭 tooltip */\n this._updateTooltip(false, params);\n return TooltipResult.success;\n }\n\n return this.changeTooltipPosition(params, data);\n };\n\n /** 改变 tooltip 位置(不带 throttle 版本),返回是否遇到异常 */\n protected changeTooltipPosition: ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n const event = params.event as MouseEvent;\n const { tooltipSpec, activeTooltipSpec, changePositionOnly } = params;\n\n if (!activeTooltipSpec) {\n return TooltipResult.failed;\n }\n\n const activeType = activeTooltipSpec.activeType;\n\n /** 用户自定义逻辑 */\n if (activeTooltipSpec.handler) {\n return activeTooltipSpec.handler.showTooltip?.(activeType, data, params) ?? TooltipResult.success;\n }\n\n /** 默认逻辑 */\n const pattern = activeTooltipSpec;\n\n // 计算 tooltip 位置\n const position = this._getActualTooltipPosition(\n activeTooltipSpec,\n params,\n this._getTooltipBoxSize(activeTooltipSpec, changePositionOnly)\n );\n activeTooltipSpec.position = position;\n const updatePosition = activeTooltipSpec.updatePosition ?? tooltipSpec[activeType]?.updatePosition;\n\n if (updatePosition) {\n activeTooltipSpec.position = updatePosition(activeTooltipSpec.position, data, params);\n }\n\n // 判断 tooltip 可见性\n let tooltipVisible = pattern?.visible !== false;\n if (\n !data ||\n event.type === 'pointerout' ||\n !activeTooltipSpec.visible ||\n (!activeTooltipSpec.title && !activeTooltipSpec.content)\n ) {\n tooltipVisible = false;\n }\n\n this._updateTooltip(tooltipVisible, {\n ...params,\n changePositionOnly\n });\n return TooltipResult.success;\n };\n\n hideTooltip(params: TooltipHandlerParams): TooltipResult {\n return this.changeTooltip(false, params);\n }\n\n release(): void {\n const spec = this._component.getSpec() ?? {};\n /** 用户自定义逻辑 */\n if (spec.handler) {\n spec.handler.release?.();\n return;\n }\n /** 默认逻辑 */\n this._removeTooltip();\n\n this._isReleased = true;\n }\n\n /* -----需要子类继承的方法开始----- */\n\n protected abstract _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;\n protected abstract _removeTooltip(): void;\n protected abstract _getTooltipBoxSize(\n actualTooltip: ITooltipActual,\n changePositionOnly: boolean\n ): IContainerSize | undefined;\n\n /* -----需要子类继承的方法结束----- */\n\n protected _getDefaultOption(): ITooltipHandlerOptions {\n const { offset } = this._component.getSpec();\n\n return offset\n ? {\n offsetX: offset.x ?? DEFAULT_OPTIONS.offsetX,\n offsetY: offset.y ?? DEFAULT_OPTIONS.offsetY\n }\n : DEFAULT_OPTIONS;\n }\n\n /**\n * 计算实际的 tooltip 位置\n */\n protected _getActualTooltipPosition = (\n actualTooltip: ITooltipActual,\n params: TooltipHandlerParams,\n tooltipBoxSize: IContainerSize | undefined\n ): ITooltipPositionActual => {\n const { tooltipSpec } = params;\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n if (!tooltipSpec) {\n return invalidPosition;\n }\n const event = params.event as MouseEvent;\n const { activeType, data } = actualTooltip;\n const firstDim =\n activeType === 'dimension' ? (data as IDimensionInfo[])[0]?.data?.[0] : (data as IDimensionData[])?.[0];\n\n const { offsetX, offsetY } = this._option;\n\n const spec = tooltipSpec[activeType];\n const position = getTooltipPatternValue(spec?.position, data, params);\n const positionMode =\n getTooltipPatternValue(spec?.positionMode, data, params) ?? (activeType === 'mark' ? 'mark' : 'pointer');\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = tooltipBoxSize ?? {};\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const canvasRect = params?.chart?.getCanvasRect();\n const canvasWidth = canvasRect?.width ?? DEFAULT_CHART_WIDTH;\n const canvasHeight = canvasRect?.height ?? DEFAULT_CHART_HEIGHT;\n let isFixedPosition = false;\n\n const containerSize = {\n width: 0,\n height: 0\n };\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementRect: DOMRect;\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n const isBrowser = isTrueBrowser(this._env);\n\n if (isBrowser && !tooltipSpec.confine) {\n // 只有在 browser 模式下才可以获取到 window 对象\n containerSize.width = window.innerWidth;\n containerSize.height = window.innerHeight;\n } else {\n containerSize.width = canvasWidth;\n containerSize.height = canvasHeight;\n }\n if (isBrowser && !isCanvas) {\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect?.() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n const tooltipSizeScale = tooltipParentElementScale / chartElementScale;\n\n /* 一、计算 left、top、right、bottom */\n\n const calcPos: { top?: number; bottom?: number; left?: number; right?: number } = {};\n const pointerFixedPosition: {\n x: TooltipFixedPosition;\n y: TooltipFixedPosition;\n } = { x: position as any, y: position as any };\n const dimToPos = { x: ['left', 'right'], y: ['top', 'bottom'] };\n\n const processCartesianFixedPosition = ({ orient, mode, offset }: ITooltipPositionFixedValue, dim: 'x' | 'y') => {\n let dim1: number;\n let dim2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n const dimOffset = offset ?? (dim === 'x' ? offsetX : offsetY);\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n dim1 = (dim === 'x' ? bounds.x1 : bounds.y1) + startPoint[dim];\n dim2 = (dim === 'x' ? bounds.x2 : bounds.y2) + startPoint[dim];\n }\n } else if (\n mode === 'crosshair' &&\n firstDim?.series?.coordinate === 'cartesian' &&\n firstDim.datum &&\n firstDim.datum.length\n ) {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(firstDim, startPoint);\n if (rect) {\n dim1 = rect.start[dim];\n dim2 = rect.end[dim];\n }\n } else {\n pointerFixedPosition[dim] = orient;\n }\n\n if (isFixedPosition) {\n const posKey = dimToPos[dim][0] as TooltipPositionKeys;\n const boxSize = dim === 'x' ? tooltipBoxWidth : tooltipBoxHeight;\n switch (getPositionType(orient, dim)) {\n case -2:\n calcPos[posKey] = dim1 - boxSize * tooltipSizeScale - dimOffset;\n break;\n case 0:\n calcPos[posKey] = (dim1 + dim2) / 2 - (boxSize * tooltipSizeScale) / 2;\n break;\n case -1:\n calcPos[posKey] = (dim1 + dim2) / 2 - boxSize * tooltipSizeScale - dimOffset;\n break;\n case 1:\n calcPos[posKey] = (dim1 + dim2) / 2 + dimOffset;\n break;\n case 2:\n calcPos[posKey] = dim2 + dimOffset;\n break;\n }\n }\n };\n const dims = ['x', 'y'] as ('x' | 'y')[];\n if (isObject(position)) {\n if (isGlobalTooltipPositionPattern(position)) {\n const {\n left: posLeft,\n right: posRight,\n top: posTop,\n bottom: posBottom\n } = position as IGlobalTooltipPositionPattern;\n calcPos.left = getActualTooltipPositionValue(posLeft, event);\n calcPos.top = getActualTooltipPositionValue(posTop, event);\n calcPos.right = getActualTooltipPositionValue(posRight, event);\n calcPos.bottom = getActualTooltipPositionValue(posBottom, event);\n } else if (isFixedTooltipPositionPattern(position)) {\n dims.forEach(dim => {\n const dimValue = position[dim];\n if (isNumber(dimValue) || isFunction(dimValue)) {\n calcPos[dimToPos[dim][0] as TooltipPositionKeys] = getActualTooltipPositionValue(\n dimValue as number | ((event: MouseEvent) => number),\n event\n );\n } else {\n processCartesianFixedPosition(dimValue as ITooltipPositionFixedValue, dim);\n }\n });\n }\n } else if (isValid(position)) {\n processCartesianFixedPosition({ orient: position, mode: positionMode } as ITooltipPositionFixedValue, 'x');\n processCartesianFixedPosition({ orient: position, mode: positionMode } as ITooltipPositionFixedValue, 'y');\n }\n\n const result: ITooltipPositionActual = { x: null, y: null };\n\n dims.forEach(dim => {\n /* 二、换算成 x 和 y */\n const boxSize = dim === 'x' ? tooltipBoxWidth : tooltipBoxHeight;\n const canvasSize = dim === 'x' ? canvasWidth : canvasHeight;\n const offset = dim === 'x' ? offsetX : offsetY;\n const posType = getPositionType(pointerFixedPosition[dim], dim);\n if (isValidNumber(calcPos[dimToPos[dim][0] as TooltipPositionKeys])) {\n result[dim] = calcPos[dimToPos[dim][0] as TooltipPositionKeys];\n } else if (isValidNumber(calcPos[dimToPos[dim][1] as TooltipPositionKeys])) {\n result[dim] = canvasSize - boxSize * tooltipSizeScale - calcPos[dimToPos[dim][1] as TooltipPositionKeys];\n } else {\n const value0 = dim === 'x' ? (event as any).canvasX : (event as any).canvasY;\n\n if (posType > 0) {\n result[dim] = value0 + offset;\n } else if (posType === 0) {\n result[dim] = value0 - (boxSize * tooltipSizeScale) / 2;\n } else {\n result[dim] = value0 - boxSize * tooltipSizeScale - offset;\n }\n }\n result[dim] *= chartElementScale;\n\n if (isBrowser) {\n result[dim] += relativePosOffset[dim];\n }\n result[dim] /= tooltipParentElementScale;\n\n /* 三、确保tooltip在视区内 */\n const containerDimSize = dim === 'x' ? containerSize.width : containerSize.height;\n const leftOrTop = tooltipSpec.confine\n ? -(tooltipParentElementRect[dim] - (chartElementRect?.[dim] ?? 0) / chartElementScale) /\n tooltipParentElementScale\n : -tooltipParentElementRect[dim] / tooltipParentElementScale;\n const rightOrBottom = containerDimSize / tooltipParentElementScale + leftOrTop - boxSize;\n\n // 处理左右\n if (posType !== 2 && result[dim] < leftOrTop) {\n // 优先检测left\n if (isFixedPosition) {\n result[dim] = leftOrTop;\n } else {\n if (posType === 0) {\n // 从居中 挪至 右侧\n result[dim] += offset + boxSize / 2;\n } else {\n // 从居左/左侧 挪至 居右/右侧\n result[dim] += offset * 2 + boxSize;\n }\n\n if (result[dim] > rightOrBottom) {\n // 位置不超出视区右界\n result[dim] = rightOrBottom;\n }\n }\n } else if (posType !== -2 && result[dim] > rightOrBottom) {\n // 优先检测right\n // 位置不超出视区右界\n if (isFixedPosition) {\n result[dim] = rightOrBottom;\n } else {\n if (posType === 0) {\n // 从居中 挪至 左侧\n result[dim] -= offset + boxSize / 2;\n } else {\n // 从居右/右侧 挪至 居左/左侧\n result[dim] -= offset * 2 + boxSize;\n }\n\n if (result[dim] < leftOrTop) {\n // 位置不超出视区左界\n result[dim] = leftOrTop;\n }\n }\n }\n });\n\n return result;\n };\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return spec.parentElement as any;\n }\n\n getTooltipContainer() {\n return this._container;\n }\n\n protected _initFromSpec() {\n this._option = this._getDefaultOption();\n }\n\n reInit() {\n this._initFromSpec();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/base.ts"],"names":[],"mappings":";;;AAAA,iDAAmF;AAEnF,2CAA8C;AAK9C,2CAAkD;AAWlD,2CAA0C;AAC1C,+CAM0B;AAI1B,6CAA0F;AAS1F,wDAAoD;AACpD,4DAA0E;AAY1E,MAAsB,kBAAmB,SAAQ,wBAAU;IAA3D;;QAOY,aAAQ,GAAG,IAAI,CAAC;QAqBhB,gBAAW,GAAY,KAAK,CAAC;QAavC,gBAAW,GAAG,CAAC,UAA6B,EAAE,IAAiB,EAAE,MAA4B,EAAE,EAAE;YAC/F,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;YAEtC,IAAI,kBAAkB,EAAE;gBACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACjD;YACD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;QAGQ,kBAAa,GAAsB,CAAC,OAAgB,EAAE,MAA4B,EAAE,IAAkB,EAAE,EAAE;YAClH,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,SAA4B;aAC7B;YAED,IAAI,CAAC,OAAO,EAAE;gBAEZ,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACnC,SAA6B;aAC9B;YAED,OAAO,IAAI,C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,iBAAiB,CAAC,IAAkB;QAC5C,OAAO,IAAI,CAAC,aAAoB,CAAC;IACnC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AAraH,gDAsaC;AApaiB,0BAAO,GAAG,SAAS,CAAC","file":"base.js","sourcesContent":["import { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT } from '../../../constant/base';\n// eslint-disable-next-line no-duplicate-imports\nimport { DEFAULT_OPTIONS } from './constants';\nimport type { Maybe, IPoint, RenderMode } from '../../../typings';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ITooltipPositionFixedValue, TooltipPositionKeys } from '../../../typings/tooltip/position';\n// eslint-disable-next-line no-duplicate-imports\nimport { isTrueBrowser } from '../../../util/env';\nimport type {\n TooltipData,\n ITooltipActual,\n TooltipActiveType,\n ITooltipHandler,\n ITooltipPositionActual,\n IGlobalTooltipPositionPattern\n} from '../../../typings/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TooltipFixedPosition } from '../../../typings/tooltip';\nimport { getScale } from './utils/common';\nimport {\n getActualTooltipPositionValue,\n getCartesianCrosshairRect,\n getPositionType,\n isFixedTooltipPositionPattern,\n isGlobalTooltipPositionPattern\n} from './utils/position';\nimport type { IGroup } from '@visactor/vrender-core';\nimport type { AABBBounds } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNumber, isObject, isValidNumber, isValid, isFunction } from '@visactor/vutils';\nimport type { IElement } from '@visactor/vgrammar-core';\nimport type { ILayoutModel } from '../../../model/interface';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport type { IChartOption } from '../../../chart/interface';\nimport type { ITooltipSpec, Tooltip, TooltipHandlerParams } from '../../../component/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport { TooltipResult } from '../../../component/tooltip';\nimport type { IComponentPlugin, IComponentPluginService } from '../interface';\nimport { BasePlugin } from '../../base/base-plugin';\nimport { getTooltipPatternValue } from '../../../component/tooltip/utils';\nimport type { IDimensionData, IDimensionInfo } from '../../../event/events/dimension/interface';\nimport type { ITooltipHandlerOptions } from './interface';\nimport type { ICompiler } from '../../../compile/interface/compilable-item';\n\ntype ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => TooltipResult;\n\ntype ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => TooltipResult;\n\n/**\n * The tooltip handler class.\n */\nexport abstract class BaseTooltipHandler extends BasePlugin implements ITooltipHandler, IComponentPlugin {\n static readonly pluginType: 'component';\n static readonly specKey = 'tooltip';\n\n readonly type: string;\n\n /** 是否可见 */\n protected _visible = true;\n\n // protected _style: ITooltipStyle = {};\n\n protected _option: ITooltipHandlerOptions;\n\n protected _chartOption: IChartOption;\n\n protected _env: RenderMode;\n public get env() {\n return this._env;\n }\n\n protected _component: Tooltip;\n\n protected _chartContainer: Maybe<HTMLElement>;\n protected _compiler: ICompiler;\n\n // tooltip 容器\n protected _container!: Maybe<IGroup | HTMLElement>;\n\n protected _isReleased: boolean = false;\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n const component = service.component as Tooltip;\n this._component = component;\n this._chartOption = component.getOption() as any;\n this._env = this._chartOption.mode;\n this._chartContainer = this._chartOption.globalInstance.getContainer();\n this._compiler = component.getCompiler();\n this._initFromSpec();\n }\n\n showTooltip = (activeType: TooltipActiveType, data: TooltipData, params: TooltipHandlerParams) => {\n const { changePositionOnly } = params;\n\n if (changePositionOnly) {\n return this.changeTooltipPosition(params, data);\n }\n return this.changeTooltip(true, params, data);\n };\n\n /** 改变 tooltip 内容和位置(不带 throttle 版本),返回是否遇到异常 */\n protected changeTooltip: ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n if (!visible) {\n /** 关闭 tooltip */\n this._updateTooltip(false, params);\n return TooltipResult.success;\n }\n\n return this.changeTooltipPosition(params, data);\n };\n\n /** 改变 tooltip 位置(不带 throttle 版本),返回是否遇到异常 */\n protected changeTooltipPosition: ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n const event = params.event as MouseEvent;\n const { tooltipSpec, activeTooltipSpec, changePositionOnly } = params;\n\n if (!activeTooltipSpec) {\n return TooltipResult.failed;\n }\n\n const activeType = activeTooltipSpec.activeType;\n\n /** 用户自定义逻辑 */\n if (activeTooltipSpec.handler) {\n return activeTooltipSpec.handler.showTooltip?.(activeType, data, params) ?? TooltipResult.success;\n }\n\n /** 默认逻辑 */\n const pattern = activeTooltipSpec;\n\n // 计算 tooltip 位置\n const position = this._getActualTooltipPosition(\n activeTooltipSpec,\n params,\n this._getTooltipBoxSize(activeTooltipSpec, changePositionOnly)\n );\n activeTooltipSpec.position = position;\n const updatePosition = activeTooltipSpec.updatePosition ?? tooltipSpec[activeType]?.updatePosition;\n\n if (updatePosition) {\n activeTooltipSpec.position = updatePosition(activeTooltipSpec.position, data, params);\n }\n\n // 判断 tooltip 可见性\n let tooltipVisible = pattern?.visible !== false;\n if (\n !data ||\n event.type === 'pointerout' ||\n !activeTooltipSpec.visible ||\n (!activeTooltipSpec.title && !activeTooltipSpec.content)\n ) {\n tooltipVisible = false;\n }\n\n this._updateTooltip(tooltipVisible, {\n ...params,\n changePositionOnly\n });\n return TooltipResult.success;\n };\n\n hideTooltip(params: TooltipHandlerParams): TooltipResult {\n return this.changeTooltip(false, params);\n }\n\n release(): void {\n const spec = this._component.getSpec() ?? {};\n /** 用户自定义逻辑 */\n if (spec.handler) {\n spec.handler.release?.();\n return;\n }\n /** 默认逻辑 */\n this._removeTooltip();\n\n this._isReleased = true;\n }\n\n /* -----需要子类继承的方法开始----- */\n\n protected abstract _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;\n protected abstract _removeTooltip(): void;\n protected abstract _getTooltipBoxSize(\n actualTooltip: ITooltipActual,\n changePositionOnly: boolean\n ): IContainerSize | undefined;\n\n /* -----需要子类继承的方法结束----- */\n\n protected _getDefaultOption(): ITooltipHandlerOptions {\n const { offset } = this._component.getSpec();\n\n return offset\n ? {\n offsetX: offset.x ?? DEFAULT_OPTIONS.offsetX,\n offsetY: offset.y ?? DEFAULT_OPTIONS.offsetY\n }\n : DEFAULT_OPTIONS;\n }\n\n /**\n * 计算实际的 tooltip 位置\n */\n protected _getActualTooltipPosition = (\n actualTooltip: ITooltipActual,\n params: TooltipHandlerParams,\n tooltipBoxSize: IContainerSize | undefined\n ): ITooltipPositionActual => {\n const { tooltipSpec } = params;\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n if (!tooltipSpec) {\n return invalidPosition;\n }\n const event = params.event as MouseEvent;\n const { activeType, data } = actualTooltip;\n const firstDim =\n activeType === 'dimension' ? (data as IDimensionInfo[])[0]?.data?.[0] : (data as IDimensionData[])?.[0];\n\n const { offsetX, offsetY } = this._option;\n\n const spec = tooltipSpec[activeType];\n const position = getTooltipPatternValue(spec?.position, data, params);\n const positionMode =\n getTooltipPatternValue(spec?.positionMode, data, params) ?? (activeType === 'mark' ? 'mark' : 'pointer');\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = tooltipBoxSize ?? {};\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const canvasRect = params?.chart?.getCanvasRect();\n const canvasWidth = canvasRect?.width ?? DEFAULT_CHART_WIDTH;\n const canvasHeight = canvasRect?.height ?? DEFAULT_CHART_HEIGHT;\n let isFixedPosition = false;\n\n const containerSize = {\n width: 0,\n height: 0\n };\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementRect: DOMRect;\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n const isBrowser = isTrueBrowser(this._env);\n\n if (isBrowser && !tooltipSpec.confine) {\n // 只有在 browser 模式下才可以获取到 window 对象\n containerSize.width = window.innerWidth;\n containerSize.height = window.innerHeight;\n } else {\n containerSize.width = canvasWidth;\n containerSize.height = canvasHeight;\n }\n if (isBrowser && !isCanvas) {\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect?.() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n const tooltipSizeScale = tooltipParentElementScale / chartElementScale;\n\n /* 一、计算 left、top、right、bottom */\n\n const calcPos: { top?: number; bottom?: number; left?: number; right?: number } = {};\n const pointerFixedPosition: {\n x: TooltipFixedPosition;\n y: TooltipFixedPosition;\n } = { x: position as any, y: position as any };\n const dimToPos = { x: ['left', 'right'], y: ['top', 'bottom'] };\n\n const processCartesianFixedPosition = ({ orient, mode, offset }: ITooltipPositionFixedValue, dim: 'x' | 'y') => {\n let dim1: number;\n let dim2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n const dimOffset = offset ?? (dim === 'x' ? offsetX : offsetY);\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n dim1 = (dim === 'x' ? bounds.x1 : bounds.y1) + startPoint[dim];\n dim2 = (dim === 'x' ? bounds.x2 : bounds.y2) + startPoint[dim];\n }\n } else if (\n mode === 'crosshair' &&\n firstDim?.series?.coordinate === 'cartesian' &&\n firstDim.datum &&\n firstDim.datum.length\n ) {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(firstDim, startPoint);\n if (rect) {\n dim1 = rect.start[dim];\n dim2 = rect.end[dim];\n }\n } else {\n pointerFixedPosition[dim] = orient;\n }\n\n if (isFixedPosition) {\n const posKey = dimToPos[dim][0] as TooltipPositionKeys;\n const boxSize = dim === 'x' ? tooltipBoxWidth : tooltipBoxHeight;\n switch (getPositionType(orient, dim)) {\n case -2:\n calcPos[posKey] = dim1 - boxSize * tooltipSizeScale - dimOffset;\n break;\n case -1.5:\n calcPos[posKey] = dim1 + dimOffset;\n break;\n case 0:\n calcPos[posKey] = (dim1 + dim2) / 2 - (boxSize * tooltipSizeScale) / 2;\n break;\n case -1:\n calcPos[posKey] = (dim1 + dim2) / 2 - boxSize * tooltipSizeScale - dimOffset;\n break;\n case 1:\n calcPos[posKey] = (dim1 + dim2) / 2 + dimOffset;\n break;\n case 1.5:\n calcPos[posKey] = dim2 - boxSize * tooltipSizeScale - dimOffset;\n break;\n case 2:\n calcPos[posKey] = dim2 + dimOffset;\n break;\n }\n }\n };\n const dims = ['x', 'y'] as ('x' | 'y')[];\n if (isObject(position)) {\n if (isGlobalTooltipPositionPattern(position)) {\n const {\n left: posLeft,\n right: posRight,\n top: posTop,\n bottom: posBottom\n } = position as IGlobalTooltipPositionPattern;\n calcPos.left = getActualTooltipPositionValue(posLeft, event);\n calcPos.top = getActualTooltipPositionValue(posTop, event);\n calcPos.right = getActualTooltipPositionValue(posRight, event);\n calcPos.bottom = getActualTooltipPositionValue(posBottom, event);\n } else if (isFixedTooltipPositionPattern(position)) {\n dims.forEach(dim => {\n const dimValue = position[dim];\n if (isNumber(dimValue) || isFunction(dimValue)) {\n calcPos[dimToPos[dim][0] as TooltipPositionKeys] = getActualTooltipPositionValue(\n dimValue as number | ((event: MouseEvent) => number),\n event\n );\n } else {\n processCartesianFixedPosition(dimValue as ITooltipPositionFixedValue, dim);\n }\n });\n }\n } else if (isValid(position)) {\n processCartesianFixedPosition({ orient: position, mode: positionMode } as ITooltipPositionFixedValue, 'x');\n processCartesianFixedPosition({ orient: position, mode: positionMode } as ITooltipPositionFixedValue, 'y');\n }\n\n const result: ITooltipPositionActual = { x: null, y: null };\n\n dims.forEach(dim => {\n /* 二、换算成 x 和 y */\n const boxSize = dim === 'x' ? tooltipBoxWidth : tooltipBoxHeight;\n const canvasSize = dim === 'x' ? canvasWidth : canvasHeight;\n const offset = dim === 'x' ? offsetX : offsetY;\n const posType = getPositionType(pointerFixedPosition[dim], dim);\n if (isValidNumber(calcPos[dimToPos[dim][0] as TooltipPositionKeys])) {\n result[dim] = calcPos[dimToPos[dim][0] as TooltipPositionKeys];\n } else if (isValidNumber(calcPos[dimToPos[dim][1] as TooltipPositionKeys])) {\n result[dim] = canvasSize - boxSize * tooltipSizeScale - calcPos[dimToPos[dim][1] as TooltipPositionKeys];\n } else {\n const value0 = dim === 'x' ? (event as any).canvasX : (event as any).canvasY;\n\n if (posType > 0) {\n result[dim] = value0 + offset;\n } else if (posType === 0) {\n result[dim] = value0 - (boxSize * tooltipSizeScale) / 2;\n } else {\n result[dim] = value0 - boxSize * tooltipSizeScale - offset;\n }\n }\n result[dim] *= chartElementScale;\n\n if (isBrowser) {\n result[dim] += relativePosOffset[dim];\n }\n result[dim] /= tooltipParentElementScale;\n\n /* 三、确保tooltip在视区内 */\n const containerDimSize = dim === 'x' ? containerSize.width : containerSize.height;\n const leftOrTop = tooltipSpec.confine\n ? -(tooltipParentElementRect[dim] - (chartElementRect?.[dim] ?? 0) / chartElementScale) /\n tooltipParentElementScale\n : -tooltipParentElementRect[dim] / tooltipParentElementScale;\n const rightOrBottom = containerDimSize / tooltipParentElementScale + leftOrTop - boxSize;\n\n // 处理左右\n if (posType !== 2 && result[dim] < leftOrTop) {\n // 优先检测left\n if (isFixedPosition) {\n result[dim] = leftOrTop;\n } else {\n if (posType === 0) {\n // 从居中 挪至 右侧\n result[dim] += offset + boxSize / 2;\n } else {\n // 从居左/左侧 挪至 居右/右侧\n result[dim] += offset * 2 + boxSize;\n }\n\n if (result[dim] > rightOrBottom) {\n // 位置不超出视区右界\n result[dim] = rightOrBottom;\n }\n }\n } else if (posType !== -2 && result[dim] > rightOrBottom) {\n // 优先检测right\n // 位置不超出视区右界\n if (isFixedPosition) {\n result[dim] = rightOrBottom;\n } else {\n if (posType === 0) {\n // 从居中 挪至 左侧\n result[dim] -= offset + boxSize / 2;\n } else {\n // 从居右/右侧 挪至 居左/左侧\n result[dim] -= offset * 2 + boxSize;\n }\n\n if (result[dim] < leftOrTop) {\n // 位置不超出视区左界\n result[dim] = leftOrTop;\n }\n }\n }\n });\n\n return result;\n };\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return spec.parentElement as any;\n }\n\n getTooltipContainer() {\n return this._container;\n }\n\n protected _initFromSpec() {\n this._option = this._getDefaultOption();\n }\n\n reInit() {\n this._initFromSpec();\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import type { IDimensionData } from '../../../../event';
|
|
|
2
2
|
import { type ILayoutPoint } from '../../../../typings';
|
|
3
3
|
import type { IFixedTooltipPositionPattern, IGlobalTooltipPositionPattern, TooltipFixedPosition } from '../../../../typings/tooltip/position';
|
|
4
4
|
export declare const getActualTooltipPositionValue: (position: number | ((event: MouseEvent) => number), event: MouseEvent) => number;
|
|
5
|
-
export type TooltipPositionType = -2 | -1 | 0 | 1 | 2;
|
|
5
|
+
export type TooltipPositionType = -2 | -1.5 | -1 | 0 | 1 | 1.5 | 2;
|
|
6
6
|
export declare const positionType: Record<TooltipFixedPosition, [TooltipPositionType, TooltipPositionType]>;
|
|
7
7
|
export declare const getPositionType: (position: TooltipFixedPosition, dim: 'x' | 'y', defaultCase?: TooltipPositionType) => TooltipPositionType;
|
|
8
8
|
export declare const getCartesianCrosshairRect: (dimensionData: IDimensionData, layoutStartPoint: ILayoutPoint) => {
|
|
@@ -18,11 +18,19 @@ exports.getActualTooltipPositionValue = getActualTooltipPositionValue, exports.p
|
|
|
18
18
|
left: [ -2, 0 ],
|
|
19
19
|
right: [ 2, 0 ],
|
|
20
20
|
top: [ 0, -2 ],
|
|
21
|
+
bottom: [ 0, 2 ],
|
|
22
|
+
insideTop: [ 0, -1.5 ],
|
|
23
|
+
insideBottom: [ 0, 1.5 ],
|
|
24
|
+
insideLeft: [ -1.5, 0 ],
|
|
25
|
+
insideRight: [ 1.5, 0 ],
|
|
26
|
+
insideTopLeft: [ -1.5, -1.5 ],
|
|
27
|
+
insideTopRight: [ 1.5, -1.5 ],
|
|
28
|
+
insideBottomLeft: [ -1.5, 1.5 ],
|
|
29
|
+
insideBottomRight: [ 1.5, 1.5 ],
|
|
21
30
|
lt: [ -2, -2 ],
|
|
22
31
|
tl: [ -2, -2 ],
|
|
23
32
|
rt: [ 2, -2 ],
|
|
24
33
|
tr: [ 2, -2 ],
|
|
25
|
-
bottom: [ 0, 2 ],
|
|
26
34
|
bl: [ -2, 2 ],
|
|
27
35
|
lb: [ -2, 2 ],
|
|
28
36
|
br: [ 2, 2 ],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/position.ts"],"names":[],"mappings":";;;AAGA,+EAAiG;AASjG,6CAA2E;AAEpE,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACT,EAAE;IACV,IAAI,MAAc,CAAC;IACnB,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,IAAA,iBAAQ,EAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAkB,CAAC;SAC7B;aAAM,IAAI,IAAA,mBAAU,EAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAI,QAA0C,CAAC,KAAK,CAAC,CAAC;YAE3E,IAAI,IAAA,iBAAQ,EAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,6BAA6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AA6B,iCAKxC","file":"position.js","sourcesContent":["import type { IAxis } from '../../../../component/axis';\nimport type { AxisCurrentValueMap, CrossHairStateByField } from '../../../../component/crosshair';\n\nimport { layoutByValue, layoutCrosshair } from '../../../../component/crosshair/utils/cartesian';\nimport type { IDimensionData } from '../../../../event';\nimport type { ICartesianSeries } from '../../../../series';\nimport { Direction, type ILayoutPoint } from '../../../../typings';\nimport type {\n IFixedTooltipPositionPattern,\n IGlobalTooltipPositionPattern,\n TooltipFixedPosition\n} from '../../../../typings/tooltip/position';\nimport { isFunction, isNumber, isObject, isValid } from '@visactor/vutils';\n\nexport const getActualTooltipPositionValue = (\n position: number | ((event: MouseEvent) => number) | null | undefined,\n event: MouseEvent\n): number => {\n let result: number;\n if (isValid(position)) {\n if (isNumber(position)) {\n result = position as number;\n } else if (isFunction(position)) {\n // 这里额外判断下是否合法\n const tooltipPosition = (position as (event: MouseEvent) => number)(event);\n\n if (isNumber(tooltipPosition)) {\n result = tooltipPosition;\n }\n }\n }\n return result;\n};\n\n// 'left' | 'innerLeft' | 'centerLeft' | 'center' | 'centerRight' | 'innerRight' | 'right'\n// 'top' | 'innerTop' | 'centerTop' | 'center' | 'centerBottom' | 'innerBottom' | 'bottom'\nexport type TooltipPositionType = -2 | -1.5 | -1 | 0 | 1 | 1.5 | 2;\n\n/** position 对齐方式在 x、y 分量下的分解 */\nexport const positionType: Record<TooltipFixedPosition, [TooltipPositionType, TooltipPositionType]> = {\n left: [-2, 0],\n right: [2, 0],\n top: [0, -2],\n bottom: [0, 2],\n\n insideTop: [0, -1.5],\n insideBottom: [0, 1.5],\n insideLeft: [-1.5, 0],\n insideRight: [1.5, 0],\n\n insideTopLeft: [-1.5, -1.5],\n insideTopRight: [1.5, -1.5],\n insideBottomLeft: [-1.5, 1.5],\n insideBottomRight: [1.5, 1.5],\n\n lt: [-2, -2],\n tl: [-2, -2],\n rt: [2, -2],\n tr: [2, -2],\n bl: [-2, 2],\n lb: [-2, 2],\n br: [2, 2],\n rb: [2, 2],\n inside: [0, 0], // 旧版兼容\n center: [0, 0],\n centerBottom: [0, 1],\n centerTop: [0, -1],\n centerLeft: [-1, 0],\n centerRight: [1, 0]\n};\n\nexport const getPositionType = (\n position: TooltipFixedPosition,\n dim: 'x' | 'y',\n defaultCase: TooltipPositionType = 2\n): TooltipPositionType => positionType[position]?.[dim === 'x' ? 0 : 1] ?? defaultCase;\n\nexport const getCartesianCrosshairRect = (dimensionData: IDimensionData, layoutStartPoint: ILayoutPoint) => {\n const currValueX: AxisCurrentValueMap = new Map();\n const currValueY: AxisCurrentValueMap = new Map();\n const { series, datum } = dimensionData;\n const isHorizontal = (series as ICartesianSeries).direction === Direction.horizontal;\n const axisHelper = isHorizontal\n ? (series as ICartesianSeries).getYAxisHelper()\n : (series as ICartesianSeries).getXAxisHelper();\n const axisId = axisHelper.getAxisId();\n const axis = series\n .getChart()\n .getComponentsByKey('axes')\n .find(axis => axis.id === axisId) as IAxis;\n\n if (!axis) {\n return undefined;\n }\n (isHorizontal ? currValueY : currValueX).set(axis.getSpecIndex(), {\n datum: series.getDatumPositionValues(datum[0], series.getDimensionField())?.[0],\n axis\n });\n\n const state: CrossHairStateByField = {\n xField: {\n coordKey: 'x',\n anotherAxisKey: 'y',\n currentValue: currValueX,\n attributes: {\n visible: !!currValueX.size,\n type: 'rect'\n }\n },\n yField: {\n coordKey: 'y',\n anotherAxisKey: 'x',\n currentValue: currValueY,\n attributes: {\n visible: !!currValueY.size,\n type: 'rect'\n }\n }\n };\n\n layoutByValue(state, series as ICartesianSeries, layoutStartPoint);\n\n if (state.xField.cacheInfo) {\n return layoutCrosshair(state.xField);\n }\n if (state.yField.cacheInfo) {\n return layoutCrosshair(state.yField);\n }\n return undefined;\n};\n\nexport const isGlobalTooltipPositionPattern = (obj: any): obj is IGlobalTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IGlobalTooltipPositionPattern).left) ||\n isValid((obj as IGlobalTooltipPositionPattern).right) ||\n isValid((obj as IGlobalTooltipPositionPattern).top) ||\n isValid((obj as IGlobalTooltipPositionPattern).bottom))\n );\n};\n\nexport const isFixedTooltipPositionPattern = (obj: any): obj is IFixedTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IFixedTooltipPositionPattern).x) || isValid((obj as IFixedTooltipPositionPattern).y))\n );\n};\n"]}
|
|
@@ -15,7 +15,6 @@ export type ISankeyLabelSpec = ILabelSpec & {
|
|
|
15
15
|
limit?: number;
|
|
16
16
|
};
|
|
17
17
|
export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {
|
|
18
|
-
nameKey: any;
|
|
19
18
|
type: 'sankey';
|
|
20
19
|
categoryField: string;
|
|
21
20
|
valueField: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n
|
|
1
|
+
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n type: 'sankey';\n\n /**\n * 数据字段配置\n */\n /** 节点名称字段配置 */\n categoryField: string;\n /** 节点之间关系的权重字段 */\n valueField: string;\n /** 来源节点数据字段\n * 层级数据不提供\n */\n sourceField?: string;\n /** 目标节点数据字段\n * 层级数据不提供\n */\n targetField?: string;\n\n /**\n * 图表布局方向\n */\n direction?: DirectionType;\n /**\n * 节点的对齐类型,所有深度相同的节点,采用什么对齐方式,决定了节点在第几层:\n * - 横向布局的桑基图,用于计算节点x坐标\n * - 纵向布局的桑基图,用于计算节点y坐标\n */\n nodeAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';\n /**\n * 横向布局的桑基图,设置节点Y坐标的对齐方式:\n * 'start' - '顶部对齐'\n * 'end' - '底部对齐'\n * 'middle' - '居中对齐'\n *\n * 纵向布局的桑基图,设置节点X坐标的对齐方式:\n * 'start' - '左对齐'\n * 'end' - '右对齐'\n * 'middle' - '居中对齐'\n * 'parent' - '父节点',从1.12.14版本开始支持\n *\n * @since 1.12.4\n */\n crossNodeAlign?: 'start' | 'end' | 'middle' | 'parent';\n /**\n * 是否反向\n * @since 1.12.2\n */\n inverse?: boolean;\n /**\n * 同一层中两个节点之间的间隙大小\n */\n nodeGap?: number;\n /**\n * 每个节点的宽度,支持三种取值\n * 1. 百分比字符串,例如:{ nodeWidth: '12%' }\n * 2. 以'px'为单位的简单数字,eg: { nodeWidth: 20 }\n * 3. function,通过自定义计算指定nodeWidth\n */\n nodeWidth?: string | number | ((node: SankeyNodeElement) => number);\n /**\n * link宽度,单位px\n */\n linkWidth?: number | ((link: SankeyLinkElement) => number);\n /**\n * link + node 的最小宽度\n */\n minStepWidth?: number;\n /**\n * 数据不为零或空时节点的最小大小\n * - 这个配置可以用来避免数据太小时看不到太细的节点\n * - 建议小于5px\n */\n minNodeHeight?: number;\n /**\n * 数据不为零或空时边的最小大小\n * - 这个配置可以用来避免数据太小的时候看不到太细的链接\n * - 建议小于5px\n * - 当同时指定 `minNodeHeight` 和 `minLinkHeight` 两个选项时,此选项应小于 `minNodeHeight`\n */\n minLinkHeight?: number;\n /**\n * 数据不为零或空时节点的最大大小\n * @since 1.12.14\n */\n maxNodeHeight?: number;\n /**\n * 数据不为零或空时边的最大大小\n * - 当同时指定 `maxNodeHeight` 和 `maxLinkHeight` 两个选项时,此选项应小于 `maxNodeHeight`\n * @since 1.12.14\n */\n maxLinkHeight?: number;\n /** 布局的迭代次数 */\n iterations?: number;\n /** 解析node的key,defaultValue */\n nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);\n /** 按此funtion排序link */\n linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;\n /** 按此funtion排序node */\n nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;\n /** 自定义指定节点层 */\n setNodeLayer?: (datum: SankeyNodeDatum) => number;\n /**\n * 是否丢弃孤立的节点\n * @since 1.11.0\n */\n dropIsolatedNode?: boolean;\n /**\n * set the height of node\n * @since 1.11.0\n */\n nodeHeight?: number | ((node: SankeyNodeElement) => number);\n /**\n * set the height of link\n * @since 1.11.0\n */\n linkHeight?: number | ((link: SankeyLinkElement, sourceNode: SankeyNodeElement, sourceNodeHeight: number) => number);\n /**\n * each node has same height\n * @since 1.11.0\n */\n equalNodeHeight?: boolean;\n /**\n * the layout type of link\n * @since 1.11.0\n */\n linkOverlap?: 'start' | 'center' | 'end';\n\n /** 节点配置 */\n [SeriesMarkNameEnum.node]?: IMarkSpec<IRectMarkSpec>;\n\n /** 边配置 */\n [SeriesMarkNameEnum.link]?: IMarkSpec<ILinkPathMarkSpec>;\n\n /** 联动交互配置 */\n emphasis?: {\n /** 是否开启交互 */\n enable: boolean;\n /**\n * 交互触发类型\n * 默认为‘click'\n */\n trigger?: 'click' | 'hover';\n /**桑基图提供3种在节点上的交互联动效果\n * self: 仅高亮当前节点。\n * adjacency: 高亮当前节点上下游节点和关联的边,淡化其它图形元素。\n * related: 高亮与当前节点相关的整条路径上的节点和边,淡化其它图形元素。 */\n effect: 'self' | 'adjacency' | 'related';\n };\n\n /** 标签配置 */\n [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];\n\n /**\n * 当制定了节点、边的宽度的时候,可以配置这个属性\n * 当宽度大于图表region的宽度、高度大于图表resion高度的时候是否自动产生滚动条\n * @since 1.13.0\n */\n overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n\n /** 进度条配置 */\n // scroll?: IScrollSpec & {\n // /** 是否开启进度条 */\n // enable: boolean;\n // };\n}\n\nexport interface SankeyLinkDatum {\n source: string | number;\n target: string | number;\n value?: number;\n}\n\nexport interface SankeyNodeDatum {\n value?: number;\n}\n\nexport interface HierarchyNodeDatum {\n value?: number;\n children?: HierarchyNodeDatum[];\n}\n\nexport type SankeyData =\n | {\n nodes?: SankeyNodeDatum[];\n links: SankeyLinkDatum[];\n }\n | {\n nodes: HierarchyNodeDatum[];\n };\n\n/**\n * The node element after sankey layout\n */\nexport interface SankeyNodeElement {\n key: string | number;\n index: number;\n /** the depth of node, from source to target */\n depth: number;\n\n /** the depth of node, from target to source */\n endDepth?: number;\n /** the final layer index after layout */\n layer?: number;\n isLastLayer?: boolean;\n value: number;\n datum: SankeyNodeDatum;\n sourceLinks: SankeyLinkElement[];\n targetLinks: SankeyLinkElement[];\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n}\n/**\n * the link element after sankey layout\n */\nexport interface SankeyLinkElement {\n vertical?: boolean;\n index: number;\n source: string | number;\n target: string | number;\n value: number;\n datum: SankeyLinkDatum | SankeyLinkDatum[];\n thickness?: number;\n sourceRect?: { x0: number; x1: number; y0: number; y1: number };\n targetRect?: { x0: number; x1: number; y0: number; y1: number };\n /** this will only be generate in hierarchy node data*/\n parents?: (string | number)[];\n y0?: number;\n y1?: number;\n x0?: number;\n x1?: number;\n}\n\nexport type SankeyLayoutResult = {\n nodes: SankeyNodeElement[];\n links: SankeyLinkElement[];\n columns: SankeyNodeElement[][];\n}[];\n\nexport interface ISankeySeriesTheme {\n [SeriesMarkNameEnum.node]?: IMarkTheme<IRectMarkSpec>;\n [SeriesMarkNameEnum.link]?: IMarkTheme<ILinkPathMarkSpec>;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ export interface ITooltipPositionFixedValue {
|
|
|
6
6
|
offset?: number;
|
|
7
7
|
}
|
|
8
8
|
export type TooltipPositionPatternItem = TooltipPositionValue | ITooltipPositionFixedValue;
|
|
9
|
-
export type TooltipFixedPosition = 'top' | 'bottom' | 'left' | 'right' | 'tl' | 'lt' | 'tr' | 'rt' | 'bl' | 'lb' | 'br' | 'rb' | 'center' | 'centerTop' | 'centerBottom' | 'centerLeft' | 'centerRight' | 'inside';
|
|
9
|
+
export type TooltipFixedPosition = 'top' | 'bottom' | 'left' | 'right' | 'tl' | 'lt' | 'tr' | 'rt' | 'bl' | 'lb' | 'br' | 'rb' | 'center' | 'centerTop' | 'centerBottom' | 'centerLeft' | 'centerRight' | 'inside' | 'insideTop' | 'insideBottom' | 'insideLeft' | 'insideRight' | 'insideTopLeft' | 'insideTopRight' | 'insideBottomLeft' | 'insideBottomRight';
|
|
10
10
|
export type TooltipPositionMode = 'pointer' | 'mark' | 'crosshair';
|
|
11
11
|
export interface IGlobalTooltipPositionPattern {
|
|
12
12
|
left?: TooltipPositionValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/typings/tooltip/position.ts"],"names":[],"mappings":"","file":"position.js","sourcesContent":["export type TooltipPositionCallback<T> = (event: MouseEvent) => T;\n\nexport type TooltipPositionValue = number | TooltipPositionCallback<number>;\n\nexport interface ITooltipPositionFixedValue {\n /** 固定方位 */\n orient: TooltipFixedPosition;\n /** 固定模式 */\n mode: TooltipPositionMode;\n /** 偏移量(像素值) */\n offset?: number;\n}\n\nexport type TooltipPositionPatternItem = TooltipPositionValue | ITooltipPositionFixedValue;\n\n/** tooltip显示在鼠标所在图形的固定位置,只对 mark tooltip 有效 */\nexport type TooltipFixedPosition =\n /** tooltip 显示在上侧 */\n | 'top'\n /** tooltip 显示在下侧 */\n | 'bottom'\n /** tooltip 显示在左侧 */\n | 'left'\n /** tooltip 显示在右侧 */\n | 'right'\n /**\n * tooltip 显示在左上角\n * @since 1.4.0\n */\n | 'tl'\n /**\n * tooltip 显示在左上角(容错)\n * @since 1.4.0\n */\n | 'lt'\n /**\n * tooltip 显示在右上角\n * @since 1.4.0\n */\n | 'tr'\n /**\n * tooltip 显示在右上角(容错)\n * @since 1.4.0\n */\n | 'rt'\n /**\n * tooltip 显示在左下角\n * @since 1.4.0\n */\n | 'bl'\n /**\n * tooltip 显示在左下角(容错)\n * @since 1.4.0\n */\n | 'lb'\n /**\n * tooltip 显示在右下角\n * @since 1.4.0\n */\n | 'br'\n /**\n * tooltip 显示在右下角(容错)\n * @since 1.4.0\n */\n | 'rb'\n /**\n * tooltip 显示在鼠标所在图形中心位置\n * @since 1.10.0\n */\n | 'center'\n /**\n * tooltip 显示在鼠标所在图形中心位置的上侧\n * @since 1.10.0\n */\n | 'centerTop'\n /**\n * tooltip 显示在鼠标所在图形中心位置的下侧\n * @since 1.10.0\n */\n | 'centerBottom'\n /**\n * tooltip 显示在鼠标所在图形中心位置的左侧\n * @since 1.10.0\n */\n | 'centerLeft'\n /**\n * tooltip 显示在鼠标所在图形中心位置的右侧\n * @since 1.10.0\n */\n | 'centerRight'\n /** tooltip 显示在鼠标所在图形中心位置(旧版兼容,建议用 `'center'`) */\n | 'inside';\n\nexport type TooltipPositionMode =\n /** tooltip 固定在鼠标指针附近 */\n | 'pointer'\n /** tooltip 固定在图元附近 */\n | 'mark'\n /** tooltip 固定在 crosshair 附近 */\n | 'crosshair';\n\n/** 相对于全局布局的 tooltip position,只支持像素值或者像素值的回调 */\nexport interface IGlobalTooltipPositionPattern {\n left?: TooltipPositionValue;\n right?: TooltipPositionValue;\n top?: TooltipPositionValue;\n bottom?: TooltipPositionValue;\n}\n\n/** 相对于某个图表元素的 tooltip position,支持像素值或者固定方位(x、y 可分别配置) */\nexport interface IFixedTooltipPositionPattern {\n x: TooltipPositionPatternItem;\n y: TooltipPositionPatternItem;\n}\n\nexport type TooltipPosition = IGlobalTooltipPositionPattern | IFixedTooltipPositionPattern | TooltipFixedPosition;\n\nexport interface ITooltipPositionActual {\n x: number;\n y: number;\n}\n\nexport type TooltipPositionKeys = 'top' | 'left' | 'right' | 'bottom';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/typings/tooltip/position.ts"],"names":[],"mappings":"","file":"position.js","sourcesContent":["export type TooltipPositionCallback<T> = (event: MouseEvent) => T;\n\nexport type TooltipPositionValue = number | TooltipPositionCallback<number>;\n\nexport interface ITooltipPositionFixedValue {\n /** 固定方位 */\n orient: TooltipFixedPosition;\n /** 固定模式 */\n mode: TooltipPositionMode;\n /** 偏移量(像素值) */\n offset?: number;\n}\n\nexport type TooltipPositionPatternItem = TooltipPositionValue | ITooltipPositionFixedValue;\n\n/** tooltip显示在鼠标所在图形的固定位置,只对 mark tooltip 有效 */\nexport type TooltipFixedPosition =\n /** tooltip 显示在上侧 */\n | 'top'\n /** tooltip 显示在下侧 */\n | 'bottom'\n /** tooltip 显示在左侧 */\n | 'left'\n /** tooltip 显示在右侧 */\n | 'right'\n /**\n * tooltip 显示在左上角\n * @since 1.4.0\n */\n | 'tl'\n /**\n * tooltip 显示在左上角(容错)\n * @since 1.4.0\n */\n | 'lt'\n /**\n * tooltip 显示在右上角\n * @since 1.4.0\n */\n | 'tr'\n /**\n * tooltip 显示在右上角(容错)\n * @since 1.4.0\n */\n | 'rt'\n /**\n * tooltip 显示在左下角\n * @since 1.4.0\n */\n | 'bl'\n /**\n * tooltip 显示在左下角(容错)\n * @since 1.4.0\n */\n | 'lb'\n /**\n * tooltip 显示在右下角\n * @since 1.4.0\n */\n | 'br'\n /**\n * tooltip 显示在右下角(容错)\n * @since 1.4.0\n */\n | 'rb'\n /**\n * tooltip 显示在鼠标所在图形中心位置\n * @since 1.10.0\n */\n | 'center'\n /**\n * tooltip 显示在鼠标所在图形中心位置的上侧\n * @since 1.10.0\n */\n | 'centerTop'\n /**\n * tooltip 显示在鼠标所在图形中心位置的下侧\n * @since 1.10.0\n */\n | 'centerBottom'\n /**\n * tooltip 显示在鼠标所在图形中心位置的左侧\n * @since 1.10.0\n */\n | 'centerLeft'\n /**\n * tooltip 显示在鼠标所在图形中心位置的右侧\n * @since 1.10.0\n */\n | 'centerRight'\n /** tooltip 显示在鼠标所在图形中心位置(旧版兼容,建议用 `'center'`) */\n | 'inside'\n /**\n * tooltip 显示在鼠标所在图形的内侧顶部\n * @since 1.13.10\n */\n | 'insideTop'\n /**\n * tooltip 显示在鼠标所在图形的内侧底部\n * @since 1.13.10\n */\n | 'insideBottom'\n /**\n * tooltip 显示在鼠标所在图形的内侧左侧\n * @since 1.13.10\n */\n | 'insideLeft'\n /**\n * tooltip 显示在鼠标所在图形的内侧右侧\n * @since 1.13.10\n */\n | 'insideRight'\n /**\n * tooltip 显示在鼠标所在图形的内侧左上角\n * @since 1.13.10\n */\n | 'insideTopLeft'\n /**\n * tooltip 显示在鼠标所在图形的内侧右上角\n * @since 1.13.10\n */\n | 'insideTopRight'\n /**\n * tooltip 显示在鼠标所在图形的内侧左下角\n * @since 1.13.10\n */\n | 'insideBottomLeft'\n /**\n * tooltip 显示在鼠标所在图形的内侧右下角\n * @since 1.13.10\n */\n | 'insideBottomRight';\n\nexport type TooltipPositionMode =\n /** tooltip 固定在鼠标指针附近 */\n | 'pointer'\n /** tooltip 固定在图元附近 */\n | 'mark'\n /** tooltip 固定在 crosshair 附近 */\n | 'crosshair';\n\n/** 相对于全局布局的 tooltip position,只支持像素值或者像素值的回调 */\nexport interface IGlobalTooltipPositionPattern {\n left?: TooltipPositionValue;\n right?: TooltipPositionValue;\n top?: TooltipPositionValue;\n bottom?: TooltipPositionValue;\n}\n\n/** 相对于某个图表元素的 tooltip position,支持像素值或者固定方位(x、y 可分别配置) */\nexport interface IFixedTooltipPositionPattern {\n x: TooltipPositionPatternItem;\n y: TooltipPositionPatternItem;\n}\n\nexport type TooltipPosition = IGlobalTooltipPositionPattern | IFixedTooltipPositionPattern | TooltipFixedPosition;\n\nexport interface ITooltipPositionActual {\n x: number;\n y: number;\n}\n\nexport type TooltipPositionKeys = 'top' | 'left' | 'right' | 'bottom';\n"]}
|
package/esm/constant/funnel.js
CHANGED
package/esm/constant/sunburst.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export const SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = 10;
|
|
1
|
+
export const SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = 10;
|
|
2
|
+
//# sourceMappingURL=sunburst.js.map
|
package/esm/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.13.
|
|
4
|
+
export declare const version = "1.13.10-alpha.0";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export type { IRegion } from '../region/interface';
|
package/esm/core/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Factory } from "./factory";
|
|
|
4
4
|
|
|
5
5
|
export { VChart, Factory };
|
|
6
6
|
|
|
7
|
-
export const version = "1.13.
|
|
7
|
+
export const version = "1.13.10-alpha.0";
|
|
8
8
|
|
|
9
9
|
export * from "../typings/spec/common";
|
|
10
10
|
|
|
@@ -24,5 +24,4 @@ export * from "../typings/tooltip";
|
|
|
24
24
|
|
|
25
25
|
export * from "../theme/index";
|
|
26
26
|
|
|
27
|
-
export { vglobal, createGroup, createRichText, createText, createArc, createArea, createRect, createLine, createSymbol } from "@visactor/vrender-core";
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
27
|
+
export { vglobal, createGroup, createRichText, createText, createArc, createArea, createRect, createLine, createSymbol } from "@visactor/vrender-core";
|
package/esm/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAOzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAKjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACb,MAAM,wBAAwB,CAAC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.10-alpha.0\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '@visactor/vrender-core';\n"]}
|
package/esm/core/vchart.js
CHANGED
|
@@ -972,4 +972,5 @@ export const registerVChartCore = () => {
|
|
|
972
972
|
|
|
973
973
|
Factory.registerRegion("region", Region), Factory.registerLayout("base", Layout),
|
|
974
974
|
registerGroupMark(), View.useRegisters([ registerGesturePlugin ]), registerHoverInteraction(),
|
|
975
|
-
registerSelectInteraction(), registerTheme(darkTheme.name, darkTheme), Logger.getInstance(LoggerLevel.Error);
|
|
975
|
+
registerSelectInteraction(), registerTheme(darkTheme.name, darkTheme), Logger.getInstance(LoggerLevel.Error);
|
|
976
|
+
//# sourceMappingURL=vchart.js.map
|
|
@@ -96,6 +96,10 @@ export class BaseTooltipHandler extends BasePlugin {
|
|
|
96
96
|
calcPos[posKey] = dim1 - boxSize * tooltipSizeScale - dimOffset;
|
|
97
97
|
break;
|
|
98
98
|
|
|
99
|
+
case -1.5:
|
|
100
|
+
calcPos[posKey] = dim1 + dimOffset;
|
|
101
|
+
break;
|
|
102
|
+
|
|
99
103
|
case 0:
|
|
100
104
|
calcPos[posKey] = (dim1 + dim2) / 2 - boxSize * tooltipSizeScale / 2;
|
|
101
105
|
break;
|
|
@@ -108,6 +112,10 @@ export class BaseTooltipHandler extends BasePlugin {
|
|
|
108
112
|
calcPos[posKey] = (dim1 + dim2) / 2 + dimOffset;
|
|
109
113
|
break;
|
|
110
114
|
|
|
115
|
+
case 1.5:
|
|
116
|
+
calcPos[posKey] = dim2 - boxSize * tooltipSizeScale - dimOffset;
|
|
117
|
+
break;
|
|
118
|
+
|
|
111
119
|
case 2:
|
|
112
120
|
calcPos[posKey] = dim2 + dimOffset;
|
|
113
121
|
}
|