@antv/g2plot 2.4.10 → 2.4.11

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.10";
1
+ export declare const version = "2.4.11";
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.10';
1
+ export var version = '2.4.11';
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.10';\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.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,5 +1,5 @@
1
1
  import { __assign } from "tslib";
2
- import { isString } from '@antv/util';
2
+ import { get, isString } from '@antv/util';
3
3
  import { interaction, animation, theme, scale, annotation } from '../../adaptor/common';
4
4
  import { interval } from '../../adaptor/geometries';
5
5
  import { AXIS_META_CONFIG_KEYS } from '../../constant';
@@ -124,6 +124,35 @@ function statistic(params, updated) {
124
124
  }
125
125
  return params;
126
126
  }
127
+ /**
128
+ * tooltip 配置
129
+ */
130
+ function tooltip(params) {
131
+ var chart = params.chart, options = params.options;
132
+ var tooltip = options.tooltip;
133
+ if (tooltip) {
134
+ chart.tooltip(deepAssign({
135
+ showTitle: false,
136
+ showMarkers: false,
137
+ containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
138
+ domStyles: {
139
+ 'g2-tooltip': {
140
+ padding: '4px 8px',
141
+ fontSize: '10px',
142
+ },
143
+ },
144
+ customContent: function (x, data) {
145
+ var percent = get(data, [0, 'data', PERCENT], 0);
146
+ return (percent * 100).toFixed(2) + "%";
147
+ },
148
+ }, tooltip));
149
+ }
150
+ else {
151
+ // 默认,不展示 tooltip
152
+ chart.tooltip(false);
153
+ }
154
+ return params;
155
+ }
127
156
  /**
128
157
  * other 配置
129
158
  * @param params
@@ -131,7 +160,6 @@ function statistic(params, updated) {
131
160
  function other(params) {
132
161
  var chart = params.chart;
133
162
  chart.legend(false);
134
- chart.tooltip(false);
135
163
  return params;
136
164
  }
137
165
  /**
@@ -147,7 +175,7 @@ export function adaptor(params) {
147
175
  // flow 的方式处理所有的配置到 G2 API
148
176
  return flow(theme,
149
177
  // animation 配置必须在 createView 之前,不然无法让子 View 生效
150
- animation, geometry, meta, statistic, interaction, annotation(), other
178
+ animation, geometry, meta, tooltip, statistic, interaction, annotation(), other
151
179
  // ... 其他的 adaptor flow
152
180
  )(params);
153
181
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA4B;IACpC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GACb,OAAO,QADM,EAAE,KAAK,GACpB,OAAO,MADa,EAAE,MAAM,GAC5B,OAAO,OADqB,EAAE,WAAW,GACzC,OAAO,YADkC,EAAE,UAAU,GACrD,OAAO,WAD8C,EAAE,QAAQ,GAC/D,OAAO,SADwD,EAAE,IAAI,GACrE,OAAO,KAD8D,EAAE,SAAS,GAChF,OAAO,UADyE,EAAE,UAAU,GAC5F,OAAO,WADqF,EAAE,IAAI,GAClG,OAAO,KAD2F,EAAE,KAAK,GACzG,OAAO,MADkG,CACjG;IACF,IAAA,KAAK,GAAwB,KAAK,MAA7B,EA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SAAS,EACT,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,WAAW,EACX,UAAU,EAAE,EACZ,KAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA4B;IACpC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GACb,OAAO,QADM,EAAE,KAAK,GACpB,OAAO,MADa,EAAE,MAAM,GAC5B,OAAO,OADqB,EAAE,WAAW,GACzC,OAAO,YADkC,EAAE,UAAU,GACrD,OAAO,WAD8C,EAAE,QAAQ,GAC/D,OAAO,SADwD,EAAE,IAAI,GACrE,OAAO,KAD8D,EAAE,SAAS,GAChF,OAAO,UADyE,EAAE,UAAU,GAC5F,OAAO,WADqF,EAAE,IAAI,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mEAAmE;YACjF,SAAS,EAAE;gBACT,YAAY,EAAE;oBACZ,OAAO,EAAE,SAAS;oBAClB,QAAQ,EAAE,MAAM;iBACjB;aACF;YACD,aAAa,EAAE,UAAC,CAAS,EAAE,IAAW;gBACpC,IAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,OAAU,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,CAAC;YAC1C,CAAC;SACF,EACD,OAAO,CACR,CACF,CAAC;KACH;SAAM;QACL,iBAAiB;QACjB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA4B;IACjC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAI,CACT,KAAK;IACL,+CAA+C;IAC/C,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EAAE,EACZ,KAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { get, isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * tooltip 配置\n */\nfunction tooltip(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip) {\n chart.tooltip(\n deepAssign(\n {\n showTitle: false,\n showMarkers: false,\n containerTpl: '<div class=\"g2-tooltip\"><div class=\"g2-tooltip-list\"></div></div>',\n domStyles: {\n 'g2-tooltip': {\n padding: '4px 8px',\n fontSize: '10px',\n },\n },\n customContent: (x: string, data: any[]) => {\n const percent = get(data, [0, 'data', PERCENT], 0);\n return `${(percent * 100).toFixed(2)}%`;\n },\n },\n tooltip\n )\n );\n } else {\n // 默认,不展示 tooltip\n chart.tooltip(false);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n tooltip,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
@@ -49,7 +49,7 @@ export declare type GaugeRangeData = {
49
49
  /**
50
50
  * @title 仪表盘配置类型定义
51
51
  */
52
- export interface GaugeOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
52
+ export interface GaugeOptions extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
53
53
  /**
54
54
  * @title 指标的比例
55
55
  * @description 范围0 ~ 1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n /**\n * @title 指针\n * @description 只允许静态的 object\n */\n readonly pointer?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 圆环\n * @description 只允许静态的 object\n */\n readonly pin?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 自定义指针 shape\n * @default 'gauge-indicator'\n */\n readonly shape?: string;\n};\n\nexport type Range = {\n /**\n * @title 辅助的刻度值\n * @description 0 ~ 1 的数字\n */\n readonly ticks?: number[];\n /**\n * @title 辅助刻度的颜色配置\n */\n readonly color?: string | string[];\n /**\n * @title 仪表盘辅助背景的宽度\n */\n readonly width?: number;\n};\n\n/**\n * @title 仪表盘辅助生成的 rangeData\n */\nexport type GaugeRangeData = {\n readonly [RANGE_VALUE]?: number;\n readonly [RANGE_TYPE]: string;\n readonly [PERCENT]: number;\n}[];\n\n/**\n * @title 仪表盘配置类型定义\n */\nexport interface GaugeOptions\n extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {\n /**\n * @title 指标的比例\n * @description 范围0 ~ 1\n */\n readonly percent: number;\n /**\n * @title 外弧度\n * @description 范围0 ~ 1\n */\n readonly radius?: number;\n /**\n * @title 内弧度\n * @description 范围0 ~ 1\n */\n readonly innerRadius?: number;\n /**\n * @title 弧度起始\n */\n readonly startAngle?: number;\n /**\n * @title 弧度结束\n */\n readonly endAngle?: number;\n /**\n * @title 辅助的 range 组件\n */\n readonly range?: Range;\n /**\n * @title 坐标轴配置\n */\n readonly axis?: Axis;\n /**\n * @title 指针的配置\n */\n readonly indicator?: false | Indicator;\n /**\n * @title 统计文本\n */\n readonly statistic?: Statistic;\n /**\n * @title 仪表盘样式\n */\n readonly gaugeStyle?: StyleAttr;\n\n /**\n * @title meter gauge 相关配置\n */\n\n /**\n * @title 仪表盘类型\n * @description 可选项: 'meter', default 为空\n */\n readonly type?: string;\n /**\n * @title 仪表盘配置\n * @description 当仪表盘类型 = 'meter' 生效\n */\n readonly meter?: {\n /**\n * @title 仪表盘总步数\n * @default \"50\"\n */\n readonly steps?: number;\n /**\n * @title step 与 gap 的宽度占比\n * @default \"0.5\"\n */\n readonly stepRatio?: number;\n };\n}\n\n/**\n * @title 仪表盘\n * @description 自定义 shape 使用的 customInfo\n */\nexport type GaugeCustomInfo = {\n /**\n * @title 仪表盘 meter 类型的相关配置\n */\n readonly meter?: GaugeOptions['meter'];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n /**\n * @title 指针\n * @description 只允许静态的 object\n */\n readonly pointer?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 圆环\n * @description 只允许静态的 object\n */\n readonly pin?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 自定义指针 shape\n * @default 'gauge-indicator'\n */\n readonly shape?: string;\n};\n\nexport type Range = {\n /**\n * @title 辅助的刻度值\n * @description 0 ~ 1 的数字\n */\n readonly ticks?: number[];\n /**\n * @title 辅助刻度的颜色配置\n */\n readonly color?: string | string[];\n /**\n * @title 仪表盘辅助背景的宽度\n */\n readonly width?: number;\n};\n\n/**\n * @title 仪表盘辅助生成的 rangeData\n */\nexport type GaugeRangeData = {\n readonly [RANGE_VALUE]?: number;\n readonly [RANGE_TYPE]: string;\n readonly [PERCENT]: number;\n}[];\n\n/**\n * @title 仪表盘配置类型定义\n */\nexport interface GaugeOptions\n extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {\n /**\n * @title 指标的比例\n * @description 范围0 ~ 1\n */\n readonly percent: number;\n /**\n * @title 外弧度\n * @description 范围0 ~ 1\n */\n readonly radius?: number;\n /**\n * @title 内弧度\n * @description 范围0 ~ 1\n */\n readonly innerRadius?: number;\n /**\n * @title 弧度起始\n */\n readonly startAngle?: number;\n /**\n * @title 弧度结束\n */\n readonly endAngle?: number;\n /**\n * @title 辅助的 range 组件\n */\n readonly range?: Range;\n /**\n * @title 坐标轴配置\n */\n readonly axis?: Axis;\n /**\n * @title 指针的配置\n */\n readonly indicator?: false | Indicator;\n /**\n * @title 统计文本\n */\n readonly statistic?: Statistic;\n /**\n * @title 仪表盘样式\n */\n readonly gaugeStyle?: StyleAttr;\n\n /**\n * @title meter gauge 相关配置\n */\n\n /**\n * @title 仪表盘类型\n * @description 可选项: 'meter', default 为空\n */\n readonly type?: string;\n /**\n * @title 仪表盘配置\n * @description 当仪表盘类型 = 'meter' 生效\n */\n readonly meter?: {\n /**\n * @title 仪表盘总步数\n * @default \"50\"\n */\n readonly steps?: number;\n /**\n * @title step 与 gap 的宽度占比\n * @default \"0.5\"\n */\n readonly stepRatio?: number;\n };\n}\n\n/**\n * @title 仪表盘\n * @description 自定义 shape 使用的 customInfo\n */\nexport type GaugeCustomInfo = {\n /**\n * @title 仪表盘 meter 类型的相关配置\n */\n readonly meter?: GaugeOptions['meter'];\n};\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.10";
1
+ export declare const version = "2.4.11";
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.10';
5
+ exports.version = '2.4.11';
6
6
  // G2 自定义能力透出
7
7
  var G2 = tslib_1.__importStar(require("@antv/g2"));
8
8
  exports.G2 = G2;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA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AAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.10';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid, addWaterWave } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAElB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAKb,SAAS;AACT,kDAAwB;AAExB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uDAAuD;AACvD,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,0DAA0D;AAC1D,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAGZ,uEAAuE;AACvE,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uEAAuE;AACvE,iDAA+C;AAAtC,uGAAA,SAAS,OAAA;AAGlB,yDAAyD;AACzD,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAGhB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,iEAAiE;AACjE,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,+DAA+D;AAC/D,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,+DAA+D;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GAA6G;AAC7G,yDAAuD;AAA9C,+GAAA,aAAa,OAAA;AAGtB,2BAA2B;AAC3B,mEAAmE;AACnE,mCAA6B;AAApB,2FAAA,CAAC,OAAA;AAEV,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAEzB,eAAe;AACf,mCAA+C;AAAtC,gGAAA,GAAG,OAAa;AAEzB,oBAAoB;AACpB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.4.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"]}
@@ -128,6 +128,35 @@ function statistic(params, updated) {
128
128
  return params;
129
129
  }
130
130
  exports.statistic = statistic;
131
+ /**
132
+ * tooltip 配置
133
+ */
134
+ function tooltip(params) {
135
+ var chart = params.chart, options = params.options;
136
+ var tooltip = options.tooltip;
137
+ if (tooltip) {
138
+ chart.tooltip(utils_1.deepAssign({
139
+ showTitle: false,
140
+ showMarkers: false,
141
+ containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
142
+ domStyles: {
143
+ 'g2-tooltip': {
144
+ padding: '4px 8px',
145
+ fontSize: '10px',
146
+ },
147
+ },
148
+ customContent: function (x, data) {
149
+ var percent = util_1.get(data, [0, 'data', constants_1.PERCENT], 0);
150
+ return (percent * 100).toFixed(2) + "%";
151
+ },
152
+ }, tooltip));
153
+ }
154
+ else {
155
+ // 默认,不展示 tooltip
156
+ chart.tooltip(false);
157
+ }
158
+ return params;
159
+ }
131
160
  /**
132
161
  * other 配置
133
162
  * @param params
@@ -135,7 +164,6 @@ exports.statistic = statistic;
135
164
  function other(params) {
136
165
  var chart = params.chart;
137
166
  chart.legend(false);
138
- chart.tooltip(false);
139
167
  return params;
140
168
  }
141
169
  /**
@@ -147,7 +175,7 @@ function adaptor(params) {
147
175
  // flow 的方式处理所有的配置到 G2 API
148
176
  return utils_1.flow(common_1.theme,
149
177
  // animation 配置必须在 createView 之前,不然无法让子 View 生效
150
- common_1.animation, geometry, meta, statistic, common_1.interaction, common_1.annotation(), other
178
+ common_1.animation, geometry, meta, tooltip, statistic, common_1.interaction, common_1.annotation(), other
151
179
  // ... 其他的 adaptor flow
152
180
  )(params);
153
181
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAAsC;AACtC,+CAAwF;AACxF,uDAAoD;AACpD,2CAAuD;AAEvD,qCAA2E;AAC3E,yCAAiH;AAEjH,iCAAyD;AAEzD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA4B;IACpC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GACb,OAAO,QADM,EAAE,KAAK,GACpB,OAAO,MADa,EAAE,MAAM,GAC5B,OAAO,OADqB,EAAE,WAAW,GACzC,OAAO,YADkC,EAAE,UAAU,GACrD,OAAO,WAD8C,EAAE,QAAQ,GAC/D,OAAO,SADwD,EAAE,IAAI,GACrE,OAAO,KAD8D,EAAE,SAAS,GAChF,OAAO,UADyE,EAAE,UAAU,GAC5F,OAAO,WADqF,EAAE,IAAI,GAClG,OAAO,KAD2F,EAAE,KAAK,GACzG,OAAO,MADkG,CACjG;IACF,IAAA,KAAK,GAAwB,KAAK,MAA7B,EAAS,UAAU,GAAK,KAAK,MAAV,CAAW;IAE3C,UAAU;IACV,UAAU;IACV,IAAI,SAAS,EAAE;QACb,IAAM,aAAa,GAAG,wBAAgB,CAAC,OAAO,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dD,0BAcC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAA2C;AAC3C,+CAAwF;AACxF,uDAAoD;AACpD,2CAAuD;AAEvD,qCAA2E;AAC3E,yCAAiH;AAEjH,iCAAyD;AAEzD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA4B;IACpC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GACb,OAAO,QADM,EAAE,KAAK,GACpB,OAAO,MADa,EAAE,MAAM,GAC5B,OAAO,OADqB,EAAE,WAAW,GACzC,OAAO,YADkC,EAAE,UAAU,GACrD,OAAO,WAD8C,EAAE,QAAQ,GAC/D,OAAO,SADwD,EAAE,IAAI,GACrE,OAAO,KAD8D,EAAE,SAAS,GAChF,OAAO,UADyE,EAAE,UAAU,GAC5F,OAAO,WADqF,EAAE,IAAI,GAClG,OAAO,KAD2F,EAAE,KAAK,GACzG,OAAO,MADkG,CACjG;IACF,IAAA,KAAK,GAAwB,KAAK,MAA7B,EAAS,UAAU,GAAK,KAAK,MAAV,CAAW;IAE3C,UAAU;IACV,UAAU;IACV,IAAI,SAAS,EAAE;QACb,IAAM,aAAa,GAAG,wBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhD,IAAM,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,8BAAkB,EAAE,CAAC,CAAC;QACxD,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEvB,EAAE,CAAC,KAAK,EAAE;aACP,QAAQ,CAAI,mBAAO,OAAI,CAAC;aACxB,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,iBAAiB,CAAC;YAC5C,sBAAsB;aACrB,UAAU,CAAC;YACV,YAAY,EA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AED;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA4B;IACjC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpB,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,YAAI,CACT,cAAK;IACL,+CAA+C;IAC/C,kBAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,oBAAW,EACX,mBAAU,EAAE,EACZ,KAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAfD,0BAeC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { get, isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * tooltip 配置\n */\nfunction tooltip(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { tooltip } = options;\n\n if (tooltip) {\n chart.tooltip(\n deepAssign(\n {\n showTitle: false,\n showMarkers: false,\n containerTpl: '<div class=\"g2-tooltip\"><div class=\"g2-tooltip-list\"></div></div>',\n domStyles: {\n 'g2-tooltip': {\n padding: '4px 8px',\n fontSize: '10px',\n },\n },\n customContent: (x: string, data: any[]) => {\n const percent = get(data, [0, 'data', PERCENT], 0);\n return `${(percent * 100).toFixed(2)}%`;\n },\n },\n tooltip\n )\n );\n } else {\n // 默认,不展示 tooltip\n chart.tooltip(false);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n tooltip,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
@@ -49,7 +49,7 @@ export declare type GaugeRangeData = {
49
49
  /**
50
50
  * @title 仪表盘配置类型定义
51
51
  */
52
- export interface GaugeOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
52
+ export interface GaugeOptions extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
53
53
  /**
54
54
  * @title 指标的比例
55
55
  * @description 范围0 ~ 1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":";;AAEA,yCAA+D","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n /**\n * @title 指针\n * @description 只允许静态的 object\n */\n readonly pointer?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 圆环\n * @description 只允许静态的 object\n */\n readonly pin?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 自定义指针 shape\n * @default 'gauge-indicator'\n */\n readonly shape?: string;\n};\n\nexport type Range = {\n /**\n * @title 辅助的刻度值\n * @description 0 ~ 1 的数字\n */\n readonly ticks?: number[];\n /**\n * @title 辅助刻度的颜色配置\n */\n readonly color?: string | string[];\n /**\n * @title 仪表盘辅助背景的宽度\n */\n readonly width?: number;\n};\n\n/**\n * @title 仪表盘辅助生成的 rangeData\n */\nexport type GaugeRangeData = {\n readonly [RANGE_VALUE]?: number;\n readonly [RANGE_TYPE]: string;\n readonly [PERCENT]: number;\n}[];\n\n/**\n * @title 仪表盘配置类型定义\n */\nexport interface GaugeOptions\n extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {\n /**\n * @title 指标的比例\n * @description 范围0 ~ 1\n */\n readonly percent: number;\n /**\n * @title 外弧度\n * @description 范围0 ~ 1\n */\n readonly radius?: number;\n /**\n * @title 内弧度\n * @description 范围0 ~ 1\n */\n readonly innerRadius?: number;\n /**\n * @title 弧度起始\n */\n readonly startAngle?: number;\n /**\n * @title 弧度结束\n */\n readonly endAngle?: number;\n /**\n * @title 辅助的 range 组件\n */\n readonly range?: Range;\n /**\n * @title 坐标轴配置\n */\n readonly axis?: Axis;\n /**\n * @title 指针的配置\n */\n readonly indicator?: false | Indicator;\n /**\n * @title 统计文本\n */\n readonly statistic?: Statistic;\n /**\n * @title 仪表盘样式\n */\n readonly gaugeStyle?: StyleAttr;\n\n /**\n * @title meter gauge 相关配置\n */\n\n /**\n * @title 仪表盘类型\n * @description 可选项: 'meter', default 为空\n */\n readonly type?: string;\n /**\n * @title 仪表盘配置\n * @description 当仪表盘类型 = 'meter' 生效\n */\n readonly meter?: {\n /**\n * @title 仪表盘总步数\n * @default \"50\"\n */\n readonly steps?: number;\n /**\n * @title step 与 gap 的宽度占比\n * @default \"0.5\"\n */\n readonly stepRatio?: number;\n };\n}\n\n/**\n * @title 仪表盘\n * @description 自定义 shape 使用的 customInfo\n */\nexport type GaugeCustomInfo = {\n /**\n * @title 仪表盘 meter 类型的相关配置\n */\n readonly meter?: GaugeOptions['meter'];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":";;AAEA,yCAA+D","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n /**\n * @title 指针\n * @description 只允许静态的 object\n */\n readonly pointer?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 圆环\n * @description 只允许静态的 object\n */\n readonly pin?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 自定义指针 shape\n * @default 'gauge-indicator'\n */\n readonly shape?: string;\n};\n\nexport type Range = {\n /**\n * @title 辅助的刻度值\n * @description 0 ~ 1 的数字\n */\n readonly ticks?: number[];\n /**\n * @title 辅助刻度的颜色配置\n */\n readonly color?: string | string[];\n /**\n * @title 仪表盘辅助背景的宽度\n */\n readonly width?: number;\n};\n\n/**\n * @title 仪表盘辅助生成的 rangeData\n */\nexport type GaugeRangeData = {\n readonly [RANGE_VALUE]?: number;\n readonly [RANGE_TYPE]: string;\n readonly [PERCENT]: number;\n}[];\n\n/**\n * @title 仪表盘配置类型定义\n */\nexport interface GaugeOptions\n extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {\n /**\n * @title 指标的比例\n * @description 范围0 ~ 1\n */\n readonly percent: number;\n /**\n * @title 外弧度\n * @description 范围0 ~ 1\n */\n readonly radius?: number;\n /**\n * @title 内弧度\n * @description 范围0 ~ 1\n */\n readonly innerRadius?: number;\n /**\n * @title 弧度起始\n */\n readonly startAngle?: number;\n /**\n * @title 弧度结束\n */\n readonly endAngle?: number;\n /**\n * @title 辅助的 range 组件\n */\n readonly range?: Range;\n /**\n * @title 坐标轴配置\n */\n readonly axis?: Axis;\n /**\n * @title 指针的配置\n */\n readonly indicator?: false | Indicator;\n /**\n * @title 统计文本\n */\n readonly statistic?: Statistic;\n /**\n * @title 仪表盘样式\n */\n readonly gaugeStyle?: StyleAttr;\n\n /**\n * @title meter gauge 相关配置\n */\n\n /**\n * @title 仪表盘类型\n * @description 可选项: 'meter', default 为空\n */\n readonly type?: string;\n /**\n * @title 仪表盘配置\n * @description 当仪表盘类型 = 'meter' 生效\n */\n readonly meter?: {\n /**\n * @title 仪表盘总步数\n * @default \"50\"\n */\n readonly steps?: number;\n /**\n * @title step 与 gap 的宽度占比\n * @default \"0.5\"\n */\n readonly stepRatio?: number;\n };\n}\n\n/**\n * @title 仪表盘\n * @description 自定义 shape 使用的 customInfo\n */\nexport type GaugeCustomInfo = {\n /**\n * @title 仪表盘 meter 类型的相关配置\n */\n readonly meter?: GaugeOptions['meter'];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g2plot",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "An interactive and responsive charting library",
5
5
  "keywords": [
6
6
  "chart",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '2.4.10';
1
+ export const version = '2.4.11';
2
2
 
3
3
  // G2 自定义能力透出
4
4
  import * as G2 from '@antv/g2';
@@ -1,5 +1,5 @@
1
1
  import { Geometry } from '@antv/g2';
2
- import { isString } from '@antv/util';
2
+ import { get, isString } from '@antv/util';
3
3
  import { interaction, animation, theme, scale, annotation } from '../../adaptor/common';
4
4
  import { interval } from '../../adaptor/geometries';
5
5
  import { AXIS_META_CONFIG_KEYS } from '../../constant';
@@ -149,6 +149,42 @@ function statistic(params: Params<GaugeOptions>, updated?: boolean): Params<Gaug
149
149
  return params;
150
150
  }
151
151
 
152
+ /**
153
+ * tooltip 配置
154
+ */
155
+ function tooltip(params: Params<GaugeOptions>): Params<GaugeOptions> {
156
+ const { chart, options } = params;
157
+ const { tooltip } = options;
158
+
159
+ if (tooltip) {
160
+ chart.tooltip(
161
+ deepAssign(
162
+ {
163
+ showTitle: false,
164
+ showMarkers: false,
165
+ containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
166
+ domStyles: {
167
+ 'g2-tooltip': {
168
+ padding: '4px 8px',
169
+ fontSize: '10px',
170
+ },
171
+ },
172
+ customContent: (x: string, data: any[]) => {
173
+ const percent = get(data, [0, 'data', PERCENT], 0);
174
+ return `${(percent * 100).toFixed(2)}%`;
175
+ },
176
+ },
177
+ tooltip
178
+ )
179
+ );
180
+ } else {
181
+ // 默认,不展示 tooltip
182
+ chart.tooltip(false);
183
+ }
184
+
185
+ return params;
186
+ }
187
+
152
188
  /**
153
189
  * other 配置
154
190
  * @param params
@@ -157,7 +193,6 @@ function other(params: Params<GaugeOptions>): Params<GaugeOptions> {
157
193
  const { chart } = params;
158
194
 
159
195
  chart.legend(false);
160
- chart.tooltip(false);
161
196
 
162
197
  return params;
163
198
  }
@@ -180,6 +215,7 @@ export function adaptor(params: Params<GaugeOptions>) {
180
215
  animation,
181
216
  geometry,
182
217
  meta,
218
+ tooltip,
183
219
  statistic,
184
220
  interaction,
185
221
  annotation(),
@@ -54,7 +54,7 @@ export type GaugeRangeData = {
54
54
  * @title 仪表盘配置类型定义
55
55
  */
56
56
  export interface GaugeOptions
57
- extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
57
+ extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
58
58
  /**
59
59
  * @title 指标的比例
60
60
  * @description 范围0 ~ 1