@antv/g2plot 2.4.18 → 2.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.18";
1
+ export declare const version = "2.4.19";
2
2
  import * as G2 from '@antv/g2';
3
3
  export { G2 };
4
4
  import { registerLocale } from './core/locale';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export var version = '2.4.18';
1
+ export var version = '2.4.19';
2
2
  // G2 自定义能力透出
3
3
  import * as G2 from '@antv/g2';
4
4
  export { G2 };
package/esm/index.js.map CHANGED
@@ -1 +1 @@
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,OAAO,EAAE,EAAE,EAAE,CAAC;AAEd,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,WAAW;AACX,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKnC,SAAS;AACT,cAAc,SAAS,CAAC;AAExB,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cA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ACvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjD,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AASpF,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrG,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;AAE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.4.18';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\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\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\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\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\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\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\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\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\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\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\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\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\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\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\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,OAAO,EAAE,EAAE,EAAE,CAAC;AAEd,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,WAAW;AACX,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKnC,SAAS;AACT,cAAc,SAAS,CAAC;AAExB,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,uDAAuD;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,yDAAyD;AACzD,OAAO,EAAE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QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AASpF,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrG,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;AAE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.4.19';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\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\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\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\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\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\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\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\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\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\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\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\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\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\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
@@ -25,10 +25,14 @@ var Bar = /** @class */ (function (_super) {
25
25
  * @override
26
26
  */
27
27
  Bar.prototype.changeData = function (data) {
28
+ var _a, _b;
28
29
  this.updateOption({ data: data });
29
- var _a = this, chart = _a.chart, options = _a.options;
30
- var xField = options.xField, yField = options.yField, isPercent = options.isPercent;
31
- var switchedFieldOptions = __assign(__assign({}, options), { xField: yField, yField: xField });
30
+ var _c = this, chart = _c.chart, options = _c.options;
31
+ var isPercent = options.isPercent;
32
+ var xField = options.xField, yField = options.yField, xAxis = options.xAxis, yAxis = options.yAxis;
33
+ _a = [yField, xField], xField = _a[0], yField = _a[1];
34
+ _b = [yAxis, xAxis], xAxis = _b[0], yAxis = _b[1];
35
+ var switchedFieldOptions = __assign(__assign({}, options), { xField: xField, yField: yField, yAxis: yAxis, xAxis: xAxis });
32
36
  meta({ chart: chart, options: switchedFieldOptions });
33
37
  chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));
34
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/bar/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C;;GAEG;AACH;IAAyB,uBAAgB;IAAzC;QAAA,qEAqCC;QA5BC,WAAW;QACK,UAAI,GAAW,KAAK,CAAC;;IA2BvC,CAAC;IApCC;;;OAGG;IACI,qBAAiB,GAAxB;QACE,OAAO,eAAe,CAAC;IACzB,CAAC;IAKD;;OAEG;IACI,wBAAU,GAAjB,UAAkB,IAAwB;QACxC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QACxB,IAAA,MAAM,GAAwB,OAAO,OAA/B,EAAE,MAAM,GAAgB,OAAO,OAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,CAAa;QAC9C,IAAM,oBAAoB,yBAAQ,OAAO,KAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,CAAC;QAC5E,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACO,+BAAiB,GAA3B;QACE,OAAO,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,8BAAgB,GAA1B;QACE,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,UAAC;AAAD,CAAC,AArCD,CAAyB,IAAI,GAqC5B","sourcesContent":["import { Plot } from '../../core/plot';\nimport { Adaptor } from '../../core/adaptor';\nimport { getDataWhetherPercentage } from '../../utils/transform/percent';\nimport { BarOptions } from './types';\nimport { adaptor, meta } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\n\nexport type { BarOptions };\n\n/**\n * 条形图\n */\nexport class Bar extends Plot<BarOptions> {\n /**\n * 获取 条形图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<BarOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public readonly type: string = 'bar';\n\n /**\n * @override\n */\n public changeData(data: BarOptions['data']) {\n this.updateOption({ data });\n const { chart, options } = this;\n const { xField, yField, isPercent } = options;\n const switchedFieldOptions = { ...options, xField: yField, yField: xField };\n meta({ chart, options: switchedFieldOptions });\n chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));\n }\n\n /**\n * 获取 条形图 默认配置\n */\n protected getDefaultOptions() {\n return Bar.getDefaultOptions();\n }\n\n /**\n * 获取 条形图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<BarOptions> {\n return adaptor;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/bar/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C;;GAEG;AACH;IAAyB,uBAAgB;IAAzC;QAAA,qEAwCC;QA/BC,WAAW;QACK,UAAI,GAAW,KAAK,CAAC;;IA8BvC,CAAC;IAvCC;;;OAGG;IACI,qBAAiB,GAAxB;QACE,OAAO,eAAe,CAAC;IACzB,CAAC;IAKD;;OAEG;IACI,wBAAU,GAAjB,UAAkB,IAAwB;;QACxC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QACxB,IAAA,SAAS,GAAK,OAAO,UAAZ,CAAa;QACxB,IAAA,MAAM,GAA2B,OAAO,OAAlC,EAAE,MAAM,GAAmB,OAAO,OAA1B,EAAE,KAAK,GAAY,OAAO,MAAnB,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAa;QAC/C,KAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAlC,MAAM,QAAA,EAAE,MAAM,QAAA,CAAqB;QACpC,KAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,EAA9B,KAAK,QAAA,EAAE,KAAK,QAAA,CAAmB;QAChC,IAAM,oBAAoB,yBAAQ,OAAO,KAAE,MAAM,QAAA,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,GAAE,CAAC;QAC1E,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,UAAU,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACO,+BAAiB,GAA3B;QACE,OAAO,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,8BAAgB,GAA1B;QACE,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,UAAC;AAAD,CAAC,AAxCD,CAAyB,IAAI,GAwC5B","sourcesContent":["import { Plot } from '../../core/plot';\nimport { Adaptor } from '../../core/adaptor';\nimport { getDataWhetherPercentage } from '../../utils/transform/percent';\nimport { BarOptions } from './types';\nimport { adaptor, meta } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\n\nexport type { BarOptions };\n\n/**\n * 条形图\n */\nexport class Bar extends Plot<BarOptions> {\n /**\n * 获取 条形图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<BarOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public readonly type: string = 'bar';\n\n /**\n * @override\n */\n public changeData(data: BarOptions['data']) {\n this.updateOption({ data });\n const { chart, options } = this;\n const { isPercent } = options;\n let { xField, yField, xAxis, yAxis } = options;\n [xField, yField] = [yField, xField];\n [xAxis, yAxis] = [yAxis, xAxis];\n const switchedFieldOptions = { ...options, xField, yField, yAxis, xAxis };\n meta({ chart, options: switchedFieldOptions });\n chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));\n }\n\n /**\n * 获取 条形图 默认配置\n */\n protected getDefaultOptions() {\n return Bar.getDefaultOptions();\n }\n\n /**\n * 获取 条形图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<BarOptions> {\n return adaptor;\n }\n}\n"]}
@@ -1,3 +1,13 @@
1
+ /**
2
+ * 获取分类字段 key 值 一个分类值的时候, 返回非索引 key 值,在 tooltip 不做索引区分
3
+ * @param values 数据量
4
+ * @param field 指标字段
5
+ * @param index 索引
6
+ * @returns string
7
+ */
8
+ function getSeriesFieldKey(values, field, index) {
9
+ return values.length > 1 ? field + "_" + index : "" + field;
10
+ }
1
11
  /**
2
12
  * bullet 处理数据
3
13
  * @param options
@@ -7,12 +17,12 @@ export function transformData(options) {
7
17
  var ds = [];
8
18
  var scales = [];
9
19
  data.forEach(function (item, index) {
10
- var _a;
11
20
  // 构建 title * range
12
- item[rangeField].sort(function (a, b) { return a - b; });
13
- item[rangeField].forEach(function (d, i) {
21
+ var rangeValues = [item[rangeField]].flat();
22
+ rangeValues.sort(function (a, b) { return a - b; });
23
+ rangeValues.forEach(function (d, i) {
14
24
  var _a;
15
- var range = i === 0 ? d : item[rangeField][i] - item[rangeField][i - 1];
25
+ var range = i === 0 ? d : rangeValues[i] - rangeValues[i - 1];
16
26
  ds.push((_a = {
17
27
  rKey: rangeField + "_" + i
18
28
  },
@@ -21,22 +31,27 @@ export function transformData(options) {
21
31
  _a));
22
32
  });
23
33
  // 构建 title * measure
24
- item[measureField].forEach(function (d, i) {
34
+ var measureValues = [item[measureField]].flat();
35
+ measureValues.forEach(function (d, i) {
25
36
  var _a;
26
37
  ds.push((_a = {
27
- mKey: item[measureField].length > 1 ? measureField + "_" + i : "" + measureField
38
+ mKey: getSeriesFieldKey(measureValues, measureField, i)
28
39
  },
29
40
  _a[xField] = xField ? item[xField] : String(index),
30
41
  _a[measureField] = d,
31
42
  _a));
32
43
  });
33
44
  // 构建 title * target
34
- ds.push((_a = {
35
- tKey: "" + targetField
36
- },
37
- _a[xField] = xField ? item[xField] : String(index),
38
- _a[targetField] = item[targetField],
39
- _a));
45
+ var targetValues = [item[targetField]].flat();
46
+ targetValues.forEach(function (d, i) {
47
+ var _a;
48
+ ds.push((_a = {
49
+ tKey: getSeriesFieldKey(targetValues, targetField, i)
50
+ },
51
+ _a[xField] = xField ? item[xField] : String(index),
52
+ _a[targetField] = d,
53
+ _a));
54
+ });
40
55
  // 为了取最大值和最小值,先存储
41
56
  scales.push(item[rangeField], item[measureField], item[targetField]);
42
57
  });
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/bullet/utils.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAsB;IAC1C,IAAA,IAAI,GAA4D,OAAO,KAAnE,EAAE,MAAM,GAAoD,OAAO,OAA3D,EAAE,YAAY,GAAsC,OAAO,aAA7C,EAAE,UAAU,GAA0B,OAAO,WAAjC,EAAE,WAAW,GAAa,OAAO,YAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAChF,IAAM,EAAE,GAAU,EAAE,CAAC;IACrB,IAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAC,IAAS,EAAE,KAAa;;QACpC,mBAAmB;QACnB,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAC,CAAS,EAAE,CAAS;;YAC5C,IAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAA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GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,kBAAkB;IAClB,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAExB,cAAc;IACd,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,EAAE,CAAC,OAAO,EAAE,CAAC;KACd;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,GAAG,KAAA,EAAE,EAAE,IAAA,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { BulletOptions } from './types';\n\ntype TransformData = {\n min: number;\n max: number;\n ds: any[];\n};\n/**\n * bullet 处理数据\n * @param options\n */\nexport function transformData(options: BulletOptions): TransformData {\n const { data, xField, measureField, rangeField, targetField, layout } = options;\n const ds: any[] = [];\n const scales: number[] = [];\n data.forEach((item: any, index: number) => {\n // 构建 title * range\n item[rangeField].sort((a: number, b: number) => a - b);\n item[rangeField].forEach((d: number, i: number) => {\n const range = i === 0 ? d : item[rangeField][i] - item[rangeField][i - 1];\n ds.push({\n rKey: `${rangeField}_${i}`,\n [xField]: xField ? item[xField] : String(index), // 没有xField就用索引\n [rangeField]: range,\n });\n });\n // 构建 title * measure\n item[measureField].forEach((d: number, i: number) => {\n ds.push({\n mKey: item[measureField].length > 1 ? `${measureField}_${i}` : `${measureField}`, // 一个数据就不带索引了\n [xField]: xField ? item[xField] : String(index),\n [measureField]: d,\n });\n });\n // 构建 title * target\n ds.push({\n tKey: `${targetField}`,\n [xField]: xField ? item[xField] : String(index),\n [targetField]: item[targetField],\n });\n // 为了取最大值和最小值,先存储\n scales.push(item[rangeField], item[measureField], item[targetField]);\n });\n // scales 是嵌套的需要拍平\n let min = Math.min(...scales.flat(Infinity));\n const max = Math.max(...scales.flat(Infinity));\n // min 大于 0 从 0 开始\n min = min > 0 ? 0 : min;\n\n // 垂直情况,需要反转数据\n if (layout === 'vertical') {\n ds.reverse();\n }\n return { min, max, ds };\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/bullet/utils.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,MAAgB,EAAE,KAAa,EAAE,KAAa;IACvE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAI,KAAK,SAAI,KAAO,CAAC,CAAC,CAAC,KAAG,KAAO,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAsB;IAC1C,IAAA,IAAI,GAA4D,OAAO,KAAnE,EAAE,MAAM,GAAoD,OAAO,OAA3D,EAAE,YAAY,GAAsC,OAAO,aAA7C,EAAE,UAAU,GAA0B,OAAO,WAAjC,EAAE,WAAW,GAAa,OAAO,YAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAChF,IAAM,EAAE,GAAU,EAAE,CAAC;IACrB,IAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAC,IAAS,EAAE,KAAa;QACpC,mBAAmB;QACnB,IAAM,WAAW,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,WAAW,CAAC,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;QAClD,WAAW,CAAC,OAAO,CAAC,UAAC,CAAS,EAAE,CAAS;;YACvC,IAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAChE,EAAE,CAAC,IAAI;oBACL,IAAI,EAAK,UAAU,SAAI,CAAG;;gBAC1B,GAAC,MAAM,IAAG,MAAM,CAAC,CAAC,CA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I,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,kBAAkB;IAClB,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAExB,cAAc;IACd,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,EAAE,CAAC,OAAO,EAAE,CAAC;KACd;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,GAAG,KAAA,EAAE,EAAE,IAAA,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { BulletOptions } from './types';\n\ntype TransformData = {\n min: number;\n max: number;\n ds: any[];\n};\n\n/**\n * 获取分类字段 key 值 一个分类值的时候, 返回非索引 key 值,在 tooltip 不做索引区分\n * @param values 数据量\n * @param field 指标字段\n * @param index 索引\n * @returns string\n */\nfunction getSeriesFieldKey(values: number[], field: string, index: number): string {\n return values.length > 1 ? `${field}_${index}` : `${field}`;\n}\n\n/**\n * bullet 处理数据\n * @param options\n */\nexport function transformData(options: BulletOptions): TransformData {\n const { data, xField, measureField, rangeField, targetField, layout } = options;\n const ds: any[] = [];\n const scales: number[] = [];\n data.forEach((item: any, index: number) => {\n // 构建 title * range\n const rangeValues = [item[rangeField]].flat();\n rangeValues.sort((a: number, b: number) => a - b);\n rangeValues.forEach((d: number, i: number) => {\n const range = i === 0 ? d : rangeValues[i] - rangeValues[i - 1];\n ds.push({\n rKey: `${rangeField}_${i}`,\n [xField]: xField ? item[xField] : String(index), // 没有xField就用索引\n [rangeField]: range,\n });\n });\n\n // 构建 title * measure\n const measureValues = [item[measureField]].flat();\n measureValues.forEach((d: number, i: number) => {\n ds.push({\n mKey: getSeriesFieldKey(measureValues, measureField, i),\n [xField]: xField ? item[xField] : String(index),\n [measureField]: d,\n });\n });\n\n // 构建 title * target\n const targetValues = [item[targetField]].flat();\n targetValues.forEach((d: number, i: number) => {\n ds.push({\n tKey: getSeriesFieldKey(targetValues, targetField, i),\n [xField]: xField ? item[xField] : String(index),\n [targetField]: d,\n });\n });\n\n // 为了取最大值和最小值,先存储\n scales.push(item[rangeField], item[measureField], item[targetField]);\n });\n // scales 是嵌套的需要拍平\n let min = Math.min(...scales.flat(Infinity));\n const max = Math.max(...scales.flat(Infinity));\n // min 大于 0 从 0 开始\n min = min > 0 ? 0 : min;\n\n // 垂直情况,需要反转数据\n if (layout === 'vertical') {\n ds.reverse();\n }\n return { min, max, ds };\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.18";
1
+ export declare const version = "2.4.19";
2
2
  import * as G2 from '@antv/g2';
3
3
  export { G2 };
4
4
  import { registerLocale } from './core/locale';
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.adaptors = exports.registerLocale = exports.G2 = exports.version = void 0;
4
4
  var tslib_1 = require("tslib");
5
- exports.version = '2.4.18';
5
+ exports.version = '2.4.19';
6
6
  // G2 自定义能力透出
7
7
  var G2 = tslib_1.__importStar(require("@antv/g2"));
8
8
  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;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAEl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,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,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;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.18';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\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\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\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\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\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\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\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\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\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\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\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\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\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\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\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;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAElB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAKb,SAAS;AACT,kDAAwB;AAExB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uDAAuD;AACvD,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,0DAA0D;AAC1D,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,uEAAuE;AACvE,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uEAAuE;AACvE,iDAA+C;AAAtC,uGAAA,SAAS,OAAA;AAGlB,yDAAyD;AACzD,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAGhB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,iEAAiE;AACjE,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,+DAA+D;AAC/D,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,+DAA+D;AAC/D,mDAAiD;A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AAuD;AAA9C,+GAAA,aAAa,OAAA;AAGtB,2BAA2B;AAC3B,mEAAmE;AACnE,mCAA6B;AAApB,2FAAA,CAAC,OAAA;AAEV,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAEzB,eAAe;AACf,mCAA+C;AAAtC,gGAAA,GAAG,OAAa;AAEzB,oBAAoB;AACpB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,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;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,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;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.19';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\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\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\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\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\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\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\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\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\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\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\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\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\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\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
@@ -28,10 +28,14 @@ var Bar = /** @class */ (function (_super) {
28
28
  * @override
29
29
  */
30
30
  Bar.prototype.changeData = function (data) {
31
+ var _a, _b;
31
32
  this.updateOption({ data: data });
32
- var _a = this, chart = _a.chart, options = _a.options;
33
- var xField = options.xField, yField = options.yField, isPercent = options.isPercent;
34
- var switchedFieldOptions = tslib_1.__assign(tslib_1.__assign({}, options), { xField: yField, yField: xField });
33
+ var _c = this, chart = _c.chart, options = _c.options;
34
+ var isPercent = options.isPercent;
35
+ var xField = options.xField, yField = options.yField, xAxis = options.xAxis, yAxis = options.yAxis;
36
+ _a = [yField, xField], xField = _a[0], yField = _a[1];
37
+ _b = [yAxis, xAxis], xAxis = _b[0], yAxis = _b[1];
38
+ var switchedFieldOptions = tslib_1.__assign(tslib_1.__assign({}, options), { xField: xField, yField: yField, yAxis: yAxis, xAxis: xAxis });
35
39
  adaptor_1.meta({ chart: chart, options: switchedFieldOptions });
36
40
  chart.changeData(percent_1.getDataWhetherPercentage(data, xField, yField, xField, isPercent));
37
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/bar/index.ts"],"names":[],"mappings":";;;;AAAA,wCAAuC;AAEvC,yDAAyE;AAEzE,qCAA0C;AAC1C,yCAA8C;AAI9C;;GAEG;AACH;IAAyB,+BAAgB;IAAzC;QAAA,qEAqCC;QA5BC,WAAW;QACK,UAAI,GAAW,KAAK,CAAC;;IA2BvC,CAAC;IApCC;;;OAGG;IACI,qBAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;OAEG;IACI,wBAAU,GAAjB,UAAkB,IAAwB;QACxC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QACxB,IAAA,MAAM,GAAwB,OAAO,OAA/B,EAAE,MAAM,GAAgB,OAAO,OAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,CAAa;QAC9C,IAAM,oBAAoB,yCAAQ,OAAO,KAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,CAAC;QAC5E,cAAI,CAAC,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,UAAU,CAAC,kCAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACO,+BAAiB,GAA3B;QACE,OAAO,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,8BAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,UAAC;AAAD,CAAC,AArCD,CAAyB,WAAI,GAqC5B;AArCY,kBAAG","sourcesContent":["import { Plot } from '../../core/plot';\nimport { Adaptor } from '../../core/adaptor';\nimport { getDataWhetherPercentage } from '../../utils/transform/percent';\nimport { BarOptions } from './types';\nimport { adaptor, meta } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\n\nexport type { BarOptions };\n\n/**\n * 条形图\n */\nexport class Bar extends Plot<BarOptions> {\n /**\n * 获取 条形图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<BarOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public readonly type: string = 'bar';\n\n /**\n * @override\n */\n public changeData(data: BarOptions['data']) {\n this.updateOption({ data });\n const { chart, options } = this;\n const { xField, yField, isPercent } = options;\n const switchedFieldOptions = { ...options, xField: yField, yField: xField };\n meta({ chart, options: switchedFieldOptions });\n chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));\n }\n\n /**\n * 获取 条形图 默认配置\n */\n protected getDefaultOptions() {\n return Bar.getDefaultOptions();\n }\n\n /**\n * 获取 条形图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<BarOptions> {\n return adaptor;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/bar/index.ts"],"names":[],"mappings":";;;;AAAA,wCAAuC;AAEvC,yDAAyE;AAEzE,qCAA0C;AAC1C,yCAA8C;AAI9C;;GAEG;AACH;IAAyB,+BAAgB;IAAzC;QAAA,qEAwCC;QA/BC,WAAW;QACK,UAAI,GAAW,KAAK,CAAC;;IA8BvC,CAAC;IAvCC;;;OAGG;IACI,qBAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;OAEG;IACI,wBAAU,GAAjB,UAAkB,IAAwB;;QACxC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QACxB,IAAA,SAAS,GAAK,OAAO,UAAZ,CAAa;QACxB,IAAA,MAAM,GAA2B,OAAO,OAAlC,EAAE,MAAM,GAAmB,OAAO,OAA1B,EAAE,KAAK,GAAY,OAAO,MAAnB,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAa;QAC/C,KAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAlC,MAAM,QAAA,EAAE,MAAM,QAAA,CAAqB;QACpC,KAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,EAA9B,KAAK,QAAA,EAAE,KAAK,QAAA,CAAmB;QAChC,IAAM,oBAAoB,yCAAQ,OAAO,KAAE,MAAM,QAAA,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,GAAE,CAAC;QAC1E,cAAI,CAAC,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,UAAU,CAAC,kCAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACO,+BAAiB,GAA3B;QACE,OAAO,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,8BAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,UAAC;AAAD,CAAC,AAxCD,CAAyB,WAAI,GAwC5B;AAxCY,kBAAG","sourcesContent":["import { Plot } from '../../core/plot';\nimport { Adaptor } from '../../core/adaptor';\nimport { getDataWhetherPercentage } from '../../utils/transform/percent';\nimport { BarOptions } from './types';\nimport { adaptor, meta } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\n\nexport type { BarOptions };\n\n/**\n * 条形图\n */\nexport class Bar extends Plot<BarOptions> {\n /**\n * 获取 条形图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<BarOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public readonly type: string = 'bar';\n\n /**\n * @override\n */\n public changeData(data: BarOptions['data']) {\n this.updateOption({ data });\n const { chart, options } = this;\n const { isPercent } = options;\n let { xField, yField, xAxis, yAxis } = options;\n [xField, yField] = [yField, xField];\n [xAxis, yAxis] = [yAxis, xAxis];\n const switchedFieldOptions = { ...options, xField, yField, yAxis, xAxis };\n meta({ chart, options: switchedFieldOptions });\n chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));\n }\n\n /**\n * 获取 条形图 默认配置\n */\n protected getDefaultOptions() {\n return Bar.getDefaultOptions();\n }\n\n /**\n * 获取 条形图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<BarOptions> {\n return adaptor;\n }\n}\n"]}
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformData = void 0;
4
+ /**
5
+ * 获取分类字段 key 值 一个分类值的时候, 返回非索引 key 值,在 tooltip 不做索引区分
6
+ * @param values 数据量
7
+ * @param field 指标字段
8
+ * @param index 索引
9
+ * @returns string
10
+ */
11
+ function getSeriesFieldKey(values, field, index) {
12
+ return values.length > 1 ? field + "_" + index : "" + field;
13
+ }
4
14
  /**
5
15
  * bullet 处理数据
6
16
  * @param options
@@ -10,12 +20,12 @@ function transformData(options) {
10
20
  var ds = [];
11
21
  var scales = [];
12
22
  data.forEach(function (item, index) {
13
- var _a;
14
23
  // 构建 title * range
15
- item[rangeField].sort(function (a, b) { return a - b; });
16
- item[rangeField].forEach(function (d, i) {
24
+ var rangeValues = [item[rangeField]].flat();
25
+ rangeValues.sort(function (a, b) { return a - b; });
26
+ rangeValues.forEach(function (d, i) {
17
27
  var _a;
18
- var range = i === 0 ? d : item[rangeField][i] - item[rangeField][i - 1];
28
+ var range = i === 0 ? d : rangeValues[i] - rangeValues[i - 1];
19
29
  ds.push((_a = {
20
30
  rKey: rangeField + "_" + i
21
31
  },
@@ -24,22 +34,27 @@ function transformData(options) {
24
34
  _a));
25
35
  });
26
36
  // 构建 title * measure
27
- item[measureField].forEach(function (d, i) {
37
+ var measureValues = [item[measureField]].flat();
38
+ measureValues.forEach(function (d, i) {
28
39
  var _a;
29
40
  ds.push((_a = {
30
- mKey: item[measureField].length > 1 ? measureField + "_" + i : "" + measureField
41
+ mKey: getSeriesFieldKey(measureValues, measureField, i)
31
42
  },
32
43
  _a[xField] = xField ? item[xField] : String(index),
33
44
  _a[measureField] = d,
34
45
  _a));
35
46
  });
36
47
  // 构建 title * target
37
- ds.push((_a = {
38
- tKey: "" + targetField
39
- },
40
- _a[xField] = xField ? item[xField] : String(index),
41
- _a[targetField] = item[targetField],
42
- _a));
48
+ var targetValues = [item[targetField]].flat();
49
+ targetValues.forEach(function (d, i) {
50
+ var _a;
51
+ ds.push((_a = {
52
+ tKey: getSeriesFieldKey(targetValues, targetField, i)
53
+ },
54
+ _a[xField] = xField ? item[xField] : String(index),
55
+ _a[targetField] = d,
56
+ _a));
57
+ });
43
58
  // 为了取最大值和最小值,先存储
44
59
  scales.push(item[rangeField], item[measureField], item[targetField]);
45
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/bullet/utils.ts"],"names":[],"mappings":";;;AAOA;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAAsB;IAC1C,IAAA,IAAI,GAA4D,OAAO,KAAnE,EAAE,MAAM,GAAoD,OAAO,OAA3D,EAAE,YAAY,GAAsC,OAAO,aAA7C,EAAE,UAAU,GAA0B,OAAO,WAAjC,EAAE,WAAW,GAAa,OAAO,YAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAChF,IAAM,EAAE,GAAU,EAAE,CAAC;IACrB,IAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAC,IAAS,EAAE,KAAa;;QACpC,mBAAmB;QACnB,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU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C,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IACH,kBAAkB;IAClB,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,kBAAkB;IAClB,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAExB,cAAc;IACd,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,EAAE,CAAC,OAAO,EAAE,CAAC;KACd;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,GAAG,KAAA,EAAE,EAAE,IAAA,EAAE,CAAC;AAC1B,CAAC;AA3CD,sCA2CC","sourcesContent":["import { BulletOptions } from './types';\n\ntype TransformData = {\n min: number;\n max: number;\n ds: any[];\n};\n/**\n * bullet 处理数据\n * @param options\n */\nexport function transformData(options: BulletOptions): TransformData {\n const { data, xField, measureField, rangeField, targetField, layout } = options;\n const ds: any[] = [];\n const scales: number[] = [];\n data.forEach((item: any, index: number) => {\n // 构建 title * range\n item[rangeField].sort((a: number, b: number) => a - b);\n item[rangeField].forEach((d: number, i: number) => {\n const range = i === 0 ? d : item[rangeField][i] - item[rangeField][i - 1];\n ds.push({\n rKey: `${rangeField}_${i}`,\n [xField]: xField ? item[xField] : String(index), // 没有xField就用索引\n [rangeField]: range,\n });\n });\n // 构建 title * measure\n item[measureField].forEach((d: number, i: number) => {\n ds.push({\n mKey: item[measureField].length > 1 ? `${measureField}_${i}` : `${measureField}`, // 一个数据就不带索引了\n [xField]: xField ? item[xField] : String(index),\n [measureField]: d,\n });\n });\n // 构建 title * target\n ds.push({\n tKey: `${targetField}`,\n [xField]: xField ? item[xField] : String(index),\n [targetField]: item[targetField],\n });\n // 为了取最大值和最小值,先存储\n scales.push(item[rangeField], item[measureField], item[targetField]);\n });\n // scales 是嵌套的需要拍平\n let min = Math.min(...scales.flat(Infinity));\n const max = Math.max(...scales.flat(Infinity));\n // min 大于 0 从 0 开始\n min = min > 0 ? 0 : min;\n\n // 垂直情况,需要反转数据\n if (layout === 'vertical') {\n ds.reverse();\n }\n return { min, max, ds };\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/bullet/utils.ts"],"names":[],"mappings":";;;AAQA;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,MAAgB,EAAE,KAAa,EAAE,KAAa;IACvE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAI,KAAK,SAAI,KAAO,CAAC,CAAC,CAAC,KAAG,KAAO,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAAsB;IAC1C,IAAA,IAAI,GAA4D,OAAO,KAAnE,EAAE,MAAM,GAAoD,OAAO,OAA3D,EAAE,YAAY,GAAsC,OAAO,aAA7C,EAAE,UAAU,GAA0B,OAAO,WAAjC,EAAE,WAAW,GAAa,OAAO,YAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAChF,IAAM,EAAE,GAAU,EAAE,CAAC;IACrB,IAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAC,IAAS,EAAE,KAAa;QACpC,mBAAmB;QACnB,IAAM,WAAW,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,WAAW,CAAC,IAAI,CAAC,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;QAClD,WAAW,CAAC,OAAO,CAAC,UAAC,CAAS,EAAE,CAAS;;YACvC,IAAM,KAA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,CAAC,CAAC,CAAC;QAEH,iBAAiB;QACjB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IACH,kBAAkB;IAClB,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,kBAAkB;IAClB,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAExB,cAAc;IACd,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,EAAE,CAAC,OAAO,EAAE,CAAC;KACd;IACD,OAAO,EAAE,GAAG,KAAA,EAAE,GAAG,KAAA,EAAE,EAAE,IAAA,EAAE,CAAC;AAC1B,CAAC;AAnDD,sCAmDC","sourcesContent":["import { BulletOptions } from './types';\n\ntype TransformData = {\n min: number;\n max: number;\n ds: any[];\n};\n\n/**\n * 获取分类字段 key 值 一个分类值的时候, 返回非索引 key 值,在 tooltip 不做索引区分\n * @param values 数据量\n * @param field 指标字段\n * @param index 索引\n * @returns string\n */\nfunction getSeriesFieldKey(values: number[], field: string, index: number): string {\n return values.length > 1 ? `${field}_${index}` : `${field}`;\n}\n\n/**\n * bullet 处理数据\n * @param options\n */\nexport function transformData(options: BulletOptions): TransformData {\n const { data, xField, measureField, rangeField, targetField, layout } = options;\n const ds: any[] = [];\n const scales: number[] = [];\n data.forEach((item: any, index: number) => {\n // 构建 title * range\n const rangeValues = [item[rangeField]].flat();\n rangeValues.sort((a: number, b: number) => a - b);\n rangeValues.forEach((d: number, i: number) => {\n const range = i === 0 ? d : rangeValues[i] - rangeValues[i - 1];\n ds.push({\n rKey: `${rangeField}_${i}`,\n [xField]: xField ? item[xField] : String(index), // 没有xField就用索引\n [rangeField]: range,\n });\n });\n\n // 构建 title * measure\n const measureValues = [item[measureField]].flat();\n measureValues.forEach((d: number, i: number) => {\n ds.push({\n mKey: getSeriesFieldKey(measureValues, measureField, i),\n [xField]: xField ? item[xField] : String(index),\n [measureField]: d,\n });\n });\n\n // 构建 title * target\n const targetValues = [item[targetField]].flat();\n targetValues.forEach((d: number, i: number) => {\n ds.push({\n tKey: getSeriesFieldKey(targetValues, targetField, i),\n [xField]: xField ? item[xField] : String(index),\n [targetField]: d,\n });\n });\n\n // 为了取最大值和最小值,先存储\n scales.push(item[rangeField], item[measureField], item[targetField]);\n });\n // scales 是嵌套的需要拍平\n let min = Math.min(...scales.flat(Infinity));\n const max = Math.max(...scales.flat(Infinity));\n // min 大于 0 从 0 开始\n min = min > 0 ? 0 : min;\n\n // 垂直情况,需要反转数据\n if (layout === 'vertical') {\n ds.reverse();\n }\n return { min, max, ds };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g2plot",
3
- "version": "2.4.18",
3
+ "version": "2.4.19",
4
4
  "description": "An interactive and responsive charting library",
5
5
  "keywords": [
6
6
  "chart",
@@ -40,7 +40,7 @@
40
40
  "lint": "eslint --ext .ts ./src ./__tests__ && prettier --check ./src ./__tests__ && lint-md ./examples ./docs",
41
41
  "lint-staged": "lint-staged",
42
42
  "test": "jest",
43
- "test-live": "cross-env DEBUG_MODE=1 jest --watch ./__tests__/",
43
+ "test-live": "cross-env DEBUG_MODE=1 jest --watch",
44
44
  "coverage": "jest -w 16 --coverage",
45
45
  "ci": "run-s lint coverage build",
46
46
  "changelog": "generate-changelog",
@@ -57,6 +57,7 @@
57
57
  "dependencies": {
58
58
  "@antv/event-emitter": "^0.1.2",
59
59
  "@antv/g2": "^4.1.26",
60
+ "@antv/util": "^2.0.17",
60
61
  "d3-hierarchy": "^2.0.0",
61
62
  "d3-regression": "^1.3.5",
62
63
  "fmin": "^0.0.2",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '2.4.18';
1
+ export const version = '2.4.19';
2
2
 
3
3
  // G2 自定义能力透出
4
4
  import * as G2 from '@antv/g2';
@@ -28,8 +28,11 @@ export class Bar extends Plot<BarOptions> {
28
28
  public changeData(data: BarOptions['data']) {
29
29
  this.updateOption({ data });
30
30
  const { chart, options } = this;
31
- const { xField, yField, isPercent } = options;
32
- const switchedFieldOptions = { ...options, xField: yField, yField: xField };
31
+ const { isPercent } = options;
32
+ let { xField, yField, xAxis, yAxis } = options;
33
+ [xField, yField] = [yField, xField];
34
+ [xAxis, yAxis] = [yAxis, xAxis];
35
+ const switchedFieldOptions = { ...options, xField, yField, yAxis, xAxis };
33
36
  meta({ chart, options: switchedFieldOptions });
34
37
  chart.changeData(getDataWhetherPercentage(data, xField, yField, xField, isPercent));
35
38
  }
@@ -5,6 +5,18 @@ type TransformData = {
5
5
  max: number;
6
6
  ds: any[];
7
7
  };
8
+
9
+ /**
10
+ * 获取分类字段 key 值 一个分类值的时候, 返回非索引 key 值,在 tooltip 不做索引区分
11
+ * @param values 数据量
12
+ * @param field 指标字段
13
+ * @param index 索引
14
+ * @returns string
15
+ */
16
+ function getSeriesFieldKey(values: number[], field: string, index: number): string {
17
+ return values.length > 1 ? `${field}_${index}` : `${field}`;
18
+ }
19
+
8
20
  /**
9
21
  * bullet 处理数据
10
22
  * @param options
@@ -15,29 +27,37 @@ export function transformData(options: BulletOptions): TransformData {
15
27
  const scales: number[] = [];
16
28
  data.forEach((item: any, index: number) => {
17
29
  // 构建 title * range
18
- item[rangeField].sort((a: number, b: number) => a - b);
19
- item[rangeField].forEach((d: number, i: number) => {
20
- const range = i === 0 ? d : item[rangeField][i] - item[rangeField][i - 1];
30
+ const rangeValues = [item[rangeField]].flat();
31
+ rangeValues.sort((a: number, b: number) => a - b);
32
+ rangeValues.forEach((d: number, i: number) => {
33
+ const range = i === 0 ? d : rangeValues[i] - rangeValues[i - 1];
21
34
  ds.push({
22
35
  rKey: `${rangeField}_${i}`,
23
36
  [xField]: xField ? item[xField] : String(index), // 没有xField就用索引
24
37
  [rangeField]: range,
25
38
  });
26
39
  });
40
+
27
41
  // 构建 title * measure
28
- item[measureField].forEach((d: number, i: number) => {
42
+ const measureValues = [item[measureField]].flat();
43
+ measureValues.forEach((d: number, i: number) => {
29
44
  ds.push({
30
- mKey: item[measureField].length > 1 ? `${measureField}_${i}` : `${measureField}`, // 一个数据就不带索引了
45
+ mKey: getSeriesFieldKey(measureValues, measureField, i),
31
46
  [xField]: xField ? item[xField] : String(index),
32
47
  [measureField]: d,
33
48
  });
34
49
  });
50
+
35
51
  // 构建 title * target
36
- ds.push({
37
- tKey: `${targetField}`,
38
- [xField]: xField ? item[xField] : String(index),
39
- [targetField]: item[targetField],
52
+ const targetValues = [item[targetField]].flat();
53
+ targetValues.forEach((d: number, i: number) => {
54
+ ds.push({
55
+ tKey: getSeriesFieldKey(targetValues, targetField, i),
56
+ [xField]: xField ? item[xField] : String(index),
57
+ [targetField]: d,
58
+ });
40
59
  });
60
+
41
61
  // 为了取最大值和最小值,先存储
42
62
  scales.push(item[rangeField], item[measureField], item[targetField]);
43
63
  });