@antv/g2plot 2.4.11 → 2.4.14

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.11";
1
+ export declare const version = "2.4.14";
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.11';
1
+ export var version = '2.4.14';
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.11';\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.14';\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"]}
@@ -217,6 +217,7 @@ export function theme(params) {
217
217
  var chart = params.chart;
218
218
  commonTheme(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));
219
219
  commonTheme(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));
220
+ commonTheme(params);
220
221
  return params;
221
222
  }
222
223
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/bidirectional-bar/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,OAAO,EACP,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,KAAK,IAAI,WAAW,EACpB,WAAW,IAAI,iBAAiB,EAChC,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAAuC;IAC/C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,GAAkE,OAAO,KAAzE,EAAE,MAAM,GAA0D,OAAO,OAAjE,EAAE,MAAM,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AAC","sourcesContent":["import { View } from '@antv/g2';\nimport { get, keys } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport {\n tooltip,\n interaction as commonInteraction,\n animation as commonAnimation,\n theme as commonTheme,\n limitInPlot as commonLimitInPlot,\n scale,\n} from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { flow, findViewById, findGeometry, transformLabel, deepAssign } from '../../utils';\nimport { BidirectionalBarOptions } from './types';\nimport { FIRST_AXES_VIEW, SECOND_AXES_VIEW, SERIES_FIELD_KEY } from './constant';\nimport { isHorizontal, transformData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { data, xField, yField, color, barStyle, widthRatio, legend, layout } = options;\n\n // 处理数据\n const groupData: any[] = transformData(xField, yField, SERIES_FIELD_KEY, data, isHorizontal(layout));\n // 在创建子 view 执行后不行,需要在前面处理 legend\n if (legend) {\n chart.legend(SERIES_FIELD_KEY, legend);\n } else if (legend === false) {\n chart.legend(false);\n }\n // 创建 view\n let firstView: View;\n let secondView: View;\n const [firstViewData, secondViewData] = groupData;\n\n // 横向\n if (isHorizontal(layout)) {\n firstView = chart.createView({\n region: {\n start: { x: 0, y: 0 },\n end: { x: 0.5, y: 1 },\n },\n id: FIRST_AXES_VIEW,\n });\n\n firstView.coordinate().transpose().reflect('x');\n\n secondView = chart.createView({\n region: {\n start: { x: 0.5, y: 0 },\n end: { x: 1, y: 1 },\n },\n id: SECOND_AXES_VIEW,\n });\n secondView.coordinate().transpose();\n\n // @说明: 测试发现,横向因为轴的反转,需要数据也反转,不然会图形渲染是反的(翻转操作进入到 transform 中处理)\n firstView.data(firstViewData);\n secondView.data(secondViewData);\n } else {\n // 纵向\n firstView = chart.createView({\n region: {\n start: { x: 0, y: 0 },\n end: { x: 1, y: 0.5 },\n },\n id: FIRST_AXES_VIEW,\n });\n secondView = chart.createView({\n region: {\n start: { x: 0, y: 0.5 },\n end: { x: 1, y: 1 },\n },\n id: SECOND_AXES_VIEW,\n });\n secondView.coordinate().reflect('y');\n\n firstView.data(firstViewData);\n secondView.data(secondViewData);\n }\n const left = deepAssign({}, params, {\n chart: firstView,\n options: {\n widthRatio,\n xField,\n yField: yField[0],\n seriesField: SERIES_FIELD_KEY,\n interval: {\n color,\n style: barStyle,\n },\n },\n });\n interval(left);\n\n const right = deepAssign({}, params, {\n chart: secondView,\n options: {\n xField,\n yField: yField[1],\n seriesField: SERIES_FIELD_KEY,\n widthRatio,\n interval: {\n color,\n style: barStyle,\n },\n },\n });\n\n interval(right);\n\n return params;\n}\n\n/**\n * meta 配置\n * - 对称条形图对数据进行了处理,通过 SERIES_FIELD_KEY 来对两条 yField 数据进行分类\n * @param params\n */\nfunction meta(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { options, chart } = params;\n const { xAxis, yAxis, xField, yField } = options;\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n\n const aliasMap = {};\n keys(options?.meta || {}).map((metaKey) => {\n if (get(options?.meta, [metaKey, 'alias'])) {\n aliasMap[metaKey] = options.meta[metaKey].alias;\n }\n });\n\n chart.scale({\n [SERIES_FIELD_KEY]: {\n sync: true,\n formatter: (v) => {\n return get(aliasMap, v, v);\n },\n },\n });\n\n scale({\n [xField]: xAxis,\n [yField[0]]: yAxis[yField[0]],\n })(deepAssign({}, params, { chart: firstView }));\n\n scale({\n [xField]: xAxis,\n [yField[1]]: yAxis[yField[1]],\n })(deepAssign({}, params, { chart: secondView }));\n\n return params;\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField, layout } = options;\n\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n // 第二个 view axis 始终隐藏; 注意 bottom 的时候,只隐藏 label,其他共用配置\n // @ts-ignore\n if (xAxis?.position === 'bottom') {\n // fixme 直接设置 label: null 会导致 tickLine 无法显示\n secondView.axis(xField, { ...xAxis, label: { formatter: () => '' } });\n } else {\n secondView.axis(xField, false);\n }\n\n // 为 false 则是不显示 firstView 轴\n if (xAxis === false) {\n firstView.axis(xField, false);\n } else {\n firstView.axis(xField, {\n // 不同布局 firstView 的坐标轴显示位置\n position: isHorizontal(layout) ? 'top' : 'bottom',\n ...xAxis,\n });\n }\n\n if (yAxis === false) {\n firstView.axis(yField[0], false);\n secondView.axis(yField[1], false);\n } else {\n firstView.axis(yField[0], yAxis[yField[0]]);\n secondView.axis(yField[1], yAxis[yField[1]]);\n }\n /**\n * 这个注入,主要是在syncViewPadding时候拿到相对应的配置:布局和轴的位置\n * TODO 之后希望 g2 View 对象可以开放 setter 可以设置一些需要的东西\n */\n\n //@ts-ignore\n chart.__axisPosition = {\n position: firstView.getOptions().axes[xField].position,\n layout,\n };\n return params;\n}\n\n/**\n * interaction 配置\n * @param params\n */\nexport function interaction(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonInteraction(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonInteraction(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n\n return params;\n}\n\n/**\n * limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { yField, yAxis } = options;\n\n commonLimitInPlot(\n deepAssign({}, params, {\n chart: findViewById(chart, FIRST_AXES_VIEW),\n options: {\n yAxis: yAxis[yField[0]],\n },\n })\n );\n\n commonLimitInPlot(\n deepAssign({}, params, {\n chart: findViewById(chart, SECOND_AXES_VIEW),\n options: {\n yAxis: yAxis[yField[1]],\n },\n })\n );\n\n return params;\n}\n\n/**\n * theme\n * @param params\n */\nexport function theme(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonTheme(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonTheme(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n\n return params;\n}\n\n/**\n * animation\n * @param params\n */\nexport function animation(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonAnimation(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonAnimation(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n\n return params;\n}\n\n/**\n * label 配置 (1. 设置 offset 偏移量默认值 2. leftView 偏移量需要 *= -1)\n * @param params\n */\nfunction label(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { label, yField, layout } = options;\n\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n const leftGeometry = findGeometry(firstView, 'interval');\n const rightGeometry = findGeometry(secondView, 'interval');\n\n if (!label) {\n leftGeometry.label(false);\n rightGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n /** ---- 设置默认配置 ---- */\n // 默认居中\n if (!cfg.position) {\n cfg.position = 'middle';\n }\n if (cfg.offset === undefined) {\n cfg.offset = 2;\n }\n\n /** ---- leftView label 设置 ---- */\n const leftLabelCfg = { ...cfg };\n if (isHorizontal(layout)) {\n // 设置 textAlign 默认值\n const textAlign = leftLabelCfg.style?.textAlign || (cfg.position === 'middle' ? 'center' : 'left');\n cfg.style = deepAssign({}, cfg.style, { textAlign });\n const textAlignMap = { left: 'right', right: 'left', center: 'center' };\n leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textAlign: textAlignMap[textAlign] });\n } else {\n const positionMap = { top: 'bottom', bottom: 'top', middle: 'middle' };\n if (typeof cfg.position === 'string') {\n cfg.position = positionMap[cfg.position];\n } else if (typeof cfg.position === 'function') {\n cfg.position = (...args) => positionMap[(cfg.position as Function).apply(this, args)];\n }\n // 设置 textBaseline 默认值\n const textBaseline = leftLabelCfg.style?.textBaseline || 'bottom';\n leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textBaseline });\n const textBaselineMap = { top: 'bottom', bottom: 'top', middle: 'middle' };\n cfg.style = deepAssign({}, cfg.style, { textBaseline: textBaselineMap[textBaseline] });\n }\n\n leftGeometry.label({\n fields: [yField[0]],\n callback,\n cfg: transformLabel(leftLabelCfg),\n });\n rightGeometry.label({\n fields: [yField[1]],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n return params;\n}\n\n/**\n * 对称条形图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<BidirectionalBarOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(geometry, meta, axis, limitInPlot, theme, label, tooltip, interaction, animation)(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/bidirectional-bar/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,OAAO,EACP,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,KAAK,IAAI,WAAW,EACpB,WAAW,IAAI,iBAAiB,EAChC,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAAuC;IAC/C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO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AAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACxG,CAAC","sourcesContent":["import { View } from '@antv/g2';\nimport { get, keys } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport {\n tooltip,\n interaction as commonInteraction,\n animation as commonAnimation,\n theme as commonTheme,\n limitInPlot as commonLimitInPlot,\n scale,\n} from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { flow, findViewById, findGeometry, transformLabel, deepAssign } from '../../utils';\nimport { BidirectionalBarOptions } from './types';\nimport { FIRST_AXES_VIEW, SECOND_AXES_VIEW, SERIES_FIELD_KEY } from './constant';\nimport { isHorizontal, transformData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { data, xField, yField, color, barStyle, widthRatio, legend, layout } = options;\n\n // 处理数据\n const groupData: any[] = transformData(xField, yField, SERIES_FIELD_KEY, data, isHorizontal(layout));\n // 在创建子 view 执行后不行,需要在前面处理 legend\n if (legend) {\n chart.legend(SERIES_FIELD_KEY, legend);\n } else if (legend === false) {\n chart.legend(false);\n }\n // 创建 view\n let firstView: View;\n let secondView: View;\n const [firstViewData, secondViewData] = groupData;\n\n // 横向\n if (isHorizontal(layout)) {\n firstView = chart.createView({\n region: {\n start: { x: 0, y: 0 },\n end: { x: 0.5, y: 1 },\n },\n id: FIRST_AXES_VIEW,\n });\n\n firstView.coordinate().transpose().reflect('x');\n\n secondView = chart.createView({\n region: {\n start: { x: 0.5, y: 0 },\n end: { x: 1, y: 1 },\n },\n id: SECOND_AXES_VIEW,\n });\n secondView.coordinate().transpose();\n\n // @说明: 测试发现,横向因为轴的反转,需要数据也反转,不然会图形渲染是反的(翻转操作进入到 transform 中处理)\n firstView.data(firstViewData);\n secondView.data(secondViewData);\n } else {\n // 纵向\n firstView = chart.createView({\n region: {\n start: { x: 0, y: 0 },\n end: { x: 1, y: 0.5 },\n },\n id: FIRST_AXES_VIEW,\n });\n secondView = chart.createView({\n region: {\n start: { x: 0, y: 0.5 },\n end: { x: 1, y: 1 },\n },\n id: SECOND_AXES_VIEW,\n });\n secondView.coordinate().reflect('y');\n\n firstView.data(firstViewData);\n secondView.data(secondViewData);\n }\n const left = deepAssign({}, params, {\n chart: firstView,\n options: {\n widthRatio,\n xField,\n yField: yField[0],\n seriesField: SERIES_FIELD_KEY,\n interval: {\n color,\n style: barStyle,\n },\n },\n });\n interval(left);\n\n const right = deepAssign({}, params, {\n chart: secondView,\n options: {\n xField,\n yField: yField[1],\n seriesField: SERIES_FIELD_KEY,\n widthRatio,\n interval: {\n color,\n style: barStyle,\n },\n },\n });\n\n interval(right);\n\n return params;\n}\n\n/**\n * meta 配置\n * - 对称条形图对数据进行了处理,通过 SERIES_FIELD_KEY 来对两条 yField 数据进行分类\n * @param params\n */\nfunction meta(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { options, chart } = params;\n const { xAxis, yAxis, xField, yField } = options;\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n\n const aliasMap = {};\n keys(options?.meta || {}).map((metaKey) => {\n if (get(options?.meta, [metaKey, 'alias'])) {\n aliasMap[metaKey] = options.meta[metaKey].alias;\n }\n });\n\n chart.scale({\n [SERIES_FIELD_KEY]: {\n sync: true,\n formatter: (v) => {\n return get(aliasMap, v, v);\n },\n },\n });\n\n scale({\n [xField]: xAxis,\n [yField[0]]: yAxis[yField[0]],\n })(deepAssign({}, params, { chart: firstView }));\n\n scale({\n [xField]: xAxis,\n [yField[1]]: yAxis[yField[1]],\n })(deepAssign({}, params, { chart: secondView }));\n\n return params;\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField, layout } = options;\n\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n // 第二个 view axis 始终隐藏; 注意 bottom 的时候,只隐藏 label,其他共用配置\n // @ts-ignore\n if (xAxis?.position === 'bottom') {\n // fixme 直接设置 label: null 会导致 tickLine 无法显示\n secondView.axis(xField, { ...xAxis, label: { formatter: () => '' } });\n } else {\n secondView.axis(xField, false);\n }\n\n // 为 false 则是不显示 firstView 轴\n if (xAxis === false) {\n firstView.axis(xField, false);\n } else {\n firstView.axis(xField, {\n // 不同布局 firstView 的坐标轴显示位置\n position: isHorizontal(layout) ? 'top' : 'bottom',\n ...xAxis,\n });\n }\n\n if (yAxis === false) {\n firstView.axis(yField[0], false);\n secondView.axis(yField[1], false);\n } else {\n firstView.axis(yField[0], yAxis[yField[0]]);\n secondView.axis(yField[1], yAxis[yField[1]]);\n }\n /**\n * 这个注入,主要是在syncViewPadding时候拿到相对应的配置:布局和轴的位置\n * TODO 之后希望 g2 View 对象可以开放 setter 可以设置一些需要的东西\n */\n\n //@ts-ignore\n chart.__axisPosition = {\n position: firstView.getOptions().axes[xField].position,\n layout,\n };\n return params;\n}\n\n/**\n * interaction 配置\n * @param params\n */\nexport function interaction(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonInteraction(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonInteraction(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n\n return params;\n}\n\n/**\n * limitInPlot\n * @param params\n */\nexport function limitInPlot(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { yField, yAxis } = options;\n\n commonLimitInPlot(\n deepAssign({}, params, {\n chart: findViewById(chart, FIRST_AXES_VIEW),\n options: {\n yAxis: yAxis[yField[0]],\n },\n })\n );\n\n commonLimitInPlot(\n deepAssign({}, params, {\n chart: findViewById(chart, SECOND_AXES_VIEW),\n options: {\n yAxis: yAxis[yField[1]],\n },\n })\n );\n\n return params;\n}\n\n/**\n * theme\n * @param params\n */\nexport function theme(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonTheme(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonTheme(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n commonTheme(params);\n\n return params;\n}\n\n/**\n * animation\n * @param params\n */\nexport function animation(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart } = params;\n\n commonAnimation(deepAssign({}, params, { chart: findViewById(chart, FIRST_AXES_VIEW) }));\n commonAnimation(deepAssign({}, params, { chart: findViewById(chart, SECOND_AXES_VIEW) }));\n\n return params;\n}\n\n/**\n * label 配置 (1. 设置 offset 偏移量默认值 2. leftView 偏移量需要 *= -1)\n * @param params\n */\nfunction label(params: Params<BidirectionalBarOptions>): Params<BidirectionalBarOptions> {\n const { chart, options } = params;\n const { label, yField, layout } = options;\n\n const firstView = findViewById(chart, FIRST_AXES_VIEW);\n const secondView = findViewById(chart, SECOND_AXES_VIEW);\n const leftGeometry = findGeometry(firstView, 'interval');\n const rightGeometry = findGeometry(secondView, 'interval');\n\n if (!label) {\n leftGeometry.label(false);\n rightGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n /** ---- 设置默认配置 ---- */\n // 默认居中\n if (!cfg.position) {\n cfg.position = 'middle';\n }\n if (cfg.offset === undefined) {\n cfg.offset = 2;\n }\n\n /** ---- leftView label 设置 ---- */\n const leftLabelCfg = { ...cfg };\n if (isHorizontal(layout)) {\n // 设置 textAlign 默认值\n const textAlign = leftLabelCfg.style?.textAlign || (cfg.position === 'middle' ? 'center' : 'left');\n cfg.style = deepAssign({}, cfg.style, { textAlign });\n const textAlignMap = { left: 'right', right: 'left', center: 'center' };\n leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textAlign: textAlignMap[textAlign] });\n } else {\n const positionMap = { top: 'bottom', bottom: 'top', middle: 'middle' };\n if (typeof cfg.position === 'string') {\n cfg.position = positionMap[cfg.position];\n } else if (typeof cfg.position === 'function') {\n cfg.position = (...args) => positionMap[(cfg.position as Function).apply(this, args)];\n }\n // 设置 textBaseline 默认值\n const textBaseline = leftLabelCfg.style?.textBaseline || 'bottom';\n leftLabelCfg.style = deepAssign({}, leftLabelCfg.style, { textBaseline });\n const textBaselineMap = { top: 'bottom', bottom: 'top', middle: 'middle' };\n cfg.style = deepAssign({}, cfg.style, { textBaseline: textBaselineMap[textBaseline] });\n }\n\n leftGeometry.label({\n fields: [yField[0]],\n callback,\n cfg: transformLabel(leftLabelCfg),\n });\n rightGeometry.label({\n fields: [yField[1]],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n return params;\n}\n\n/**\n * 对称条形图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<BidirectionalBarOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(geometry, meta, axis, limitInPlot, theme, label, tooltip, interaction, animation)(params);\n}\n"]}
@@ -1,5 +1,10 @@
1
1
  import { Params } from '../../core/adaptor';
2
2
  import { MixOptions } from './types';
3
+ /**
4
+ * 处理缩略轴的 adaptor (mix)
5
+ * @param params
6
+ */
7
+ export declare function slider(params: Params<MixOptions>): Params<MixOptions>;
3
8
  /**
4
9
  * 图适配器
5
10
  * @param chart
@@ -1,7 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  import { each } from '@antv/util';
3
3
  import { geometry as geometryAdaptor } from '../../adaptor/geometries/base';
4
- import { interaction, animation, theme, tooltip } from '../../adaptor/common';
4
+ import { interaction, animation, theme, tooltip, annotation } from '../../adaptor/common';
5
5
  import { PLOT_CONTAINER_OPTIONS } from '../../core/plot';
6
6
  import { AXIS_META_CONFIG_KEYS } from '../../constant';
7
7
  import { deepAssign, flow, pick } from '../../utils';
@@ -102,19 +102,32 @@ function multiView(params) {
102
102
  */
103
103
  function multiPlot(params) {
104
104
  var chart = params.chart, options = params.options;
105
- var plots = options.plots;
105
+ var plots = options.plots, _a = options.data, data = _a === void 0 ? [] : _a;
106
106
  each(plots, function (plot) {
107
- var type = plot.type, region = plot.region, _a = plot.options, options = _a === void 0 ? {} : _a;
107
+ var type = plot.type, region = plot.region, _a = plot.options, options = _a === void 0 ? {} : _a, top = plot.top;
108
108
  var tooltip = options.tooltip;
109
+ if (top) {
110
+ execPlotAdaptor(type, chart, __assign(__assign({}, options), { data: data }));
111
+ return;
112
+ }
109
113
  var viewOfG2 = chart.createView(__assign({ region: region }, pick(options, PLOT_CONTAINER_OPTIONS)));
110
114
  if (tooltip) {
111
115
  // 配置 tooltip 交互
112
116
  viewOfG2.interaction('tooltip');
113
117
  }
114
- execPlotAdaptor(type, viewOfG2, options);
118
+ execPlotAdaptor(type, viewOfG2, __assign({ data: data }, options));
115
119
  });
116
120
  return params;
117
121
  }
122
+ /**
123
+ * 处理缩略轴的 adaptor (mix)
124
+ * @param params
125
+ */
126
+ export function slider(params) {
127
+ var chart = params.chart, options = params.options;
128
+ chart.option('slider', options.slider);
129
+ return params;
130
+ }
118
131
  /**
119
132
  * 图适配器
120
133
  * @param chart
@@ -122,7 +135,7 @@ function multiPlot(params) {
122
135
  */
123
136
  export function adaptor(params) {
124
137
  return flow(animation, // 多 view 的图,动画配置放到最前面
125
- multiView, multiPlot, interaction, animation, theme, tooltip
138
+ multiView, multiPlot, interaction, animation, theme, tooltip, slider, annotation()
126
139
  // ... 其他的 adaptor flow
127
140
  )(params);
128
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/mix/adaptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KA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,KAAK,CAAC,UAAU,YAAG,MAAM,QAAA,IAAK,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC,EAAG,CAAC;QACxF,IAAI,OAAO,EAAE;YACX,gBAAgB;YAChB,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;SACjC;QAED,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA0B;IAChD,OAAO,IAAI,CACT,SAAS,EAAE,sBAAsB;IACjC,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO;IACP,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { each } from '@antv/util';\nimport { Geometry } from '@antv/g2';\nimport { geometry as geometryAdaptor } from '../../adaptor/geometries/base';\nimport { interaction, animation, theme, tooltip } from '../../adaptor/common';\nimport { Params } from '../../core/adaptor';\nimport { PLOT_CONTAINER_OPTIONS } from '../../core/plot';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Interaction } from '../../types/interaction';\nimport { MixOptions, IView, IGeometry } from './types';\nimport { execPlotAdaptor } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction multiView(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { views, legend } = options;\n\n each(views, (v: IView) => {\n const { region, data, meta, axes, coordinate, interactions, annotations, tooltip, geometries } = v;\n\n // 1. 创建 view\n const viewOfG2 = chart.createView({\n region,\n });\n\n // 2. data\n viewOfG2.data(data);\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 viewOfG2.scale(scales);\n\n // 4. x y axis\n if (!axes) {\n viewOfG2.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n viewOfG2.axis(field, axis);\n });\n }\n\n // 5. coordinate\n viewOfG2.coordinate(coordinate);\n\n // 6. geometry\n each(geometries, (geometry: IGeometry) => {\n const { ext } = geometryAdaptor({\n chart: viewOfG2,\n options: geometry,\n });\n\n // adjust\n const { adjust } = geometry;\n if (adjust) {\n ext.geometry.adjust(adjust);\n }\n });\n\n // 7. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n viewOfG2.removeInteraction(interaction.type);\n } else {\n viewOfG2.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 8. annotations\n each(annotations, (annotation) => {\n viewOfG2.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n // 9. animation (先做动画)\n if (typeof v.animation === 'boolean') {\n viewOfG2.animate(false);\n } else {\n viewOfG2.animate(true);\n // 9.1 所有的 Geometry 都使用同一动画(各个图形如有区别,todo 自行覆盖)\n each(viewOfG2.geometries, (g: Geometry) => {\n g.animate(v.animation);\n });\n }\n\n if (tooltip) {\n // 10. tooltip\n viewOfG2.interaction('tooltip');\n viewOfG2.tooltip(tooltip);\n }\n });\n\n // legend\n if (!legend) {\n chart.legend(false);\n } else {\n each(legend, (l: Legend, field: string) => {\n chart.legend(field, l);\n });\n }\n\n // tooltip\n chart.tooltip(options.tooltip);\n return params;\n}\n\n/**\n * 支持嵌套使用 g2plot 内置图表\n * @param params\n */\nfunction multiPlot(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { plots } = options;\n\n each(plots, (plot) => {\n const { type, region, options = {} } = plot;\n const { tooltip } = options;\n\n const viewOfG2 = chart.createView({ region, ...pick(options, PLOT_CONTAINER_OPTIONS) });\n if (tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n\n execPlotAdaptor(type, viewOfG2, options);\n });\n\n return params;\n}\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<MixOptions>) {\n return flow(\n animation, // 多 view 的图,动画配置放到最前面\n multiView,\n multiPlot,\n interaction,\n animation,\n theme,\n tooltip\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/mix/adaptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;GAGG;AACH,SAAS,SAAS,CAAC,MAA0B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAK,GAAa,OAAO,MAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAElC,IAAI,CAAC,KAAK,EAAE,UAAC,CAAQ;QACX,IAAA,MAAM,GAAmF,CAAC,OAApF,EAAE,IAAI,GAA6E,CAAC,KAA9E,EAAE,IAAI,GAAuE,CAAC,KAAxE,EAAE,IAAI,GAAiE,CAAC,KAAlE,EAAE,UAAU,GAAqD,CAAC,WAAtD,EAAE,YAAY,GAAuC,CAAC,aAAxC,EAAE,WAAW,GAA0B,CAAC,YAA3B,EAAE,OAAO,GAAiB,CAAC,QAAlB,EAAE,UAAU,GAAK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AAU,OAAO,CAAC,MAA0B;IAChD,OAAO,IAAI,CACT,SAAS,EAAE,sBAAsB;IACjC,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,UAAU,EAAE;IACZ,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { each } from '@antv/util';\nimport { Geometry } from '@antv/g2';\nimport { geometry as geometryAdaptor } from '../../adaptor/geometries/base';\nimport { interaction, animation, theme, tooltip, annotation } from '../../adaptor/common';\nimport { Params } from '../../core/adaptor';\nimport { PLOT_CONTAINER_OPTIONS } from '../../core/plot';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Interaction } from '../../types/interaction';\nimport { MixOptions, IView, IGeometry } from './types';\nimport { execPlotAdaptor } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction multiView(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { views, legend } = options;\n\n each(views, (v: IView) => {\n const { region, data, meta, axes, coordinate, interactions, annotations, tooltip, geometries } = v;\n\n // 1. 创建 view\n const viewOfG2 = chart.createView({\n region,\n });\n\n // 2. data\n viewOfG2.data(data);\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 viewOfG2.scale(scales);\n\n // 4. x y axis\n if (!axes) {\n viewOfG2.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n viewOfG2.axis(field, axis);\n });\n }\n\n // 5. coordinate\n viewOfG2.coordinate(coordinate);\n\n // 6. geometry\n each(geometries, (geometry: IGeometry) => {\n const { ext } = geometryAdaptor({\n chart: viewOfG2,\n options: geometry,\n });\n\n // adjust\n const { adjust } = geometry;\n if (adjust) {\n ext.geometry.adjust(adjust);\n }\n });\n\n // 7. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n viewOfG2.removeInteraction(interaction.type);\n } else {\n viewOfG2.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 8. annotations\n each(annotations, (annotation) => {\n viewOfG2.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n // 9. animation (先做动画)\n if (typeof v.animation === 'boolean') {\n viewOfG2.animate(false);\n } else {\n viewOfG2.animate(true);\n // 9.1 所有的 Geometry 都使用同一动画(各个图形如有区别,todo 自行覆盖)\n each(viewOfG2.geometries, (g: Geometry) => {\n g.animate(v.animation);\n });\n }\n\n if (tooltip) {\n // 10. tooltip\n viewOfG2.interaction('tooltip');\n viewOfG2.tooltip(tooltip);\n }\n });\n\n // legend\n if (!legend) {\n chart.legend(false);\n } else {\n each(legend, (l: Legend, field: string) => {\n chart.legend(field, l);\n });\n }\n\n // tooltip\n chart.tooltip(options.tooltip);\n return params;\n}\n\n/**\n * 支持嵌套使用 g2plot 内置图表\n * @param params\n */\nfunction multiPlot(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { plots, data = [] } = options;\n\n each(plots, (plot) => {\n const { type, region, options = {}, top } = plot;\n const { tooltip } = options;\n\n if (top) {\n execPlotAdaptor(type, chart, { ...options, data });\n return;\n }\n\n const viewOfG2 = chart.createView({ region, ...pick(options, PLOT_CONTAINER_OPTIONS) });\n if (tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n\n execPlotAdaptor(type, viewOfG2, { data, ...options });\n });\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor (mix)\n * @param params\n */\nexport function slider(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n\n chart.option('slider', options.slider);\n\n return params;\n}\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<MixOptions>) {\n return flow(\n animation, // 多 view 的图,动画配置放到最前面\n multiView,\n multiPlot,\n interaction,\n animation,\n theme,\n tooltip,\n slider,\n annotation()\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
@@ -6,6 +6,7 @@ import { Geometry } from '../../adaptor/geometries/base';
6
6
  import { Animation } from '../../types/animation';
7
7
  import { Annotation } from '../../types/annotation';
8
8
  import { Interaction } from '../../types/interaction';
9
+ import { Slider } from '../../types/slider';
9
10
  import { IPlotTypes } from './utils';
10
11
  /**
11
12
  * @title geometry 映射信息
@@ -65,16 +66,31 @@ export declare type IView = {
65
66
  * @title 子 plot 的配置
66
67
  */
67
68
  export declare type IPlot = IPlotTypes & {
69
+ /**
70
+ * @title 数据
71
+ * @description 设置画布具体的数据. 默认基础顶层 data
72
+ */
73
+ readonly data?: Record<string, any>[];
68
74
  /**
69
75
  * @title plot view 的布局范围
70
76
  * @default "占满全部"
71
77
  */
72
78
  readonly region?: Region;
79
+ /**
80
+ * @title 是否为顶层
81
+ * @description 设置为 true 时,几何图形挂在顶层 chart 对象上,而不是子 view 下。此时 region 设置无效,data 继承顶层 data 配置。
82
+ * @default false
83
+ */
84
+ readonly top?: boolean;
73
85
  };
74
86
  /**
75
87
  * @title 类型定义
76
88
  */
77
89
  export interface MixOptions extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'legend' | 'tooltip' | 'slider' | 'scrollbar'> {
90
+ /**
91
+ * @title 顶层数据配置
92
+ */
93
+ readonly data?: Options['data'];
78
94
  /**
79
95
  * @title 是否同步子 view 的配置
80
96
  * @description 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步
@@ -92,12 +108,18 @@ export interface MixOptions extends Omit<Options, 'data' | 'legend' | 'xAxis' |
92
108
  readonly plots?: IPlot[];
93
109
  /**
94
110
  * @title tooltip 配置
95
- * @description tooltip 配置在 chart 层配置
111
+ * @description Mix tooltip 组件配置,统一顶层配置
112
+ * TODO 字段映射
96
113
  */
97
114
  readonly tooltip?: Tooltip;
98
115
  /**
99
116
  * @title legend 配置
100
- * @description 统一顶层配置
117
+ * @description Mix 图例配置,统一顶层配置
101
118
  */
102
119
  readonly legend?: false | Record<string, Legend>;
120
+ /**
121
+ * @title slider 配置
122
+ * @description Mix 缩略轴配置,统一顶层配置
123
+ */
124
+ readonly slider?: Slider;
103
125
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/mix/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Data, Meta, Options, Region, Tooltip } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Animation } from '../../types/animation';\nimport { Annotation } from '../../types/annotation';\nimport { Interaction } from '../../types/interaction';\nimport { IPlotTypes } from './utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n/**\n * @title 子 view 的配置\n * @description 暂时不开嵌套 view 的情况\n */\nexport type IView = {\n /**\n * @title view 的布局范围\n * @default \"占满全部\"\n */\n readonly region?: Region;\n /**\n * @title view 中的数据\n */\n readonly data: Data;\n /**\n * @title view 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 图形 geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title x,y 轴\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 annotation\n */\n readonly animation?: Animation;\n /**\n * @title tooltip\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes & {\n /**\n * @title plot view 的布局范围\n * @default \"占满全部\"\n */\n readonly region?: Region;\n};\n\n/**\n * @title 类型定义\n */\nexport interface MixOptions\n extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'legend' | 'tooltip' | 'slider' | 'scrollbar'> {\n /**\n * @title 是否同步子 view 的配置\n * @description 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步\n */\n readonly syncViewPadding?: boolean;\n /**\n * @title 每一个图层的配置\n * @description 每个图层包括有自己的:数据、图形、图形映射\n */\n readonly views?: IView[];\n /**\n * @title 限定与指定 plot 类型\n * @description 支持使用已有的 plot,限定与指定 plot 类型\n */\n readonly plots?: IPlot[];\n /**\n * @title tooltip 配置\n * @description tooltip 配置在 chart 层配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title legend 配置\n * @description 统一顶层配置\n */\n readonly legend?: false | Record<string, Legend>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/mix/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Data, Meta, Options, Region, Tooltip } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Animation } from '../../types/animation';\nimport { Annotation } from '../../types/annotation';\nimport { Interaction } from '../../types/interaction';\nimport { Slider } from '../../types/slider';\nimport { IPlotTypes } from './utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n/**\n * @title 子 view 的配置\n * @description 暂时不开嵌套 view 的情况\n */\nexport type IView = {\n /**\n * @title view 的布局范围\n * @default \"占满全部\"\n */\n readonly region?: Region;\n /**\n * @title view 中的数据\n */\n readonly data: Data;\n /**\n * @title view 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 图形 geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title x,y 轴\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 annotation\n */\n readonly animation?: Animation;\n /**\n * @title tooltip\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes & {\n /**\n * @title 数据\n * @description 设置画布具体的数据. 默认基础顶层 data\n */\n readonly data?: Record<string, any>[];\n /**\n * @title plot view 的布局范围\n * @default \"占满全部\"\n */\n readonly region?: Region;\n /**\n * @title 是否为顶层\n * @description 设置为 true 时,几何图形挂在顶层 chart 对象上,而不是子 view 下。此时 region 设置无效,data 继承顶层 data 配置。\n * @default false\n */\n readonly top?: boolean;\n};\n\n/**\n * @title 类型定义\n */\nexport interface MixOptions\n extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'legend' | 'tooltip' | 'slider' | 'scrollbar'> {\n /**\n * @title 顶层数据配置\n */\n readonly data?: Options['data'];\n /**\n * @title 是否同步子 view 的配置\n * @description 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步\n */\n readonly syncViewPadding?: boolean;\n /**\n * @title 每一个图层的配置\n * @description 每个图层包括有自己的:数据、图形、图形映射\n */\n readonly views?: IView[];\n /**\n * @title 限定与指定 plot 类型\n * @description 支持使用已有的 plot,限定与指定 plot 类型\n */\n readonly plots?: IPlot[];\n /**\n * @title tooltip 配置\n * @description Mix tooltip 组件配置,统一顶层配置\n * TODO 字段映射\n */\n readonly tooltip?: Tooltip;\n /**\n * @title legend 配置\n * @description Mix 图例配置,统一顶层配置\n */\n readonly legend?: false | Record<string, Legend>;\n /**\n * @title slider 配置\n * @description Mix 缩略轴配置,统一顶层配置\n */\n readonly slider?: Slider;\n}\n"]}
@@ -13,10 +13,11 @@ import { ProgressOptions } from '../progress';
13
13
  import { ScatterOptions } from '../scatter';
14
14
  import { HistogramOptions } from '../histogram';
15
15
  import { FunnelOptions } from '../funnel';
16
+ import { StockOptions } from '../stock';
16
17
  /**
17
- * 移除 options 中的 width、height 设置
18
+ * 移除 options 中的 width、height、data 设置
18
19
  */
19
- declare type OmitSize<T> = Omit<T, 'width' | 'height'>;
20
+ declare type OmitPlotOptions<T> = Omit<T, 'width' | 'height' | 'data'>;
20
21
  /**
21
22
  * multi-view 中的支持的 plots 类型(带 options 定义)
22
23
  */
@@ -28,46 +29,49 @@ export declare type IPlotTypes = {
28
29
  /**
29
30
  * plot 配置
30
31
  */
31
- readonly options: OmitSize<LineOptions>;
32
+ readonly options: OmitPlotOptions<LineOptions>;
32
33
  } | {
33
34
  readonly type: 'pie';
34
- readonly options: OmitSize<PieOptions>;
35
+ readonly options: OmitPlotOptions<PieOptions>;
35
36
  } | {
36
37
  readonly type: 'bar';
37
- readonly options: OmitSize<BarOptions>;
38
+ readonly options: OmitPlotOptions<BarOptions>;
38
39
  } | {
39
40
  readonly type: 'column';
40
- readonly options: OmitSize<ColumnOptions>;
41
+ readonly options: OmitPlotOptions<ColumnOptions>;
41
42
  } | {
42
43
  readonly type: 'area';
43
- readonly options: OmitSize<AreaOptions>;
44
+ readonly options: OmitPlotOptions<AreaOptions>;
44
45
  } | {
45
46
  readonly type: 'gauge';
46
- readonly options: OmitSize<GaugeOptions>;
47
+ readonly options: OmitPlotOptions<GaugeOptions>;
47
48
  } | {
48
49
  readonly type: 'tiny-line';
49
- readonly options: OmitSize<TinyLineOptions>;
50
+ readonly options: OmitPlotOptions<TinyLineOptions>;
50
51
  } | {
51
52
  readonly type: 'tiny-area';
52
- readonly options: OmitSize<TinyAreaOptions>;
53
+ readonly options: OmitPlotOptions<TinyAreaOptions>;
53
54
  } | {
54
55
  readonly type: 'tiny-column';
55
- readonly options: OmitSize<TinyColumnOptions>;
56
+ readonly options: OmitPlotOptions<TinyColumnOptions>;
56
57
  } | {
57
58
  readonly type: 'ring-progress';
58
- readonly options: OmitSize<RingProgressOptions>;
59
+ readonly options: OmitPlotOptions<RingProgressOptions>;
59
60
  } | {
60
61
  readonly type: 'progress';
61
- readonly options: OmitSize<ProgressOptions>;
62
+ readonly options: OmitPlotOptions<ProgressOptions>;
62
63
  } | {
63
64
  readonly type: 'histogram';
64
- readonly options: OmitSize<HistogramOptions>;
65
+ readonly options: OmitPlotOptions<HistogramOptions>;
65
66
  } | {
66
67
  readonly type: 'scatter';
67
- readonly options: OmitSize<ScatterOptions>;
68
+ readonly options: OmitPlotOptions<ScatterOptions>;
68
69
  } | {
69
70
  readonly type: 'funnel';
70
- readonly options: OmitSize<FunnelOptions>;
71
+ readonly options: OmitPlotOptions<FunnelOptions>;
72
+ } | {
73
+ readonly type: 'stock';
74
+ readonly options: OmitPlotOptions<StockOptions>;
71
75
  };
72
76
  /**
73
77
  * 执行 plot 的 adaptor, 默认都带上 defaultOptions
@@ -8,12 +8,13 @@ import { adaptor as areaAdaptor } from '../area/adaptor';
8
8
  import { adaptor as gaugeAdaptor } from '../gauge/adaptor';
9
9
  import { adaptor as tinyLineAdaptor } from '../tiny-line/adaptor';
10
10
  import { adaptor as tinyColumnAdaptor } from '../tiny-column/adaptor';
11
- import { adaptor as tinyAreadaptor } from '../tiny-area/adaptor';
11
+ import { adaptor as tinyAreaAdaptor } from '../tiny-area/adaptor';
12
12
  import { adaptor as ringProgressAdaptor } from '../ring-progress/adaptor';
13
13
  import { adaptor as progressAdaptor } from '../progress/adaptor';
14
14
  import { adaptor as scatterAdaptor } from '../scatter/adaptor';
15
15
  import { adaptor as histogramAdaptor } from '../histogram/adaptor';
16
16
  import { adaptor as funnelAdaptor } from '../funnel/adaptor';
17
+ import { adaptor as stockAdaptor } from '../stock/adaptor';
17
18
  import { Line } from '../line';
18
19
  import { Pie } from '../pie';
19
20
  import { Bar } from '../bar';
@@ -28,6 +29,7 @@ import { Progress } from '../progress';
28
29
  import { Scatter } from '../scatter';
29
30
  import { Histogram } from '../histogram';
30
31
  import { Funnel } from '../funnel';
32
+ import { Stock } from '../stock';
31
33
  /**
32
34
  * 可在 multi-view 中使用的 plots
33
35
  */
@@ -40,12 +42,13 @@ var PLOT_ADAPTORS = {
40
42
  gauge: gaugeAdaptor,
41
43
  'tiny-line': tinyLineAdaptor,
42
44
  'tiny-column': tinyColumnAdaptor,
43
- 'tiny-area': tinyAreadaptor,
45
+ 'tiny-area': tinyAreaAdaptor,
44
46
  'ring-progress': ringProgressAdaptor,
45
47
  progress: progressAdaptor,
46
48
  scatter: scatterAdaptor,
47
49
  histogram: histogramAdaptor,
48
50
  funnel: funnelAdaptor,
51
+ stock: stockAdaptor,
49
52
  };
50
53
  /**
51
54
  * 获取指定 plot 的 class contructor
@@ -66,6 +69,7 @@ var PLOT_CONSTRUCTOR = {
66
69
  scatter: Scatter,
67
70
  histogram: Histogram,
68
71
  funnel: Funnel,
72
+ stock: Stock,
69
73
  };
70
74
  /**
71
75
  * 在 mix 图表以及 facet 图表中,defaultOptions 进行复写简化
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/mix/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MA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AAI;QACX,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC;KAC9F,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { View } from '@antv/g2';\nimport { get } from '@antv/util';\nimport { deepAssign } from '../../utils';\nimport { adaptor as lineAdaptor } from '../line/adaptor';\nimport { adaptor as pieAdaptor } from '../pie/adaptor';\nimport { adaptor as columnAdaptor } from '../column/adaptor';\nimport { adaptor as barAdaptor } from '../bar/adaptor';\nimport { adaptor as areaAdaptor } from '../area/adaptor';\nimport { adaptor as gaugeAdaptor } from '../gauge/adaptor';\nimport { adaptor as tinyLineAdaptor } from '../tiny-line/adaptor';\nimport { adaptor as tinyColumnAdaptor } from '../tiny-column/adaptor';\nimport { adaptor as tinyAreadaptor } from '../tiny-area/adaptor';\nimport { adaptor as ringProgressAdaptor } from '../ring-progress/adaptor';\nimport { adaptor as progressAdaptor } from '../progress/adaptor';\nimport { adaptor as scatterAdaptor } from '../scatter/adaptor';\nimport { adaptor as histogramAdaptor } from '../histogram/adaptor';\nimport { adaptor as funnelAdaptor } from '../funnel/adaptor';\nimport { Line, LineOptions } from '../line';\nimport { Pie, PieOptions } from '../pie';\nimport { Bar, BarOptions } from '../bar';\nimport { Column, ColumnOptions } from '../column';\nimport { Area, AreaOptions } from '../area';\nimport { Gauge, GaugeOptions } from '../gauge';\nimport { TinyLine, TinyLineOptions } from '../tiny-line';\nimport { TinyArea, TinyAreaOptions } from '../tiny-area';\nimport { TinyColumn, TinyColumnOptions } from '../tiny-column';\nimport { RingProgress, RingProgressOptions } from '../ring-progress';\nimport { Progress, ProgressOptions } from '../progress';\nimport { Scatter, ScatterOptions } from '../scatter';\nimport { Histogram, HistogramOptions } from '../histogram';\nimport { Funnel, FunnelOptions } from '../funnel';\n\n/**\n * 移除 options 中的 width、height 设置\n */\ntype OmitSize<T> = Omit<T, 'width' | 'height'>;\n\n/**\n * multi-view 中的支持的 plots 类型(带 options 定义)\n */\nexport type IPlotTypes =\n | {\n /**\n * plot 类型\n */\n readonly type: 'line';\n /**\n * plot 配置\n */\n readonly options: OmitSize<LineOptions>;\n }\n | {\n readonly type: 'pie';\n readonly options: OmitSize<PieOptions>;\n }\n | {\n readonly type: 'bar';\n readonly options: OmitSize<BarOptions>;\n }\n | {\n readonly type: 'column';\n readonly options: OmitSize<ColumnOptions>;\n }\n | {\n readonly type: 'area';\n readonly options: OmitSize<AreaOptions>;\n }\n | {\n readonly type: 'gauge';\n readonly options: OmitSize<GaugeOptions>;\n }\n | {\n readonly type: 'tiny-line';\n readonly options: OmitSize<TinyLineOptions>;\n }\n | {\n readonly type: 'tiny-area';\n readonly options: OmitSize<TinyAreaOptions>;\n }\n | {\n readonly type: 'tiny-column';\n readonly options: OmitSize<TinyColumnOptions>;\n }\n | {\n readonly type: 'ring-progress';\n readonly options: OmitSize<RingProgressOptions>;\n }\n | {\n readonly type: 'progress';\n readonly options: OmitSize<ProgressOptions>;\n }\n | {\n readonly type: 'histogram';\n readonly options: OmitSize<HistogramOptions>;\n }\n | {\n readonly type: 'scatter';\n readonly options: OmitSize<ScatterOptions>;\n }\n | {\n readonly type: 'funnel';\n readonly options: OmitSize<FunnelOptions>;\n };\n\n/**\n * 可在 multi-view 中使用的 plots\n */\nconst PLOT_ADAPTORS = {\n line: lineAdaptor,\n pie: pieAdaptor,\n column: columnAdaptor,\n bar: barAdaptor,\n area: areaAdaptor,\n gauge: gaugeAdaptor,\n 'tiny-line': tinyLineAdaptor,\n 'tiny-column': tinyColumnAdaptor,\n 'tiny-area': tinyAreadaptor,\n 'ring-progress': ringProgressAdaptor,\n progress: progressAdaptor,\n scatter: scatterAdaptor,\n histogram: histogramAdaptor,\n funnel: funnelAdaptor,\n};\n\n/**\n * 获取指定 plot 的 class contructor\n * @param {string} plot\n */\nconst PLOT_CONSTRUCTOR = {\n line: Line,\n pie: Pie,\n column: Column,\n bar: Bar,\n area: Area,\n gauge: Gauge,\n 'tiny-line': TinyLine,\n 'tiny-column': TinyColumn,\n 'tiny-area': TinyArea,\n 'ring-progress': RingProgress,\n progress: Progress,\n scatter: Scatter,\n histogram: Histogram,\n funnel: Funnel,\n};\n\n/**\n * 在 mix 图表以及 facet 图表中,defaultOptions 进行复写简化\n */\nconst DEFAULT_OPTIONS_MAP = {\n pie: { label: false },\n column: { tooltip: { showMarkers: false } },\n bar: { tooltip: { showMarkers: false } },\n};\n\n/**\n * 执行 plot 的 adaptor, 默认都带上 defaultOptions\n * @param {string} plot\n */\nexport function execPlotAdaptor<T extends IPlotTypes['type']>(\n plot: T,\n view: View,\n options: IPlotTypes['options']\n): void {\n const cls = PLOT_CONSTRUCTOR[plot];\n if (!cls) {\n console.error(`could not find ${plot} plot`);\n return;\n }\n const module = PLOT_ADAPTORS[plot];\n module({\n chart: view,\n options: deepAssign({}, cls.getDefaultOptions(), get(DEFAULT_OPTIONS_MAP, plot, {}), options),\n });\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/plots/mix/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sB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C,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,oBAAkB,IAAI,UAAO,CAAC,CAAC;QAC7C,OAAO;KACR;IACD,IAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC;QACL,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC;KAC9F,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { View } from '@antv/g2';\nimport { get } from '@antv/util';\nimport { deepAssign } from '../../utils';\nimport { adaptor as lineAdaptor } from '../line/adaptor';\nimport { adaptor as pieAdaptor } from '../pie/adaptor';\nimport { adaptor as columnAdaptor } from '../column/adaptor';\nimport { adaptor as barAdaptor } from '../bar/adaptor';\nimport { adaptor as areaAdaptor } from '../area/adaptor';\nimport { adaptor as gaugeAdaptor } from '../gauge/adaptor';\nimport { adaptor as tinyLineAdaptor } from '../tiny-line/adaptor';\nimport { adaptor as tinyColumnAdaptor } from '../tiny-column/adaptor';\nimport { adaptor as tinyAreaAdaptor } from '../tiny-area/adaptor';\nimport { adaptor as ringProgressAdaptor } from '../ring-progress/adaptor';\nimport { adaptor as progressAdaptor } from '../progress/adaptor';\nimport { adaptor as scatterAdaptor } from '../scatter/adaptor';\nimport { adaptor as histogramAdaptor } from '../histogram/adaptor';\nimport { adaptor as funnelAdaptor } from '../funnel/adaptor';\nimport { adaptor as stockAdaptor } from '../stock/adaptor';\nimport { Line, LineOptions } from '../line';\nimport { Pie, PieOptions } from '../pie';\nimport { Bar, BarOptions } from '../bar';\nimport { Column, ColumnOptions } from '../column';\nimport { Area, AreaOptions } from '../area';\nimport { Gauge, GaugeOptions } from '../gauge';\nimport { TinyLine, TinyLineOptions } from '../tiny-line';\nimport { TinyArea, TinyAreaOptions } from '../tiny-area';\nimport { TinyColumn, TinyColumnOptions } from '../tiny-column';\nimport { RingProgress, RingProgressOptions } from '../ring-progress';\nimport { Progress, ProgressOptions } from '../progress';\nimport { Scatter, ScatterOptions } from '../scatter';\nimport { Histogram, HistogramOptions } from '../histogram';\nimport { Funnel, FunnelOptions } from '../funnel';\nimport { Stock, StockOptions } from '../stock';\n\n/**\n * 移除 options 中的 width、height、data 设置\n */\ntype OmitPlotOptions<T> = Omit<T, 'width' | 'height' | 'data'>;\n\n/**\n * multi-view 中的支持的 plots 类型(带 options 定义)\n */\nexport type IPlotTypes =\n | {\n /**\n * plot 类型\n */\n readonly type: 'line';\n /**\n * plot 配置\n */\n readonly options: OmitPlotOptions<LineOptions>;\n }\n | {\n readonly type: 'pie';\n readonly options: OmitPlotOptions<PieOptions>;\n }\n | {\n readonly type: 'bar';\n readonly options: OmitPlotOptions<BarOptions>;\n }\n | {\n readonly type: 'column';\n readonly options: OmitPlotOptions<ColumnOptions>;\n }\n | {\n readonly type: 'area';\n readonly options: OmitPlotOptions<AreaOptions>;\n }\n | {\n readonly type: 'gauge';\n readonly options: OmitPlotOptions<GaugeOptions>;\n }\n | {\n readonly type: 'tiny-line';\n readonly options: OmitPlotOptions<TinyLineOptions>;\n }\n | {\n readonly type: 'tiny-area';\n readonly options: OmitPlotOptions<TinyAreaOptions>;\n }\n | {\n readonly type: 'tiny-column';\n readonly options: OmitPlotOptions<TinyColumnOptions>;\n }\n | {\n readonly type: 'ring-progress';\n readonly options: OmitPlotOptions<RingProgressOptions>;\n }\n | {\n readonly type: 'progress';\n readonly options: OmitPlotOptions<ProgressOptions>;\n }\n | {\n readonly type: 'histogram';\n readonly options: OmitPlotOptions<HistogramOptions>;\n }\n | {\n readonly type: 'scatter';\n readonly options: OmitPlotOptions<ScatterOptions>;\n }\n | {\n readonly type: 'funnel';\n readonly options: OmitPlotOptions<FunnelOptions>;\n }\n | {\n readonly type: 'stock';\n readonly options: OmitPlotOptions<StockOptions>;\n };\n\n/**\n * 可在 multi-view 中使用的 plots\n */\nconst PLOT_ADAPTORS = {\n line: lineAdaptor,\n pie: pieAdaptor,\n column: columnAdaptor,\n bar: barAdaptor,\n area: areaAdaptor,\n gauge: gaugeAdaptor,\n 'tiny-line': tinyLineAdaptor,\n 'tiny-column': tinyColumnAdaptor,\n 'tiny-area': tinyAreaAdaptor,\n 'ring-progress': ringProgressAdaptor,\n progress: progressAdaptor,\n scatter: scatterAdaptor,\n histogram: histogramAdaptor,\n funnel: funnelAdaptor,\n stock: stockAdaptor,\n};\n\n/**\n * 获取指定 plot 的 class contructor\n * @param {string} plot\n */\nconst PLOT_CONSTRUCTOR = {\n line: Line,\n pie: Pie,\n column: Column,\n bar: Bar,\n area: Area,\n gauge: Gauge,\n 'tiny-line': TinyLine,\n 'tiny-column': TinyColumn,\n 'tiny-area': TinyArea,\n 'ring-progress': RingProgress,\n progress: Progress,\n scatter: Scatter,\n histogram: Histogram,\n funnel: Funnel,\n stock: Stock,\n};\n\n/**\n * 在 mix 图表以及 facet 图表中,defaultOptions 进行复写简化\n */\nconst DEFAULT_OPTIONS_MAP = {\n pie: { label: false },\n column: { tooltip: { showMarkers: false } },\n bar: { tooltip: { showMarkers: false } },\n};\n\n/**\n * 执行 plot 的 adaptor, 默认都带上 defaultOptions\n * @param {string} plot\n */\nexport function execPlotAdaptor<T extends IPlotTypes['type']>(\n plot: T,\n view: View,\n options: IPlotTypes['options']\n): void {\n const cls = PLOT_CONSTRUCTOR[plot];\n if (!cls) {\n console.error(`could not find ${plot} plot`);\n return;\n }\n const module = PLOT_ADAPTORS[plot];\n module({\n chart: view,\n options: deepAssign({}, cls.getDefaultOptions(), get(DEFAULT_OPTIONS_MAP, plot, {}), options),\n });\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.11";
1
+ export declare const version = "2.4.14";
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.11';
5
+ exports.version = '2.4.14';
6
6
  // G2 自定义能力透出
7
7
  var G2 = tslib_1.__importStar(require("@antv/g2"));
8
8
  exports.G2 = G2;