@antv/g2plot 2.4.32 → 2.4.34

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.
@@ -42,6 +42,8 @@ export type Geometry = {
42
42
  readonly rawFields?: RawFields;
43
43
  /** 图形映射规则 */
44
44
  readonly mapping?: MappingOptions;
45
+ /** 自定义映射字段 */
46
+ readonly customMappingField?: string;
45
47
  /** label 映射通道,因为历史原因导致实现略有区别 */
46
48
  readonly label?: Label;
47
49
  /** 不同状态的样式 */
@@ -74,7 +74,7 @@ export function getMappingFunction(mappingFields, func) {
74
74
  */
75
75
  export function geometry(params) {
76
76
  var chart = params.chart, options = params.options;
77
- var type = options.type, args = options.args, mapping = options.mapping, xField = options.xField, yField = options.yField, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, tooltipFields = options.tooltipFields, label = options.label, state = options.state, customInfo = options.customInfo;
77
+ var type = options.type, args = options.args, mapping = options.mapping, xField = options.xField, yField = options.yField, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, tooltipFields = options.tooltipFields, label = options.label, state = options.state, customInfo = options.customInfo, customMappingField = options.customMappingField;
78
78
  // 如果没有 mapping 信息,那么直接返回
79
79
  if (!mapping) {
80
80
  return params;
@@ -94,7 +94,7 @@ export function geometry(params) {
94
94
  }
95
95
  else if (isFunction(color)) {
96
96
  var _a = getMappingField(options, 'color'), mappingFields = _a.mappingFields, tileMappingField = _a.tileMappingField;
97
- geometry.color(tileMappingField, getMappingFunction(mappingFields, color));
97
+ geometry.color(customMappingField || tileMappingField, getMappingFunction(mappingFields, color));
98
98
  }
99
99
  else {
100
100
  colorField && geometry.color(colorField, color);
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YA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AAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6BACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC","sourcesContent":["import { isEmpty, isFunction, isNumber, isObject, isString, uniq } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, Datum, Options, RawFields, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKrF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA4D7C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoE,CAAC,KAArE,EAAE,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QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6BACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC","sourcesContent":["import { isEmpty, isFunction, isNumber, isObject, isString, uniq } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, Datum, Options, RawFields, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** 自定义映射字段 */\n readonly customMappingField?: string;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n customMappingField,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(customMappingField || tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
package/esm/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.32";
1
+ export declare const version = "2.4.34";
2
2
  import * as G2 from '@antv/g2';
3
3
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
4
4
  import { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export var version = '2.4.32';
1
+ export var version = '2.4.34';
2
2
  // G2 自定义能力透出
3
3
  import * as G2 from '@antv/g2';
4
4
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file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AAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.32';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrG,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE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CAAC;AAE7C,OAAO;AACP,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,qGAAqG;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,uEAAuE;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,2BAA2B;AAC3B,mEAAmE;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAC7B,SAAS;AACT,cAAc,SAAS,CAAC;AACxB,uCAAuC;AACvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjD,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAEtC,MAAM,CAAC,IAAM,QAAQ,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.34';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
@@ -19,8 +19,8 @@ export var doSliderFilter = function (view, sliderValue) {
19
19
  var values = valuesOfKey(data, xScale.field);
20
20
  var xValues = isHorizontal ? values : values.reverse();
21
21
  var xTickCount = size(xValues);
22
- var minIndex = Math.floor(min * (xTickCount - 1));
23
- var maxIndex = Math.floor(max * (xTickCount - 1));
22
+ var minIndex = Math.round(min * (xTickCount - 1));
23
+ var maxIndex = Math.round(max * (xTickCount - 1));
24
24
  // 增加 x 轴的过滤器
25
25
  view.filter(xScale.field, function (value) {
26
26
  var idx = xValues.indexOf(value);
@@ -1 +1 @@
1
- {"version":3,"file":"render-sider.js","sourceRoot":"","sources":["../../../../src/plots/dual-axes/util/render-sider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAAU,EAAE,WAA6B;IAC/D,IAAA,GAAG,GAAS,WAAW,GAApB,EAA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右侧 View 进行 slider 过滤\n * 由于双轴图是多 View , 需要监听左侧 Slider 的 change 事件来同步右侧 View\n * @param { View } view 右侧视图\n * @param { number[] } sliderValue 滑块当前值\n * @returns void\n */\nexport const doSliderFilter = (view: View, sliderValue: [number, number]) => {\n const [min, max] = sliderValue;\n const data = view.getOptions().data;\n const xScale = view.getXScale();\n const dataSize = size(data);\n if (!xScale || !dataSize) {\n return;\n }\n const isHorizontal = true;\n const values = valuesOfKey(data, xScale.field);\n const xValues = isHorizontal ? values : values.reverse();\n const xTickCount = size(xValues);\n const minIndex = Math.floor(min * (xTickCount - 1));\n const maxIndex = Math.floor(max * (xTickCount - 1));\n\n // 增加 x 轴的过滤器\n view.filter(xScale.field, (value: any) => {\n const idx: number = xValues.indexOf(value);\n return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;\n });\n view.getRootView().render(true);\n};\n"]}
1
+ {"version":3,"file":"render-sider.js","sourceRoot":"","sources":["../../../../src/plots/dual-axes/util/render-sider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAAU,EAAE,WAA6B;IAC/D,IAAA,GAAG,GAAS,WAAW,GAApB,EAAE,GAAG,GAAI,WAAW,GAAf,CAAgB;IAC/B,IAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC;IACpC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO;KACR;IACD,IAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,IAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACpD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEpD,aAAa;IACb,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAC,KAAU;QACnC,IAAM,GAAG,GAAW,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { View } from '@antv/g2';\nimport { size, valuesOfKey } from '@antv/util';\nimport { isBetween } from '../../../utils';\n\n/**\n * 右侧 View 进行 slider 过滤\n * 由于双轴图是多 View , 需要监听左侧 Slider 的 change 事件来同步右侧 View\n * @param { View } view 右侧视图\n * @param { number[] } sliderValue 滑块当前值\n * @returns void\n */\nexport const doSliderFilter = (view: View, sliderValue: [number, number]) => {\n const [min, max] = sliderValue;\n const data = view.getOptions().data;\n const xScale = view.getXScale();\n const dataSize = size(data);\n if (!xScale || !dataSize) {\n return;\n }\n const isHorizontal = true;\n const values = valuesOfKey(data, xScale.field);\n const xValues = isHorizontal ? values : values.reverse();\n const xTickCount = size(xValues);\n const minIndex = Math.round(min * (xTickCount - 1));\n const maxIndex = Math.round(max * (xTickCount - 1));\n\n // 增加 x 轴的过滤器\n view.filter(xScale.field, (value: any) => {\n const idx: number = xValues.indexOf(value);\n return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;\n });\n view.getRootView().render(true);\n};\n"]}
@@ -32,20 +32,26 @@ function facetAdaptor(params) {
32
32
  }
33
33
  else {
34
34
  var plot = viewOptions;
35
- var plotOptions = plot.options;
35
+ var plotOptions_1 = plot.options;
36
+ // 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段
37
+ ['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach(function (key) {
38
+ if (options[key] && typeof plotOptions_1[key] === 'undefined') {
39
+ plotOptions_1[key] = options[key];
40
+ }
41
+ });
36
42
  // @ts-ignore 仪表盘没 tooltip
37
- if (plotOptions.tooltip) {
43
+ if (plotOptions_1.tooltip) {
38
44
  // 配置 tooltip 交互
39
45
  viewOfG2.interaction('tooltip');
40
46
  }
41
- execPlotAdaptor(plot.type, viewOfG2, plotOptions);
47
+ execPlotAdaptor(plot.type, viewOfG2, plotOptions_1);
42
48
  }
43
49
  } }));
44
50
  return params;
45
51
  }
46
52
  function component(params) {
47
53
  var chart = params.chart, options = params.options;
48
- var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations;
54
+ var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations, shapeField = options.shapeField, sizeField = options.sizeField, shapeLegend = options.shapeLegend, sizeLegend = options.sizeLegend;
49
55
  // 3. meta 配置
50
56
  var scales = {};
51
57
  if (axes) {
@@ -76,6 +82,22 @@ function component(params) {
76
82
  }
77
83
  // 7. legend 配置(默认展示)
78
84
  chart.legend(legend);
85
+ var showLegend = legend !== false;
86
+ if (shapeField) {
87
+ if (shapeLegend) {
88
+ chart.legend(shapeField, shapeLegend);
89
+ }
90
+ else {
91
+ chart.legend(shapeField, shapeLegend === false ? false : legend);
92
+ }
93
+ }
94
+ if (sizeField) {
95
+ chart.legend(sizeField, sizeLegend ? sizeLegend : false);
96
+ }
97
+ // /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */
98
+ if (!showLegend && !shapeLegend && !sizeLegend) {
99
+ chart.legend(false);
100
+ }
79
101
  // theme 配置
80
102
  if (theme) {
81
103
  chart.theme(theme);
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/facet/adaptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,SAAS,YAAY,CAAC,MAA4B;IACxC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAM,SAAS,GAA6B,OAAO,KAApC,EAAE,IAAI,GAAuB,OAAO,KAA9B,EAAE,MAAM,GAAe,OAAO,OAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAa;IAE5D,IAAM,YAAY,GAAG,IAAI,CAAC,OAAc,EAAE;QACxC,MAAM;QACN,MAAM;QACN,QAAQ;QACR,UAAU;QACV,MAAM;QACN,MAAM;QACN,SAAS;QACT,YAAY;QACZ,OAAO;QACP,QAAQ;QACR,cAAc;QACd,aAAa;KACd,CAAC,CAAC;IAEH,UAAU;IACV,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjB,WA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I,CAAC,cAC9B,UAAU,EACb,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { each, omit } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { Axis, Interaction } from '../../types';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { execPlotAdaptor } from '../mix/utils';\nimport { FacetOptions, IPlot, IView } from './types';\nimport { execViewAdaptor } from './utils';\n\nfunction facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const { type: facetType, data, fields, eachView } = options;\n\n const restFacetCfg = omit(options as any, [\n 'type',\n 'data',\n 'fields',\n 'eachView',\n 'axes',\n 'meta',\n 'tooltip',\n 'coordinate',\n 'theme',\n 'legend',\n 'interactions',\n 'annotations',\n ]);\n\n // 1. data\n chart.data(data);\n\n // 2. facet\n chart.facet(facetType, {\n ...restFacetCfg,\n fields,\n eachView: (viewOfG2, facet) => {\n const viewOptions = eachView(viewOfG2, facet);\n if ((viewOptions as IView).geometries) {\n execViewAdaptor(viewOfG2, viewOptions as IView);\n } else {\n const plot = viewOptions as IPlot;\n const plotOptions = plot.options;\n // @ts-ignore 仪表盘没 tooltip\n if (plotOptions.tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n execPlotAdaptor(plot.type, viewOfG2, plotOptions);\n }\n },\n });\n\n return params;\n}\n\nfunction component(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const { axes, meta, tooltip, coordinate, theme, legend, interactions, annotations } = options;\n\n // 3. meta 配置\n let scales: Record<string, any> = {};\n if (axes) {\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n }\n\n scales = deepAssign({}, meta, scales);\n chart.scale(scales);\n\n // 4. coordinate 配置\n chart.coordinate(coordinate);\n\n // 5. axis 轴配置 (默认不展示)\n if (!axes) {\n chart.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n chart.axis(field, axis);\n });\n }\n\n // 6. tooltip 配置\n if (tooltip) {\n chart.interaction('tooltip');\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.removeInteraction('tooltip');\n }\n\n // 7. legend 配置(默认展示)\n chart.legend(legend);\n\n // theme 配置\n if (theme) {\n chart.theme(theme);\n }\n\n // 8. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n chart.removeInteraction(interaction.type);\n } else {\n chart.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 9. annotations\n each(annotations, (annotation) => {\n chart.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n return params;\n}\n\n/**\n * 分面图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<FacetOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(theme, facetAdaptor, component)(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/facet/adaptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,SAAS,YAAY,CAAC,MAA4B;IACxC,IAAA,KAAK,GAAc,MA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,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;SACtD;IACH,CAAC,CAAC,CAAC;IAEH,iBAAiB;IACjB,IAAI,CAAC,WAAW,EAAE,UAAC,UAAU;QAC3B,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,cAC9B,UAAU,EACb,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { each, omit } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { Axis, Interaction } from '../../types';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { execPlotAdaptor } from '../mix/utils';\nimport { FacetOptions, IPlot, IView } from './types';\nimport { execViewAdaptor } from './utils';\n\nfunction facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const { type: facetType, data, fields, eachView } = options;\n\n const restFacetCfg = omit(options as any, [\n 'type',\n 'data',\n 'fields',\n 'eachView',\n 'axes',\n 'meta',\n 'tooltip',\n 'coordinate',\n 'theme',\n 'legend',\n 'interactions',\n 'annotations',\n ]);\n\n // 1. data\n chart.data(data);\n\n // 2. facet\n chart.facet(facetType, {\n ...restFacetCfg,\n fields,\n eachView: (viewOfG2, facet) => {\n const viewOptions = eachView(viewOfG2, facet);\n if ((viewOptions as IView).geometries) {\n execViewAdaptor(viewOfG2, viewOptions as IView);\n } else {\n const plot = viewOptions as IPlot;\n const plotOptions = plot.options;\n\n // 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段\n ['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach((key) => {\n if (options[key] && typeof plotOptions[key] === 'undefined') {\n plotOptions[key] = options[key];\n }\n });\n\n // @ts-ignore 仪表盘没 tooltip\n if (plotOptions.tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n execPlotAdaptor(plot.type, viewOfG2, plotOptions);\n }\n },\n });\n\n return params;\n}\n\nfunction component(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const {\n axes,\n meta,\n tooltip,\n coordinate,\n theme,\n legend,\n interactions,\n annotations,\n shapeField,\n sizeField,\n shapeLegend,\n sizeLegend,\n } = options;\n\n // 3. meta 配置\n let scales: Record<string, any> = {};\n if (axes) {\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n }\n\n scales = deepAssign({}, meta, scales);\n chart.scale(scales);\n\n // 4. coordinate 配置\n chart.coordinate(coordinate);\n\n // 5. axis 轴配置 (默认不展示)\n if (!axes) {\n chart.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n chart.axis(field, axis);\n });\n }\n\n // 6. tooltip 配置\n if (tooltip) {\n chart.interaction('tooltip');\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.removeInteraction('tooltip');\n }\n\n // 7. legend 配置(默认展示)\n chart.legend(legend);\n const showLegend = legend !== false;\n if (shapeField) {\n if (shapeLegend) {\n chart.legend(shapeField, shapeLegend);\n } else {\n chart.legend(shapeField, shapeLegend === false ? false : legend);\n }\n }\n\n if (sizeField) {\n chart.legend(sizeField, sizeLegend ? sizeLegend : false);\n }\n // /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */\n if (!showLegend && !shapeLegend && !sizeLegend) {\n chart.legend(false);\n }\n\n // theme 配置\n if (theme) {\n chart.theme(theme);\n }\n\n // 8. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n chart.removeInteraction(interaction.type);\n } else {\n chart.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 9. annotations\n each(annotations, (annotation) => {\n chart.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n return params;\n}\n\n/**\n * 分面图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<FacetOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(theme, facetAdaptor, component)(params);\n}\n"]}
@@ -141,8 +141,33 @@ export interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.Fa
141
141
  */
142
142
  readonly legend?: Legend;
143
143
  /**
144
- * @title 图例配置
144
+ * @title 交互配置
145
145
  */
146
146
  readonly interactions?: Interaction[];
147
+ /**
148
+ * @title 形状字段
149
+ * @description 形状映射字段
150
+ */
151
+ readonly shapeField?: string;
152
+ /**
153
+ * @title 颜色字段
154
+ * @description 颜色映射字段
155
+ */
156
+ readonly colorField?: string;
157
+ /**
158
+ * @title 大小字段
159
+ * @description 大小映射字段
160
+ */
161
+ readonly sizeField?: string;
162
+ /**
163
+ * @title 形状图例配置
164
+ * @description 形状图例的配置项
165
+ */
166
+ readonly shapeLegend?: Legend | false;
167
+ /**
168
+ * @title 大小图例配置
169
+ * @description 大小图例的配置项
170
+ */
171
+ readonly sizeLegend?: Legend | false;
147
172
  }
148
173
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title 图例配置\n */\n readonly interactions?: Interaction[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title 交互配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title 形状字段\n * @description 形状映射字段\n */\n readonly shapeField?: string;\n /**\n * @title 颜色字段\n * @description 颜色映射字段\n */\n readonly colorField?: string;\n /**\n * @title 大小字段\n * @description 大小映射字段\n */\n readonly sizeField?: string;\n /**\n * @title 形状图例配置\n * @description 形状图例的配置项\n */\n readonly shapeLegend?: Legend | false;\n /**\n * @title 大小图例配置\n * @description 大小图例的配置项\n */\n readonly sizeLegend?: Legend | false;\n}\n"]}
@@ -42,6 +42,8 @@ export type Geometry = {
42
42
  readonly rawFields?: RawFields;
43
43
  /** 图形映射规则 */
44
44
  readonly mapping?: MappingOptions;
45
+ /** 自定义映射字段 */
46
+ readonly customMappingField?: string;
45
47
  /** label 映射通道,因为历史原因导致实现略有区别 */
46
48
  readonly label?: Label;
47
49
  /** 不同状态的样式 */
@@ -79,7 +79,7 @@ exports.getMappingFunction = getMappingFunction;
79
79
  */
80
80
  function geometry(params) {
81
81
  var chart = params.chart, options = params.options;
82
- var type = options.type, args = options.args, mapping = options.mapping, xField = options.xField, yField = options.yField, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, tooltipFields = options.tooltipFields, label = options.label, state = options.state, customInfo = options.customInfo;
82
+ var type = options.type, args = options.args, mapping = options.mapping, xField = options.xField, yField = options.yField, colorField = options.colorField, shapeField = options.shapeField, sizeField = options.sizeField, tooltipFields = options.tooltipFields, label = options.label, state = options.state, customInfo = options.customInfo, customMappingField = options.customMappingField;
83
83
  // 如果没有 mapping 信息,那么直接返回
84
84
  if (!mapping) {
85
85
  return params;
@@ -99,7 +99,7 @@ function geometry(params) {
99
99
  }
100
100
  else if ((0, util_1.isFunction)(color)) {
101
101
  var _a = getMappingField(options, 'color'), mappingFields = _a.mappingFields, tileMappingField = _a.tileMappingField;
102
- geometry.color(tileMappingField, getMappingFunction(mappingFields, color));
102
+ geometry.color(customMappingField || tileMappingField, getMappingFunction(mappingFields, color));
103
103
  }
104
104
  else {
105
105
  colorField && geometry.color(colorField, color);
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;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U,CAAC,UAAU,CAAC,CAAC;KACjC;IAED,2BAA2B;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC;SACb,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,KAAK,UAAU,EAAhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AAzID,4BAyIC","sourcesContent":["import { isEmpty, isFunction, isNumber, isObject, isString, uniq } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, Datum, Options, RawFields, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/adaptor/geometries/base.ts"],"names":[],"mappings":";;;;AAAA,mCAAqF;AAKrF,qCAA6C;AA4D7C;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,CAAkB,EAClB,KAA2C;IAKnC,IAAA,IAAI,GAAoE,CAAC,KAArE,EAAE,MAAM,GAA4D,CAAC,OAA7D,EAAE,MAAM,GAAoD,CAAC,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AhB,CAAgB,CAAC;SACvC,OAAO,CAAC,UAAC,CAAS;QACjB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACL,6CACK,MAAM;QACT,gFAAgF;QAChF,GAAG,EAAE,EAAE,QAAQ,UAAA,EAAE,IACjB;AACJ,CAAC;AA1ID,4BA0IC","sourcesContent":["import { isEmpty, isFunction, isNumber, isObject, isString, uniq } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { ColorAttr, Datum, Options, RawFields, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr } from '../../types';\nimport { Label } from '../../types/label';\nimport { State } from '../../types/state';\nimport { transformLabel } from '../../utils';\n\n/**\n * 图形映射属性,按照优先级来的\n */\nexport type MappingOptions = {\n /** color 映射 */\n readonly color?: ColorAttr;\n /** shape 映射 */\n readonly shape?: ShapeAttr;\n /** 大小映射, 提供回调的方式 */\n readonly size?: SizeAttr;\n /** 样式映射 */\n readonly style?: StyleAttr;\n /** tooltip 映射 */\n readonly tooltip?: TooltipAttr;\n};\n\n/**\n * 一个图形映射的逻辑,纯粹的图形语法\n * // TODO 后续需要处理 adjust 的配置,然后通过 field 信息。比如 styleField,labelField 等一定是一个数组形式\n */\nexport type Geometry = {\n /** geometry 类型, 'line' | 'interval' | 'point' | 'area' | 'polygon' */\n readonly type?: string;\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 分组字段 */\n readonly colorField?: string;\n /** shape 的映射字段 */\n readonly shapeField?: string;\n /** size 映射字段 */\n readonly sizeField?: string;\n /** style 的映射字段 */\n readonly styleField?: string;\n /** tooltip 的映射字段 */\n readonly tooltipFields?: string[] | false;\n /** 其他原始字段, 用于 mapping 回调参数 */\n readonly rawFields?: RawFields;\n /** 图形映射规则 */\n readonly mapping?: MappingOptions;\n /** 自定义映射字段 */\n readonly customMappingField?: string;\n /** label 映射通道,因为历史原因导致实现略有区别 */\n readonly label?: Label;\n /** 不同状态的样式 */\n readonly state?: State;\n /** 自定义信息,一般在 registerShape 中使用 */\n readonly customInfo?: any;\n /** geometry params */\n readonly args?: any;\n};\n\n/**\n * geometry options\n */\nexport type GeometryOptions = Geometry & Partial<Options>;\n\n/**\n * 获得映射的字段列表\n * @param options\n * @param field\n */\nexport function getMappingField(\n o: GeometryOptions,\n field: 'color' | 'shape' | 'size' | 'style'\n): {\n mappingFields: string[];\n tileMappingField: string;\n} {\n const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;\n let { rawFields } = o;\n\n let fields = [];\n rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];\n\n // 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效\n // 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields\n // shape, size 同理\n if (field === 'color') {\n fields = [colorField || xField, ...rawFields];\n } else if (field === 'shape') {\n fields = [shapeField || xField, ...rawFields];\n } else if (field === 'size') {\n fields = [sizeField || xField, ...rawFields];\n } else {\n fields = [xField, yField, colorField, shapeField, sizeField, styleField, ...rawFields];\n\n // 一定能找到的!\n const idx = ['x', 'y', 'color', 'shape', 'size', 'style'].indexOf(field);\n\n const f = fields[idx];\n // 删除当前字段\n fields.splice(idx, 1);\n // 插入到第一个\n fields.unshift(f);\n }\n\n const mappingFields = uniq(fields.filter((f) => !!f));\n /**\n * 修复 line geometry 无拆分时 color 回调错误\n * eg:\n * geometry.color(xField, ()=> '#f24')\n */\n const tileMappingField =\n type === 'line' && [xField, yField].includes(mappingFields.join('*')) ? '' : mappingFields.join('*');\n return {\n mappingFields,\n tileMappingField,\n };\n}\n\n/**\n * 获得映射函数\n * @param mappingFields\n * @param func\n */\nexport function getMappingFunction(mappingFields: string[], func: (datum: Datum) => any) {\n if (!func) return undefined;\n // 返回函数\n return (...args: any[]) => {\n const params: Datum = {};\n\n mappingFields.forEach((f: string, idx: number) => {\n params[f] = args[idx];\n });\n\n // 删除 undefined\n delete params['undefined'];\n\n return func(params);\n };\n}\n\n/**\n * 通用 geometry 的配置处理的 adaptor\n * @param params\n */\nexport function geometry<O extends GeometryOptions>(params: Params<O>): Params<O> {\n const { chart, options } = params;\n const {\n type,\n args,\n mapping,\n xField,\n yField,\n colorField,\n shapeField,\n sizeField,\n tooltipFields,\n label,\n state,\n customInfo,\n customMappingField,\n } = options;\n\n // 如果没有 mapping 信息,那么直接返回\n if (!mapping) {\n return params;\n }\n\n const { color, shape, size, style, tooltip } = mapping;\n\n // 创建 geometry\n const geometry = chart[type](args).position(`${xField}*${yField}`);\n\n /**\n * color 的几种情况\n * g.color('red');\n * g.color('color', ['red', 'blue']);\n * g.color('x', (x, y) => 'red');\n * g.color('color', (color, x, y) => 'red');\n */\n if (isString(color)) {\n colorField ? geometry.color(colorField, color) : geometry.color(color);\n } else if (isFunction(color)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'color');\n geometry.color(customMappingField || tileMappingField, getMappingFunction(mappingFields, color));\n } else {\n colorField && geometry.color(colorField, color);\n }\n\n /**\n * shape 的几种情况\n * g.shape('rect');\n * g.shape('shape', ['rect', 'circle']);\n * g.shape('x*y', (x, y) => 'rect');\n * g.shape('shape*x*y', (shape, x, y) => 'rect');\n */\n if (isString(shape)) {\n shapeField ? geometry.shape(shapeField, [shape]) : geometry.shape(shape); // [shape] 需要在 G2 做掉\n } else if (isFunction(shape)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'shape');\n geometry.shape(tileMappingField, getMappingFunction(mappingFields, shape));\n } else {\n shapeField && geometry.shape(shapeField, shape);\n }\n\n /**\n * size 的几种情况\n * g.size(10);\n * g.size('size', [10, 20]);\n * g.size('x*y', (x, y) => 10);\n * g.color('size*x*y', (size, x, y) => 1-);\n */\n if (isNumber(size)) {\n sizeField ? geometry.size(sizeField, size) : geometry.size(size);\n } else if (isFunction(size)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'size');\n geometry.size(tileMappingField, getMappingFunction(mappingFields, size));\n } else {\n sizeField && geometry.size(sizeField, size);\n }\n\n /**\n * style 的几种情况\n * g.style({ fill: 'red' });\n * g.style('x*y*color', (x, y, color) => ({ fill: 'red' }));\n */\n if (isFunction(style)) {\n const { mappingFields, tileMappingField } = getMappingField(options, 'style');\n geometry.style(tileMappingField, getMappingFunction(mappingFields, style));\n } else if (isObject(style)) {\n geometry.style(style);\n }\n\n /**\n * tooltip 的 API\n * g.tooltip('x*y*color', (x, y, color) => ({ name, value }));\n * g.tooltip(false);\n */\n if (tooltipFields === false) {\n geometry.tooltip(false);\n } else if (!isEmpty(tooltipFields)) {\n geometry.tooltip(tooltipFields.join('*'), getMappingFunction(tooltipFields, tooltip));\n }\n\n /**\n * label 的映射\n */\n if (label === false) {\n geometry.label(false);\n } else if (label) {\n const { callback, fields, ...cfg } = label;\n geometry.label({\n fields: fields || [yField],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n /**\n * state 状态样式\n */\n if (state) {\n geometry.state(state);\n }\n\n /**\n * 自定义信息\n */\n if (customInfo) {\n geometry.customInfo(customInfo);\n }\n\n // 防止因为 x y 字段做了通道映射,导致生成图例\n [xField, yField]\n .filter((f: string) => f !== colorField)\n .forEach((f: string) => {\n chart.legend(f, false);\n });\n return {\n ...params,\n // geometry adaptor 额外需要做的事情,就是将创建好的 geometry 返回到下一层 adaptor,防止通过 type 查询的时候容易误判\n ext: { geometry },\n };\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.32";
1
+ export declare const version = "2.4.34";
2
2
  import * as G2 from '@antv/g2';
3
3
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
4
4
  import { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flow = exports.P = exports.WordCloud = exports.Waterfall = exports.Violin = exports.Venn = exports.Treemap = exports.TinyLine = exports.TinyColumn = exports.TinyArea = exports.Sunburst = exports.Stock = exports.Scatter = exports.Sankey = exports.Rose = exports.RingProgress = exports.RadialBar = exports.Radar = exports.Progress = exports.Pie = exports.MultiView = exports.Mix = exports.Liquid = exports.addWaterWave = exports.Line = exports.Histogram = exports.Heatmap = exports.Gauge = exports.FUNNEL_CONVERSATION_FIELD = exports.Funnel = exports.Facet = exports.DualAxes = exports.Column = exports.CirclePacking = exports.Chord = exports.Bullet = exports.Box = exports.BidirectionalBar = exports.Bar = exports.Area = exports.Lab = exports.Plot = exports.setGlobal = exports.schema = exports.polygon = exports.point = exports.line = exports.interval = exports.area = exports.version = void 0;
4
4
  exports.adaptors = exports.registerLocale = exports.G2 = exports.getCanvasPattern = exports.measureTextWidth = void 0;
5
5
  var tslib_1 = require("tslib");
6
- exports.version = '2.4.32';
6
+ exports.version = '2.4.34';
7
7
  // G2 自定义能力透出
8
8
  var G2 = tslib_1.__importStar(require("@antv/g2"));
9
9
  exports.G2 = G2;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AA2ItB,gBAAE;AA1IX,uCAAuC;AACvC,2CAAqG;AACrG,QAAQ;AACR,wCAA+C;AAyItC,+FAzIA,uBAAc,OAyIA;AAxIvB,yCAA+C;AAC/C,yCAA+C;AAC/C,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AAWrD,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAClB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,oDAAoD;AACpD,6BAA4B;AAAnB,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,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.32';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AA2ItB,gBAAE;AA1IX,uCAAuC;AACvC,2CAAqG;AACrG,QAAQ;AACR,wCAA+C;AAyItC,+FAzIA,uBAAc,OAyIA;AAxIvB,yCAA+C;AAC/C,yCAA+C;AA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V,SAAS;AACT,kDAAwB;AACxB,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAC/B,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAKzB,8BAA8B;AAC9B,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.34';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
@@ -22,8 +22,8 @@ var doSliderFilter = function (view, sliderValue) {
22
22
  var values = (0, util_1.valuesOfKey)(data, xScale.field);
23
23
  var xValues = isHorizontal ? values : values.reverse();
24
24
  var xTickCount = (0, util_1.size)(xValues);
25
- var minIndex = Math.floor(min * (xTickCount - 1));
26
- var maxIndex = Math.floor(max * (xTickCount - 1));
25
+ var minIndex = Math.round(min * (xTickCount - 1));
26
+ var maxIndex = Math.round(max * (xTickCount - 1));
27
27
  // 增加 x 轴的过滤器
28
28
  view.filter(xScale.field, function (value) {
29
29
  var idx = xValues.indexOf(value);
@@ -1 +1 @@
1
- {"version":3,"file":"render-sider.js","sourceRoot":"","sources":["../../../../src/plots/dual-axes/util/render-sider.ts"],"names":[],"mappings":";;;AACA,mCAA+C;AAC/C,wCAA2C;AAE3C;;;;;;GAMG;AACI,IAAM,cAAc,GAAG,UAAC,IAAU,EAAE,WAA6B;IAC/D,IAAA,GAAG,GAAS,WAAW,GAApB,EAAE,GAAG,GAAI,WAAW,GAAf,CAAgB;IAC/B,IAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC;IACpC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,IAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO;KACR;IACD,IAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,IAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,IAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,CAAC;IACjC,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACpD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEpD,aAAa;IACb,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAC,KAAU;QACnC,IAAM,GAAG,GAAW,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB","sourcesContent":["import { View } from '@antv/g2';\nimport { size, valuesOfKey } from '@antv/util';\nimport { isBetween } from '../../../utils';\n\n/**\n * 右侧 View 进行 slider 过滤\n * 由于双轴图是多 View , 需要监听左侧 Slider 的 change 事件来同步右侧 View\n * @param { View } view 右侧视图\n * @param { number[] } sliderValue 滑块当前值\n * @returns void\n */\nexport const doSliderFilter = (view: View, sliderValue: [number, number]) => {\n const [min, max] = sliderValue;\n const data = view.getOptions().data;\n const xScale = view.getXScale();\n const dataSize = size(data);\n if (!xScale || !dataSize) {\n return;\n }\n const isHorizontal = true;\n const values = valuesOfKey(data, xScale.field);\n const xValues = isHorizontal ? values : values.reverse();\n const xTickCount = size(xValues);\n const minIndex = Math.floor(min * (xTickCount - 1));\n const maxIndex = Math.floor(max * (xTickCount - 1));\n\n // 增加 x 轴的过滤器\n view.filter(xScale.field, (value: any) => {\n const idx: number = xValues.indexOf(value);\n return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;\n });\n view.getRootView().render(true);\n};\n"]}
1
+ {"version":3,"file":"render-sider.js","sourceRoot":"","sources":["../../../../src/plots/dual-axes/util/render-sider.ts"],"names":[],"mappings":";;;AACA,mCAA+C;AAC/C,wCAA2C;AAE3C;;;;;;GAMG;AACI,IAAM,cAAc,GAAG,UAAC,IAAU,EAAE,WAA6B;IAC/D,IAAA,GAAG,GAAS,WAAW,GAApB,EAAE,GAAG,GAAI,WAAW,GAAf,CAAgB;IAC/B,IAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC;IACpC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,IAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO;KACR;IACD,IAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,IAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,IAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,CAAC;IACjC,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACpD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEpD,aAAa;IACb,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAC,KAAU;QACnC,IAAM,GAAG,GAAW,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB","sourcesContent":["import { View } from '@antv/g2';\nimport { size, valuesOfKey } from '@antv/util';\nimport { isBetween } from '../../../utils';\n\n/**\n * 右侧 View 进行 slider 过滤\n * 由于双轴图是多 View , 需要监听左侧 Slider 的 change 事件来同步右侧 View\n * @param { View } view 右侧视图\n * @param { number[] } sliderValue 滑块当前值\n * @returns void\n */\nexport const doSliderFilter = (view: View, sliderValue: [number, number]) => {\n const [min, max] = sliderValue;\n const data = view.getOptions().data;\n const xScale = view.getXScale();\n const dataSize = size(data);\n if (!xScale || !dataSize) {\n return;\n }\n const isHorizontal = true;\n const values = valuesOfKey(data, xScale.field);\n const xValues = isHorizontal ? values : values.reverse();\n const xTickCount = size(xValues);\n const minIndex = Math.round(min * (xTickCount - 1));\n const maxIndex = Math.round(max * (xTickCount - 1));\n\n // 增加 x 轴的过滤器\n view.filter(xScale.field, (value: any) => {\n const idx: number = xValues.indexOf(value);\n return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;\n });\n view.getRootView().render(true);\n};\n"]}