@antv/g2plot 2.4.14 → 2.4.17
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/dist/g2plot.min.js +3 -17
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/common.d.ts +10 -0
- package/esm/adaptor/common.js +25 -0
- package/esm/adaptor/common.js.map +1 -1
- package/esm/adaptor/geometries/area.js +2 -1
- package/esm/adaptor/geometries/area.js.map +1 -1
- package/esm/adaptor/geometries/edge.js +2 -1
- package/esm/adaptor/geometries/edge.js.map +1 -1
- package/esm/adaptor/geometries/interval.js +9 -2
- package/esm/adaptor/geometries/interval.js.map +1 -1
- package/esm/adaptor/geometries/line.js +2 -2
- package/esm/adaptor/geometries/line.js.map +1 -1
- package/esm/adaptor/geometries/point.js +2 -1
- package/esm/adaptor/geometries/point.js.map +1 -1
- package/esm/adaptor/geometries/polygon.js +2 -1
- package/esm/adaptor/geometries/polygon.js.map +1 -1
- package/esm/adaptor/geometries/schema.js +2 -1
- package/esm/adaptor/geometries/schema.js.map +1 -1
- package/esm/adaptor/pattern.d.ts +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/area/adaptor.js +4 -4
- package/esm/plots/area/adaptor.js.map +1 -1
- package/esm/plots/area/index.js +2 -2
- package/esm/plots/area/index.js.map +1 -1
- package/esm/plots/area/types.d.ts +6 -0
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/adaptor.js +3 -3
- package/esm/plots/bar/adaptor.js.map +1 -1
- package/esm/plots/bar/index.js +2 -2
- package/esm/plots/bar/index.js.map +1 -1
- package/esm/plots/column/adaptor.js +4 -4
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/column/index.js +2 -2
- package/esm/plots/column/index.js.map +1 -1
- package/esm/plots/column/types.d.ts +6 -0
- package/esm/plots/column/types.js.map +1 -1
- package/esm/plots/mix/utils.d.ts +18 -17
- package/esm/plots/mix/utils.js.map +1 -1
- package/esm/plots/pie/adaptor.js +1 -1
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/sankey/layout.js +14 -3
- package/esm/plots/sankey/layout.js.map +1 -1
- package/esm/types/common.d.ts +6 -0
- package/esm/types/common.js.map +1 -1
- package/esm/types/coordinate.d.ts +13 -0
- package/esm/types/coordinate.js +1 -0
- package/esm/types/coordinate.js.map +1 -0
- package/esm/utils/transform/percent.d.ts +1 -1
- package/esm/utils/transform/percent.js +1 -1
- package/esm/utils/transform/percent.js.map +1 -1
- package/lib/adaptor/common.d.ts +10 -0
- package/lib/adaptor/common.js +27 -1
- package/lib/adaptor/common.js.map +1 -1
- package/lib/adaptor/geometries/area.js +2 -1
- package/lib/adaptor/geometries/area.js.map +1 -1
- package/lib/adaptor/geometries/edge.js +2 -1
- package/lib/adaptor/geometries/edge.js.map +1 -1
- package/lib/adaptor/geometries/interval.js +9 -2
- package/lib/adaptor/geometries/interval.js.map +1 -1
- package/lib/adaptor/geometries/line.js +2 -2
- package/lib/adaptor/geometries/line.js.map +1 -1
- package/lib/adaptor/geometries/point.js +2 -1
- package/lib/adaptor/geometries/point.js.map +1 -1
- package/lib/adaptor/geometries/polygon.js +2 -1
- package/lib/adaptor/geometries/polygon.js.map +1 -1
- package/lib/adaptor/geometries/schema.js +2 -1
- package/lib/adaptor/geometries/schema.js.map +1 -1
- package/lib/adaptor/pattern.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/adaptor.js +2 -2
- package/lib/plots/area/adaptor.js.map +1 -1
- package/lib/plots/area/index.js +1 -1
- package/lib/plots/area/index.js.map +1 -1
- package/lib/plots/area/types.d.ts +6 -0
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/adaptor.js +3 -3
- package/lib/plots/bar/adaptor.js.map +1 -1
- package/lib/plots/bar/index.js +1 -1
- package/lib/plots/bar/index.js.map +1 -1
- package/lib/plots/column/adaptor.js +2 -2
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/column/index.js +1 -1
- package/lib/plots/column/index.js.map +1 -1
- package/lib/plots/column/types.d.ts +6 -0
- package/lib/plots/column/types.js.map +1 -1
- package/lib/plots/mix/utils.d.ts +18 -17
- package/lib/plots/mix/utils.js.map +1 -1
- package/lib/plots/pie/adaptor.js +1 -1
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/sankey/layout.js +14 -3
- package/lib/plots/sankey/layout.js.map +1 -1
- package/lib/types/common.d.ts +6 -0
- package/lib/types/common.js.map +1 -1
- package/lib/types/coordinate.d.ts +13 -0
- package/lib/types/coordinate.js +3 -0
- package/lib/types/coordinate.js.map +1 -0
- package/lib/utils/transform/percent.d.ts +1 -1
- package/lib/utils/transform/percent.js +3 -3
- package/lib/utils/transform/percent.js.map +1 -1
- package/package.json +2 -1
- package/src/adaptor/common.ts +28 -1
- package/src/adaptor/geometries/area.ts +2 -1
- package/src/adaptor/geometries/edge.ts +2 -1
- package/src/adaptor/geometries/interval.ts +9 -1
- package/src/adaptor/geometries/line.ts +2 -2
- package/src/adaptor/geometries/point.ts +2 -1
- package/src/adaptor/geometries/polygon.ts +2 -1
- package/src/adaptor/geometries/schema.ts +2 -1
- package/src/index.ts +1 -1
- package/src/plots/area/adaptor.ts +14 -3
- package/src/plots/area/index.ts +2 -2
- package/src/plots/area/types.ts +7 -0
- package/src/plots/bar/adaptor.ts +3 -3
- package/src/plots/bar/index.ts +2 -2
- package/src/plots/column/adaptor.ts +4 -2
- package/src/plots/column/index.ts +2 -2
- package/src/plots/column/types.ts +7 -0
- package/src/plots/mix/utils.ts +18 -17
- package/src/plots/pie/adaptor.ts +1 -1
- package/src/plots/sankey/layout.ts +34 -21
- package/src/types/common.ts +6 -0
- package/src/types/coordinate.ts +17 -0
- package/src/utils/transform/percent.ts +1 -1
- package/CHANGELOG.md +0 -1515
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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AI,CAAC;IACtD,CAAC,CAAC,CAAC;IAEL,OAAO,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { assign, isString, isFunction } from '@antv/util';\nimport { Datum } from '../../types';\nimport { sankey, left, right, center, justify } from './sankey';\n\nconst ALIGN_METHOD = {\n left,\n right,\n center,\n justify,\n};\n\ntype InputNode = {\n readonly name: string;\n};\n\ntype InputLink = {\n readonly source: number;\n readonly target: number;\n readonly value: number;\n};\n\ntype OutputNode = {\n readonly name: string;\n readonly x0: number;\n readonly x1: number;\n readonly y0: number;\n readonly y1: number;\n readonly depth: number;\n readonly value: number;\n\n // 用于绘制 polygon\n x: number[];\n y: number[];\n};\n\ntype OutputLink = {\n readonly source: OutputNode;\n readonly target: OutputNode;\n readonly value: number;\n readonly width: number;\n readonly y0: number;\n readonly y1: number;\n\n // 用于绘制 edge\n x?: number[];\n y?: number[];\n};\n\n/**\n * 桑基图布局的数据结构定义\n */\nexport type SankeyLayoutInputData = {\n readonly nodes: InputNode[];\n readonly links: InputLink[];\n};\n\ntype SankeyLayoutOutputData = {\n readonly nodes: OutputNode[];\n readonly links: OutputLink[];\n};\n\n/**\n * 对齐方式的类型定义\n */\nexport type NodeAlign = keyof typeof ALIGN_METHOD | Function;\n\n/**\n * 节点的 depth 自定义\n */\nexport type NodeDepth = (datum: Datum, maxDepth: number) => number;\n\n/**\n * 节点排序方法的类型定义\n */\nexport type NodeSort = (a: Datum, b: Datum) => number;\n\n/**\n * 布局参数的定义\n */\nexport type SankeyLayoutOptions = {\n readonly nodeId?: (node: Datum) => any;\n // readonly value?: (node: Datum) => any;\n // readonly source?: (edge: Datum) => any;\n // readonly target?: (edge: Datum) => any;\n // sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.\n // sankey.nodeSort(null) specifies the input order of nodes and never sorts.\n // sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.\n readonly nodeSort?: (a: any, b: any) => number;\n readonly nodeAlign?: NodeAlign;\n readonly nodeWidth?: number;\n readonly nodePadding?: number;\n readonly nodeDepth?: NodeDepth;\n};\n\n/**\n * 默认值\n */\nconst DEFAULT_OPTIONS: Partial<SankeyLayoutOptions> = {\n nodeId: (node: Datum) => node.index,\n nodeAlign: 'justify',\n nodeWidth: 0.008,\n nodePadding: 0.03,\n nodeSort: undefined,\n};\n\n/**\n * 获得 align function\n * @param nodeAlign\n * @param nodeDepth\n */\nexport function getNodeAlignFunction(nodeAlign: NodeAlign) {\n const func = isString(nodeAlign) ? ALIGN_METHOD[nodeAlign] : isFunction(nodeAlign) ? nodeAlign : null;\n\n return func || justify;\n}\n\nexport function getDefaultOptions(sankeyLayoutOptions: SankeyLayoutOptions) {\n return assign({}, DEFAULT_OPTIONS, sankeyLayoutOptions);\n}\n\n/**\n * 桑基图利用数据进行布局的函数,最终返回节点、边的位置(0 - 1 的信息)\n * 将会修改 data 数据\n * @param sankeyLayoutOptions\n * @param data\n */\nexport function sankeyLayout(\n sankeyLayoutOptions: SankeyLayoutOptions,\n data: SankeyLayoutInputData\n): SankeyLayoutOutputData {\n const options = getDefaultOptions(sankeyLayoutOptions);\n\n const { nodeId, nodeSort, nodeAlign, nodeWidth, nodePadding, nodeDepth } = options;\n\n const sankeyProcessor = sankey()\n // .links((d: any) => d.links)\n // .nodes((d: any) => d.nodes)\n .nodeSort(nodeSort)\n .nodeWidth(nodeWidth)\n .nodePadding(nodePadding)\n .nodeDepth(nodeDepth)\n .nodeAlign(getNodeAlignFunction(nodeAlign))\n .extent([\n [0, 0],\n [1, 1],\n ])\n .nodeId(nodeId);\n\n // 进行桑基图布局处理\n const layoutData: SankeyLayoutOutputData = sankeyProcessor(data);\n\n // post process (x, y), etc.\n const nodes = layoutData.nodes\n .map((node) => {\n const { x0, x1, y0, y1 } = node;\n /* points\n * 3---2\n * | |\n * 0---1\n */\n node.x = [x0, x1, x1, x0];\n node.y = [y0, y0, y1, y1];\n\n return node;\n })\n .filter((node) => {\n return node.name !== null;\n });\n\n const links = layoutData.links\n .map((edge) => {\n const { source, target } = edge;\n const sx = source.x1;\n const tx = target.x0;\n edge.x = [sx, sx, tx, tx];\n const offset = edge.width / 2;\n edge.y = [edge.y0 + offset, edge.y0 - offset, edge.y1 + offset, edge.y1 - offset];\n\n return edge;\n })\n .filter((edge) => {\n const { source, target } = edge;\n return source.name !== null && target.name !== null;\n });\n\n return { nodes, links };\n}\n"]}
|
package/esm/types/common.d.ts
CHANGED
|
@@ -135,6 +135,12 @@ export declare type Options = {
|
|
|
135
135
|
* @default false
|
|
136
136
|
*/
|
|
137
137
|
readonly supportCSSTransform?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @title 是否开启 label 延迟渲染
|
|
140
|
+
* @description 开启后 label 渲染会在浏览器空闲时机执行。可制定具体 number 数值,来限定 timeout 时间 (建议开启时,指定 timeout 时间)
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
readonly useDeferredLabel?: boolean | number;
|
|
138
144
|
/**
|
|
139
145
|
* @title 数据
|
|
140
146
|
* @description 设置画布具体的数据
|
package/esm/types/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Axis } from './axis';\nimport { Label } from './label';\nimport { Tooltip } from './tooltip';\nimport { Legend } from './legend';\nimport { Interaction } from './interaction';\nimport { Animation } from './animation';\nimport { Annotation } from './annotation';\nimport { State } from './state';\nimport { Slider } from './slider';\nimport { Scrollbar } from './scrollbar';\nimport { ColorAttr, PatternAttr } from './attr';\nimport { Meta } from './meta';\n\n/** annotation position */\nexport type AnnotationPosition = Types.AnnotationPosition;\nexport type RegionPositionBaseOption = Types.RegionPositionBaseOption;\nexport type TextOption = Types.TextOption;\n\n/** 一条数据记录 */\nexport type Datum = Record<string, any>;\n\n/** 一个数据序列 */\nexport type Data = Datum[];\n\n/** 点位置信息 */\nexport type Point = {\n readonly x: number;\n readonly y: number;\n};\n\n/** 描述一个点 x y 位置 */\nexport type Position = [number, number];\n\n/** 一个区域描述 */\nexport type Region = {\n /**\n * @title 开始位置\n * @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly start: Point;\n /**\n * @title 结束位置\n * @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly end: Point;\n};\n\n/** 位置 */\nexport type BBox = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\n\n/** 文字 */\nexport type TextStyle = {\n /**\n * @title 文本大小\n */\n readonly fontSize?: number;\n /**\n * @title 字体系列\n */\n readonly fontFamily?: string;\n /**\n * @title 文本粗细\n */\n readonly fontWeight?: number;\n /**\n * @title 文本行高\n */\n readonly lineHeight?: number;\n /**\n * @title 文本对齐方式\n */\n readonly textAlign?: 'center' | 'left' | 'right';\n /**\n * @title 文本基线\n */\n readonly textBaseline?: 'middle' | 'top' | 'bottom';\n};\n\nexport type Size = {\n readonly width: number;\n readonly height: number;\n};\n\n/** 基础的 Options 配置 */\nexport type Options = {\n /**\n * @title 画布宽度\n */\n readonly width?: number;\n /**\n * @title 画布高度\n */\n readonly height?: number;\n /**\n * @title 自适应\n * @description 画布是否自动适配容器大小,默认为 true\n */\n readonly autoFit?: boolean;\n /**\n * @title 内填充\n * @description 画布的 padding 值,或者开启 'auto'\n */\n readonly padding?: number[] | number | 'auto';\n /**\n * @title 画布宽度\n * @description 额外怎加的 padding 值\n */\n readonly appendPadding?: number[] | number;\n /**\n * @title 额外填充\n * @description 是否同步子 view 的 padding\n */\n readonly syncViewPadding?: boolean | Types.SyncViewPaddingFn;\n\n /**\n * @title 国际化\n * @description 语言配置\n */\n readonly locale?: string;\n\n /**\n * @title 渲染引擎\n * @description 设置渲染引擎,'svg' | 'canvas'\n * @default \"canvas\"\n */\n readonly renderer?: 'svg' | 'canvas';\n /**\n * @title 屏幕像素比\n * @description 默认为 window.devicePixelRatio\n */\n readonly pixelRatio?: number;\n /**\n * @title 是否启局部渲染\n * @description 是否开启局部渲染,默认为 true\n * @default true\n */\n readonly localRefresh?: boolean;\n /**\n * @title 是否支持 CSS transform\n * @description 开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。\n * @default false\n */\n readonly supportCSSTransform?: boolean;\n\n /**\n * @title 数据\n * @description 设置画布具体的数据\n */\n readonly data: Record<string, any>[];\n /**\n * @title 数据字段元信息\n * @description 设置数据字段元信息\n */\n readonly meta?: Record<string, Meta>;\n\n // G2 相关\n /**\n * @title 主题\n * @description G2 主题,字符串或者 theme object\n * @default \"light\"\n */\n readonly theme?: string | object;\n /**\n * @title 颜色色板\n * @description 设置颜色色板\n */\n readonly color?: ColorAttr;\n /**\n * @title pattern 配置\n * @description 设置图表 pattern\n */\n readonly pattern?: PatternAttr;\n /**\n * @title 横坐标\n * @description 设置画布横坐标的配置项\n */\n readonly xAxis?: Axis;\n /**\n * @title 纵坐标\n * @description 设置画布纵坐标的配置项\n */\n readonly yAxis?: Axis;\n /**\n * @title 数据标签\n * @description 设置数据标签\n */\n readonly label?: Label;\n /**\n * @title tooltip 提示\n * @description 设置画布 tooltip 的配置项\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例\n * @description 设置画布图例 legend 的配置项\n */\n readonly legend?: Legend;\n /**\n * @title 缩略轴\n * @description 设置缩略轴 slider 的配置项\n */\n readonly slider?: Slider;\n /**\n * @title 滚动条\n * @description 设置画布缩略轴 scrollbar 的配置项\n */\n readonly scrollbar?: Scrollbar;\n /**\n * @title 动画\n * @description 设置图表动画\n */\n readonly animation?: Animation;\n /**\n * @title 交互\n * @description 设置画布交互行为\n */\n readonly interactions?: Interaction[];\n /**\n * @title 注解\n * @description 设置画布注解\n */\n readonly annotations?: Annotation[];\n /**\n * @title 图表状态\n * @description 设置画布配置 active,inactive,selected 三种状态的样式,也可在 Theme 主题中配置\n */\n readonly state?: State;\n /**\n * @title 是否裁剪\n * @description 是否对超出坐标系范围的 Geometry 进行剪切\n */\n readonly limitInPlot?: boolean;\n /**\n * @title 内置交互\n * @description 内置注册的交互\n * @deprecated false\n */\n readonly defaultInteractions?: string[];\n};\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Axis } from './axis';\nimport { Label } from './label';\nimport { Tooltip } from './tooltip';\nimport { Legend } from './legend';\nimport { Interaction } from './interaction';\nimport { Animation } from './animation';\nimport { Annotation } from './annotation';\nimport { State } from './state';\nimport { Slider } from './slider';\nimport { Scrollbar } from './scrollbar';\nimport { ColorAttr, PatternAttr } from './attr';\nimport { Meta } from './meta';\n\n/** annotation position */\nexport type AnnotationPosition = Types.AnnotationPosition;\nexport type RegionPositionBaseOption = Types.RegionPositionBaseOption;\nexport type TextOption = Types.TextOption;\n\n/** 一条数据记录 */\nexport type Datum = Record<string, any>;\n\n/** 一个数据序列 */\nexport type Data = Datum[];\n\n/** 点位置信息 */\nexport type Point = {\n readonly x: number;\n readonly y: number;\n};\n\n/** 描述一个点 x y 位置 */\nexport type Position = [number, number];\n\n/** 一个区域描述 */\nexport type Region = {\n /**\n * @title 开始位置\n * @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly start: Point;\n /**\n * @title 结束位置\n * @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range\n */\n readonly end: Point;\n};\n\n/** 位置 */\nexport type BBox = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n};\n\n/** 文字 */\nexport type TextStyle = {\n /**\n * @title 文本大小\n */\n readonly fontSize?: number;\n /**\n * @title 字体系列\n */\n readonly fontFamily?: string;\n /**\n * @title 文本粗细\n */\n readonly fontWeight?: number;\n /**\n * @title 文本行高\n */\n readonly lineHeight?: number;\n /**\n * @title 文本对齐方式\n */\n readonly textAlign?: 'center' | 'left' | 'right';\n /**\n * @title 文本基线\n */\n readonly textBaseline?: 'middle' | 'top' | 'bottom';\n};\n\nexport type Size = {\n readonly width: number;\n readonly height: number;\n};\n\n/** 基础的 Options 配置 */\nexport type Options = {\n /**\n * @title 画布宽度\n */\n readonly width?: number;\n /**\n * @title 画布高度\n */\n readonly height?: number;\n /**\n * @title 自适应\n * @description 画布是否自动适配容器大小,默认为 true\n */\n readonly autoFit?: boolean;\n /**\n * @title 内填充\n * @description 画布的 padding 值,或者开启 'auto'\n */\n readonly padding?: number[] | number | 'auto';\n /**\n * @title 画布宽度\n * @description 额外怎加的 padding 值\n */\n readonly appendPadding?: number[] | number;\n /**\n * @title 额外填充\n * @description 是否同步子 view 的 padding\n */\n readonly syncViewPadding?: boolean | Types.SyncViewPaddingFn;\n\n /**\n * @title 国际化\n * @description 语言配置\n */\n readonly locale?: string;\n\n /**\n * @title 渲染引擎\n * @description 设置渲染引擎,'svg' | 'canvas'\n * @default \"canvas\"\n */\n readonly renderer?: 'svg' | 'canvas';\n /**\n * @title 屏幕像素比\n * @description 默认为 window.devicePixelRatio\n */\n readonly pixelRatio?: number;\n /**\n * @title 是否启局部渲染\n * @description 是否开启局部渲染,默认为 true\n * @default true\n */\n readonly localRefresh?: boolean;\n /**\n * @title 是否支持 CSS transform\n * @description 开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。\n * @default false\n */\n readonly supportCSSTransform?: boolean;\n /**\n * @title 是否开启 label 延迟渲染\n * @description 开启后 label 渲染会在浏览器空闲时机执行。可制定具体 number 数值,来限定 timeout 时间 (建议开启时,指定 timeout 时间)\n * @default false\n */\n readonly useDeferredLabel?: boolean | number;\n\n /**\n * @title 数据\n * @description 设置画布具体的数据\n */\n readonly data: Record<string, any>[];\n /**\n * @title 数据字段元信息\n * @description 设置数据字段元信息\n */\n readonly meta?: Record<string, Meta>;\n\n // G2 相关\n /**\n * @title 主题\n * @description G2 主题,字符串或者 theme object\n * @default \"light\"\n */\n readonly theme?: string | object;\n /**\n * @title 颜色色板\n * @description 设置颜色色板\n */\n readonly color?: ColorAttr;\n /**\n * @title pattern 配置\n * @description 设置图表 pattern\n */\n readonly pattern?: PatternAttr;\n /**\n * @title 横坐标\n * @description 设置画布横坐标的配置项\n */\n readonly xAxis?: Axis;\n /**\n * @title 纵坐标\n * @description 设置画布纵坐标的配置项\n */\n readonly yAxis?: Axis;\n /**\n * @title 数据标签\n * @description 设置数据标签\n */\n readonly label?: Label;\n /**\n * @title tooltip 提示\n * @description 设置画布 tooltip 的配置项\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例\n * @description 设置画布图例 legend 的配置项\n */\n readonly legend?: Legend;\n /**\n * @title 缩略轴\n * @description 设置缩略轴 slider 的配置项\n */\n readonly slider?: Slider;\n /**\n * @title 滚动条\n * @description 设置画布缩略轴 scrollbar 的配置项\n */\n readonly scrollbar?: Scrollbar;\n /**\n * @title 动画\n * @description 设置图表动画\n */\n readonly animation?: Animation;\n /**\n * @title 交互\n * @description 设置画布交互行为\n */\n readonly interactions?: Interaction[];\n /**\n * @title 注解\n * @description 设置画布注解\n */\n readonly annotations?: Annotation[];\n /**\n * @title 图表状态\n * @description 设置画布配置 active,inactive,selected 三种状态的样式,也可在 Theme 主题中配置\n */\n readonly state?: State;\n /**\n * @title 是否裁剪\n * @description 是否对超出坐标系范围的 Geometry 进行剪切\n */\n readonly limitInPlot?: boolean;\n /**\n * @title 内置交互\n * @description 内置注册的交互\n * @deprecated false\n */\n readonly defaultInteractions?: string[];\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transformations of coordinate
|
|
3
|
+
*/
|
|
4
|
+
export declare type Transformations = Array<{
|
|
5
|
+
/** send (x, y) to (-x, y) */
|
|
6
|
+
type: 'reflectX';
|
|
7
|
+
} | {
|
|
8
|
+
/** send (x, y) to (x, -y) */
|
|
9
|
+
type: 'reflectY';
|
|
10
|
+
} | {
|
|
11
|
+
/** send (x, y) to (y, x) */
|
|
12
|
+
type: 'transpose';
|
|
13
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=coordinate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../../src/types/coordinate.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Transformations of coordinate\n */\nexport type Transformations = Array<\n | {\n /** send (x, y) to (-x, y) */\n type: 'reflectX';\n }\n | {\n /** send (x, y) to (x, -y) */\n type: 'reflectY';\n }\n | {\n /** send (x, y) to (y, x) */\n type: 'transpose';\n }\n>;\n"]}
|
|
@@ -23,4 +23,4 @@ export declare function getDeepPercent(data: Record<string, any>[], measure: str
|
|
|
23
23
|
* 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)
|
|
24
24
|
* @param isPercent 是否百分比
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function getDataWhetherPercentage(data: Record<string, any>[], yField: string, groupField: string, asField: string, isPercent?: boolean): Record<string, any>[];
|
|
@@ -58,7 +58,7 @@ export function getDeepPercent(data, measure, fields, percent) {
|
|
|
58
58
|
* 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)
|
|
59
59
|
* @param isPercent 是否百分比
|
|
60
60
|
*/
|
|
61
|
-
export function
|
|
61
|
+
export function getDataWhetherPercentage(data, yField, groupField, asField, isPercent) {
|
|
62
62
|
return !isPercent ? data : percent(data, yField, groupField, asField);
|
|
63
63
|
}
|
|
64
64
|
//# sourceMappingURL=percent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent.js","sourceRoot":"","sources":["../../../src/utils/transform/percent.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,IAAU,EAAE,OAAe,EAAE,UAA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CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpG,6BACK,KAAK,gBACP,OAAO,IAAG,UAAU,OACrB;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAA2B,EAC3B,MAAc,EACd,UAAkB,EAClB,OAAe,EACf,SAAmB;IAEnB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { map, reduce } from '@antv/util';\nimport { Data, Datum } from '../../types';\nimport { isRealNumber } from '../number';\n\n/**\n * 对数据进行百分比化\n * @param data\n * @param measure\n * @param groupField\n * @param as\n */\nexport function percent(data: Data, measure: string, groupField: string, as: string) {\n // 1. 先计算每一个分组的 max 值\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n const groupValue = datum[groupField];\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n const groupValue = datum[groupField];\n const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [as]: percentage,\n };\n });\n}\n\n/**\n * 对数据进行深层百分比化\n * @param data\n * @param measure // 数值\n * @param fields // 需要分组的 field值\n * @param as // 存储percent 百分比的值\n */\nexport function getDeepPercent(data: Record<string, any>[], measure: string, fields: string[], percent: string) {\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [percent]: percentage,\n };\n });\n}\n\n/**\n * 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)\n * @param isPercent 是否百分比\n */\nexport function getDataWhetherPercentage(\n data: Record<string, any>[],\n yField: string,\n groupField: string,\n asField: string,\n isPercent?: boolean\n) {\n return !isPercent ? data : percent(data, yField, groupField, asField);\n}\n"]}
|
package/lib/adaptor/common.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Types } from '@antv/g2';
|
|
1
2
|
import { Params } from '../core/adaptor';
|
|
2
3
|
import { Options } from '../types';
|
|
4
|
+
import { Transformations } from '../types/coordinate';
|
|
3
5
|
import { Axis } from '../types/axis';
|
|
4
6
|
/**
|
|
5
7
|
* 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表
|
|
@@ -59,4 +61,12 @@ export declare function annotation(annotationOptions?: Options['annotations']):
|
|
|
59
61
|
* @param params
|
|
60
62
|
*/
|
|
61
63
|
export declare function limitInPlot(params: Params<Options>): Params<Options>;
|
|
64
|
+
/**
|
|
65
|
+
* 坐标系转换
|
|
66
|
+
*/
|
|
67
|
+
export declare function transformations(coordinateType?: Types.CoordinateOption['type']): (params: Params<Options & {
|
|
68
|
+
coordinate: Transformations;
|
|
69
|
+
}>) => Params<Options & {
|
|
70
|
+
coordinate: Transformations;
|
|
71
|
+
}>;
|
|
62
72
|
export { pattern } from './pattern';
|
package/lib/adaptor/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.limitInPlot = exports.annotation = exports.scale = exports.scrollbar = exports.slider = exports.state = exports.theme = exports.animation = exports.interaction = exports.tooltip = exports.legend = void 0;
|
|
3
|
+
exports.transformations = exports.limitInPlot = exports.annotation = exports.scale = exports.scrollbar = exports.slider = exports.state = exports.theme = exports.animation = exports.interaction = exports.tooltip = exports.legend = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var util_1 = require("@antv/util");
|
|
6
6
|
var constant_1 = require("../constant");
|
|
@@ -181,6 +181,32 @@ function limitInPlot(params) {
|
|
|
181
181
|
return params;
|
|
182
182
|
}
|
|
183
183
|
exports.limitInPlot = limitInPlot;
|
|
184
|
+
/**
|
|
185
|
+
* 坐标系转换
|
|
186
|
+
*/
|
|
187
|
+
function transformations(coordinateType) {
|
|
188
|
+
if (coordinateType === void 0) { coordinateType = 'rect'; }
|
|
189
|
+
return function (params) {
|
|
190
|
+
var chart = params.chart, options = params.options;
|
|
191
|
+
var coordinate = options.coordinate;
|
|
192
|
+
var actions = Array.from(coordinate || [])
|
|
193
|
+
.map(function (cfg) {
|
|
194
|
+
if (cfg.type === 'reflectX')
|
|
195
|
+
return ['reflect', 'x'];
|
|
196
|
+
if (cfg.type === 'reflectY')
|
|
197
|
+
return ['reflect', 'y'];
|
|
198
|
+
if (cfg.type === 'transpose')
|
|
199
|
+
return ['transpose'];
|
|
200
|
+
return null;
|
|
201
|
+
})
|
|
202
|
+
.filter(function (d) { return !!d; });
|
|
203
|
+
if (actions.length !== 0) {
|
|
204
|
+
chart.coordinate({ type: coordinateType, actions: actions });
|
|
205
|
+
}
|
|
206
|
+
return params;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
exports.transformations = transformations;
|
|
184
210
|
var pattern_1 = require("./pattern");
|
|
185
211
|
Object.defineProperty(exports, "pattern", { enumerable: true, get: function () { return pattern_1.pattern; } });
|
|
186
212
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAKnD,wCAAoD;AACpD,kCAA4C;AAE5C;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,IAAI,WAAW,EAAE;QACpC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,WAAW,EAAE,MAAM,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAqC,MAAiB;IACnE,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,0BASC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAA0C,MAAiB;IAC5E,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAa;IAEjC,WAAI,CAAC,YAAY,EAAE,UAAC,CAAc;QAChC,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,EAAE;Y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,CAAC;SACf;KACF;IACD,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;IAE1B,OAAO,MAAM,CAAC;AAChB,CAAC;AAjBD,kCAiBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n chart.animate(animation);\n } else {\n chart.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.geometries, (g: Geometry) => {\n g.animate(animation);\n });\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adaptor/common.ts"],"names":[],"mappings":";;;;AACA,mCAAmD;AAMnD,wCAAoD;AACpD,kCAA4C;AAE5C;;;GAGG;AACH,SAAgB,MAAM,CACpB,MAAiB;IAET,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,MAAM,GAA8B,OAAO,OAArC,EAAE,UAAU,GAAkB,OAAO,WAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,CAAa;IAEpD,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM,IAAI,UAAU,IAAI,WAAW,EAAE;QACpC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,WAAW,EAAE,MAAM,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wBAaC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAqC,MAAiB;IACnE,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;A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AED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,0CAqBC;AAED,qCAAoC;AAA3B,kGAAA,OAAO,OAAA","sourcesContent":["import { Geometry, Types } from '@antv/g2';\nimport { each, isNil, isObject } from '@antv/util';\nimport { Params } from '../core/adaptor';\nimport { Options } from '../types';\nimport { Interaction } from '../types/interaction';\nimport { Transformations } from '../types/coordinate';\nimport { Axis } from '../types/axis';\nimport { AXIS_META_CONFIG_KEYS } from '../constant';\nimport { pick, deepAssign } from '../utils';\n\n/**\n * 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表\n * @param params\n */\nexport function legend<O extends Pick<Options, 'legend'> & { colorField?: string; seriesField?: string }>(\n params: Params<O>\n): Params<O> {\n const { chart, options } = params;\n const { legend, colorField, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (colorField || seriesField) {\n chart.legend(colorField || seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * 通用 tooltip 配置\n * @param params\n */\nexport function tooltip<O extends Pick<Options, 'tooltip'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip !== undefined) {\n chart.tooltip(tooltip);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nexport function interaction<O extends Pick<Options, 'interactions'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { interactions } = options;\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation<O extends Pick<Options, 'animation'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { animation } = options;\n\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n chart.animate(animation);\n } else {\n chart.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(chart.geometries, (g: Geometry) => {\n g.animate(animation);\n });\n\n return params;\n}\n\n/**\n * 设置全局主题配置\n * @param params\n */\nexport function theme<O extends Pick<Options, 'theme'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { theme } = options;\n\n // 存在主题才设置主题\n if (theme) {\n chart.theme(theme);\n }\n return params;\n}\n\n/**\n * 状态 state 配置\n * @param params\n */\nexport function state<O extends Options>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const { state } = options;\n\n if (state) {\n each(chart.geometries, (geometry: Geometry) => {\n geometry.state(state);\n });\n }\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function slider(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { slider } = options;\n\n chart.option('slider', slider);\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor\n * @param params\n */\nexport function scrollbar(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { scrollbar } = options;\n\n chart.option('scrollbar', scrollbar);\n\n return params;\n}\n\n/**\n * scale 的 adaptor\n * @param axes\n */\nexport function scale(axes: Record<string, Axis>, meta?: Options['meta']) {\n return function <O extends Pick<Options, 'meta'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n // 1. 轴配置中的 scale 信息\n let scales: Record<string, any> = {};\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n\n // 2. meta 直接是 scale 的信息\n scales = deepAssign({}, meta, options.meta, scales);\n\n chart.scale(scales);\n\n return params;\n };\n}\n\n/**\n * annotation 配置\n * @param params\n */\nexport function annotation(annotationOptions?: Options['annotations']) {\n return function <O extends Pick<Options, 'annotations'>>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n\n const annotationController = chart.getController('annotation');\n\n /** 自定义 annotation */\n each([...(options.annotations || []), ...(annotationOptions || [])], (annotationOption) => {\n // @ts-ignore\n annotationController.annotation(annotationOption);\n });\n\n return params;\n };\n}\n\n/**\n * 自动设置 limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<Options>): Params<Options> {\n const { chart, options } = params;\n const { yAxis, limitInPlot } = options;\n\n let value = limitInPlot;\n\n // 用户没有设置 limitInPlot,则自动根据 yAxis 是否有 min/max 来设置 limitInPlot\n if (isObject(yAxis) && isNil(limitInPlot)) {\n if (Object.values(pick(yAxis, ['min', 'max', 'minLimit', 'maxLimit'])).some((value) => !isNil(value))) {\n value = true;\n } else {\n value = false;\n }\n }\n chart.limitInPlot = value;\n\n return params;\n}\n\n/**\n * 坐标系转换\n */\nexport function transformations(coordinateType: Types.CoordinateOption['type'] = 'rect') {\n return (params: Params<Options & { coordinate: Transformations }>) => {\n const { chart, options } = params;\n const { coordinate } = options;\n\n const actions: Types.CoordinateActions[] = Array.from(coordinate || [])\n .map((cfg) => {\n if (cfg.type === 'reflectX') return ['reflect', 'x'] as Types.CoordinateActions;\n if (cfg.type === 'reflectY') return ['reflect', 'y'] as Types.CoordinateActions;\n if (cfg.type === 'transpose') return ['transpose'] as Types.CoordinateActions;\n\n return null;\n })\n .filter((d) => !!d);\n\n if (actions.length !== 0) {\n chart.coordinate({ type: coordinateType, actions });\n }\n\n return params;\n };\n}\n\nexport { pattern } from './pattern';\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function area(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var area = options.area, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, tooltip = options.tooltip;
|
|
14
|
+
var area = options.area, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
// 如果存在才处理
|
|
17
17
|
return area
|
|
@@ -21,6 +21,7 @@ function area(params) {
|
|
|
21
21
|
colorField: seriesField,
|
|
22
22
|
tooltipFields: fields,
|
|
23
23
|
mapping: tslib_1.__assign({ shape: smooth ? 'smooth' : 'area', tooltip: formatter }, area),
|
|
24
|
+
args: { useDeferredLabel: useDeferredLabel },
|
|
24
25
|
},
|
|
25
26
|
}))
|
|
26
27
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/area.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAenE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"area.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/area.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAenE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,GAAqE,OAAO,KAA5E,EAAE,MAAM,GAA6D,OAAO,OAApE,EAAE,MAAM,GAAqD,OAAO,OAA5D,EAAE,WAAW,GAAwC,OAAO,YAA/C,EAAE,MAAM,GAAgC,OAAO,OAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAEnF,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,UAAU;IACV,OAAO,IAAI;QACT,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACjC,OAAO,EAAE,SAAS,IACf,IAAI,CACR;gBACD,IAAI,EAAE,EAAE,gBAAgB,kBAAA,EAAE;aAC3B;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AAxBD,oBAwBC","sourcesContent":["import { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { GeometryOptions, geometry, MappingOptions } from './base';\n\nexport interface AreaGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** 是否平滑 */\n readonly smooth?: boolean;\n /** area 图形的样式设置 */\n readonly area?: MappingOptions;\n}\n\n/**\n * area geometry 的配置处理\n * @param params\n */\nexport function area<O extends AreaGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { area, xField, yField, seriesField, smooth, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n // 如果存在才处理\n return area\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'area',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: {\n shape: smooth ? 'smooth' : 'area',\n tooltip: formatter,\n ...area,\n },\n args: { useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function edge(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var edge = options.edge, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip;
|
|
14
|
+
var edge = options.edge, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
return edge
|
|
17
17
|
? base_1.geometry(utils_1.deepAssign({}, params, {
|
|
@@ -20,6 +20,7 @@ function edge(params) {
|
|
|
20
20
|
colorField: seriesField,
|
|
21
21
|
tooltipFields: fields,
|
|
22
22
|
mapping: tslib_1.__assign({ tooltip: formatter }, edge),
|
|
23
|
+
args: { useDeferredLabel: useDeferredLabel },
|
|
23
24
|
},
|
|
24
25
|
}))
|
|
25
26
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/edge.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/edge.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,GAA6D,OAAO,KAApE,EAAE,MAAM,GAAqD,OAAO,OAA5D,EAAE,MAAM,GAA6C,OAAO,OAApD,EAAE,WAAW,GAAgC,OAAO,YAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAE3E,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,OAAO,IAAI;QACT,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,OAAO,EAAE,SAAS,IACf,IAAI,CACR;gBACD,IAAI,EAAE,EAAE,gBAAgB,kBAAA,EAAE;aAC3B;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AAtBD,oBAsBC","sourcesContent":["import { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { geometry, MappingOptions, GeometryOptions } from './base';\n\nexport interface EdgeGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组颜色字段 */\n readonly seriesField?: string;\n /** edge 图形映射规则 */\n readonly edge?: MappingOptions;\n}\n\n/**\n * edge 的配置处理\n * @param params\n */\nexport function edge<O extends EdgeGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { edge, xField, yField, seriesField, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n return edge\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'edge',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: {\n tooltip: formatter,\n ...edge,\n },\n args: { useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
|
@@ -50,7 +50,7 @@ function otherAdaptor(params) {
|
|
|
50
50
|
}
|
|
51
51
|
function interval(params) {
|
|
52
52
|
var options = params.options;
|
|
53
|
-
var xField = options.xField, yField = options.yField, interval = options.interval, seriesField = options.seriesField, tooltip = options.tooltip, minColumnWidth = options.minColumnWidth, maxColumnWidth = options.maxColumnWidth, columnBackground = options.columnBackground, dodgePadding = options.dodgePadding, intervalPadding = options.intervalPadding;
|
|
53
|
+
var xField = options.xField, yField = options.yField, interval = options.interval, seriesField = options.seriesField, tooltip = options.tooltip, minColumnWidth = options.minColumnWidth, maxColumnWidth = options.maxColumnWidth, columnBackground = options.columnBackground, dodgePadding = options.dodgePadding, intervalPadding = options.intervalPadding, useDeferredLabel = options.useDeferredLabel;
|
|
54
54
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
55
55
|
// 保障一定要存在 interval 映射
|
|
56
56
|
var ext = (interval
|
|
@@ -60,7 +60,14 @@ function interval(params) {
|
|
|
60
60
|
colorField: seriesField,
|
|
61
61
|
tooltipFields: fields,
|
|
62
62
|
mapping: tslib_1.__assign({ tooltip: formatter }, interval),
|
|
63
|
-
args: {
|
|
63
|
+
args: {
|
|
64
|
+
dodgePadding: dodgePadding,
|
|
65
|
+
intervalPadding: intervalPadding,
|
|
66
|
+
minColumnWidth: minColumnWidth,
|
|
67
|
+
maxColumnWidth: maxColumnWidth,
|
|
68
|
+
background: columnBackground,
|
|
69
|
+
useDeferredLabel: useDeferredLabel,
|
|
70
|
+
},
|
|
64
71
|
},
|
|
65
72
|
}))
|
|
66
73
|
: params).ext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interval.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/interval.ts"],"names":[],"mappings":";;;;AAAA,+BAA0D;AAC1D,mCAA6C;AAE7C,qCAAyC;AACzC,+CAAwD;AACxD,+BAAmE;AAiCnE;;;GAGG;AACH,SAAS,YAAY,CAAoC,MAAiB;IAChE,IAAA,KAAK,GAAmB,MAAM,MAAzB,EAAE,OAAO,GAAU,MAAM,QAAhB,EAAE,GAAG,GAAK,MAAM,IAAX,CAAY;IAC/B,IAAA,WAAW,GAAmE,OAAO,YAA1E,EAAE,OAAO,GAA0D,OAAO,QAAjE,EAAE,OAAO,GAAiD,OAAO,QAAxD,EAAE,WAAW,GAAoC,OAAO,YAA3C,EAAE,UAAU,GAAwB,OAAO,WAA/B,EAAE,UAAU,GAAY,OAAO,WAAnB,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAa;IAE9F;;O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AED,SAAgB,QAAQ,CAAoC,MAAiB;IACnE,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IAEzB,IAAA,MAAM,GAWJ,OAAO,OAXH,EACN,MAAM,GAUJ,OAAO,OAVH,EACN,QAAQ,GASN,OAAO,SATD,EACR,WAAW,GAQT,OAAO,YARE,EACX,OAAO,GAOL,OAAO,QAPF,EACP,cAAc,GAMZ,OAAO,eANK,EACd,cAAc,GAKZ,OAAO,eALK,EACd,gBAAgB,GAId,OAAO,iBAJO,EAChB,YAAY,GAGV,OAAO,aAHG,EACZ,eAAe,GAEb,OAAO,gBAFM,EACf,gBAAgB,GACd,OAAO,iBADO,CACN;IAEN,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,sBAAsB;IACd,IAAA,GAAG,GAAK,CAAA,QAAQ;QACtB,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,OAAO,EAAE,SAAS,IACf,QAAQ,CACZ;gBACD,IAAI,EAAE;oBACJ,YAAY,cAAA;oBACZ,eAAe,iBAAA;oBACf,cAAc,gBAAA;oBACd,cAAc,gBAAA;oBACd,UAAU,EAAE,gBAAgB;oBAC5B,gBAAgB,kBAAA;iBACjB;aACF;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAA,IAtBC,CAsBA;IAEX,OAAO,YAAY,uCACd,MAAM,KACT,GAAG,KAAA,IACH,CAAC;AACL,CAAC;AA/CD,4BA+CC","sourcesContent":["import { Geometry, getTheme, ShapeAttrs } from '@antv/g2';\nimport { isNil, isObject } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign } from '../../utils';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { GeometryOptions, MappingOptions, geometry } from './base';\n\nexport interface IntervalGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField: string;\n /** y 轴字段 */\n readonly yField: string;\n /** 拆分字段,在分组柱状图下同 groupField、colorField,在堆积柱状图下同 stackField、colorField */\n readonly seriesField?: string;\n /** 是否分组柱形图 */\n readonly isGroup?: boolean;\n /** 是否堆积柱状图 */\n readonly isStack?: boolean;\n /** 柱状图宽度占比 [0-1] */\n readonly widthRatio?: number;\n /** 分组间柱子之间的组间间距(像素级),仅对分组柱状图适用 */\n readonly intervalPadding?: number;\n /** 分组中柱子之间的间距 [0-1],仅对分组柱状图适用 */\n readonly marginRatio?: number;\n /** 分组中柱子之间的组内间距(像素级),仅对分组柱状图适用 */\n readonly dodgePadding?: number;\n /** 柱状图最小宽度(像素) */\n readonly minColumnWidth?: number;\n /** 柱状图最大宽度(像素) */\n readonly maxColumnWidth?: number;\n /** 柱子的背景样式设置 */\n readonly columnBackground?: { style: ShapeAttrs };\n /** 柱子视觉通道配置(含 color、shape、size、style、tooltip) */\n readonly interval?: MappingOptions;\n /** 分组字段,优先级高于 seriesField , isGroup: true 时会根据 groupField 进行分组。*/\n readonly groupField?: string;\n}\n\n/**\n * 柱形图其他的 adaptor\n * @param params\n */\nfunction otherAdaptor<O extends IntervalGeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options, ext } = params;\n const { seriesField, isGroup, isStack, marginRatio, widthRatio, groupField, theme } = options;\n\n /**\n * adjust\n */\n const adjust = [];\n if (seriesField) {\n // group\n if (isGroup) {\n adjust.push({\n type: 'dodge',\n dodgeBy: groupField || seriesField,\n marginRatio,\n });\n }\n // stack\n if (isStack) {\n adjust.push({\n type: 'stack',\n marginRatio,\n });\n }\n }\n\n if (adjust.length && ext?.geometry) {\n const g = ext?.geometry as Geometry;\n g.adjust(adjust);\n }\n\n // widthRatio\n if (!isNil(widthRatio)) {\n chart.theme(\n deepAssign({}, isObject(theme) ? theme : getTheme(theme), {\n // columWidthRatio 配置覆盖 theme 中的配置\n columnWidthRatio: widthRatio,\n })\n );\n }\n\n return params;\n}\n\nexport function interval<O extends IntervalGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const {\n xField,\n yField,\n interval,\n seriesField,\n tooltip,\n minColumnWidth,\n maxColumnWidth,\n columnBackground,\n dodgePadding,\n intervalPadding,\n useDeferredLabel,\n } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n // 保障一定要存在 interval 映射\n const { ext } = interval\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'interval',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: {\n tooltip: formatter,\n ...interval,\n },\n args: {\n dodgePadding,\n intervalPadding,\n minColumnWidth,\n maxColumnWidth,\n background: columnBackground,\n useDeferredLabel,\n },\n },\n })\n )\n : params;\n\n return otherAdaptor({\n ...params,\n ext,\n });\n}\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function line(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var line = options.line, stepType = options.stepType, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, connectNulls = options.connectNulls, tooltip = options.tooltip;
|
|
14
|
+
var line = options.line, stepType = options.stepType, xField = options.xField, yField = options.yField, seriesField = options.seriesField, smooth = options.smooth, connectNulls = options.connectNulls, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
// 如果存在才处理
|
|
17
17
|
return line
|
|
@@ -24,7 +24,7 @@ function line(params) {
|
|
|
24
24
|
shape: stepType || (smooth ? 'smooth' : 'line'),
|
|
25
25
|
tooltip: formatter,
|
|
26
26
|
}, line),
|
|
27
|
-
args: { connectNulls: connectNulls },
|
|
27
|
+
args: { connectNulls: connectNulls, useDeferredLabel: useDeferredLabel },
|
|
28
28
|
},
|
|
29
29
|
}))
|
|
30
30
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/line.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAmBnE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/line.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAmBnE;;;GAGG;AACH,SAAgB,IAAI,CAAgC,MAAiB;IAC3D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,IAAI,GAA6F,OAAO,KAApG,EAAE,QAAQ,GAAmF,OAAO,SAA1F,EAAE,MAAM,GAA2E,OAAO,OAAlF,EAAE,MAAM,GAAmE,OAAO,OAA1E,EAAE,WAAW,GAAsD,OAAO,YAA7D,EAAE,MAAM,GAA8C,OAAO,OAArD,EAAE,YAAY,GAAgC,OAAO,aAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAE3G,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,UAAU;IACV,OAAO,IAAI;QACT,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,EAAE,cAAO,CACd;oBACE,KAAK,EAAE,QAAQ,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;oBAC/C,OAAO,EAAE,SAAS;iBACnB,EACD,IAAI,CACL;gBACD,IAAI,EAAE,EAAE,YAAY,cAAA,EAAE,gBAAgB,kBAAA,EAAE;aACzC;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AA1BD,oBA0BC","sourcesContent":["import { deepMix } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { GeometryOptions, geometry, MappingOptions } from './base';\n\nexport interface LineGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** 是否平滑 */\n readonly smooth?: boolean;\n /** 是否连接空数据 */\n readonly connectNulls?: boolean;\n /** line 映射配置 */\n readonly line?: MappingOptions;\n /** 阶梯折线图类型 */\n readonly stepType?: string;\n}\n\n/**\n * line 辅助点的配置处理\n * @param params\n */\nexport function line<O extends LineGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { line, stepType, xField, yField, seriesField, smooth, connectNulls, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n // 如果存在才处理\n return line\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'line',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: deepMix(\n {\n shape: stepType || (smooth ? 'smooth' : 'line'),\n tooltip: formatter,\n },\n line\n ),\n args: { connectNulls, useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function point(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var point = options.point, xField = options.xField, yField = options.yField, seriesField = options.seriesField, sizeField = options.sizeField, shapeField = options.shapeField, tooltip = options.tooltip;
|
|
14
|
+
var point = options.point, xField = options.xField, yField = options.yField, seriesField = options.seriesField, sizeField = options.sizeField, shapeField = options.shapeField, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField, sizeField, shapeField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
return point
|
|
17
17
|
? base_1.geometry(utils_1.deepAssign({}, params, {
|
|
@@ -21,6 +21,7 @@ function point(params) {
|
|
|
21
21
|
shapeField: shapeField,
|
|
22
22
|
tooltipFields: fields,
|
|
23
23
|
mapping: tslib_1.__assign({ tooltip: formatter }, point),
|
|
24
|
+
args: { useDeferredLabel: useDeferredLabel },
|
|
24
25
|
},
|
|
25
26
|
}))
|
|
26
27
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/point.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAiBnE;;;GAGG;AACH,SAAgB,KAAK,CAAiC,MAAiB;IAC7D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,KAAK,
|
|
1
|
+
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/point.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAiBnE;;;GAGG;AACH,SAAgB,KAAK,CAAiC,MAAiB;IAC7D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,KAAK,GAAoF,OAAO,MAA3F,EAAE,MAAM,GAA4E,OAAO,OAAnF,EAAE,MAAM,GAAoE,OAAO,OAA3E,EAAE,WAAW,GAAuD,OAAO,YAA9D,EAAE,SAAS,GAA4C,OAAO,UAAnD,EAAE,UAAU,GAAgC,OAAO,WAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAEnG,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,EAAtG,MAAM,YAAA,EAAE,SAAS,eAAqF,CAAC;IAE/G,OAAO,KAAK;QACV,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,WAAW;gBACvB,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,OAAO,EAAE,SAAS,IACf,KAAK,CACT;gBACD,IAAI,EAAE,EAAE,gBAAgB,kBAAA,EAAE;aAC3B;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AAvBD,sBAuBC","sourcesContent":["import { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { geometry, MappingOptions, GeometryOptions } from './base';\n\nexport interface PointGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** point 图形映射规则 */\n readonly point?: MappingOptions;\n}\n\n/**\n * point 辅助点的配置处理\n * @param params\n */\nexport function point<O extends PointGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { point, xField, yField, seriesField, sizeField, shapeField, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField, sizeField, shapeField]);\n\n return point\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'point',\n colorField: seriesField,\n shapeField: shapeField,\n tooltipFields: fields,\n mapping: {\n tooltip: formatter,\n ...point,\n },\n args: { useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function polygon(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var polygon = options.polygon, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip;
|
|
14
|
+
var polygon = options.polygon, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
return polygon
|
|
17
17
|
? base_1.geometry(utils_1.deepAssign({}, params, {
|
|
@@ -20,6 +20,7 @@ function polygon(params) {
|
|
|
20
20
|
colorField: seriesField,
|
|
21
21
|
tooltipFields: fields,
|
|
22
22
|
mapping: tslib_1.__assign({ tooltip: formatter }, polygon),
|
|
23
|
+
args: { useDeferredLabel: useDeferredLabel },
|
|
23
24
|
},
|
|
24
25
|
}))
|
|
25
26
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/polygon.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,OAAO,CAAmC,MAAiB;IACjE,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/polygon.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,OAAO,CAAmC,MAAiB;IACjE,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,OAAO,GAA6D,OAAO,QAApE,EAAE,MAAM,GAAqD,OAAO,OAA5D,EAAE,MAAM,GAA6C,OAAO,OAApD,EAAE,WAAW,GAAgC,OAAO,YAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAE9E,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,OAAO,OAAO;QACZ,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,OAAO,EAAE,SAAS,IACf,OAAO,CACX;gBACD,IAAI,EAAE,EAAE,gBAAgB,kBAAA,EAAE;aAC3B;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AAtBD,0BAsBC","sourcesContent":["import { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { geometry, MappingOptions, GeometryOptions } from './base';\n\nexport interface PolygonGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** point 图形映射规则 */\n readonly polygon?: MappingOptions;\n}\n\n/**\n * polygon 的配置处理\n * @param params\n */\nexport function polygon<O extends PolygonGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { polygon, xField, yField, seriesField, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n return polygon\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'polygon',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: {\n tooltip: formatter,\n ...polygon,\n },\n args: { useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ var base_1 = require("./base");
|
|
|
11
11
|
*/
|
|
12
12
|
function schema(params) {
|
|
13
13
|
var options = params.options;
|
|
14
|
-
var schema = options.schema, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip;
|
|
14
|
+
var schema = options.schema, xField = options.xField, yField = options.yField, seriesField = options.seriesField, tooltip = options.tooltip, useDeferredLabel = options.useDeferredLabel;
|
|
15
15
|
var _a = tooltip_1.getTooltipMapping(tooltip, [xField, yField, seriesField]), fields = _a.fields, formatter = _a.formatter;
|
|
16
16
|
return schema
|
|
17
17
|
? base_1.geometry(utils_1.deepAssign({}, params, {
|
|
@@ -20,6 +20,7 @@ function schema(params) {
|
|
|
20
20
|
colorField: seriesField,
|
|
21
21
|
tooltipFields: fields,
|
|
22
22
|
mapping: tslib_1.__assign({ tooltip: formatter }, schema),
|
|
23
|
+
args: { useDeferredLabel: useDeferredLabel },
|
|
23
24
|
},
|
|
24
25
|
}))
|
|
25
26
|
: params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/schema.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,MAAM,CAAkC,MAAiB;IAC/D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/schema.ts"],"names":[],"mappings":";;;;AACA,+CAAwD;AACxD,qCAAyC;AACzC,+BAAmE;AAanE;;;GAGG;AACH,SAAgB,MAAM,CAAkC,MAAiB;IAC/D,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,MAAM,GAA6D,OAAO,OAApE,EAAE,MAAM,GAAqD,OAAO,OAA5D,EAAE,MAAM,GAA6C,OAAO,OAApD,EAAE,WAAW,GAAgC,OAAO,YAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,gBAAgB,GAAK,OAAO,iBAAZ,CAAa;IAE7E,IAAA,KAAwB,2BAAiB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAA/E,MAAM,YAAA,EAAE,SAAS,eAA8D,CAAC;IAExF,OAAO,MAAM;QACX,CAAC,CAAC,eAAQ,CACN,kBAAU,CAAC,EAAE,EAAE,MAAM,EAAE;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,MAAM;gBACrB,OAAO,qBACL,OAAO,EAAE,SAAS,IACf,MAAM,CACV;gBACD,IAAI,EAAE,EAAE,gBAAgB,kBAAA,EAAE;aAC3B;SACF,CAAC,CACH;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC;AAtBD,wBAsBC","sourcesContent":["import { Params } from '../../core/adaptor';\nimport { getTooltipMapping } from '../../utils/tooltip';\nimport { deepAssign } from '../../utils';\nimport { geometry, MappingOptions, GeometryOptions } from './base';\n\nexport interface SchemaGeometryOptions extends GeometryOptions {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** point 图形映射规则 */\n readonly schema?: MappingOptions;\n}\n\n/**\n * schema 的配置处理\n * @param params\n */\nexport function schema<O extends SchemaGeometryOptions>(params: Params<O>): Params<O> {\n const { options } = params;\n const { schema, xField, yField, seriesField, tooltip, useDeferredLabel } = options;\n\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, seriesField]);\n\n return schema\n ? geometry(\n deepAssign({}, params, {\n options: {\n type: 'schema',\n colorField: seriesField,\n tooltipFields: fields,\n mapping: {\n tooltip: formatter,\n ...schema,\n },\n args: { useDeferredLabel },\n },\n })\n )\n : params;\n}\n"]}
|
package/lib/adaptor/pattern.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ import { Options } from '../types';
|
|
|
7
7
|
* @param key key of style property
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "animation" | "color" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state"> = Pick<Options, "label" | "legend" | "meta" | "padding" | "animation" | "color" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state">>(params: Params<O>) => Params<O>;
|
|
10
|
+
export declare function pattern(key: string): <O extends Pick<Options, "label" | "legend" | "meta" | "padding" | "animation" | "color" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state"> = Pick<Options, "label" | "legend" | "meta" | "padding" | "animation" | "color" | "height" | "width" | "appendPadding" | "renderer" | "pixelRatio" | "autoFit" | "syncViewPadding" | "supportCSSTransform" | "limitInPlot" | "locale" | "defaultInteractions" | "localRefresh" | "useDeferredLabel" | "theme" | "pattern" | "xAxis" | "yAxis" | "tooltip" | "slider" | "scrollbar" | "interactions" | "annotations" | "state">>(params: Params<O>) => Params<O>;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.adaptors = exports.registerLocale = exports.G2 = exports.version = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
exports.version = '2.4.
|
|
5
|
+
exports.version = '2.4.17';
|
|
6
6
|
// G2 自定义能力透出
|
|
7
7
|
var G2 = tslib_1.__importStar(require("@antv/g2"));
|
|
8
8
|
exports.G2 = G2;
|