@antv/g2plot 2.4.33 → 2.4.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g2plot.min.js +2 -2
- package/dist/g2plot.min.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/facet/adaptor.js +26 -4
- package/esm/plots/facet/adaptor.js.map +1 -1
- package/esm/plots/facet/types.d.ts +26 -1
- package/esm/plots/facet/types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/facet/adaptor.js +26 -4
- package/lib/plots/facet/adaptor.js.map +1 -1
- package/lib/plots/facet/types.d.ts +26 -1
- package/lib/plots/facet/types.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/plots/facet/adaptor.ts +38 -1
- package/src/plots/facet/types.ts +26 -1
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
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,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrG,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK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AAExC,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,uEAAuE;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,2BAA2B;AAC3B,mEAAmE;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAC7B,SAAS;AACT,cAAc,SAAS,CAAC;AACxB,uCAAuC;AACvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjD,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAEtC,MAAM,CAAC,IAAM,QAAQ,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.33';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrG,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAWpF,WAAW;AACX,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,yDAAyD;AACz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;AACjD,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAEtC,MAAM,CAAC,IAAM,QAAQ,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.35';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
|
|
@@ -32,20 +32,26 @@ function facetAdaptor(params) {
|
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
var plot = viewOptions;
|
|
35
|
-
var
|
|
35
|
+
var plotOptions_1 = plot.options;
|
|
36
|
+
// 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段
|
|
37
|
+
['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach(function (key) {
|
|
38
|
+
if (options[key] && typeof plotOptions_1[key] === 'undefined') {
|
|
39
|
+
plotOptions_1[key] = options[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
// @ts-ignore 仪表盘没 tooltip
|
|
37
|
-
if (
|
|
43
|
+
if (plotOptions_1.tooltip) {
|
|
38
44
|
// 配置 tooltip 交互
|
|
39
45
|
viewOfG2.interaction('tooltip');
|
|
40
46
|
}
|
|
41
|
-
execPlotAdaptor(plot.type, viewOfG2,
|
|
47
|
+
execPlotAdaptor(plot.type, viewOfG2, plotOptions_1);
|
|
42
48
|
}
|
|
43
49
|
} }));
|
|
44
50
|
return params;
|
|
45
51
|
}
|
|
46
52
|
function component(params) {
|
|
47
53
|
var chart = params.chart, options = params.options;
|
|
48
|
-
var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations;
|
|
54
|
+
var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations, shapeField = options.shapeField, sizeField = options.sizeField, shapeLegend = options.shapeLegend, sizeLegend = options.sizeLegend;
|
|
49
55
|
// 3. meta 配置
|
|
50
56
|
var scales = {};
|
|
51
57
|
if (axes) {
|
|
@@ -76,6 +82,22 @@ function component(params) {
|
|
|
76
82
|
}
|
|
77
83
|
// 7. legend 配置(默认展示)
|
|
78
84
|
chart.legend(legend);
|
|
85
|
+
var showLegend = legend !== false;
|
|
86
|
+
if (shapeField) {
|
|
87
|
+
if (shapeLegend) {
|
|
88
|
+
chart.legend(shapeField, shapeLegend);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
chart.legend(shapeField, shapeLegend === false ? false : legend);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (sizeField) {
|
|
95
|
+
chart.legend(sizeField, sizeLegend ? sizeLegend : false);
|
|
96
|
+
}
|
|
97
|
+
// /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */
|
|
98
|
+
if (!showLegend && !shapeLegend && !sizeLegend) {
|
|
99
|
+
chart.legend(false);
|
|
100
|
+
}
|
|
79
101
|
// theme 配置
|
|
80
102
|
if (theme) {
|
|
81
103
|
chart.theme(theme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/facet/adaptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,SAAS,YAAY,CAAC,MAA4B;IACxC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAM,SAAS,GAA6B,OAAO,KAApC,EAAE,IAAI,GAAuB,OAAO,KAA9B,EAAE,MAAM,GAAe,OAAO,OAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAa;IAE5D,IAAM,YAAY,GAAG,IAAI,CAAC,OAAc,EAAE;QACxC,MA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AC,UAAU,CAAC,IAAI,CAAC,cAC9B,UAAU,EACb,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { each, omit } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { Axis, Interaction } from '../../types';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { execPlotAdaptor } from '../mix/utils';\nimport { FacetOptions, IPlot, IView } from './types';\nimport { execViewAdaptor } from './utils';\n\nfunction facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const { type: facetType, data, fields, eachView } = options;\n\n const restFacetCfg = omit(options as any, [\n 'type',\n 'data',\n 'fields',\n 'eachView',\n 'axes',\n 'meta',\n 'tooltip',\n 'coordinate',\n 'theme',\n 'legend',\n 'interactions',\n 'annotations',\n ]);\n\n // 1. data\n chart.data(data);\n\n // 2. facet\n chart.facet(facetType, {\n ...restFacetCfg,\n fields,\n eachView: (viewOfG2, facet) => {\n const viewOptions = eachView(viewOfG2, facet);\n if ((viewOptions as IView).geometries) {\n execViewAdaptor(viewOfG2, viewOptions as IView);\n } else {\n const plot = viewOptions as IPlot;\n const plotOptions = plot.options;\n\n // 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段\n ['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach((key) => {\n if (options[key] && typeof plotOptions[key] === 'undefined') {\n plotOptions[key] = options[key];\n }\n });\n\n // @ts-ignore 仪表盘没 tooltip\n if (plotOptions.tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n execPlotAdaptor(plot.type, viewOfG2, plotOptions);\n }\n },\n });\n\n return params;\n}\n\nfunction component(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const {\n axes,\n meta,\n tooltip,\n coordinate,\n theme,\n legend,\n interactions,\n annotations,\n shapeField,\n sizeField,\n shapeLegend,\n sizeLegend,\n } = options;\n\n // 3. meta 配置\n let scales: Record<string, any> = {};\n if (axes) {\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n }\n\n scales = deepAssign({}, meta, scales);\n chart.scale(scales);\n\n // 4. coordinate 配置\n chart.coordinate(coordinate);\n\n // 5. axis 轴配置 (默认不展示)\n if (!axes) {\n chart.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n chart.axis(field, axis);\n });\n }\n\n // 6. tooltip 配置\n if (tooltip) {\n chart.interaction('tooltip');\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.removeInteraction('tooltip');\n }\n\n // 7. legend 配置(默认展示)\n chart.legend(legend);\n const showLegend = legend !== false;\n if (shapeField) {\n if (shapeLegend) {\n chart.legend(shapeField, shapeLegend);\n } else {\n chart.legend(shapeField, shapeLegend === false ? false : legend);\n }\n }\n\n if (sizeField) {\n chart.legend(sizeField, sizeLegend ? sizeLegend : false);\n }\n // /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */\n if (!showLegend && !shapeLegend && !sizeLegend) {\n chart.legend(false);\n }\n\n // theme 配置\n if (theme) {\n chart.theme(theme);\n }\n\n // 8. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n chart.removeInteraction(interaction.type);\n } else {\n chart.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 9. annotations\n each(annotations, (annotation) => {\n chart.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n return params;\n}\n\n/**\n * 分面图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<FacetOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(theme, facetAdaptor, component)(params);\n}\n"]}
|
|
@@ -141,8 +141,33 @@ export interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.Fa
|
|
|
141
141
|
*/
|
|
142
142
|
readonly legend?: Legend;
|
|
143
143
|
/**
|
|
144
|
-
* @title
|
|
144
|
+
* @title 交互配置
|
|
145
145
|
*/
|
|
146
146
|
readonly interactions?: Interaction[];
|
|
147
|
+
/**
|
|
148
|
+
* @title 形状字段
|
|
149
|
+
* @description 形状映射字段
|
|
150
|
+
*/
|
|
151
|
+
readonly shapeField?: string;
|
|
152
|
+
/**
|
|
153
|
+
* @title 颜色字段
|
|
154
|
+
* @description 颜色映射字段
|
|
155
|
+
*/
|
|
156
|
+
readonly colorField?: string;
|
|
157
|
+
/**
|
|
158
|
+
* @title 大小字段
|
|
159
|
+
* @description 大小映射字段
|
|
160
|
+
*/
|
|
161
|
+
readonly sizeField?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @title 形状图例配置
|
|
164
|
+
* @description 形状图例的配置项
|
|
165
|
+
*/
|
|
166
|
+
readonly shapeLegend?: Legend | false;
|
|
167
|
+
/**
|
|
168
|
+
* @title 大小图例配置
|
|
169
|
+
* @description 大小图例的配置项
|
|
170
|
+
*/
|
|
171
|
+
readonly sizeLegend?: Legend | false;
|
|
147
172
|
}
|
|
148
173
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title 交互配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title 形状字段\n * @description 形状映射字段\n */\n readonly shapeField?: string;\n /**\n * @title 颜色字段\n * @description 颜色映射字段\n */\n readonly colorField?: string;\n /**\n * @title 大小字段\n * @description 大小映射字段\n */\n readonly sizeField?: string;\n /**\n * @title 形状图例配置\n * @description 形状图例的配置项\n */\n readonly shapeLegend?: Legend | false;\n /**\n * @title 大小图例配置\n * @description 大小图例的配置项\n */\n readonly sizeLegend?: Legend | false;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flow = exports.P = exports.WordCloud = exports.Waterfall = exports.Violin = exports.Venn = exports.Treemap = exports.TinyLine = exports.TinyColumn = exports.TinyArea = exports.Sunburst = exports.Stock = exports.Scatter = exports.Sankey = exports.Rose = exports.RingProgress = exports.RadialBar = exports.Radar = exports.Progress = exports.Pie = exports.MultiView = exports.Mix = exports.Liquid = exports.addWaterWave = exports.Line = exports.Histogram = exports.Heatmap = exports.Gauge = exports.FUNNEL_CONVERSATION_FIELD = exports.Funnel = exports.Facet = exports.DualAxes = exports.Column = exports.CirclePacking = exports.Chord = exports.Bullet = exports.Box = exports.BidirectionalBar = exports.Bar = exports.Area = exports.Lab = exports.Plot = exports.setGlobal = exports.schema = exports.polygon = exports.point = exports.line = exports.interval = exports.area = exports.version = void 0;
|
|
4
4
|
exports.adaptors = exports.registerLocale = exports.G2 = exports.getCanvasPattern = exports.measureTextWidth = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
|
-
exports.version = '2.4.
|
|
6
|
+
exports.version = '2.4.35';
|
|
7
7
|
// G2 自定义能力透出
|
|
8
8
|
var G2 = tslib_1.__importStar(require("@antv/g2"));
|
|
9
9
|
exports.G2 = G2;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAa,QAAA,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,OAAA;AAEf,sDAAsD;AACtD,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uEAAuE;AACvE,iDAA+C;AAAtC,uGAAA,SAAS,OAAA;AAElB,2BAA2B;AAC3B,mEAAmE;AACnE,mCAA6B;AAApB,2FAAA,CAAC,OAAA;AACV,SAAS;AACT,kDAAwB;AACxB,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAC/B,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAKzB,8BAA8B;AAC9B,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.33';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AA2ItB,gBAAE;AA1IX,uCAAuC;AACvC,2CAAqG;AACrG,QAAQ;AACR,wCAA+C;AAyItC,+FAzIA,uBAAc,OAyIA;AAxIvB,yCAA+C;AAC/C,yCAA+C;AAC/C,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AAWrD,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAClB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAEb,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAEZ,+DAA+D;AAC/D,+DAA6D;AAApD,qHAAA,gBAAgB,OAAA;AAEzB,8FAA8F;AAC9F,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAEZ,6DAA6D;AAC7D,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,uGAAuG;AACvG,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAEd,6GAA6G;AAC7G,y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;AAEjB,+DAA+D;AAC/D,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAEjB,+DAA+D;AAC/D,mDAAiD;AAAxC,yGAAA,UAAU,OAAA;AAEnB,+DAA+D;AAC/D,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAEjB,OAAO;AACP,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAEhB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAEb,qGAAqG;AACrG,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,sDAAsD;AACtD,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uEAAuE;AACvE,iDAA+C;AAAtC,uGAAA,SAAS,OAAA;AAElB,2BAA2B;AAC3B,mEAAmE;AACnE,mCAA6B;AAApB,2FAAA,CAAC,OAAA;AACV,SAAS;AACT,kDAAwB;AACxB,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAC/B,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAKzB,8BAA8B;AAC9B,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,IAAA,uBAAc,EAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC","sourcesContent":["export const version = '2.4.35';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { area, interval, line, point, polygon, schema } from './adaptor/geometries';\nexport type {\n AreaGeometryOptions,\n IntervalGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { addWaterWave, Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n// 已经废弃,更名为 Mix\nexport { Mix as Mix, Mix as MultiView } from './plots/mix';\nexport type { MixOptions, MixOptions as MultiViewOptions } from './plots/mix';\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n// 类型定义导出\nexport * from './types';\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\nexport { G2 };\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n"]}
|
|
@@ -35,20 +35,26 @@ function facetAdaptor(params) {
|
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
var plot = viewOptions;
|
|
38
|
-
var
|
|
38
|
+
var plotOptions_1 = plot.options;
|
|
39
|
+
// 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段
|
|
40
|
+
['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach(function (key) {
|
|
41
|
+
if (options[key] && typeof plotOptions_1[key] === 'undefined') {
|
|
42
|
+
plotOptions_1[key] = options[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
39
45
|
// @ts-ignore 仪表盘没 tooltip
|
|
40
|
-
if (
|
|
46
|
+
if (plotOptions_1.tooltip) {
|
|
41
47
|
// 配置 tooltip 交互
|
|
42
48
|
viewOfG2.interaction('tooltip');
|
|
43
49
|
}
|
|
44
|
-
(0, utils_2.execPlotAdaptor)(plot.type, viewOfG2,
|
|
50
|
+
(0, utils_2.execPlotAdaptor)(plot.type, viewOfG2, plotOptions_1);
|
|
45
51
|
}
|
|
46
52
|
} }));
|
|
47
53
|
return params;
|
|
48
54
|
}
|
|
49
55
|
function component(params) {
|
|
50
56
|
var chart = params.chart, options = params.options;
|
|
51
|
-
var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations;
|
|
57
|
+
var axes = options.axes, meta = options.meta, tooltip = options.tooltip, coordinate = options.coordinate, theme = options.theme, legend = options.legend, interactions = options.interactions, annotations = options.annotations, shapeField = options.shapeField, sizeField = options.sizeField, shapeLegend = options.shapeLegend, sizeLegend = options.sizeLegend;
|
|
52
58
|
// 3. meta 配置
|
|
53
59
|
var scales = {};
|
|
54
60
|
if (axes) {
|
|
@@ -79,6 +85,22 @@ function component(params) {
|
|
|
79
85
|
}
|
|
80
86
|
// 7. legend 配置(默认展示)
|
|
81
87
|
chart.legend(legend);
|
|
88
|
+
var showLegend = legend !== false;
|
|
89
|
+
if (shapeField) {
|
|
90
|
+
if (shapeLegend) {
|
|
91
|
+
chart.legend(shapeField, shapeLegend);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
chart.legend(shapeField, shapeLegend === false ? false : legend);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (sizeField) {
|
|
98
|
+
chart.legend(sizeField, sizeLegend ? sizeLegend : false);
|
|
99
|
+
}
|
|
100
|
+
// /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */
|
|
101
|
+
if (!showLegend && !shapeLegend && !sizeLegend) {
|
|
102
|
+
chart.legend(false);
|
|
103
|
+
}
|
|
82
104
|
// theme 配置
|
|
83
105
|
if (theme) {
|
|
84
106
|
chart.theme(theme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/facet/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAwC;AACxC,+CAA6C;AAC7C,2CAAuD;AAGvD,qCAAqD;AACrD,sC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AAW,CAAC,GAAG,CAAC,CAAC;SACtD;IACH,CAAC,CAAC,CAAC;IAEH,iBAAiB;IACjB,IAAA,WAAI,EAAC,WAAW,EAAE,UAAC,UAAU;QAC3B,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,sBAC9B,UAAU,EACb,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAA,YAAI,EAAC,cAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC;AAHD,0BAGC","sourcesContent":["import { each, omit } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { Axis, Interaction } from '../../types';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { execPlotAdaptor } from '../mix/utils';\nimport { FacetOptions, IPlot, IView } from './types';\nimport { execViewAdaptor } from './utils';\n\nfunction facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const { type: facetType, data, fields, eachView } = options;\n\n const restFacetCfg = omit(options as any, [\n 'type',\n 'data',\n 'fields',\n 'eachView',\n 'axes',\n 'meta',\n 'tooltip',\n 'coordinate',\n 'theme',\n 'legend',\n 'interactions',\n 'annotations',\n ]);\n\n // 1. data\n chart.data(data);\n\n // 2. facet\n chart.facet(facetType, {\n ...restFacetCfg,\n fields,\n eachView: (viewOfG2, facet) => {\n const viewOptions = eachView(viewOfG2, facet);\n if ((viewOptions as IView).geometries) {\n execViewAdaptor(viewOfG2, viewOptions as IView);\n } else {\n const plot = viewOptions as IPlot;\n const plotOptions = plot.options;\n\n // 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段\n ['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach((key) => {\n if (options[key] && typeof plotOptions[key] === 'undefined') {\n plotOptions[key] = options[key];\n }\n });\n\n // @ts-ignore 仪表盘没 tooltip\n if (plotOptions.tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n execPlotAdaptor(plot.type, viewOfG2, plotOptions);\n }\n },\n });\n\n return params;\n}\n\nfunction component(params: Params<FacetOptions>): Params<FacetOptions> {\n const { chart, options } = params;\n const {\n axes,\n meta,\n tooltip,\n coordinate,\n theme,\n legend,\n interactions,\n annotations,\n shapeField,\n sizeField,\n shapeLegend,\n sizeLegend,\n } = options;\n\n // 3. meta 配置\n let scales: Record<string, any> = {};\n if (axes) {\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n }\n\n scales = deepAssign({}, meta, scales);\n chart.scale(scales);\n\n // 4. coordinate 配置\n chart.coordinate(coordinate);\n\n // 5. axis 轴配置 (默认不展示)\n if (!axes) {\n chart.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n chart.axis(field, axis);\n });\n }\n\n // 6. tooltip 配置\n if (tooltip) {\n chart.interaction('tooltip');\n chart.tooltip(tooltip);\n } else if (tooltip === false) {\n chart.removeInteraction('tooltip');\n }\n\n // 7. legend 配置(默认展示)\n chart.legend(legend);\n const showLegend = legend !== false;\n if (shapeField) {\n if (shapeLegend) {\n chart.legend(shapeField, shapeLegend);\n } else {\n chart.legend(shapeField, shapeLegend === false ? false : legend);\n }\n }\n\n if (sizeField) {\n chart.legend(sizeField, sizeLegend ? sizeLegend : false);\n }\n // /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */\n if (!showLegend && !shapeLegend && !sizeLegend) {\n chart.legend(false);\n }\n\n // theme 配置\n if (theme) {\n chart.theme(theme);\n }\n\n // 8. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n chart.removeInteraction(interaction.type);\n } else {\n chart.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 9. annotations\n each(annotations, (annotation) => {\n chart.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n return params;\n}\n\n/**\n * 分面图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<FacetOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(theme, facetAdaptor, component)(params);\n}\n"]}
|
|
@@ -141,8 +141,33 @@ export interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.Fa
|
|
|
141
141
|
*/
|
|
142
142
|
readonly legend?: Legend;
|
|
143
143
|
/**
|
|
144
|
-
* @title
|
|
144
|
+
* @title 交互配置
|
|
145
145
|
*/
|
|
146
146
|
readonly interactions?: Interaction[];
|
|
147
|
+
/**
|
|
148
|
+
* @title 形状字段
|
|
149
|
+
* @description 形状映射字段
|
|
150
|
+
*/
|
|
151
|
+
readonly shapeField?: string;
|
|
152
|
+
/**
|
|
153
|
+
* @title 颜色字段
|
|
154
|
+
* @description 颜色映射字段
|
|
155
|
+
*/
|
|
156
|
+
readonly colorField?: string;
|
|
157
|
+
/**
|
|
158
|
+
* @title 大小字段
|
|
159
|
+
* @description 大小映射字段
|
|
160
|
+
*/
|
|
161
|
+
readonly sizeField?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @title 形状图例配置
|
|
164
|
+
* @description 形状图例的配置项
|
|
165
|
+
*/
|
|
166
|
+
readonly shapeLegend?: Legend | false;
|
|
167
|
+
/**
|
|
168
|
+
* @title 大小图例配置
|
|
169
|
+
* @description 大小图例的配置项
|
|
170
|
+
*/
|
|
171
|
+
readonly sizeLegend?: Legend | false;
|
|
147
172
|
}
|
|
148
173
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, View } from '@antv/g2';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Annotation } from '../../types/annotation';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Options['animation'];\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title 交互配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title 形状字段\n * @description 形状映射字段\n */\n readonly shapeField?: string;\n /**\n * @title 颜色字段\n * @description 颜色映射字段\n */\n readonly colorField?: string;\n /**\n * @title 大小字段\n * @description 大小映射字段\n */\n readonly sizeField?: string;\n /**\n * @title 形状图例配置\n * @description 形状图例的配置项\n */\n readonly shapeLegend?: Legend | false;\n /**\n * @title 大小图例配置\n * @description 大小图例的配置项\n */\n readonly sizeLegend?: Legend | false;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2plot",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.35",
|
|
4
4
|
"description": "An interactive and responsive charting library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@antv/color-util": "^2.0.6",
|
|
53
53
|
"@antv/event-emitter": "^0.1.2",
|
|
54
54
|
"@antv/g-base": "^0.5.11",
|
|
55
|
-
"@antv/g2": "^4.
|
|
55
|
+
"@antv/g2": "^4.2.12",
|
|
56
56
|
"@antv/matrix-util": "^3.1.0-beta.2",
|
|
57
57
|
"@antv/path-util": "^3.0.1",
|
|
58
58
|
"@antv/scale": "^0.3.18",
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,14 @@ function facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {
|
|
|
41
41
|
} else {
|
|
42
42
|
const plot = viewOptions as IPlot;
|
|
43
43
|
const plotOptions = plot.options;
|
|
44
|
+
|
|
45
|
+
// 如果 view 内部没有指定映射字段,则使用 options 内指定的映射字段
|
|
46
|
+
['seriesField', 'colorField', 'shapeField', 'sizeField', 'groupField'].forEach((key) => {
|
|
47
|
+
if (options[key] && typeof plotOptions[key] === 'undefined') {
|
|
48
|
+
plotOptions[key] = options[key];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
44
52
|
// @ts-ignore 仪表盘没 tooltip
|
|
45
53
|
if (plotOptions.tooltip) {
|
|
46
54
|
// 配置 tooltip 交互
|
|
@@ -56,7 +64,20 @@ function facetAdaptor(params: Params<FacetOptions>): Params<FacetOptions> {
|
|
|
56
64
|
|
|
57
65
|
function component(params: Params<FacetOptions>): Params<FacetOptions> {
|
|
58
66
|
const { chart, options } = params;
|
|
59
|
-
const {
|
|
67
|
+
const {
|
|
68
|
+
axes,
|
|
69
|
+
meta,
|
|
70
|
+
tooltip,
|
|
71
|
+
coordinate,
|
|
72
|
+
theme,
|
|
73
|
+
legend,
|
|
74
|
+
interactions,
|
|
75
|
+
annotations,
|
|
76
|
+
shapeField,
|
|
77
|
+
sizeField,
|
|
78
|
+
shapeLegend,
|
|
79
|
+
sizeLegend,
|
|
80
|
+
} = options;
|
|
60
81
|
|
|
61
82
|
// 3. meta 配置
|
|
62
83
|
let scales: Record<string, any> = {};
|
|
@@ -91,6 +112,22 @@ function component(params: Params<FacetOptions>): Params<FacetOptions> {
|
|
|
91
112
|
|
|
92
113
|
// 7. legend 配置(默认展示)
|
|
93
114
|
chart.legend(legend);
|
|
115
|
+
const showLegend = legend !== false;
|
|
116
|
+
if (shapeField) {
|
|
117
|
+
if (shapeLegend) {
|
|
118
|
+
chart.legend(shapeField, shapeLegend);
|
|
119
|
+
} else {
|
|
120
|
+
chart.legend(shapeField, shapeLegend === false ? false : legend);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (sizeField) {
|
|
125
|
+
chart.legend(sizeField, sizeLegend ? sizeLegend : false);
|
|
126
|
+
}
|
|
127
|
+
// /** 默认不展示 shape 图例,当 shapeLegend 为 undefined 也不展示图例 */
|
|
128
|
+
if (!showLegend && !shapeLegend && !sizeLegend) {
|
|
129
|
+
chart.legend(false);
|
|
130
|
+
}
|
|
94
131
|
|
|
95
132
|
// theme 配置
|
|
96
133
|
if (theme) {
|
package/src/plots/facet/types.ts
CHANGED
|
@@ -146,7 +146,32 @@ export interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.Fa
|
|
|
146
146
|
*/
|
|
147
147
|
readonly legend?: Legend;
|
|
148
148
|
/**
|
|
149
|
-
* @title
|
|
149
|
+
* @title 交互配置
|
|
150
150
|
*/
|
|
151
151
|
readonly interactions?: Interaction[];
|
|
152
|
+
/**
|
|
153
|
+
* @title 形状字段
|
|
154
|
+
* @description 形状映射字段
|
|
155
|
+
*/
|
|
156
|
+
readonly shapeField?: string;
|
|
157
|
+
/**
|
|
158
|
+
* @title 颜色字段
|
|
159
|
+
* @description 颜色映射字段
|
|
160
|
+
*/
|
|
161
|
+
readonly colorField?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @title 大小字段
|
|
164
|
+
* @description 大小映射字段
|
|
165
|
+
*/
|
|
166
|
+
readonly sizeField?: string;
|
|
167
|
+
/**
|
|
168
|
+
* @title 形状图例配置
|
|
169
|
+
* @description 形状图例的配置项
|
|
170
|
+
*/
|
|
171
|
+
readonly shapeLegend?: Legend | false;
|
|
172
|
+
/**
|
|
173
|
+
* @title 大小图例配置
|
|
174
|
+
* @description 大小图例的配置项
|
|
175
|
+
*/
|
|
176
|
+
readonly sizeLegend?: Legend | false;
|
|
152
177
|
}
|