@visactor/vrender-components 1.0.28-alpha.0 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/circle.d.ts +20 -0
- package/cjs/axis/config.d.ts +20 -0
- package/cjs/axis/config.js +20 -0
- package/cjs/axis/config.js.map +1 -1
- package/cjs/axis/constant.d.ts +1 -0
- package/cjs/axis/constant.js +5 -4
- package/cjs/axis/constant.js.map +1 -1
- package/cjs/axis/line.d.ts +27 -2
- package/cjs/axis/line.js +76 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/type.d.ts +12 -0
- package/cjs/axis/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +175 -5
- package/es/axis/circle.d.ts +20 -0
- package/es/axis/config.d.ts +20 -0
- package/es/axis/config.js +20 -0
- package/es/axis/config.js.map +1 -1
- package/es/axis/constant.d.ts +1 -0
- package/es/axis/constant.js +5 -4
- package/es/axis/constant.js.map +1 -1
- package/es/axis/line.d.ts +27 -2
- package/es/axis/line.js +76 -1
- package/es/axis/line.js.map +1 -1
- package/es/axis/type.d.ts +12 -0
- package/es/axis/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +4 -4
package/cjs/axis/type.js.map
CHANGED
|
@@ -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 * 轴刻度线配置\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 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// 坐标轴标题配置\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"]}
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "1.0.
|
|
20
|
+
}), exports.version = void 0, exports.version = "1.0.29", __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,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,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.29\";\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/dist/index.es.js
CHANGED
|
@@ -592,7 +592,7 @@ class SyncHook extends Hook {
|
|
|
592
592
|
|
|
593
593
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
594
594
|
const VGlobal = Symbol.for("VGlobal");
|
|
595
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui
|
|
595
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
596
596
|
|
|
597
597
|
const container = new Container();
|
|
598
598
|
|
|
@@ -2369,7 +2369,7 @@ const DefaultTextStyle = {
|
|
|
2369
2369
|
textAlign: "left",
|
|
2370
2370
|
textBaseline: "alphabetic",
|
|
2371
2371
|
fontSize: 16,
|
|
2372
|
-
fontFamily: "PingFang SC,Microsoft Yahei,system-ui
|
|
2372
|
+
fontFamily: "PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
|
|
2373
2373
|
fontWeight: "",
|
|
2374
2374
|
ellipsis: "…",
|
|
2375
2375
|
fontVariant: "",
|
|
@@ -17393,6 +17393,7 @@ var AXIS_ELEMENT_NAME;
|
|
|
17393
17393
|
AXIS_ELEMENT_NAME["subTick"] = "axis-sub-tick";
|
|
17394
17394
|
AXIS_ELEMENT_NAME["label"] = "axis-label";
|
|
17395
17395
|
AXIS_ELEMENT_NAME["title"] = "axis-title";
|
|
17396
|
+
AXIS_ELEMENT_NAME["labelHoverOnAxis"] = "axis-label-hover-on-axis";
|
|
17396
17397
|
AXIS_ELEMENT_NAME["gridContainer"] = "axis-grid-container";
|
|
17397
17398
|
AXIS_ELEMENT_NAME["grid"] = "axis-grid";
|
|
17398
17399
|
AXIS_ELEMENT_NAME["gridRegion"] = "axis-grid-region";
|
|
@@ -17440,6 +17441,26 @@ const DEFAULT_AXIS_THEME = {
|
|
|
17440
17441
|
fillOpacity: 1
|
|
17441
17442
|
}
|
|
17442
17443
|
},
|
|
17444
|
+
labelHoverOnAxis: {
|
|
17445
|
+
visible: false,
|
|
17446
|
+
space: 7,
|
|
17447
|
+
padding: 2,
|
|
17448
|
+
position: 0,
|
|
17449
|
+
autoRotate: false,
|
|
17450
|
+
textStyle: {
|
|
17451
|
+
fontSize: 12,
|
|
17452
|
+
fill: 'red',
|
|
17453
|
+
fontWeight: 'normal',
|
|
17454
|
+
fillOpacity: 1
|
|
17455
|
+
},
|
|
17456
|
+
background: {
|
|
17457
|
+
visible: true,
|
|
17458
|
+
style: {
|
|
17459
|
+
cornerRadius: 2,
|
|
17460
|
+
fill: 'black'
|
|
17461
|
+
}
|
|
17462
|
+
}
|
|
17463
|
+
},
|
|
17443
17464
|
tick: {
|
|
17444
17465
|
visible: true,
|
|
17445
17466
|
inside: false,
|
|
@@ -20275,7 +20296,25 @@ function loadCircleAxisGridComponent() {
|
|
|
20275
20296
|
loadLineAxisComponent();
|
|
20276
20297
|
class LineAxis extends AxisBase {
|
|
20277
20298
|
constructor(attributes, options) {
|
|
20299
|
+
var _a;
|
|
20300
|
+
if (attributes.labelHoverOnAxis) {
|
|
20301
|
+
attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle);
|
|
20302
|
+
if (attributes.labelHoverOnAxis.space === undefined) {
|
|
20303
|
+
const { padding = 2 } = attributes.labelHoverOnAxis;
|
|
20304
|
+
const parsedPadding = normalizePadding(padding);
|
|
20305
|
+
const toDiffPadding = attributes.orient === 'bottom'
|
|
20306
|
+
? parsedPadding[0]
|
|
20307
|
+
: attributes.orient === 'left'
|
|
20308
|
+
? parsedPadding[1]
|
|
20309
|
+
: attributes.orient === 'top'
|
|
20310
|
+
? parsedPadding[2]
|
|
20311
|
+
: parsedPadding[3];
|
|
20312
|
+
const space = ((_a = attributes.label.space) !== null && _a !== void 0 ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
20313
|
+
attributes.labelHoverOnAxis.space = space;
|
|
20314
|
+
}
|
|
20315
|
+
}
|
|
20278
20316
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options);
|
|
20317
|
+
this.labelHoverOnAxisGroup = null;
|
|
20279
20318
|
}
|
|
20280
20319
|
_renderInner(container) {
|
|
20281
20320
|
var _a;
|
|
@@ -20327,6 +20366,18 @@ class LineAxis extends AxisBase {
|
|
|
20327
20366
|
bgRect.states = merge({}, DEFAULT_STATES$1, (_a = panel.state) !== null && _a !== void 0 ? _a : {});
|
|
20328
20367
|
axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
20329
20368
|
}
|
|
20369
|
+
const { labelHoverOnAxis } = this.attribute;
|
|
20370
|
+
if (labelHoverOnAxis && labelHoverOnAxis.visible) {
|
|
20371
|
+
this.renderLabelHoverOnAxis();
|
|
20372
|
+
}
|
|
20373
|
+
}
|
|
20374
|
+
renderLabelHoverOnAxis() {
|
|
20375
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute();
|
|
20376
|
+
const hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
20377
|
+
hoverOnLabel.name = AXIS_ELEMENT_NAME.title;
|
|
20378
|
+
hoverOnLabel.id = this._getNodeId('hover-on-label');
|
|
20379
|
+
this.labelHoverOnAxisGroup = hoverOnLabel;
|
|
20380
|
+
this.axisContainer.add(hoverOnLabel);
|
|
20330
20381
|
}
|
|
20331
20382
|
renderLine(container) {
|
|
20332
20383
|
const { start, end, line } = this.attribute;
|
|
@@ -20521,6 +20572,60 @@ class LineAxis extends AxisBase {
|
|
|
20521
20572
|
}
|
|
20522
20573
|
return attrs;
|
|
20523
20574
|
}
|
|
20575
|
+
getLabelHoverOnAxisAttribute() {
|
|
20576
|
+
var _a, _b;
|
|
20577
|
+
const { orient } = this.attribute;
|
|
20578
|
+
const _c = this.attribute.labelHoverOnAxis, { position = 0, space = 4, autoRotate = true, textStyle = {}, background = {}, formatMethod, text: textContent = '', maxWidth } = _c, restAttrs = __rest(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]);
|
|
20579
|
+
const point = this.getTickCoord(0);
|
|
20580
|
+
if (orient === 'bottom' || orient === 'top') {
|
|
20581
|
+
point.x = position;
|
|
20582
|
+
}
|
|
20583
|
+
else {
|
|
20584
|
+
point.y = position;
|
|
20585
|
+
}
|
|
20586
|
+
let tickLength = 0;
|
|
20587
|
+
if (((_a = this.attribute.tick) === null || _a === void 0 ? void 0 : _a.visible) && this.attribute.tick.inside === false) {
|
|
20588
|
+
tickLength = this.attribute.tick.length || 4;
|
|
20589
|
+
}
|
|
20590
|
+
if (((_b = this.attribute.subTick) === null || _b === void 0 ? void 0 : _b.visible) && this.attribute.subTick.inside === false) {
|
|
20591
|
+
tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);
|
|
20592
|
+
}
|
|
20593
|
+
const labelLength = 0;
|
|
20594
|
+
const offset = tickLength + labelLength + space;
|
|
20595
|
+
const labelPoint = this.getVerticalCoord(point, offset, false);
|
|
20596
|
+
const vector = this.getVerticalVector(offset, false, { x: 0, y: 0 });
|
|
20597
|
+
let { angle } = restAttrs;
|
|
20598
|
+
let textAlign = 'center';
|
|
20599
|
+
let textBaseline;
|
|
20600
|
+
if (isNil(angle) && autoRotate) {
|
|
20601
|
+
const axisVector = this.getRelativeVector();
|
|
20602
|
+
const v1 = [1, 0];
|
|
20603
|
+
const radian = angleTo(axisVector, v1, true);
|
|
20604
|
+
angle = radian;
|
|
20605
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
20606
|
+
const factor = -1 * verticalFactor;
|
|
20607
|
+
if (factor === 1) {
|
|
20608
|
+
textBaseline = 'bottom';
|
|
20609
|
+
}
|
|
20610
|
+
else {
|
|
20611
|
+
textBaseline = 'top';
|
|
20612
|
+
}
|
|
20613
|
+
}
|
|
20614
|
+
else {
|
|
20615
|
+
const { textAlign: textAlign2, textBaseline: textBaseline2 } = this.getLabelAlign(vector, false, textStyle.angle);
|
|
20616
|
+
textAlign = textAlign2;
|
|
20617
|
+
textBaseline = textBaseline2;
|
|
20618
|
+
}
|
|
20619
|
+
const maxTagWidth = maxWidth;
|
|
20620
|
+
const text = formatMethod ? formatMethod(textContent) : textContent;
|
|
20621
|
+
const attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), { maxWidth: maxTagWidth, textStyle: Object.assign({ textAlign,
|
|
20622
|
+
textBaseline }, textStyle), text });
|
|
20623
|
+
attrs.angle = angle;
|
|
20624
|
+
if (background && background.visible) {
|
|
20625
|
+
attrs.panel = Object.assign(Object.assign({ visible: true }, restAttrs.panel), background.style);
|
|
20626
|
+
}
|
|
20627
|
+
return attrs;
|
|
20628
|
+
}
|
|
20524
20629
|
getTextBaseline(vector, inside) {
|
|
20525
20630
|
let base = 'middle';
|
|
20526
20631
|
const { verticalFactor = 1 } = this.attribute;
|
|
@@ -20753,8 +20858,8 @@ class LineAxis extends AxisBase {
|
|
|
20753
20858
|
let limitLength = limitSize;
|
|
20754
20859
|
let titleHeight = 0;
|
|
20755
20860
|
let titleSpacing = 0;
|
|
20756
|
-
const axisLineWidth = line && line.visible ? (
|
|
20757
|
-
const tickLength = tick && tick.visible ? (
|
|
20861
|
+
const axisLineWidth = line && line.visible ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
20862
|
+
const tickLength = tick && tick.visible ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
20758
20863
|
if (title && title.visible && typeof title.text === 'string') {
|
|
20759
20864
|
titleHeight = measureTextSize(title.text, title.textStyle, (_e = (_d = this.stage) === null || _d === void 0 ? void 0 : _d.getTheme()) === null || _e === void 0 ? void 0 : _e.text).height;
|
|
20760
20865
|
const padding = normalizePadding(title.padding);
|
|
@@ -20765,6 +20870,71 @@ class LineAxis extends AxisBase {
|
|
|
20765
20870
|
}
|
|
20766
20871
|
return limitLength;
|
|
20767
20872
|
}
|
|
20873
|
+
showLabelHoverOnAxis(position, text, adjustPosition = true) {
|
|
20874
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
20875
|
+
const preContainerBounds = this.axisContainer.AABBBounds;
|
|
20876
|
+
const preWidth = preContainerBounds.width();
|
|
20877
|
+
const preHeight = preContainerBounds.height();
|
|
20878
|
+
const preX1 = preContainerBounds.x1;
|
|
20879
|
+
const preY1 = preContainerBounds.y1;
|
|
20880
|
+
const preX2 = preContainerBounds.x2;
|
|
20881
|
+
const preY2 = preContainerBounds.y2;
|
|
20882
|
+
if (this.labelHoverOnAxisGroup) {
|
|
20883
|
+
const { formatMethod } = this.attribute.labelHoverOnAxis;
|
|
20884
|
+
const textStr = formatMethod ? formatMethod(text) : text;
|
|
20885
|
+
this.labelHoverOnAxisGroup.setAttribute('text', textStr);
|
|
20886
|
+
this.labelHoverOnAxisGroup.setAttribute('visible', true);
|
|
20887
|
+
this.labelHoverOnAxisGroup.setAttribute('visibleAll', true);
|
|
20888
|
+
if (this.attribute.orient === 'left' || this.attribute.orient === 'right') {
|
|
20889
|
+
this.labelHoverOnAxisGroup.setAttributes({
|
|
20890
|
+
y: position
|
|
20891
|
+
});
|
|
20892
|
+
}
|
|
20893
|
+
else {
|
|
20894
|
+
this.labelHoverOnAxisGroup.setAttributes({
|
|
20895
|
+
x: position
|
|
20896
|
+
});
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
else {
|
|
20900
|
+
this.attribute.labelHoverOnAxis.visible = true;
|
|
20901
|
+
this.attribute.labelHoverOnAxis.position = position;
|
|
20902
|
+
this.attribute.labelHoverOnAxis.text = text;
|
|
20903
|
+
this.renderLabelHoverOnAxis();
|
|
20904
|
+
}
|
|
20905
|
+
if (adjustPosition) {
|
|
20906
|
+
const afterContainerBounds = this.axisContainer.AABBBounds;
|
|
20907
|
+
const afterWidth = afterContainerBounds.width();
|
|
20908
|
+
const afterHeight = afterContainerBounds.height();
|
|
20909
|
+
const diffWidth = afterWidth - preWidth;
|
|
20910
|
+
const diffHeight = afterHeight - preHeight;
|
|
20911
|
+
if (diffWidth > 0 && (this.attribute.orient === 'top' || this.attribute.orient === 'bottom')) {
|
|
20912
|
+
if (afterContainerBounds.x1 < preX1) {
|
|
20913
|
+
this.showLabelHoverOnAxis(position + diffWidth, text, false);
|
|
20914
|
+
}
|
|
20915
|
+
else if (afterContainerBounds.x2 > preX2) {
|
|
20916
|
+
this.showLabelHoverOnAxis(position - diffWidth, text, false);
|
|
20917
|
+
}
|
|
20918
|
+
}
|
|
20919
|
+
if (diffHeight > 0 && (this.attribute.orient === 'left' || this.attribute.orient === 'right')) {
|
|
20920
|
+
if (afterContainerBounds.y1 < preY1) {
|
|
20921
|
+
this.showLabelHoverOnAxis(position + diffHeight, text, false);
|
|
20922
|
+
}
|
|
20923
|
+
else if (afterContainerBounds.y2 > preY2) {
|
|
20924
|
+
this.showLabelHoverOnAxis(position - diffHeight, text, false);
|
|
20925
|
+
}
|
|
20926
|
+
}
|
|
20927
|
+
}
|
|
20928
|
+
}
|
|
20929
|
+
}
|
|
20930
|
+
hideLabelHoverOnAxis() {
|
|
20931
|
+
if (this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup) {
|
|
20932
|
+
this.labelHoverOnAxisGroup.setAttributes({
|
|
20933
|
+
visible: false,
|
|
20934
|
+
visibleAll: false
|
|
20935
|
+
});
|
|
20936
|
+
}
|
|
20937
|
+
}
|
|
20768
20938
|
release() {
|
|
20769
20939
|
super.release();
|
|
20770
20940
|
this._breaks = null;
|
|
@@ -34601,6 +34771,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
34601
34771
|
select: true
|
|
34602
34772
|
};
|
|
34603
34773
|
|
|
34604
|
-
const version = "1.0.
|
|
34774
|
+
const version = "1.0.29";
|
|
34605
34775
|
|
|
34606
34776
|
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.d.ts
CHANGED
|
@@ -30,6 +30,26 @@ export declare class CircleAxis extends AxisBase<CircleAxisAttributes> {
|
|
|
30
30
|
fillOpacity: number;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
labelHoverOnAxis: {
|
|
34
|
+
visible: boolean;
|
|
35
|
+
space: number;
|
|
36
|
+
padding: number;
|
|
37
|
+
position: number;
|
|
38
|
+
autoRotate: boolean;
|
|
39
|
+
textStyle: {
|
|
40
|
+
fontSize: number;
|
|
41
|
+
fill: string;
|
|
42
|
+
fontWeight: string;
|
|
43
|
+
fillOpacity: number;
|
|
44
|
+
};
|
|
45
|
+
background: {
|
|
46
|
+
visible: boolean;
|
|
47
|
+
style: {
|
|
48
|
+
cornerRadius: number;
|
|
49
|
+
fill: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
33
53
|
tick: {
|
|
34
54
|
visible: boolean;
|
|
35
55
|
inside: boolean;
|
package/es/axis/config.d.ts
CHANGED
|
@@ -21,6 +21,26 @@ export declare const DEFAULT_AXIS_THEME: {
|
|
|
21
21
|
fillOpacity: number;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
+
labelHoverOnAxis: {
|
|
25
|
+
visible: boolean;
|
|
26
|
+
space: number;
|
|
27
|
+
padding: number;
|
|
28
|
+
position: number;
|
|
29
|
+
autoRotate: boolean;
|
|
30
|
+
textStyle: {
|
|
31
|
+
fontSize: number;
|
|
32
|
+
fill: string;
|
|
33
|
+
fontWeight: string;
|
|
34
|
+
fillOpacity: number;
|
|
35
|
+
};
|
|
36
|
+
background: {
|
|
37
|
+
visible: boolean;
|
|
38
|
+
style: {
|
|
39
|
+
cornerRadius: number;
|
|
40
|
+
fill: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
24
44
|
tick: {
|
|
25
45
|
visible: boolean;
|
|
26
46
|
inside: boolean;
|
package/es/axis/config.js
CHANGED
|
@@ -21,6 +21,26 @@ export const DEFAULT_AXIS_THEME = {
|
|
|
21
21
|
fillOpacity: 1
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
labelHoverOnAxis: {
|
|
25
|
+
visible: !1,
|
|
26
|
+
space: 7,
|
|
27
|
+
padding: 2,
|
|
28
|
+
position: 0,
|
|
29
|
+
autoRotate: !1,
|
|
30
|
+
textStyle: {
|
|
31
|
+
fontSize: 12,
|
|
32
|
+
fill: "red",
|
|
33
|
+
fontWeight: "normal",
|
|
34
|
+
fillOpacity: 1
|
|
35
|
+
},
|
|
36
|
+
background: {
|
|
37
|
+
visible: !0,
|
|
38
|
+
style: {
|
|
39
|
+
cornerRadius: 2,
|
|
40
|
+
fill: "black"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
24
44
|
tick: {
|
|
25
45
|
visible: !0,
|
|
26
46
|
inside: !1,
|
package/es/axis/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE;QACL,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;CACV,CAAC","file":"config.js","sourcesContent":["export const DEFAULT_AXIS_THEME = {\n title: {\n space: 4,\n padding: 0,\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n padding: 0,\n style: {\n fontSize: 12,\n fill: '#333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#000',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#000',\n strokeOpacity: 1\n }\n }\n};\n\nexport const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = {\n size: 8,\n stroke: '#000',\n lineWidth: 1,\n zIndex: 1\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/axis/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE;QACL,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;QACD,UAAU,EAAE;YACV,OAAO,EAAE,IAAI;YACb,KAAK,EAAE;gBACL,YAAY,EAAE,CAAC;gBACf,IAAI,EAAE,OAAO;aACd;SACF;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;SACjB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;CACV,CAAC","file":"config.js","sourcesContent":["export const DEFAULT_AXIS_THEME = {\n title: {\n space: 4,\n padding: 0,\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n padding: 0,\n style: {\n fontSize: 12,\n fill: '#333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n labelHoverOnAxis: {\n visible: false,\n space: 7,\n padding: 2,\n position: 0,\n autoRotate: false,\n textStyle: {\n fontSize: 12,\n fill: 'red',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n background: {\n visible: true,\n style: {\n cornerRadius: 2,\n fill: 'black'\n }\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#000',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#000',\n strokeOpacity: 1\n }\n }\n};\n\nexport const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = {\n size: 8,\n stroke: '#000',\n lineWidth: 1,\n zIndex: 1\n};\n"]}
|
package/es/axis/constant.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare enum AXIS_ELEMENT_NAME {
|
|
|
7
7
|
subTick = "axis-sub-tick",
|
|
8
8
|
label = "axis-label",
|
|
9
9
|
title = "axis-title",
|
|
10
|
+
labelHoverOnAxis = "axis-label-hover-on-axis",
|
|
10
11
|
gridContainer = "axis-grid-container",
|
|
11
12
|
grid = "axis-grid",
|
|
12
13
|
gridRegion = "axis-grid-region",
|
package/es/axis/constant.js
CHANGED
|
@@ -5,10 +5,11 @@ export var AXIS_ELEMENT_NAME;
|
|
|
5
5
|
AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container",
|
|
6
6
|
AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick",
|
|
7
7
|
AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title",
|
|
8
|
-
AXIS_ELEMENT_NAME.
|
|
9
|
-
AXIS_ELEMENT_NAME.
|
|
10
|
-
AXIS_ELEMENT_NAME.
|
|
11
|
-
AXIS_ELEMENT_NAME.
|
|
8
|
+
AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container",
|
|
9
|
+
AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region",
|
|
10
|
+
AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background",
|
|
11
|
+
AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break",
|
|
12
|
+
AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
12
13
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
13
14
|
|
|
14
15
|
export var AxisStateValue;
|
package/es/axis/constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/constant.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"sources":["../src/axis/constant.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,6CAAwB,CAAA;IACxB,qDAAgC,CAAA;IAChC,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,uCAAkB,CAAA;IAClB,8CAAyB,CAAA;IACzB,yCAAoB,CAAA;IACpB,yCAAoB,CAAA;IACpB,kEAA6C,CAAA;IAC7C,0DAAqC,CAAA;IACrC,uCAAkB,CAAA;IAClB,oDAA+B,CAAA;IAC/B,uCAAkB,CAAA;IAClB,mDAA8B,CAAA;IAC9B,kEAA6C,CAAA;IAC7C,6CAAwB,CAAA;IACxB,0DAAqC,CAAA;AACvC,CAAC,EAlBW,iBAAiB,KAAjB,iBAAiB,QAkB5B;AAED,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,sDAAoC,CAAA;IACpC,iCAAe,CAAA;IACf,gDAA8B,CAAA;AAChC,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,EAAE;IACpC,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE;IAC7B,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE;IAC1B,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,EAAE;CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC","file":"constant.js","sourcesContent":["export enum AXIS_ELEMENT_NAME {\n innerView = 'inner-view',\n axisContainer = 'axis-container',\n labelContainer = 'axis-label-container',\n tickContainer = 'axis-tick-container',\n tick = 'axis-tick',\n subTick = 'axis-sub-tick',\n label = 'axis-label',\n title = 'axis-title',\n labelHoverOnAxis = 'axis-label-hover-on-axis',\n gridContainer = 'axis-grid-container',\n grid = 'axis-grid',\n gridRegion = 'axis-grid-region',\n line = 'axis-line',\n background = 'axis-background',\n axisLabelBackground = 'axis-label-background',\n axisBreak = 'axis-break',\n axisBreakSymbol = 'axis-break-symbol'\n}\n\nexport enum AxisStateValue {\n selected = 'selected',\n selectedReverse = 'selected_reverse',\n hover = 'hover',\n hoverReverse = 'hover_reverse'\n}\n\nexport const DEFAULT_STATES = {\n [AxisStateValue.selectedReverse]: {},\n [AxisStateValue.selected]: {},\n [AxisStateValue.hover]: {},\n [AxisStateValue.hoverReverse]: {}\n};\n\nexport const TopZIndex = 999;\n"]}
|
package/es/axis/line.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TextAlignType, IGroup, IText, TextBaselineType } from '@visactor/vrender-core';
|
|
2
|
-
import type
|
|
2
|
+
import { type TagAttributes } from '../tag';
|
|
3
3
|
import type { LineAxisAttributes, AxisItem } from './type';
|
|
4
4
|
import { AxisBase } from './base';
|
|
5
5
|
import { LineAxisMixin } from './mixin/line';
|
|
@@ -30,6 +30,26 @@ export declare class LineAxis extends AxisBase<LineAxisAttributes> {
|
|
|
30
30
|
fillOpacity: number;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
labelHoverOnAxis: {
|
|
34
|
+
visible: boolean;
|
|
35
|
+
space: number;
|
|
36
|
+
padding: number;
|
|
37
|
+
position: number;
|
|
38
|
+
autoRotate: boolean;
|
|
39
|
+
textStyle: {
|
|
40
|
+
fontSize: number;
|
|
41
|
+
fill: string;
|
|
42
|
+
fontWeight: string;
|
|
43
|
+
fillOpacity: number;
|
|
44
|
+
};
|
|
45
|
+
background: {
|
|
46
|
+
visible: boolean;
|
|
47
|
+
style: {
|
|
48
|
+
cornerRadius: number;
|
|
49
|
+
fill: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
33
53
|
tick: {
|
|
34
54
|
visible: boolean;
|
|
35
55
|
inside: boolean;
|
|
@@ -61,12 +81,15 @@ export declare class LineAxis extends AxisBase<LineAxisAttributes> {
|
|
|
61
81
|
};
|
|
62
82
|
};
|
|
63
83
|
};
|
|
64
|
-
constructor(attributes: LineAxisAttributes, options?: ComponentOptions);
|
|
65
84
|
private _breaks;
|
|
85
|
+
private labelHoverOnAxisGroup;
|
|
86
|
+
constructor(attributes: LineAxisAttributes, options?: ComponentOptions);
|
|
66
87
|
protected _renderInner(container: IGroup): void;
|
|
88
|
+
protected renderLabelHoverOnAxis(): void;
|
|
67
89
|
protected renderLine(container: IGroup): void;
|
|
68
90
|
protected getTextAlign(vector: number[]): TextAlignType;
|
|
69
91
|
protected getTitleAttribute(): TagAttributes;
|
|
92
|
+
protected getLabelHoverOnAxisAttribute(): TagAttributes;
|
|
70
93
|
protected getTextBaseline(vector: number[], inside?: boolean): TextBaselineType;
|
|
71
94
|
protected getLabelAlign(vector: [number, number], inside?: boolean, angle?: number): {
|
|
72
95
|
textAlign: TextAlignType;
|
|
@@ -76,5 +99,7 @@ export declare class LineAxis extends AxisBase<LineAxisAttributes> {
|
|
|
76
99
|
protected handleLabelsOverlap(labelShapes: IText[], labelData: AxisItem[], labelContainer: IGroup, layer: number, layerCount: number): void;
|
|
77
100
|
protected afterLabelsOverlap(labelShapes: IText[], labelData: AxisItem[], labelContainer: IGroup, layer: number, layerCount: number): void;
|
|
78
101
|
private _getAxisLabelLimitLength;
|
|
102
|
+
showLabelHoverOnAxis(position: number, text: string, adjustPosition?: boolean): void;
|
|
103
|
+
hideLabelHoverOnAxis(): void;
|
|
79
104
|
release(): void;
|
|
80
105
|
}
|