@visactor/vchart 1.9.2 → 1.10.0-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.js +80 -51
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/component/axis/interface/spec.d.ts +5 -6
- package/cjs/component/axis/interface/spec.js.map +1 -1
- package/cjs/component/indicator/indicator.js.map +1 -1
- package/cjs/component/indicator/interface.d.ts +5 -5
- package/cjs/component/indicator/interface.js.map +1 -1
- package/cjs/component/label/base-label.d.ts +4 -4
- package/cjs/component/label/interface.d.ts +6 -8
- package/cjs/component/label/interface.js.map +1 -1
- package/cjs/component/label/util.d.ts +1 -1
- package/cjs/component/label/util.js +1 -8
- package/cjs/component/label/util.js.map +1 -1
- package/cjs/component/legend/discrete/interface.d.ts +2 -2
- package/cjs/component/legend/discrete/interface.js.map +1 -1
- package/cjs/component/marker/interface.d.ts +6 -6
- package/cjs/component/marker/interface.js.map +1 -1
- package/cjs/component/marker/mark-area/interface/theme.d.ts +1 -1
- package/cjs/component/marker/mark-area/interface/theme.js.map +1 -1
- package/cjs/component/marker/mark-area/mark-area.js +15 -10
- package/cjs/component/marker/mark-area/mark-area.js.map +1 -1
- package/cjs/component/marker/mark-line/interface/theme.d.ts +1 -1
- package/cjs/component/marker/mark-line/interface/theme.js.map +1 -1
- package/cjs/component/marker/mark-line/mark-line.js.map +1 -1
- package/cjs/component/marker/mark-point/interface/theme.d.ts +1 -1
- package/cjs/component/marker/mark-point/interface/theme.js.map +1 -1
- package/cjs/component/marker/mark-point/mark-point.js.map +1 -1
- package/cjs/component/title/interface/spec.d.ts +18 -7
- package/cjs/component/title/interface/spec.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/mark/label.d.ts +2 -2
- package/cjs/mark/label.js.map +1 -1
- package/cjs/mark/text.d.ts +16 -7
- package/cjs/mark/text.js +12 -6
- package/cjs/mark/text.js.map +1 -1
- package/cjs/series/circle-packing/circle-packing.js.map +1 -1
- package/cjs/series/dot/interface.d.ts +2 -2
- package/cjs/series/dot/interface.js.map +1 -1
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/cjs/series/funnel/interface.d.ts +6 -4
- package/cjs/series/funnel/interface.js.map +1 -1
- package/cjs/series/line/interface.d.ts +1 -1
- package/cjs/series/line/interface.js.map +1 -1
- package/cjs/series/map/interface.d.ts +2 -5
- package/cjs/series/map/interface.js.map +1 -1
- package/cjs/series/pie/interface.d.ts +3 -2
- package/cjs/series/pie/interface.js.map +1 -1
- package/cjs/series/range-column/interface.d.ts +5 -5
- package/cjs/series/range-column/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/series/sunburst/sunburst.js.map +1 -1
- package/cjs/series/treemap/interface.d.ts +3 -2
- package/cjs/series/treemap/interface.js.map +1 -1
- package/cjs/series/treemap/treemap.js +10 -0
- package/cjs/series/treemap/treemap.js.map +1 -1
- package/cjs/series/word-cloud/interface.d.ts +2 -6
- package/cjs/series/word-cloud/interface.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +16 -7
- package/cjs/typings/spec/common.js.map +1 -1
- package/cjs/typings/tooltip/line.js.map +1 -1
- package/cjs/typings/visual.d.ts +10 -5
- package/cjs/typings/visual.js.map +1 -1
- package/esm/component/axis/interface/spec.d.ts +5 -6
- package/esm/component/axis/interface/spec.js.map +1 -1
- package/esm/component/indicator/indicator.js.map +1 -1
- package/esm/component/indicator/interface.d.ts +5 -5
- package/esm/component/indicator/interface.js.map +1 -1
- package/esm/component/label/base-label.d.ts +4 -4
- package/esm/component/label/interface.d.ts +6 -8
- package/esm/component/label/interface.js.map +1 -1
- package/esm/component/label/util.d.ts +1 -1
- package/esm/component/label/util.js +1 -8
- package/esm/component/label/util.js.map +1 -1
- package/esm/component/legend/discrete/interface.d.ts +2 -2
- package/esm/component/legend/discrete/interface.js.map +1 -1
- package/esm/component/marker/interface.d.ts +6 -6
- package/esm/component/marker/interface.js.map +1 -1
- package/esm/component/marker/mark-area/interface/theme.d.ts +1 -1
- package/esm/component/marker/mark-area/interface/theme.js.map +1 -1
- package/esm/component/marker/mark-area/mark-area.js +15 -9
- package/esm/component/marker/mark-area/mark-area.js.map +1 -1
- package/esm/component/marker/mark-line/interface/theme.d.ts +1 -1
- package/esm/component/marker/mark-line/interface/theme.js.map +1 -1
- package/esm/component/marker/mark-line/mark-line.js.map +1 -1
- package/esm/component/marker/mark-point/interface/theme.d.ts +1 -1
- package/esm/component/marker/mark-point/interface/theme.js.map +1 -1
- package/esm/component/marker/mark-point/mark-point.js.map +1 -1
- package/esm/component/title/interface/spec.d.ts +18 -7
- package/esm/component/title/interface/spec.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/mark/label.d.ts +2 -2
- package/esm/mark/label.js.map +1 -1
- package/esm/mark/text.d.ts +16 -7
- package/esm/mark/text.js +13 -7
- package/esm/mark/text.js.map +1 -1
- package/esm/series/circle-packing/circle-packing.js.map +1 -1
- package/esm/series/dot/interface.d.ts +2 -2
- package/esm/series/dot/interface.js.map +1 -1
- package/esm/series/funnel/funnel.js.map +1 -1
- package/esm/series/funnel/interface.d.ts +6 -4
- package/esm/series/funnel/interface.js.map +1 -1
- package/esm/series/line/interface.d.ts +1 -1
- package/esm/series/line/interface.js.map +1 -1
- package/esm/series/map/interface.d.ts +2 -5
- package/esm/series/map/interface.js.map +1 -1
- package/esm/series/pie/interface.d.ts +3 -2
- package/esm/series/pie/interface.js.map +1 -1
- package/esm/series/range-column/interface.d.ts +5 -5
- package/esm/series/range-column/interface.js.map +1 -1
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/series/sunburst/sunburst.js.map +1 -1
- package/esm/series/treemap/interface.d.ts +3 -2
- package/esm/series/treemap/interface.js.map +1 -1
- package/esm/series/treemap/treemap.js +8 -0
- package/esm/series/treemap/treemap.js.map +1 -1
- package/esm/series/word-cloud/interface.d.ts +2 -6
- package/esm/series/word-cloud/interface.js.map +1 -1
- package/esm/typings/spec/common.d.ts +16 -7
- package/esm/typings/spec/common.js.map +1 -1
- package/esm/typings/tooltip/line.js.map +1 -1
- package/esm/typings/visual.d.ts +10 -5
- package/esm/typings/visual.js.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/typings/visual.ts"],"names":[],"mappings":"","file":"visual.js","sourcesContent":["import type { PopTipAttributes } from '@visactor/vrender-components';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Cursor } from './cursor';\nimport type { InterpolateType } from './interpolate';\nimport type { ScaleType } from './scale';\nimport type { ShapeType } from './shape';\nimport type { IPoint } from './coordinate';\nimport type { IAttributeOpt, IModelMarkAttributeContext } from '../compile/mark';\nimport type { Datum, StringOrNumber } from './common';\nimport type { IPadding } from '@visactor/vutils';\nimport type { IColorKey } from '../theme/color-scheme/interface';\nimport type { IRepeatType, TextAlignType, TextBaselineType, IRichTextCharacter } from '@visactor/vrender-core';\n\n// 基础的visual 对应 scale 的属性\nexport interface IVisualSpecBase<D, T> {\n /**\n * type of scale\n */\n type: ScaleType;\n /**\n * will set to scale.domain, it means input of scale\n */\n domain: D[];\n /**\n * will set to scale.range, it means output of scale\n */\n range: T[];\n /**\n * will set to scale.specified if scale support, as a key-value pair matching capability\n * @since 1.1.0\n */\n specified?: { [key: string]: unknown };\n}\n// 用来给用户进行mark.style上的映射配置。所以要配置数据维度\nexport interface IVisualSpecStyle<D, T> extends IVisualSpecBase<D, T> {\n field?: string;\n}\n\nexport type IDataDomainSpec = {\n dataId: string;\n fields: string[];\n};\n\n// 用来提供给用户进行 scale 配置 所以名字是必选的 对用户配置\nexport interface IVisualSpecScale<D, T> extends Omit<IVisualSpecBase<D, T>, 'domain'> {\n id: string;\n domain:\n | IVisualSpecBase<D, T>['domain']\n // 使用数据的字段值,如果 scale 是连续的,就取区间,如果是离散的就使用 values 。\n // 不考虑图表内的交互等数据筛选,这里只用原始数据的统计信息\n | IDataDomainSpec[];\n}\n// 对用户配置\nexport type IVisual<D = any, R = any> = IVisualSpecStyle<D, R> | IVisualScale;\n\nexport interface IVisualScale {\n /**\n * 对应 IVisualSpecScale 的用户配置 scale-id\n */\n scale: string;\n /**\n * 指定参与映射的数据字段\n */\n field?: string;\n /**\n * 当用户指定 field 后,用该属性来控制值域。\n * @default 'none'\n */\n changeDomain?: 'none' | 'replace' | 'expand';\n}\n\nexport type FunctionType<T> = (\n datum: Datum,\n context: IModelMarkAttributeContext,\n opt?: IAttributeOpt,\n source?: DataView\n) => T;\nexport type ValueType<T> = T;\nexport type VisualType<T> = ValueType<T> | FunctionType<T> | IVisual<unknown, T>;\n\nexport type TextureType =\n | 'circle'\n | 'dimond'\n | 'rect'\n | 'vertical-line'\n | 'horizontal-line'\n | 'bias-lr'\n | 'bias-rl'\n | 'grid';\n\n/**\n * style格式转换\n */\nexport type ConvertToMarkStyleSpec<T extends Record<string, any>> = {\n [key in keyof T]: VisualType<T[key]>;\n};\n\n/**\n * border\n */\n\nexport interface IBorder {\n distance: number | string;\n stroke?: string | IGradient;\n strokeOpacity?: number;\n lineWidth?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n}\n\nexport interface ICommonSpec {\n visible?: boolean;\n x?: number;\n y?: number;\n z?: number;\n /**\n * @todo 隔离主题和 spec 配置\n * IColorKey 类型只适用于主题\n */\n stroke?: string | IGradient | false | (number | boolean)[] | IColorKey;\n strokeOpacity?: number;\n opacity?: number;\n lineWidth?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n\n cursor?: Cursor;\n zIndex?: number;\n angle?: number;\n anchor?: [number, number];\n\n // 缩放属性\n scaleX?: number;\n scaleY?: number;\n /**\n * 图形缩放中心\n * @since 1.4.0\n * 可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心\n * */\n scaleCenter?: [number | string, number | string];\n\n // 3d旋转的属性\n beta?: number;\n alpha?: number;\n anchor3d?: [number, number];\n\n /**\n * 选择模式,精确模式,粗糙模式(包围盒模式),自定义模式\n */\n pickMode?: 'accurate' | 'imprecise' | 'custom';\n boundsMode?: 'accurate' | 'imprecise';\n\n /**\n * 用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽\n * @default 0\n * @since 1.7.3\n */\n pickStrokeBuffer?: number;\n\n // 以下是纹理相关的属性\n /**\n * 纹理的类型\n */\n texture?: TextureType | string;\n /**\n * 纹理的颜色\n */\n textureColor?: string;\n /**\n * 纹理单元的大小\n */\n textureSize?: number; // 纹理大小\n /**\n * 纹理之间空隙的大小\n */\n texturePadding?: number;\n\n /**\n * 外边框\n */\n outerBorder?: IBorder;\n /**\n * 内边框\n */\n innerBorder?: IBorder;\n\n [key: string]: any;\n}\n\nexport interface IFillMarkSpec extends ICommonSpec {\n /**\n * @todo 隔离主题和 spec 配置\n * IColorKey 类型只适用于主题\n */\n fill?: VisualType<string> | IGradient | false | IColorKey;\n fillOpacity?: number;\n // TODO:waite VRender support this api\n // backgroundMode: number; // 填充模式(与具体图元有关)\n // can coexist with fill\n background?: string | HTMLImageElement | HTMLCanvasElement | null;\n}\n\n// export interface IFillImageMarkSpec {\n// fillImage?: string;\n// repeatX?: RepeatXYType;\n// repeatY?: RepeatXYType;\n// imageOrigin?: ImageOriginType;\n// }\n\nexport interface ISymbolMarkSpec extends IFillMarkSpec {\n dx?: number;\n dy?: number;\n size?: number | number[];\n /** 对外声明使用shape,vrender图形属性对应的是shape */\n shape?: ShapeType | string;\n /** FIXME: vrender Symbol接收的图形属性,暂时都申明一下 */\n symbolType?: ShapeType | string;\n scaleX?: number;\n scaleY?: number;\n}\n\n// lineMark 和 areaMark 共同配置\nexport interface ILineLikeMarkSpec extends IFillMarkSpec {\n curveType?: InterpolateType;\n defined?: boolean;\n}\n\nexport interface IAreaMarkSpec extends ILineLikeMarkSpec {\n x1?: number;\n y1?: number;\n\n orient?: 'horizontal' | 'vertical';\n}\n\nexport interface ILineMarkSpec extends ILineLikeMarkSpec {\n lineCap?: LineStrokeCap;\n lineJoin?: LineStrokeJoin;\n miterLimit?: number;\n strokeBoundsBuffer?: number;\n}\n\nexport interface IRuleMarkSpec extends ILineMarkSpec {\n x1?: number;\n y1?: number;\n}\n\nexport interface ITextMarkSpec extends IFillMarkSpec {\n /**\n * 文字类型\n * 可选,'html', 'rich', 'text'\n * @default 'text'\n */\n type?: 'html' | 'rich' | 'text';\n /**\n * 文字内容\n */\n text?: StringOrNumber | string[] | IRichTextCharacter[] | Function;\n /**\n * x 方向偏移\n */\n dx?: number;\n /**\n * y 方向偏移\n */\n dy?: number;\n /**\n * 字号\n */\n fontSize?: number;\n /**\n * 文字对齐方式\n */\n textAlign?: TextAlign;\n /**\n * 文字居中方式\n */\n textBaseline?: TextBaseLine;\n /**\n * 字体\n */\n fontFamily?: string;\n /**\n * 字重\n */\n fontWeight?: FontWeight;\n /**\n * 字体样式\n */\n fontStyle?: FontStyle;\n /**\n * 文字的最大长度\n */\n maxLineWidth?: number;\n /**\n * 文字超出 maxLineWidth 后的省略符\n */\n ellipsis?: string;\n /**\n * 文本省略的位置,默认尾部省略\n * 1. 'start' 文字首部省略\n * 2. 'middle' 文本中间省略\n * 3. 'end' 文本尾部省略\n * @default 'end'\n * @since 1.7.3\n */\n suffixPosition?: 'start' | 'end' | 'middle';\n // TODO: 这些不是常规的文字mark属性,待确认需求背景\n lineBreak?: string;\n /**\n * 下划线\n */\n underline?: boolean;\n /**\n * 中划线\n */\n lineThrough?: boolean;\n /**\n * 行高(1.3.1 版本新增字符串类型表示比例值,如\"150%\")\n * @since 1.3.1\n */\n lineHeight?: number | string;\n /**\n * poptip 相关配置\n */\n poptip?: PopTipAttributes;\n /**\n * 文本的排布方向,如果需要文本纵向排布,可以配置为 'vertical'\n * @default 'horizontal'\n */\n direction?: 'horizontal' | 'vertical';\n}\n\nexport type IPositionedTextMarkSpec = Omit<ITextMarkSpec, 'align' | 'textAlign' | 'baseline' | 'textBaseline'>;\n\nexport interface IRectMarkSpec extends IFillMarkSpec {\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n width?: number;\n height?: number;\n x1?: number;\n y1?: number;\n}\n\n// 3d rect,支持length表示长宽高中的长属性(深度属性)\nexport interface IRect3dMarkSpec extends IRectMarkSpec {\n length?: number;\n}\n\nexport interface IBoxPlotMarkSpec extends ICommonSpec {\n /**\n * box描边宽度\n */\n lineWidth?: number;\n /**\n * box宽度\n */\n boxWidth?: number;\n /**\n * 最大最小值宽度\n */\n shaftWidth?: number;\n /**\n * 中轴线类型\n */\n shaftShape?: BoxPlotShaftShape;\n /**\n * 盒子填充颜色,为空则不填充\n */\n boxFill?: string;\n // /**\n // * 描边颜色\n // */\n // stroke?: string;\n /**\n * 中轴线透明度,仅当shaftType=bar时生效\n */\n shaftFillOpacity?: number;\n\n min?: (datum: Datum) => number;\n q1?: (datum: Datum) => number;\n median?: (datum: Datum) => number;\n q3?: (datum: Datum) => number;\n max?: (datum: Datum) => number;\n}\n\nexport interface IRippleMarkSpec extends ICommonSpec {\n /**\n * 波纹密度ripple\n * ripple 取值范为[0,1]\n */\n ripple?: number;\n /**\n * 水波纹最大半径\n */\n size?: number;\n}\n\nexport interface ILiquidMarkSpec extends ICommonSpec {\n /**\n * 波浪的变化状态,范围为 [0, 1]\n */\n wave?: number;\n}\n\nexport interface ILiquidOutlineSpec extends ISymbolMarkSpec {\n lineWidth: number;\n}\n\nexport interface IOutlierMarkSpec {\n //异常点填充颜色\n fill?: string;\n //异常点大小\n size?: number;\n}\n\nexport interface IPathMarkSpec extends IFillMarkSpec {\n path?: string;\n // TODO: 该属性后续可能会删除,未定\n // 平滑缩放,不然会发生跳变,在地图交互场景需要配置为true;常规path缩放不需要\n smoothScale?: boolean;\n}\n\nexport interface ILinkPathMarkSpec extends IFillMarkSpec {\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n thickness?: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface IArcMarkSpec extends IFillMarkSpec {\n startAngle?: number;\n endAngle?: number;\n padAngle?: number;\n\n outerRadius?: number;\n innerRadius?: number;\n cornerRadius?: number;\n\n /** arc的中心点偏移距离 */\n centerOffset?: number;\n\n /** arc 的 roundCap 属性,即圆角是否伸出 startAngle 和 endAngle 之外 */\n cap?: boolean | [boolean, boolean];\n /** arc 在 roundCap 打开且应用环形渐变时是否对 cap 部分生效 */\n autoCapConical?: boolean;\n}\n\n// 3d arc,有高度配置\nexport interface IArc3dMarkSpec extends IArcMarkSpec {\n height?: number;\n}\n\nexport interface IProgressArcMarkSpec extends IArcMarkSpec {\n /** 进度条内侧 padding(接受负值) */\n innerPadding?: number;\n /** 进度条外侧 padding(接受负值) */\n outerPadding?: number;\n}\n\nexport interface ICellMarkSpec extends ISymbolMarkSpec {\n padding?: number | number[] | IPadding;\n}\n\nexport interface IGroupMarkSpec extends IFillMarkSpec {\n clip?: boolean;\n width?: number;\n height?: number;\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n}\n\nexport interface IPolygonMarkSpec extends ICommonSpec, IFillMarkSpec {\n points?: IPoint[];\n /**\n * 圆角配置,支持数组配置,数组的顺序同组成 polygon 的顺序对应\n */\n cornerRadius?: number | number[];\n scaleX?: number;\n scaleY?: number;\n}\n\nexport interface IPyramid3dMarkSpec extends IPolygonMarkSpec {\n // 只能有4个顶点\n points?: IPoint[];\n}\n\n/**\n * ImageFill\n */\nexport type RepeatType = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\nexport type RepeatXYType = 'no-repeat' | 'repeat' | 'stretch';\nexport type ImageOriginType = 'top' | 'bottom';\n\n/**\n * gradient\n */\nexport type GradientPropValue<T> = ValueType<T> | FunctionType<T>;\nexport type GradientStop = {\n offset: GradientPropValue<number>;\n color?: GradientPropValue<string>;\n opacity?: number;\n};\nexport interface IGradientLinear {\n x0?: GradientPropValue<number>;\n y0?: GradientPropValue<number>;\n x1?: GradientPropValue<number>;\n y1?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'linear';\n}\n\nexport interface IGradientRadial {\n r0?: GradientPropValue<number>;\n x0?: GradientPropValue<number>;\n y0?: GradientPropValue<number>;\n x1?: GradientPropValue<number>;\n y1?: GradientPropValue<number>;\n r1?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'radial';\n}\n\nexport interface IGradientConical {\n x?: GradientPropValue<number>;\n y?: GradientPropValue<number>;\n startAngle?: GradientPropValue<number>;\n endAngle?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'conical';\n}\n\nexport type GradientType = 'linear' | 'radial' | 'conical';\nexport type IGradient = IGradientLinear | IGradientRadial | IGradientConical;\n\nexport type LineStrokeCap = 'butt' | 'round' | 'square';\nexport type LineStrokeJoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';\n\nexport type BoxPlotShaftShape = 'line' | 'bar';\n/**\n * threshold\n */\nexport interface IThresholdStyle extends IVisualSpecStyle<number, string> {\n domain: number[];\n field: string;\n range: string[];\n type: 'threshold';\n}\n\n// FIXME: For some tool methods that need to use common configuration types\nexport interface IUnknownMarkSpec extends ICommonSpec {\n [key: string]: unknown;\n}\n\nexport interface IImageMarkSpec extends IFillMarkSpec {\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n width?: number;\n height?: number;\n repeatX?: IRepeatType;\n repeatY?: IRepeatType;\n image: string | HTMLImageElement | HTMLCanvasElement;\n}\n\n/**\n * text\n */\nexport type TextAlign = TextAlignType;\nexport type TextBaseLine = TextBaselineType;\nexport type FontStyle = 'normal' | 'italic' | 'oblique' | string;\nexport type FontWeight = 'normal' | 'bold' | 'lighter' | 'bolder' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/typings/visual.ts"],"names":[],"mappings":"","file":"visual.js","sourcesContent":["import type { PopTipAttributes } from '@visactor/vrender-components';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Cursor } from './cursor';\nimport type { InterpolateType } from './interpolate';\nimport type { ScaleType } from './scale';\nimport type { ShapeType } from './shape';\nimport type { IPoint } from './coordinate';\nimport type { IAttributeOpt, IModelMarkAttributeContext } from '../compile/mark';\nimport type { Datum, StringOrNumber } from './common';\nimport type { IPadding } from '@visactor/vutils';\nimport type { IColorKey } from '../theme/color-scheme/interface';\nimport type {\n IRepeatType,\n TextAlignType,\n TextBaselineType,\n IRichTextAttribute,\n IGraphicStyle\n} from '@visactor/vrender-core';\n\n// 基础的visual 对应 scale 的属性\nexport interface IVisualSpecBase<D, T> {\n /**\n * type of scale\n */\n type: ScaleType;\n /**\n * will set to scale.domain, it means input of scale\n */\n domain: D[];\n /**\n * will set to scale.range, it means output of scale\n */\n range: T[];\n /**\n * will set to scale.specified if scale support, as a key-value pair matching capability\n * @since 1.1.0\n */\n specified?: { [key: string]: unknown };\n}\n// 用来给用户进行mark.style上的映射配置。所以要配置数据维度\nexport interface IVisualSpecStyle<D, T> extends IVisualSpecBase<D, T> {\n field?: string;\n}\n\nexport type IDataDomainSpec = {\n dataId: string;\n fields: string[];\n};\n\n// 用来提供给用户进行 scale 配置 所以名字是必选的 对用户配置\nexport interface IVisualSpecScale<D, T> extends Omit<IVisualSpecBase<D, T>, 'domain'> {\n id: string;\n domain:\n | IVisualSpecBase<D, T>['domain']\n // 使用数据的字段值,如果 scale 是连续的,就取区间,如果是离散的就使用 values 。\n // 不考虑图表内的交互等数据筛选,这里只用原始数据的统计信息\n | IDataDomainSpec[];\n}\n// 对用户配置\nexport type IVisual<D = any, R = any> = IVisualSpecStyle<D, R> | IVisualScale;\n\nexport interface IVisualScale {\n /**\n * 对应 IVisualSpecScale 的用户配置 scale-id\n */\n scale: string;\n /**\n * 指定参与映射的数据字段\n */\n field?: string;\n /**\n * 当用户指定 field 后,用该属性来控制值域。\n * @default 'none'\n */\n changeDomain?: 'none' | 'replace' | 'expand';\n}\n\nexport type FunctionType<T> = (\n datum: Datum,\n context: IModelMarkAttributeContext,\n opt?: IAttributeOpt,\n source?: DataView\n) => T;\nexport type ValueType<T> = T;\nexport type VisualType<T> = ValueType<T> | FunctionType<T> | IVisual<unknown, T>;\n\nexport type TextureType =\n | 'circle'\n | 'dimond'\n | 'rect'\n | 'vertical-line'\n | 'horizontal-line'\n | 'bias-lr'\n | 'bias-rl'\n | 'grid';\n\n/**\n * style格式转换\n */\nexport type ConvertToMarkStyleSpec<T extends Record<string, any>> = {\n [key in keyof T]: VisualType<T[key]>;\n};\n\n/**\n * border\n */\nexport interface IBorder {\n distance: number | string;\n stroke?: string | IGradient;\n strokeOpacity?: number;\n lineWidth?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n}\n\nexport interface ICommonSpec {\n visible?: boolean;\n x?: number;\n y?: number;\n z?: number;\n /**\n * @todo 隔离主题和 spec 配置\n * IColorKey 类型只适用于主题\n */\n stroke?: string | IGradient | false | (number | boolean)[] | IColorKey;\n strokeOpacity?: number;\n opacity?: number;\n lineWidth?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n\n cursor?: Cursor;\n zIndex?: number;\n angle?: number;\n anchor?: [number, number];\n\n // 缩放属性\n scaleX?: number;\n scaleY?: number;\n /**\n * 图形缩放中心\n * @since 1.4.0\n * 可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心\n * */\n scaleCenter?: [number | string, number | string];\n\n // 3d旋转的属性\n beta?: number;\n alpha?: number;\n anchor3d?: [number, number];\n\n /**\n * 选择模式,精确模式,粗糙模式(包围盒模式),自定义模式\n */\n pickMode?: 'accurate' | 'imprecise' | 'custom';\n boundsMode?: 'accurate' | 'imprecise';\n\n /**\n * 用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽\n * @default 0\n * @since 1.7.3\n */\n pickStrokeBuffer?: number;\n\n // 以下是纹理相关的属性\n /**\n * 纹理的类型\n */\n texture?: TextureType | string;\n /**\n * 纹理的颜色\n */\n textureColor?: string;\n /**\n * 纹理单元的大小\n */\n textureSize?: number; // 纹理大小\n /**\n * 纹理之间空隙的大小\n */\n texturePadding?: number;\n\n /**\n * 外边框\n */\n outerBorder?: IBorder;\n /**\n * 内边框\n */\n innerBorder?: IBorder;\n /**\n * @experimental\n * @since 1.10.0\n * html 浮层\n */\n html?: IMarkHtmlSpec;\n\n [key: string]: any;\n}\n\nexport interface IFillMarkSpec extends ICommonSpec {\n /**\n * @todo 隔离主题和 spec 配置\n * IColorKey 类型只适用于主题\n */\n fill?: VisualType<string> | IGradient | false | IColorKey;\n fillOpacity?: number;\n // TODO:waite VRender support this api\n // backgroundMode: number; // 填充模式(与具体图元有关)\n // can coexist with fill\n background?: string | HTMLImageElement | HTMLCanvasElement | null;\n}\n\nexport type IMarkHtmlSpec = Partial<IGraphicStyle['html']>;\n\nexport interface ISymbolMarkSpec extends IFillMarkSpec {\n dx?: number;\n dy?: number;\n size?: number | number[];\n /** 对外声明使用shape,vrender图形属性对应的是shape */\n shape?: ShapeType | string;\n /** FIXME: vrender Symbol接收的图形属性,暂时都申明一下 */\n symbolType?: ShapeType | string;\n scaleX?: number;\n scaleY?: number;\n}\n\n// lineMark 和 areaMark 共同配置\nexport interface ILineLikeMarkSpec extends IFillMarkSpec {\n curveType?: InterpolateType;\n defined?: boolean;\n}\n\nexport interface IAreaMarkSpec extends ILineLikeMarkSpec {\n x1?: number;\n y1?: number;\n\n orient?: 'horizontal' | 'vertical';\n}\n\nexport interface ILineMarkSpec extends ILineLikeMarkSpec {\n lineCap?: LineStrokeCap;\n lineJoin?: LineStrokeJoin;\n miterLimit?: number;\n strokeBoundsBuffer?: number;\n}\n\nexport interface IRuleMarkSpec extends ILineMarkSpec {\n x1?: number;\n y1?: number;\n}\n\nexport interface ITextMarkSpec extends IFillMarkSpec {\n /**\n * 文字内容\n */\n text?: string | number | string[] | number[];\n /**\n * x 方向偏移\n */\n dx?: number;\n /**\n * y 方向偏移\n */\n dy?: number;\n /**\n * 字号\n */\n fontSize?: number;\n /**\n * 文字对齐方式\n */\n textAlign?: TextAlign;\n /**\n * 文字居中方式\n */\n textBaseline?: TextBaseLine;\n /**\n * 字体\n */\n fontFamily?: string;\n /**\n * 字重\n */\n fontWeight?: FontWeight;\n /**\n * 字体样式\n */\n fontStyle?: FontStyle;\n /**\n * 文字的最大长度\n */\n maxLineWidth?: number;\n /**\n * 文字超出 maxLineWidth 后的省略符\n */\n ellipsis?: string;\n /**\n * 文本省略的位置,默认尾部省略\n * 1. 'start' 文字首部省略\n * 2. 'middle' 文本中间省略\n * 3. 'end' 文本尾部省略\n * @default 'end'\n * @since 1.7.3\n */\n suffixPosition?: 'start' | 'end' | 'middle';\n /**\n * 下划线\n */\n underline?: boolean;\n /**\n * 中划线\n */\n lineThrough?: boolean;\n /**\n * 行高(1.3.1 版本新增字符串类型表示比例值,如\"150%\")\n * @since 1.3.1\n */\n lineHeight?: number | string;\n /**\n * poptip 相关配置\n */\n poptip?: PopTipAttributes;\n /**\n * 文本的排布方向,如果需要文本纵向排布,可以配置为 'vertical'\n * @default 'horizontal'\n */\n direction?: 'horizontal' | 'vertical';\n}\n\nexport type IRichTextMarkSpec = IRichTextAttribute &\n IFillMarkSpec & { type: 'rich'; text: IRichTextAttribute['textConfig'] };\n\nexport type IComposedTextMarkSpec = ITextMarkSpec | IRichTextMarkSpec;\n\nexport type IPositionedTextMarkSpec = Omit<ITextMarkSpec, 'align' | 'textAlign' | 'baseline' | 'textBaseline'>;\n\nexport interface IRectMarkSpec extends IFillMarkSpec {\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n width?: number;\n height?: number;\n x1?: number;\n y1?: number;\n}\n\n// 3d rect,支持length表示长宽高中的长属性(深度属性)\nexport interface IRect3dMarkSpec extends IRectMarkSpec {\n length?: number;\n}\n\nexport interface IBoxPlotMarkSpec extends ICommonSpec {\n /**\n * box描边宽度\n */\n lineWidth?: number;\n /**\n * box宽度\n */\n boxWidth?: number;\n /**\n * 最大最小值宽度\n */\n shaftWidth?: number;\n /**\n * 中轴线类型\n */\n shaftShape?: BoxPlotShaftShape;\n /**\n * 盒子填充颜色,为空则不填充\n */\n boxFill?: string;\n // /**\n // * 描边颜色\n // */\n // stroke?: string;\n /**\n * 中轴线透明度,仅当shaftType=bar时生效\n */\n shaftFillOpacity?: number;\n\n min?: (datum: Datum) => number;\n q1?: (datum: Datum) => number;\n median?: (datum: Datum) => number;\n q3?: (datum: Datum) => number;\n max?: (datum: Datum) => number;\n}\n\nexport interface IRippleMarkSpec extends ICommonSpec {\n /**\n * 波纹密度ripple\n * ripple 取值范为[0,1]\n */\n ripple?: number;\n /**\n * 水波纹最大半径\n */\n size?: number;\n}\n\nexport interface ILiquidMarkSpec extends ICommonSpec {\n /**\n * 波浪的变化状态,范围为 [0, 1]\n */\n wave?: number;\n}\n\nexport interface ILiquidOutlineSpec extends ISymbolMarkSpec {\n lineWidth: number;\n}\n\nexport interface IOutlierMarkSpec {\n //异常点填充颜色\n fill?: string;\n //异常点大小\n size?: number;\n}\n\nexport interface IPathMarkSpec extends IFillMarkSpec {\n path?: string;\n // TODO: 该属性后续可能会删除,未定\n // 平滑缩放,不然会发生跳变,在地图交互场景需要配置为true;常规path缩放不需要\n smoothScale?: boolean;\n}\n\nexport interface ILinkPathMarkSpec extends IFillMarkSpec {\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n thickness?: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface IArcMarkSpec extends IFillMarkSpec {\n startAngle?: number;\n endAngle?: number;\n padAngle?: number;\n\n outerRadius?: number;\n innerRadius?: number;\n cornerRadius?: number;\n\n /** arc的中心点偏移距离 */\n centerOffset?: number;\n\n /** arc 的 roundCap 属性,即圆角是否伸出 startAngle 和 endAngle 之外 */\n cap?: boolean | [boolean, boolean];\n /** arc 在 roundCap 打开且应用环形渐变时是否对 cap 部分生效 */\n autoCapConical?: boolean;\n}\n\n// 3d arc,有高度配置\nexport interface IArc3dMarkSpec extends IArcMarkSpec {\n height?: number;\n}\n\nexport interface IProgressArcMarkSpec extends IArcMarkSpec {\n /** 进度条内侧 padding(接受负值) */\n innerPadding?: number;\n /** 进度条外侧 padding(接受负值) */\n outerPadding?: number;\n}\n\nexport interface ICellMarkSpec extends ISymbolMarkSpec {\n padding?: number | number[] | IPadding;\n}\n\nexport interface IGroupMarkSpec extends IFillMarkSpec {\n clip?: boolean;\n width?: number;\n height?: number;\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n}\n\nexport interface IPolygonMarkSpec extends ICommonSpec, IFillMarkSpec {\n points?: IPoint[];\n /**\n * 圆角配置,支持数组配置,数组的顺序同组成 polygon 的顺序对应\n */\n cornerRadius?: number | number[];\n scaleX?: number;\n scaleY?: number;\n}\n\nexport interface IPyramid3dMarkSpec extends IPolygonMarkSpec {\n // 只能有4个顶点\n points?: IPoint[];\n}\n\n/**\n * ImageFill\n */\nexport type RepeatType = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\nexport type RepeatXYType = 'no-repeat' | 'repeat' | 'stretch';\nexport type ImageOriginType = 'top' | 'bottom';\n\n/**\n * gradient\n */\nexport type GradientPropValue<T> = ValueType<T> | FunctionType<T>;\nexport type GradientStop = {\n offset: GradientPropValue<number>;\n color?: GradientPropValue<string>;\n opacity?: number;\n};\nexport interface IGradientLinear {\n x0?: GradientPropValue<number>;\n y0?: GradientPropValue<number>;\n x1?: GradientPropValue<number>;\n y1?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'linear';\n}\n\nexport interface IGradientRadial {\n r0?: GradientPropValue<number>;\n x0?: GradientPropValue<number>;\n y0?: GradientPropValue<number>;\n x1?: GradientPropValue<number>;\n y1?: GradientPropValue<number>;\n r1?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'radial';\n}\n\nexport interface IGradientConical {\n x?: GradientPropValue<number>;\n y?: GradientPropValue<number>;\n startAngle?: GradientPropValue<number>;\n endAngle?: GradientPropValue<number>;\n stops: GradientStop[];\n gradient: 'conical';\n}\n\nexport type GradientType = 'linear' | 'radial' | 'conical';\nexport type IGradient = IGradientLinear | IGradientRadial | IGradientConical;\n\nexport type LineStrokeCap = 'butt' | 'round' | 'square';\nexport type LineStrokeJoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';\n\nexport type BoxPlotShaftShape = 'line' | 'bar';\n/**\n * threshold\n */\nexport interface IThresholdStyle extends IVisualSpecStyle<number, string> {\n domain: number[];\n field: string;\n range: string[];\n type: 'threshold';\n}\n\n// FIXME: For some tool methods that need to use common configuration types\nexport interface IUnknownMarkSpec extends ICommonSpec {\n [key: string]: unknown;\n}\n\nexport interface IImageMarkSpec extends IFillMarkSpec {\n /**\n * 圆角配置。\n * 1. 如果传入数值,则统一为四个角设置圆角\n * 2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]\n */\n cornerRadius?: number | number[];\n width?: number;\n height?: number;\n repeatX?: IRepeatType;\n repeatY?: IRepeatType;\n image: string | HTMLImageElement | HTMLCanvasElement;\n}\n\n/**\n * text\n */\nexport type TextAlign = TextAlignType;\nexport type TextBaseLine = TextBaselineType;\nexport type FontStyle = 'normal' | 'italic' | 'oblique' | string;\nexport type FontWeight = 'normal' | 'bold' | 'lighter' | 'bolder' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vchart",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0-alpha.0",
|
|
4
4
|
"description": "charts lib based @visactor/VGrammar",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -85,24 +85,24 @@
|
|
|
85
85
|
"@size-limit/file": "9.0.0",
|
|
86
86
|
"@internal/typescript-json-schema": "0.0.1",
|
|
87
87
|
"@internal/bundler": "0.0.1",
|
|
88
|
-
"@internal/
|
|
89
|
-
"@internal/
|
|
88
|
+
"@internal/ts-config": "0.0.1",
|
|
89
|
+
"@internal/eslint-config": "0.0.1"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@visactor/vutils": "~0.17.4",
|
|
93
93
|
"@visactor/vdataset": "~0.17.4",
|
|
94
94
|
"@visactor/vscale": "~0.17.4",
|
|
95
|
-
"@visactor/vrender-core": "0.
|
|
96
|
-
"@visactor/vrender-kits": "0.
|
|
97
|
-
"@visactor/vrender-components": "0.
|
|
98
|
-
"@visactor/vgrammar-core": "0.11.
|
|
99
|
-
"@visactor/vgrammar-projection": "0.11.
|
|
100
|
-
"@visactor/vgrammar-wordcloud": "0.11.
|
|
101
|
-
"@visactor/vgrammar-wordcloud-shape": "0.11.
|
|
102
|
-
"@visactor/vgrammar-hierarchy": "0.11.
|
|
103
|
-
"@visactor/vgrammar-sankey": "0.11.
|
|
104
|
-
"@visactor/vgrammar-util": "0.11.
|
|
105
|
-
"@visactor/vutils-extension": "1.
|
|
95
|
+
"@visactor/vrender-core": "0.18.0-alpha.1",
|
|
96
|
+
"@visactor/vrender-kits": "0.18.0-alpha.1",
|
|
97
|
+
"@visactor/vrender-components": "0.18.0-alpha.1",
|
|
98
|
+
"@visactor/vgrammar-core": "0.11.12-alpha.1",
|
|
99
|
+
"@visactor/vgrammar-projection": "0.11.12-alpha.1",
|
|
100
|
+
"@visactor/vgrammar-wordcloud": "0.11.12-alpha.1",
|
|
101
|
+
"@visactor/vgrammar-wordcloud-shape": "0.11.12-alpha.1",
|
|
102
|
+
"@visactor/vgrammar-hierarchy": "0.11.12-alpha.1",
|
|
103
|
+
"@visactor/vgrammar-sankey": "0.11.12-alpha.1",
|
|
104
|
+
"@visactor/vgrammar-util": "0.11.12-alpha.1",
|
|
105
|
+
"@visactor/vutils-extension": "1.10.0-alpha.0"
|
|
106
106
|
},
|
|
107
107
|
"publishConfig": {
|
|
108
108
|
"access": "public",
|