@antv/g2plot 2.4.23 → 2.4.24

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.23";
1
+ export declare const version = "2.4.24";
2
2
  import * as G2 from '@antv/g2';
3
3
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
4
4
  import { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export var version = '2.4.23';
1
+ export var version = '2.4.24';
2
2
  // G2 自定义能力透出
3
3
  import * as G2 from '@antv/g2';
4
4
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"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,aAA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,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.23';\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;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,+DAA+D;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,8FAA8F;AAC9F,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CA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9B,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.24';\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"]}
@@ -37,6 +37,7 @@ function geometry(params) {
37
37
  var geometry = ext.geometry;
38
38
  var background = chart.getTheme().background;
39
39
  var customInfo = {
40
+ percent: percent,
40
41
  radius: radius,
41
42
  outline: outline,
42
43
  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CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,EAA1B,CAA0B,CAAC,CAAC;IACjG,IAAI,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC;IACnC,IAAI,UAAU,EAAE;QACd,UAAU,GAAG,UAAU,CAAC,EAAE,EAAE,UAAU,EAAE;YACtC,OAAO,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;SAClF,CAAC,CAAC;KACJ;IAED,eAAe,CAAC,KAAK,EAAE,EAAE,SAAS,wBAAO,SAAS,KAAE,OAAO,EAAE,UAAU,GAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IAE9G,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA6B;IACnD,0CAA0C;IAC1C,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { get, isNil } from '@antv/util';\nimport { animation, interaction, pattern, scale, theme } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, renderStatistic } from '../../utils';\nimport { CustomInfo, LiquidOptions } from './types';\nimport { getLiquidData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<LiquidOptions>): Params<LiquidOptions> {\n const { chart, options } = params;\n const { percent, liquidStyle, radius, outline, wave, shape, shapeStyle, animation } = options;\n\n chart.scale({\n percent: {\n min: 0,\n max: 1,\n },\n });\n\n chart.data(getLiquidData(percent));\n\n const color = options.color || chart.getTheme().defaultColor;\n\n const p = deepAssign({}, params, {\n options: {\n xField: 'type',\n yField: 'percent',\n // radius 放到 columnWidthRatio 中。\n // 保证横向的大小是根据 radius 生成的\n widthRatio: radius,\n interval: {\n color,\n style: liquidStyle,\n shape: 'liquid-fill-gauge',\n },\n },\n });\n const { ext } = interval(p);\n const geometry = ext.geometry as Geometry;\n const { background } = chart.getTheme();\n const customInfo: CustomInfo = {\n radius,\n outline,\n wave,\n shape,\n shapeStyle,\n background,\n animation,\n };\n\n // 将 radius 传入到自定义 shape 中\n geometry.customInfo(customInfo);\n\n // 关闭组件\n chart.legend(false);\n chart.axis(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nexport function statistic(params: Params<LiquidOptions>, updated?: boolean): Params<LiquidOptions> {\n const { chart, options } = params;\n const { statistic, percent, meta } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n const metaFormatter = get(meta, ['percent', 'formatter']) || ((v) => `${(v * 100).toFixed(2)}%`);\n let contentOpt = statistic.content;\n if (contentOpt) {\n contentOpt = deepAssign({}, contentOpt, {\n content: !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),\n });\n }\n\n renderStatistic(chart, { statistic: { ...statistic, content: contentOpt }, plotType: 'liquid' }, { percent });\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * 水波图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LiquidOptions>) {\n // flow 的方式处理所有的配置到 G2 API (主题前置,会影响绘制的取色)\n return flow(theme, pattern('liquidStyle'), geometry, statistic, scale({}), animation, interaction)(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/liquid/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,KAAK,EAA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IAAI,UAAU,EAAE;QACd,UAAU,GAAG,UAAU,CAAC,EAAE,EAAE,UAAU,EAAE;YACtC,OAAO,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;SAClF,CAAC,CAAC;KACJ;IAED,eAAe,CAAC,KAAK,EAAE,EAAE,SAAS,wBAAO,SAAS,KAAE,OAAO,EAAE,UAAU,GAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IAE9G,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA6B;IACnD,0CAA0C;IAC1C,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { get, isNil } from '@antv/util';\nimport { animation, interaction, pattern, scale, theme } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, renderStatistic } from '../../utils';\nimport { CustomInfo, LiquidOptions } from './types';\nimport { getLiquidData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<LiquidOptions>): Params<LiquidOptions> {\n const { chart, options } = params;\n const { percent, liquidStyle, radius, outline, wave, shape, shapeStyle, animation } = options;\n\n chart.scale({\n percent: {\n min: 0,\n max: 1,\n },\n });\n\n chart.data(getLiquidData(percent));\n\n const color = options.color || chart.getTheme().defaultColor;\n\n const p = deepAssign({}, params, {\n options: {\n xField: 'type',\n yField: 'percent',\n // radius 放到 columnWidthRatio 中。\n // 保证横向的大小是根据 radius 生成的\n widthRatio: radius,\n interval: {\n color,\n style: liquidStyle,\n shape: 'liquid-fill-gauge',\n },\n },\n });\n const { ext } = interval(p);\n const geometry = ext.geometry as Geometry;\n const { background } = chart.getTheme();\n const customInfo: CustomInfo = {\n percent,\n radius,\n outline,\n wave,\n shape,\n shapeStyle,\n background,\n animation,\n };\n\n // 将 radius 传入到自定义 shape 中\n geometry.customInfo(customInfo);\n\n // 关闭组件\n chart.legend(false);\n chart.axis(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nexport function statistic(params: Params<LiquidOptions>, updated?: boolean): Params<LiquidOptions> {\n const { chart, options } = params;\n const { statistic, percent, meta } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n const metaFormatter = get(meta, ['percent', 'formatter']) || ((v) => `${(v * 100).toFixed(2)}%`);\n let contentOpt = statistic.content;\n if (contentOpt) {\n contentOpt = deepAssign({}, contentOpt, {\n content: !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),\n });\n }\n\n renderStatistic(chart, { statistic: { ...statistic, content: contentOpt }, plotType: 'liquid' }, { percent });\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * 水波图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LiquidOptions>) {\n // flow 的方式处理所有的配置到 G2 API (主题前置,会影响绘制的取色)\n return flow(theme, pattern('liquidStyle'), geometry, statistic, scale({}), animation, interaction)(params);\n}\n"]}
@@ -301,7 +301,7 @@ registerShape('interval', 'liquid-fill-gauge', {
301
301
  var cx = 0.5;
302
302
  var cy = 0.5;
303
303
  var customInfo = cfg.customInfo;
304
- var _a = customInfo, radio = _a.radius, shape = _a.shape, shapeStyle = _a.shapeStyle, background = _a.background, animation = _a.animation;
304
+ var _a = customInfo, percent = _a.percent, radio = _a.radius, shape = _a.shape, shapeStyle = _a.shapeStyle, background = _a.background, animation = _a.animation;
305
305
  var outline = customInfo.outline;
306
306
  var wave = customInfo.wave;
307
307
  var border = outline.border, distance = outline.distance;
@@ -327,19 +327,22 @@ registerShape('interval', 'liquid-fill-gauge', {
327
327
  attrs: __assign({ path: shapePath }, shapeStyle),
328
328
  });
329
329
  }
330
- // 2. 绘制一个波
331
- var waves = container.addGroup({
332
- name: 'waves',
333
- });
334
- // 3. 波对应的 clip 裁剪形状
335
- var clipPath = waves.setClip({
336
- type: 'path',
337
- attrs: {
338
- path: shapePath,
339
- },
340
- });
341
- // 4. 绘制波形
342
- addWaterWave(center.x, center.y, 1 - cfg.points[1].y, waveCount, waveAttrs, waves, clipPath, radius * 2, waveLength, animation);
330
+ // 比例大于 0 时才绘制水波
331
+ if (percent > 0) {
332
+ // 2. 绘制一个波
333
+ var waves = container.addGroup({
334
+ name: 'waves',
335
+ });
336
+ // 3. 波对应的 clip 裁剪形状
337
+ var clipPath = waves.setClip({
338
+ type: 'path',
339
+ attrs: {
340
+ path: shapePath,
341
+ },
342
+ });
343
+ // 4. 绘制波形
344
+ addWaterWave(center.x, center.y, 1 - cfg.points[1].y, waveCount, waveAttrs, waves, clipPath, radius * 2, waveLength, animation);
345
+ }
343
346
  // 5. 绘制一个 distance 宽的 border
344
347
  container.addShape('path', {
345
348
  name: 'distance',
@@ -1 +1 @@
1
- {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../../src/plots/liquid/shapes/liquid.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,IAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,MAAc;IACpD,OAAO,GAAG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;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, IShape } from '@antv/g-base';\nimport { registerShape } from '@antv/g2';\nimport { isNumber, mix, reduce } from '@antv/util';\nimport { Point, ShapeStyle } from '../../../types';\nimport { transform } from '../../../utils/matrix';\nimport { CustomInfo, LiquidOptions } from '../types';\n\nconst DURATION = 5000;\n\n/**\n * 一个线性映射的函数\n * @param min\n * @param max\n * @param factor\n */\nfunction lerp(min: number, max: number, factor: number) {\n return min + (max - min) * factor;\n}\n\n/**\n * 波浪的 attrs\n * @param cfg\n */\nfunction getFillAttrs(cfg: ShapeStyle) {\n const attrs = { opacity: 1, ...cfg.style };\n\n if (cfg.color && !attrs.fill) {\n attrs.fill = cfg.color;\n }\n\n return attrs;\n}\n\n/**\n * shape 的 attrs\n * @param cfg\n */\nfunction getLineAttrs(cfg: ShapeStyle) {\n const defaultAttrs = {\n fill: '#fff',\n fillOpacity: 0,\n lineWidth: 4,\n };\n const attrs = mix({}, defaultAttrs, cfg.style);\n\n if (cfg.color && !attrs.stroke) {\n attrs.stroke = cfg.color;\n }\n if (isNumber(cfg.opacity)) {\n attrs.opacity = attrs.strokeOpacity = cfg.opacity;\n }\n\n return attrs;\n}\n\n/**\n * 用贝塞尔曲线模拟正弦波\n * Using Bezier curves to fit sine wave.\n * There is 4 control points for each curve of wave,\n * which is at 1/4 wave length of the sine wave.\n *\n * The control points for a wave from (a) to (d) are a-b-c-d:\n * c *----* d\n * b *\n * |\n * ... a * ..................\n *\n * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)\n *\n * @param x x position of the left-most point (a)\n * @param stage 0-3, stating which part of the wave it is\n * @param waveLength wave length of the sine wave\n * @param amplitude wave amplitude\n * @return 正弦片段曲线\n */\nfunction getWaterWavePositions(x: number, stage: number, waveLength: number, amplitude: number) {\n if (stage === 0) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, amplitude],\n [x + waveLength / 4, amplitude],\n ];\n }\n if (stage === 1) {\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n }\n if (stage === 2) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, -amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, -amplitude],\n [x + waveLength / 4, -amplitude],\n ];\n }\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), -amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), -amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n}\n/**\n * 获取水波路径\n * @param radius 半径\n * @param waterLevel 水位\n * @param waveLength 波长\n * @param phase 相位\n * @param amplitude 震幅\n * @param cx 圆心x\n * @param cy 圆心y\n * @return path 路径\n * @reference http://gitlab.alipay-inc.com/datavis/g6/blob/1.2.0/src/graph/utils/path.js#L135\n */\nfunction getWaterWavePath(\n radius: number,\n waterLevel: number,\n waveLength: number,\n phase: number,\n amplitude: number,\n cx: number,\n cy: number\n) {\n const curves = Math.ceil(((2 * radius) / waveLength) * 4) * 4;\n const path = [];\n let _phase = phase;\n\n // map phase to [-Math.PI * 2, 0]\n while (_phase < -Math.PI * 2) {\n _phase += Math.PI * 2;\n }\n while (_phase > 0) {\n _phase -= Math.PI * 2;\n }\n _phase = (_phase / Math.PI / 2) * waveLength;\n\n const left = cx - radius + _phase - radius * 2;\n /**\n * top-left corner as start point\n *\n * draws this point\n * |\n * \\|/\n * ~~~~~~~~\n * | |\n * +------+\n */\n path.push(['M', left, waterLevel]);\n\n /**\n * top wave\n *\n * ~~~~~~~~ <- draws this sine wave\n * | |\n * +------+\n */\n let waveRight = 0;\n for (let c = 0; c < curves; ++c) {\n const stage = c % 4;\n const pos = getWaterWavePositions((c * waveLength) / 4, stage, waveLength, amplitude);\n path.push([\n 'C',\n pos[0][0] + left,\n -pos[0][1] + waterLevel,\n pos[1][0] + left,\n -pos[1][1] + waterLevel,\n pos[2][0] + left,\n -pos[2][1] + waterLevel,\n ]);\n\n if (c === curves - 1) {\n waveRight = pos[2][0];\n }\n }\n\n /**\n * top-right corner\n *\n * ~~~~~~~~\n * 3. draws this line -> | | <- 1. draws this line\n * +------+\n * ^\n * |\n * 2. draws this line\n */\n path.push(['L', waveRight + left, cy + radius]);\n path.push(['L', left, cy + radius]);\n path.push(['Z']);\n // path.push(['L', left, waterLevel]);\n return path;\n}\n\n/**\n * 添加水波\n * @param x 中心x\n * @param y 中心y\n * @param level 水位等级 0~1\n * @param waveCount 水波数\n * @param waveAttrs 色值\n * @param group 图组\n * @param clip 用于剪切的图形\n * @param radius 绘制图形的高度\n * @param waveLength 波的长度\n */\nexport function addWaterWave(\n x: number,\n y: number,\n level: number,\n waveCount: number,\n waveAttrs: ShapeStyle,\n group: IGroup,\n clip: IShape,\n radius: number,\n waveLength: number,\n animation: LiquidOptions['animation']\n) {\n // 盒子属性 颜色 宽高\n const { fill, opacity } = waveAttrs;\n const bbox = clip.getBBox();\n const width = bbox.maxX - bbox.minX;\n const height = bbox.maxY - bbox.minY;\n\n // 循环 waveCount 个数\n for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 1 : idx / (waveCount - 1);\n\n // 画波\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\n // 波形路径配置\n path: getWaterWavePath(\n radius,\n bbox.minY + height * level,\n waveLength,\n 0,\n width / 32, // 波幅高度\n x,\n y\n ),\n fill,\n opacity: lerp(0.2, 0.9, factor) * opacity,\n },\n });\n\n try {\n // 默认 underfind 开启动画\n if (animation === false) return;\n const matrix = transform([['t', waveLength, 0]]);\n\n wave.stopAnimate();\n wave.animate(\n { matrix },\n {\n duration: lerp(0.5 * DURATION, DURATION, factor),\n repeat: true,\n }\n );\n } catch (e) {\n // TODO off-screen canvas 中动画会找不到 canvas\n console.warn('off-screen group animate error!');\n }\n }\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction pin(x: number, y: number, width: number, height: number) {\n const w = (width * 2) / 3;\n const h = Math.max(w, height);\n const r = w / 2;\n\n // attrs of the upper circle\n const cx = x;\n const cy = r + y - h / 2;\n const theta = Math.asin(r / ((h - r) * 0.85));\n const dy = Math.sin(theta) * r;\n const dx = Math.cos(theta) * r;\n\n // the start point of the path\n const x0 = cx - dx;\n const y0 = cy + dy;\n\n // control point\n const cpX = x;\n const cpY = cy + r / Math.sin(theta);\n\n return `\n M ${x0} ${y0}\n A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}\n Q ${cpX} ${cpY} ${x} ${y + h / 2}\n Q ${cpX} ${cpY} ${x0} ${y0}\n Z \n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction circle(x: number, y: number, width: number, height: number) {\n const rx = width / 2;\n const ry = height / 2;\n return `\n M ${x} ${y - ry} \n a ${rx} ${ry} 0 1 0 0 ${ry * 2}\n a ${rx} ${ry} 0 1 0 0 ${-ry * 2}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction diamond(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y}\n L ${x} ${y + h}\n L ${x - w} ${y}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction triangle(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction rect(x: number, y: number, width: number, height: number) {\n const GOLDEN_SECTION_RATIO = 0.618;\n const h = height / 2;\n const w = (width / 2) * GOLDEN_SECTION_RATIO;\n return `\n M ${x - w} ${y - h}\n L ${x + w} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\nconst builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\n};\n\nregisterShape('interval', 'liquid-fill-gauge', {\n draw(cfg: any, container: IGroup) {\n const cx = 0.5;\n const cy = 0.5;\n\n const { customInfo } = cfg;\n const { radius: radio, shape, shapeStyle, background, animation } = customInfo as CustomInfo;\n const outline: LiquidOptions['outline'] = customInfo.outline;\n const wave: LiquidOptions['wave'] = customInfo.wave;\n const { border, distance } = outline;\n const { count: waveCount, length: waveLength } = wave;\n\n // 获取最小 minX\n const minX = reduce(\n cfg.points as Point[],\n (r: number, p: Point) => {\n return Math.min(r, p.x);\n },\n Infinity\n );\n\n const center = this.parsePoint({ x: cx, y: cy });\n const minXPoint = this.parsePoint({ x: minX, y: cy });\n const halfWidth = center.x - minXPoint.x;\n\n // 保证半径是 画布宽高最小值的 radius 值\n const radius = Math.min(halfWidth, minXPoint.y * radio);\n const waveAttrs = getFillAttrs(cfg);\n const outlineAttrs = getLineAttrs(mix({}, cfg, outline));\n const innerRadius = radius - border / 2;\n\n const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];\n const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);\n\n // 1. 当 shapeStyle 不为空时,绘制形状样式作为背景\n if (shapeStyle) {\n container.addShape('path', {\n name: 'shape',\n attrs: {\n path: shapePath,\n ...shapeStyle,\n },\n });\n }\n\n // 2. 绘制一个波\n const waves = container.addGroup({\n name: 'waves',\n });\n\n // 3. 波对应的 clip 裁剪形状\n const clipPath = waves.setClip({\n type: 'path',\n attrs: {\n path: shapePath,\n },\n });\n\n // 4. 绘制波形\n addWaterWave(\n center.x,\n center.y,\n 1 - (cfg.points[1] as Point).y,\n waveCount,\n waveAttrs,\n waves,\n clipPath,\n radius * 2,\n waveLength,\n animation\n );\n\n // 5. 绘制一个 distance 宽的 border\n container.addShape('path', {\n name: 'distance',\n attrs: {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border + distance * 2,\n stroke: background === 'transparent' ? '#fff' : background,\n },\n });\n\n // 6. 绘制一个 border 宽的 border\n container.addShape('path', {\n name: 'wrap',\n attrs: mix(outlineAttrs, {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border,\n }),\n });\n\n return container;\n },\n});\n"]}
1
+ {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../../src/plots/liquid/shapes/liquid.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,IAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,MAAc;IACpD,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAe;IACnC,IAAM,KAAK,cAAK,OAAO,EAAE,CAAC,IAAK,GAAG,CAAC,KAAK,CAAE,CAAC;IAE3C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;KACxB;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAe;IACnC,IAAM,YAAY,GAAG;QACnB,IAAI,EAAE,MAAM;Q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AAE;oBACL,IAAI,EAAE,SAAS;iBAChB;aACF,CAAC,CAAC;YAEH,UAAU;YACV,YAAY,CACV,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,CAAC,EACR,CAAC,GAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAW,CAAC,CAAC,EAC9B,SAAS,EACT,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,CAAC,EACV,UAAU,EACV,SAAS,CACV,CAAC;SACH;QAED,6BAA6B;QAC7B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,CAAC;gBAChC,MAAM,EAAE,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;aAC3D;SACF,CAAC,CAAC;QAEH,2BAA2B;QAC3B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,MAAM;aAClB,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, IShape } from '@antv/g-base';\nimport { registerShape } from '@antv/g2';\nimport { isNumber, mix, reduce } from '@antv/util';\nimport { Point, ShapeStyle } from '../../../types';\nimport { transform } from '../../../utils/matrix';\nimport { CustomInfo, LiquidOptions } from '../types';\n\nconst DURATION = 5000;\n\n/**\n * 一个线性映射的函数\n * @param min\n * @param max\n * @param factor\n */\nfunction lerp(min: number, max: number, factor: number) {\n return min + (max - min) * factor;\n}\n\n/**\n * 波浪的 attrs\n * @param cfg\n */\nfunction getFillAttrs(cfg: ShapeStyle) {\n const attrs = { opacity: 1, ...cfg.style };\n\n if (cfg.color && !attrs.fill) {\n attrs.fill = cfg.color;\n }\n\n return attrs;\n}\n\n/**\n * shape 的 attrs\n * @param cfg\n */\nfunction getLineAttrs(cfg: ShapeStyle) {\n const defaultAttrs = {\n fill: '#fff',\n fillOpacity: 0,\n lineWidth: 4,\n };\n const attrs = mix({}, defaultAttrs, cfg.style);\n\n if (cfg.color && !attrs.stroke) {\n attrs.stroke = cfg.color;\n }\n if (isNumber(cfg.opacity)) {\n attrs.opacity = attrs.strokeOpacity = cfg.opacity;\n }\n\n return attrs;\n}\n\n/**\n * 用贝塞尔曲线模拟正弦波\n * Using Bezier curves to fit sine wave.\n * There is 4 control points for each curve of wave,\n * which is at 1/4 wave length of the sine wave.\n *\n * The control points for a wave from (a) to (d) are a-b-c-d:\n * c *----* d\n * b *\n * |\n * ... a * ..................\n *\n * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)\n *\n * @param x x position of the left-most point (a)\n * @param stage 0-3, stating which part of the wave it is\n * @param waveLength wave length of the sine wave\n * @param amplitude wave amplitude\n * @return 正弦片段曲线\n */\nfunction getWaterWavePositions(x: number, stage: number, waveLength: number, amplitude: number) {\n if (stage === 0) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, amplitude],\n [x + waveLength / 4, amplitude],\n ];\n }\n if (stage === 1) {\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n }\n if (stage === 2) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, -amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, -amplitude],\n [x + waveLength / 4, -amplitude],\n ];\n }\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), -amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), -amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n}\n/**\n * 获取水波路径\n * @param radius 半径\n * @param waterLevel 水位\n * @param waveLength 波长\n * @param phase 相位\n * @param amplitude 震幅\n * @param cx 圆心x\n * @param cy 圆心y\n * @return path 路径\n * @reference http://gitlab.alipay-inc.com/datavis/g6/blob/1.2.0/src/graph/utils/path.js#L135\n */\nfunction getWaterWavePath(\n radius: number,\n waterLevel: number,\n waveLength: number,\n phase: number,\n amplitude: number,\n cx: number,\n cy: number\n) {\n const curves = Math.ceil(((2 * radius) / waveLength) * 4) * 4;\n const path = [];\n let _phase = phase;\n\n // map phase to [-Math.PI * 2, 0]\n while (_phase < -Math.PI * 2) {\n _phase += Math.PI * 2;\n }\n while (_phase > 0) {\n _phase -= Math.PI * 2;\n }\n _phase = (_phase / Math.PI / 2) * waveLength;\n\n const left = cx - radius + _phase - radius * 2;\n /**\n * top-left corner as start point\n *\n * draws this point\n * |\n * \\|/\n * ~~~~~~~~\n * | |\n * +------+\n */\n path.push(['M', left, waterLevel]);\n\n /**\n * top wave\n *\n * ~~~~~~~~ <- draws this sine wave\n * | |\n * +------+\n */\n let waveRight = 0;\n for (let c = 0; c < curves; ++c) {\n const stage = c % 4;\n const pos = getWaterWavePositions((c * waveLength) / 4, stage, waveLength, amplitude);\n path.push([\n 'C',\n pos[0][0] + left,\n -pos[0][1] + waterLevel,\n pos[1][0] + left,\n -pos[1][1] + waterLevel,\n pos[2][0] + left,\n -pos[2][1] + waterLevel,\n ]);\n\n if (c === curves - 1) {\n waveRight = pos[2][0];\n }\n }\n\n /**\n * top-right corner\n *\n * ~~~~~~~~\n * 3. draws this line -> | | <- 1. draws this line\n * +------+\n * ^\n * |\n * 2. draws this line\n */\n path.push(['L', waveRight + left, cy + radius]);\n path.push(['L', left, cy + radius]);\n path.push(['Z']);\n // path.push(['L', left, waterLevel]);\n return path;\n}\n\n/**\n * 添加水波\n * @param x 中心x\n * @param y 中心y\n * @param level 水位等级 0~1\n * @param waveCount 水波数\n * @param waveAttrs 色值\n * @param group 图组\n * @param clip 用于剪切的图形\n * @param radius 绘制图形的高度\n * @param waveLength 波的长度\n */\nexport function addWaterWave(\n x: number,\n y: number,\n level: number,\n waveCount: number,\n waveAttrs: ShapeStyle,\n group: IGroup,\n clip: IShape,\n radius: number,\n waveLength: number,\n animation: LiquidOptions['animation']\n) {\n // 盒子属性 颜色 宽高\n const { fill, opacity } = waveAttrs;\n const bbox = clip.getBBox();\n const width = bbox.maxX - bbox.minX;\n const height = bbox.maxY - bbox.minY;\n\n // 循环 waveCount 个数\n for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 1 : idx / (waveCount - 1);\n\n // 画波\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\n // 波形路径配置\n path: getWaterWavePath(\n radius,\n bbox.minY + height * level,\n waveLength,\n 0,\n width / 32, // 波幅高度\n x,\n y\n ),\n fill,\n opacity: lerp(0.2, 0.9, factor) * opacity,\n },\n });\n\n try {\n // 默认 underfind 开启动画\n if (animation === false) return;\n const matrix = transform([['t', waveLength, 0]]);\n\n wave.stopAnimate();\n wave.animate(\n { matrix },\n {\n duration: lerp(0.5 * DURATION, DURATION, factor),\n repeat: true,\n }\n );\n } catch (e) {\n // TODO off-screen canvas 中动画会找不到 canvas\n console.warn('off-screen group animate error!');\n }\n }\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction pin(x: number, y: number, width: number, height: number) {\n const w = (width * 2) / 3;\n const h = Math.max(w, height);\n const r = w / 2;\n\n // attrs of the upper circle\n const cx = x;\n const cy = r + y - h / 2;\n const theta = Math.asin(r / ((h - r) * 0.85));\n const dy = Math.sin(theta) * r;\n const dx = Math.cos(theta) * r;\n\n // the start point of the path\n const x0 = cx - dx;\n const y0 = cy + dy;\n\n // control point\n const cpX = x;\n const cpY = cy + r / Math.sin(theta);\n\n return `\n M ${x0} ${y0}\n A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}\n Q ${cpX} ${cpY} ${x} ${y + h / 2}\n Q ${cpX} ${cpY} ${x0} ${y0}\n Z \n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction circle(x: number, y: number, width: number, height: number) {\n const rx = width / 2;\n const ry = height / 2;\n return `\n M ${x} ${y - ry} \n a ${rx} ${ry} 0 1 0 0 ${ry * 2}\n a ${rx} ${ry} 0 1 0 0 ${-ry * 2}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction diamond(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y}\n L ${x} ${y + h}\n L ${x - w} ${y}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction triangle(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction rect(x: number, y: number, width: number, height: number) {\n const GOLDEN_SECTION_RATIO = 0.618;\n const h = height / 2;\n const w = (width / 2) * GOLDEN_SECTION_RATIO;\n return `\n M ${x - w} ${y - h}\n L ${x + w} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\nconst builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\n};\n\nregisterShape('interval', 'liquid-fill-gauge', {\n draw(cfg: any, container: IGroup) {\n const cx = 0.5;\n const cy = 0.5;\n\n const { customInfo } = cfg;\n const { percent, radius: radio, shape, shapeStyle, background, animation } = customInfo as CustomInfo;\n const outline: LiquidOptions['outline'] = customInfo.outline;\n const wave: LiquidOptions['wave'] = customInfo.wave;\n const { border, distance } = outline;\n const { count: waveCount, length: waveLength } = wave;\n\n // 获取最小 minX\n const minX = reduce(\n cfg.points as Point[],\n (r: number, p: Point) => {\n return Math.min(r, p.x);\n },\n Infinity\n );\n\n const center = this.parsePoint({ x: cx, y: cy });\n const minXPoint = this.parsePoint({ x: minX, y: cy });\n const halfWidth = center.x - minXPoint.x;\n\n // 保证半径是 画布宽高最小值的 radius 值\n const radius = Math.min(halfWidth, minXPoint.y * radio);\n const waveAttrs = getFillAttrs(cfg);\n const outlineAttrs = getLineAttrs(mix({}, cfg, outline));\n const innerRadius = radius - border / 2;\n\n const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];\n const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);\n\n // 1. 当 shapeStyle 不为空时,绘制形状样式作为背景\n if (shapeStyle) {\n container.addShape('path', {\n name: 'shape',\n attrs: {\n path: shapePath,\n ...shapeStyle,\n },\n });\n }\n\n // 比例大于 0 时才绘制水波\n if (percent > 0) {\n // 2. 绘制一个波\n const waves = container.addGroup({\n name: 'waves',\n });\n\n // 3. 波对应的 clip 裁剪形状\n const clipPath = waves.setClip({\n type: 'path',\n attrs: {\n path: shapePath,\n },\n });\n\n // 4. 绘制波形\n addWaterWave(\n center.x,\n center.y,\n 1 - (cfg.points[1] as Point).y,\n waveCount,\n waveAttrs,\n waves,\n clipPath,\n radius * 2,\n waveLength,\n animation\n );\n }\n\n // 5. 绘制一个 distance 宽的 border\n container.addShape('path', {\n name: 'distance',\n attrs: {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border + distance * 2,\n stroke: background === 'transparent' ? '#fff' : background,\n },\n });\n\n // 6. 绘制一个 border 宽的 border\n container.addShape('path', {\n name: 'wrap',\n attrs: mix(outlineAttrs, {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border,\n }),\n });\n\n return container;\n },\n});\n"]}
@@ -81,6 +81,7 @@ export interface LiquidOptions extends Omit<Options, 'data'> {
81
81
  * @title 水波图自定义 的 customInfo
82
82
  */
83
83
  export declare type CustomInfo = {
84
+ percent?: LiquidOptions['percent'];
84
85
  radius?: LiquidOptions['radius'];
85
86
  outline?: LiquidOptions['outline'];
86
87
  wave?: LiquidOptions['wave'];
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/liquid/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PathCommand } from '@antv/g-base';\nimport { ColorAttr, Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\n\n/**\n * @title 轮廓\n */\ntype Outline = Partial<{\n /**\n * @title 外环的宽度\n * @default \"2px\"\n */\n readonly border: number;\n /**\n * @title 内外的边距\n * @default \"0px\"\n */\n readonly distance: number;\n /**\n * @title 外环的样式\n */\n readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;\n // /** 外边框的形状,可以有 circle,rect,默认为 circle */\n // readonly containerShape?: 'circle' | 'rect';\n}>;\n\ntype Wave = Partial<{\n /**\n * @title 波形的数量\n * @default 3\n */\n readonly count: number;\n /**\n * @title 波形的长度\n * @default 192\n */\n readonly length: number;\n}>;\n\ntype ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];\n\n/**\n * @title 配置类型定义\n */\nexport interface LiquidOptions extends Omit<Options, 'data'> {\n /**\n * @title 指标比例\n */\n readonly percent: number;\n /**\n * @title 配置水波图的颜色\n * @description 使用默认色板的颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 水波的外半径\n * @description 范围0-1\n * @default 0.9\n */\n readonly radius?: number;\n /**\n * @title 水波图的样式\n */\n readonly liquidStyle?: StyleAttr;\n /**\n * @title 形状的样式\n */\n readonly shapeStyle?: StyleAttr;\n /**\n * @title 指标文本组件\n */\n readonly statistic?: Statistic;\n /**\n * @title 外环轮廓\n */\n readonly outline?: Outline;\n /**\n * @title 波的配置\n */\n readonly wave?: Wave;\n /**\n * @title 波的形状配置\n * @description ('circle' | 'rect' | 'triangle' | 'diamond')\n */\n readonly shape?: string | ShapeCallback;\n}\n\n/**\n * @title 水波图自定义 的 customInfo\n */\nexport type CustomInfo = {\n radius?: LiquidOptions['radius'];\n outline?: LiquidOptions['outline'];\n wave?: LiquidOptions['wave'];\n shape?: LiquidOptions['shape'];\n shapeStyle?: LiquidOptions['shapeStyle'];\n background?: string;\n animation?: LiquidOptions['animation'];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/liquid/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PathCommand } from '@antv/g-base';\nimport { ColorAttr, Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\n\n/**\n * @title 轮廓\n */\ntype Outline = Partial<{\n /**\n * @title 外环的宽度\n * @default \"2px\"\n */\n readonly border: number;\n /**\n * @title 内外的边距\n * @default \"0px\"\n */\n readonly distance: number;\n /**\n * @title 外环的样式\n */\n readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;\n // /** 外边框的形状,可以有 circle,rect,默认为 circle */\n // readonly containerShape?: 'circle' | 'rect';\n}>;\n\ntype Wave = Partial<{\n /**\n * @title 波形的数量\n * @default 3\n */\n readonly count: number;\n /**\n * @title 波形的长度\n * @default 192\n */\n readonly length: number;\n}>;\n\ntype ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];\n\n/**\n * @title 配置类型定义\n */\nexport interface LiquidOptions extends Omit<Options, 'data'> {\n /**\n * @title 指标比例\n */\n readonly percent: number;\n /**\n * @title 配置水波图的颜色\n * @description 使用默认色板的颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 水波的外半径\n * @description 范围0-1\n * @default 0.9\n */\n readonly radius?: number;\n /**\n * @title 水波图的样式\n */\n readonly liquidStyle?: StyleAttr;\n /**\n * @title 形状的样式\n */\n readonly shapeStyle?: StyleAttr;\n /**\n * @title 指标文本组件\n */\n readonly statistic?: Statistic;\n /**\n * @title 外环轮廓\n */\n readonly outline?: Outline;\n /**\n * @title 波的配置\n */\n readonly wave?: Wave;\n /**\n * @title 波的形状配置\n * @description ('circle' | 'rect' | 'triangle' | 'diamond')\n */\n readonly shape?: string | ShapeCallback;\n}\n\n/**\n * @title 水波图自定义 的 customInfo\n */\nexport type CustomInfo = {\n percent?: LiquidOptions['percent'];\n radius?: LiquidOptions['radius'];\n outline?: LiquidOptions['outline'];\n wave?: LiquidOptions['wave'];\n shape?: LiquidOptions['shape'];\n shapeStyle?: LiquidOptions['shapeStyle'];\n background?: string;\n animation?: LiquidOptions['animation'];\n};\n"]}
@@ -316,10 +316,11 @@ function tagCloud() {
316
316
  };
317
317
  function getContext(canvas) {
318
318
  canvas.width = canvas.height = 1;
319
- var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2);
319
+ var ratio = Math.sqrt(canvas.getContext('2d', { willReadFrequently: true }).getImageData(0, 0, 1, 1).data
320
+ .length >> 2);
320
321
  canvas.width = (cw << 5) / ratio;
321
322
  canvas.height = ch / ratio;
322
- var context = canvas.getContext('2d');
323
+ var context = canvas.getContext('2d', { willReadFrequently: true });
323
324
  context.fillStyle = context.strokeStyle = 'red';
324
325
  context.textAlign = 'center';
325
326
  return { context: context, ratio: ratio };
@@ -1 +1 @@
1
- {"version":3,"file":"word-cloud.js","sourceRoot":"","sources":["../../../src/utils/transform/word-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAkBvD,IAAM,eAAe,GAAY;IAC/B,IAAI,EAAE,cAAM,OAAA,OAAO,EAAP,CAAO;IACnB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IAChB,MAAM,EAAE,aAAa;IACrB,6CAA6C;IAC7C,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AAU,CAAC;QACxB,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { assign, isFunction, isNil } from '@antv/util';\r\nimport { Tag, Word } from '../../plots/word-cloud/types';\r\n\r\ntype FontWeight = number | 'normal' | 'bold' | 'bolder' | 'lighter';\r\n\r\nexport interface Options {\r\n size: [number, number];\r\n font?: string | ((row: Word, index?: number, words?: Word[]) => string);\r\n fontSize?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n fontWeight?: FontWeight | ((row: Word, index?: number, words?: Word[]) => FontWeight);\r\n rotate?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n padding?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n spiral?: 'archimedean' | 'rectangular' | ((size: [number, number]) => (t: number) => number[]);\r\n random?: number | (() => number);\r\n timeInterval?: number;\r\n imageMask?: HTMLImageElement;\r\n}\r\n\r\nconst DEFAULT_OPTIONS: Options = {\r\n font: () => 'serif',\r\n padding: 1,\r\n size: [500, 500],\r\n spiral: 'archimedean', // 'archimedean' || 'rectangular' || {function}\r\n // timeInterval: Infinity // max execute time\r\n timeInterval: 3000, // max execute time\r\n // imageMask: '', // instance of Image, must be loaded\r\n};\r\n\r\n/**\r\n * 根据对应的数据对象,计算每个\r\n * 词语在画布中的渲染位置,并返回\r\n * 计算后的数据对象\r\n * @param words\r\n * @param options\r\n */\r\nexport function wordCloud(words: Word[], options?: Partial<Options>): Tag[] {\r\n // 混入默认配置\r\n options = assign({} as Options, DEFAULT_OPTIONS, options);\r\n return transform(words, options as Options);\r\n}\r\n\r\n/**\r\n * 抛出没有混入默认配置的方法,用于测试。\r\n * @param words\r\n * @param options\r\n */\r\nexport function transform(words: Word[], options: Options) {\r\n // 布局对象\r\n const layout = tagCloud();\r\n ['font', 'fontSize', 'fontWeight', 'padding', 'rotate', 'size', 'spiral', 'timeInterval', 'random'].forEach(\r\n (key: string) => {\r\n if (!isNil(options[key])) {\r\n layout[key](options[key]);\r\n }\r\n }\r\n );\r\n\r\n layout.words(words);\r\n if (options.imageMask) {\r\n layout.createMask(options.imageMask);\r\n }\r\n\r\n const result = layout.start();\r\n const tags: any[] = result._tags;\r\n\r\n tags.forEach((tag) => {\r\n tag.x += options.size[0] / 2;\r\n tag.y += options.size[1] / 2;\r\n });\r\n\r\n const [w, h] = options.size;\r\n // 添加两个参照数据,分别表示左上角和右下角。\r\n // 不添加的话不会按照真实的坐标渲染,而是以\r\n // 数据中的边界坐标为边界进行拉伸,以铺满画布。\r\n // 这样的后果会导致词语之间的重叠。\r\n tags.push({\r\n text: '',\r\n value: 0,\r\n x: 0,\r\n y: 0,\r\n opacity: 0,\r\n });\r\n tags.push({\r\n text: '',\r\n value: 0,\r\n x: w,\r\n y: h,\r\n opacity: 0,\r\n });\r\n\r\n return tags;\r\n}\r\n\r\n/*\r\n * Synchronous version of d3-cloud\r\n */\r\n// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/\r\n// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf\r\n/* eslint-disable no-return-assign, no-cond-assign */\r\n\r\ninterface Item {\r\n value: number;\r\n text: string;\r\n sprite: boolean;\r\n}\r\n\r\nconst cloudRadians = Math.PI / 180,\r\n cw = (1 << 11) >> 5,\r\n ch = 1 << 11;\r\n\r\nfunction cloudText(d: Item) {\r\n return d.text;\r\n}\r\n\r\nfunction cloudFont() {\r\n return 'serif';\r\n}\r\n\r\nfunction cloudFontNormal() {\r\n return 'normal';\r\n}\r\n\r\nfunction cloudFontSize(d: Item) {\r\n return d.value;\r\n}\r\n\r\nfunction cloudRotate() {\r\n return ~~(Math.random() * 2) * 90;\r\n}\r\n\r\nfunction cloudPadding() {\r\n return 1;\r\n}\r\n\r\n// Fetches a monochrome sprite bitmap for the specified text.\r\n// Load in batches for speed.\r\nfunction cloudSprite(contextAndRatio, d, data, di) {\r\n if (d.sprite) return;\r\n const c = contextAndRatio.context,\r\n ratio = contextAndRatio.ratio;\r\n\r\n c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);\r\n let x = 0,\r\n y = 0,\r\n maxh = 0;\r\n const n = data.length;\r\n --di;\r\n while (++di < n) {\r\n d = data[di];\r\n c.save();\r\n c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font;\r\n let w = c.measureText(d.text + 'm').width * ratio,\r\n h = d.size << 1;\r\n if (d.rotate) {\r\n const sr = Math.sin(d.rotate * cloudRadians),\r\n cr = Math.cos(d.rotate * cloudRadians),\r\n wcr = w * cr,\r\n wsr = w * sr,\r\n hcr = h * cr,\r\n hsr = h * sr;\r\n w = ((Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5) << 5;\r\n h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));\r\n } else {\r\n w = ((w + 0x1f) >> 5) << 5;\r\n }\r\n if (h > maxh) maxh = h;\r\n if (x + w >= cw << 5) {\r\n x = 0;\r\n y += maxh;\r\n maxh = 0;\r\n }\r\n if (y + h >= ch) break;\r\n c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);\r\n if (d.rotate) c.rotate(d.rotate * cloudRadians);\r\n c.fillText(d.text, 0, 0);\r\n if (d.padding) {\r\n c.lineWidth = 2 * d.padding;\r\n c.strokeText(d.text, 0, 0);\r\n }\r\n c.restore();\r\n d.width = w;\r\n d.height = h;\r\n d.xoff = x;\r\n d.yoff = y;\r\n d.x1 = w >> 1;\r\n d.y1 = h >> 1;\r\n d.x0 = -d.x1;\r\n d.y0 = -d.y1;\r\n d.hasText = true;\r\n x += w;\r\n }\r\n const pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,\r\n sprite = [];\r\n while (--di >= 0) {\r\n d = data[di];\r\n if (!d.hasText) continue;\r\n const w = d.width,\r\n w32 = w >> 5;\r\n let h = d.y1 - d.y0;\r\n // Zero the buffer\r\n for (let i = 0; i < h * w32; i++) sprite[i] = 0;\r\n x = d.xoff;\r\n if (x == null) return;\r\n y = d.yoff;\r\n let seen = 0,\r\n seenRow = -1;\r\n for (let j = 0; j < h; j++) {\r\n for (let i = 0; i < w; i++) {\r\n const k = w32 * j + (i >> 5),\r\n m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;\r\n sprite[k] |= m;\r\n seen |= m;\r\n }\r\n if (seen) seenRow = j;\r\n else {\r\n d.y0++;\r\n h--;\r\n j--;\r\n y++;\r\n }\r\n }\r\n d.y1 = d.y0 + seenRow;\r\n d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);\r\n }\r\n}\r\n\r\n// Use mask-based collision detection.\r\nfunction cloudCollide(tag, board, sw) {\r\n sw >>= 5;\r\n const sprite = tag.sprite,\r\n w = tag.width >> 5,\r\n lx = tag.x - (w << 4),\r\n sx = lx & 0x7f,\r\n msx = 32 - sx,\r\n h = tag.y1 - tag.y0;\r\n let x = (tag.y + tag.y0) * sw + (lx >> 5),\r\n last;\r\n for (let j = 0; j < h; j++) {\r\n last = 0;\r\n for (let i = 0; i <= w; i++) {\r\n if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;\r\n }\r\n x += sw;\r\n }\r\n return false;\r\n}\r\n\r\nfunction cloudBounds(bounds, d) {\r\n const b0 = bounds[0],\r\n b1 = bounds[1];\r\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\r\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\r\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\r\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\r\n}\r\n\r\nfunction collideRects(a, b) {\r\n return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;\r\n}\r\n\r\nfunction archimedeanSpiral(size) {\r\n const e = size[0] / size[1];\r\n return function (t) {\r\n return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)];\r\n };\r\n}\r\n\r\nfunction rectangularSpiral(size) {\r\n const dy = 4,\r\n dx = (dy * size[0]) / size[1];\r\n let x = 0,\r\n y = 0;\r\n return function (t) {\r\n const sign = t < 0 ? -1 : 1;\r\n // See triangular numbers: T_n = n * (n + 1) / 2.\r\n switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {\r\n case 0:\r\n x += dx;\r\n break;\r\n case 1:\r\n y += dy;\r\n break;\r\n case 2:\r\n x -= dx;\r\n break;\r\n default:\r\n y -= dy;\r\n break;\r\n }\r\n return [x, y];\r\n };\r\n}\r\n\r\n// TODO reuse arrays?\r\nfunction zeroArray(n) {\r\n const a = [];\r\n let i = -1;\r\n while (++i < n) a[i] = 0;\r\n return a;\r\n}\r\n\r\nfunction cloudCanvas() {\r\n return document.createElement('canvas');\r\n}\r\n\r\nexport function functor(d) {\r\n return isFunction(d)\r\n ? d\r\n : function () {\r\n return d;\r\n };\r\n}\r\n\r\nconst spirals = {\r\n archimedean: archimedeanSpiral,\r\n rectangular: rectangularSpiral,\r\n};\r\n\r\nfunction tagCloud() {\r\n let size = [256, 256],\r\n font = cloudFont,\r\n fontSize = cloudFontSize,\r\n fontWeight = cloudFontNormal,\r\n rotate = cloudRotate,\r\n padding = cloudPadding,\r\n spiral = archimedeanSpiral,\r\n random = Math.random,\r\n words = [],\r\n timeInterval = Infinity;\r\n\r\n const text = cloudText;\r\n const fontStyle = cloudFontNormal;\r\n const canvas = cloudCanvas;\r\n const cloud: any = {};\r\n\r\n cloud.start = function () {\r\n const [width, height] = size;\r\n const contextAndRatio = getContext(canvas()),\r\n board = cloud.board ? cloud.board : zeroArray((size[0] >> 5) * size[1]),\r\n n = words.length,\r\n tags = [],\r\n data = words\r\n .map(function (d, i, data) {\r\n d.text = text.call(this, d, i, data);\r\n d.font = font.call(this, d, i, data);\r\n d.style = fontStyle.call(this, d, i, data);\r\n d.weight = fontWeight.call(this, d, i, data);\r\n d.rotate = rotate.call(this, d, i, data);\r\n d.size = ~~fontSize.call(this, d, i, data);\r\n d.padding = padding.call(this, d, i, data);\r\n return d;\r\n })\r\n .sort(function (a, b) {\r\n return b.size - a.size;\r\n });\r\n let i = -1,\r\n bounds = !cloud.board\r\n ? null\r\n : [\r\n {\r\n x: 0,\r\n y: 0,\r\n },\r\n {\r\n x: width,\r\n y: height,\r\n },\r\n ];\r\n\r\n step();\r\n\r\n function step() {\r\n const start = Date.now();\r\n while (Date.now() - start < timeInterval && ++i < n) {\r\n const d = data[i];\r\n d.x = (width * (random() + 0.5)) >> 1;\r\n d.y = (height * (random() + 0.5)) >> 1;\r\n cloudSprite(contextAndRatio, d, data, i);\r\n if (d.hasText && place(board, d, bounds)) {\r\n tags.push(d);\r\n if (bounds) {\r\n if (!cloud.hasImage) {\r\n // update bounds if image mask not set\r\n cloudBounds(bounds, d);\r\n }\r\n } else {\r\n bounds = [\r\n { x: d.x + d.x0, y: d.y + d.y0 },\r\n { x: d.x + d.x1, y: d.y + d.y1 },\r\n ];\r\n }\r\n // Temporary hack\r\n d.x -= size[0] >> 1;\r\n d.y -= size[1] >> 1;\r\n }\r\n }\r\n cloud._tags = tags;\r\n cloud._bounds = bounds;\r\n }\r\n\r\n return cloud;\r\n };\r\n\r\n function getContext(canvas: HTMLCanvasElement) {\r\n canvas.width = canvas.height = 1;\r\n const ratio = Math.sqrt(canvas.getContext('2d')!.getImageData(0, 0, 1, 1).data.length >> 2);\r\n canvas.width = (cw << 5) / ratio;\r\n canvas.height = ch / ratio;\r\n\r\n const context = canvas.getContext('2d') as CanvasRenderingContext2D;\r\n context.fillStyle = context.strokeStyle = 'red';\r\n context.textAlign = 'center';\r\n return { context, ratio };\r\n }\r\n\r\n function place(board, tag, bounds) {\r\n // const perimeter = [{ x: 0, y: 0 }, { x: size[0], y: size[1] }],\r\n const startX = tag.x,\r\n startY = tag.y,\r\n maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),\r\n s = spiral(size),\r\n dt = random() < 0.5 ? 1 : -1;\r\n let dxdy,\r\n t = -dt,\r\n dx,\r\n dy;\r\n\r\n while ((dxdy = s((t += dt)))) {\r\n dx = ~~dxdy[0];\r\n dy = ~~dxdy[1];\r\n\r\n if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;\r\n\r\n tag.x = startX + dx;\r\n tag.y = startY + dy;\r\n\r\n if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;\r\n // TODO only check for collisions within current bounds.\r\n if (!bounds || !cloudCollide(tag, board, size[0])) {\r\n if (!bounds || collideRects(tag, bounds)) {\r\n const sprite = tag.sprite,\r\n w = tag.width >> 5,\r\n sw = size[0] >> 5,\r\n lx = tag.x - (w << 4),\r\n sx = lx & 0x7f,\r\n msx = 32 - sx,\r\n h = tag.y1 - tag.y0;\r\n let last,\r\n x = (tag.y + tag.y0) * sw + (lx >> 5);\r\n for (let j = 0; j < h; j++) {\r\n last = 0;\r\n for (let i = 0; i <= w; i++) {\r\n board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);\r\n }\r\n x += sw;\r\n }\r\n delete tag.sprite;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n cloud.createMask = (img: HTMLImageElement) => {\r\n const can: HTMLCanvasElement = document.createElement('canvas');\r\n const [width, height] = size;\r\n\r\n // 当 width 或 height 为 0 时,调用 cxt.getImageData 会报错\r\n if (!width || !height) {\r\n return;\r\n }\r\n const w32 = width >> 5;\r\n const board = zeroArray((width >> 5) * height);\r\n can.width = width;\r\n can.height = height;\r\n const cxt = can.getContext('2d') as CanvasRenderingContext2D;\r\n cxt.drawImage(img, 0, 0, img.width, img.height, 0, 0, width, height);\r\n const imageData = cxt.getImageData(0, 0, width, height).data;\r\n for (let j = 0; j < height; j++) {\r\n for (let i = 0; i < width; i++) {\r\n const k = w32 * j + (i >> 5);\r\n const tmp = (j * width + i) << 2;\r\n const flag = imageData[tmp] >= 250 && imageData[tmp + 1] >= 250 && imageData[tmp + 2] >= 250;\r\n const m = flag ? 1 << (31 - (i % 32)) : 0;\r\n board[k] |= m;\r\n }\r\n }\r\n cloud.board = board;\r\n cloud.hasImage = true;\r\n };\r\n\r\n cloud.timeInterval = function (_) {\r\n timeInterval = _ == null ? Infinity : _;\r\n };\r\n\r\n cloud.words = function (_) {\r\n words = _;\r\n };\r\n\r\n cloud.size = function (_) {\r\n size = [+_[0], +_[1]];\r\n };\r\n\r\n cloud.font = function (_) {\r\n font = functor(_);\r\n };\r\n\r\n cloud.fontWeight = function (_) {\r\n fontWeight = functor(_);\r\n };\r\n\r\n cloud.rotate = function (_) {\r\n rotate = functor(_);\r\n };\r\n\r\n cloud.spiral = function (_) {\r\n spiral = spirals[_] || _;\r\n };\r\n\r\n cloud.fontSize = function (_) {\r\n fontSize = functor(_);\r\n };\r\n\r\n cloud.padding = function (_) {\r\n padding = functor(_);\r\n };\r\n\r\n cloud.random = function (_) {\r\n random = functor(_);\r\n };\r\n\r\n return cloud;\r\n}\r\n"]}
1
+ {"version":3,"file":"word-cloud.js","sourceRoot":"","sources":["../../../src/utils/transform/word-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAkBvD,IAAM,eAAe,GAAY;IAC/B,IAAI,EAAE,cAAM,OAAA,OAAO,EAAP,CAAO;IACnB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IAChB,MAAM,EAAE,aAAa;IACrB,6CAA6C;IAC7C,YAAY,EAAE,IAAI;CAEnB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,OAA0B;IACjE,SAAS;IACT,OAAO,GAAG,MAAM,CAAC,EAAa,EAAE,eAAe,EAAE,OAAO,CAAC,CAA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ACf,CAAC","sourcesContent":["import { assign, isFunction, isNil } from '@antv/util';\r\nimport { Tag, Word } from '../../plots/word-cloud/types';\r\n\r\ntype FontWeight = number | 'normal' | 'bold' | 'bolder' | 'lighter';\r\n\r\nexport interface Options {\r\n size: [number, number];\r\n font?: string | ((row: Word, index?: number, words?: Word[]) => string);\r\n fontSize?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n fontWeight?: FontWeight | ((row: Word, index?: number, words?: Word[]) => FontWeight);\r\n rotate?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n padding?: number | ((row: Word, index?: number, words?: Word[]) => number);\r\n spiral?: 'archimedean' | 'rectangular' | ((size: [number, number]) => (t: number) => number[]);\r\n random?: number | (() => number);\r\n timeInterval?: number;\r\n imageMask?: HTMLImageElement;\r\n}\r\n\r\nconst DEFAULT_OPTIONS: Options = {\r\n font: () => 'serif',\r\n padding: 1,\r\n size: [500, 500],\r\n spiral: 'archimedean', // 'archimedean' || 'rectangular' || {function}\r\n // timeInterval: Infinity // max execute time\r\n timeInterval: 3000, // max execute time\r\n // imageMask: '', // instance of Image, must be loaded\r\n};\r\n\r\n/**\r\n * 根据对应的数据对象,计算每个\r\n * 词语在画布中的渲染位置,并返回\r\n * 计算后的数据对象\r\n * @param words\r\n * @param options\r\n */\r\nexport function wordCloud(words: Word[], options?: Partial<Options>): Tag[] {\r\n // 混入默认配置\r\n options = assign({} as Options, DEFAULT_OPTIONS, options);\r\n return transform(words, options as Options);\r\n}\r\n\r\n/**\r\n * 抛出没有混入默认配置的方法,用于测试。\r\n * @param words\r\n * @param options\r\n */\r\nexport function transform(words: Word[], options: Options) {\r\n // 布局对象\r\n const layout = tagCloud();\r\n ['font', 'fontSize', 'fontWeight', 'padding', 'rotate', 'size', 'spiral', 'timeInterval', 'random'].forEach(\r\n (key: string) => {\r\n if (!isNil(options[key])) {\r\n layout[key](options[key]);\r\n }\r\n }\r\n );\r\n\r\n layout.words(words);\r\n if (options.imageMask) {\r\n layout.createMask(options.imageMask);\r\n }\r\n\r\n const result = layout.start();\r\n const tags: any[] = result._tags;\r\n\r\n tags.forEach((tag) => {\r\n tag.x += options.size[0] / 2;\r\n tag.y += options.size[1] / 2;\r\n });\r\n\r\n const [w, h] = options.size;\r\n // 添加两个参照数据,分别表示左上角和右下角。\r\n // 不添加的话不会按照真实的坐标渲染,而是以\r\n // 数据中的边界坐标为边界进行拉伸,以铺满画布。\r\n // 这样的后果会导致词语之间的重叠。\r\n tags.push({\r\n text: '',\r\n value: 0,\r\n x: 0,\r\n y: 0,\r\n opacity: 0,\r\n });\r\n tags.push({\r\n text: '',\r\n value: 0,\r\n x: w,\r\n y: h,\r\n opacity: 0,\r\n });\r\n\r\n return tags;\r\n}\r\n\r\n/*\r\n * Synchronous version of d3-cloud\r\n */\r\n// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/\r\n// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf\r\n/* eslint-disable no-return-assign, no-cond-assign */\r\n\r\ninterface Item {\r\n value: number;\r\n text: string;\r\n sprite: boolean;\r\n}\r\n\r\nconst cloudRadians = Math.PI / 180,\r\n cw = (1 << 11) >> 5,\r\n ch = 1 << 11;\r\n\r\nfunction cloudText(d: Item) {\r\n return d.text;\r\n}\r\n\r\nfunction cloudFont() {\r\n return 'serif';\r\n}\r\n\r\nfunction cloudFontNormal() {\r\n return 'normal';\r\n}\r\n\r\nfunction cloudFontSize(d: Item) {\r\n return d.value;\r\n}\r\n\r\nfunction cloudRotate() {\r\n return ~~(Math.random() * 2) * 90;\r\n}\r\n\r\nfunction cloudPadding() {\r\n return 1;\r\n}\r\n\r\n// Fetches a monochrome sprite bitmap for the specified text.\r\n// Load in batches for speed.\r\nfunction cloudSprite(contextAndRatio, d, data, di) {\r\n if (d.sprite) return;\r\n const c = contextAndRatio.context,\r\n ratio = contextAndRatio.ratio;\r\n\r\n c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);\r\n let x = 0,\r\n y = 0,\r\n maxh = 0;\r\n const n = data.length;\r\n --di;\r\n while (++di < n) {\r\n d = data[di];\r\n c.save();\r\n c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font;\r\n let w = c.measureText(d.text + 'm').width * ratio,\r\n h = d.size << 1;\r\n if (d.rotate) {\r\n const sr = Math.sin(d.rotate * cloudRadians),\r\n cr = Math.cos(d.rotate * cloudRadians),\r\n wcr = w * cr,\r\n wsr = w * sr,\r\n hcr = h * cr,\r\n hsr = h * sr;\r\n w = ((Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5) << 5;\r\n h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));\r\n } else {\r\n w = ((w + 0x1f) >> 5) << 5;\r\n }\r\n if (h > maxh) maxh = h;\r\n if (x + w >= cw << 5) {\r\n x = 0;\r\n y += maxh;\r\n maxh = 0;\r\n }\r\n if (y + h >= ch) break;\r\n c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);\r\n if (d.rotate) c.rotate(d.rotate * cloudRadians);\r\n c.fillText(d.text, 0, 0);\r\n if (d.padding) {\r\n c.lineWidth = 2 * d.padding;\r\n c.strokeText(d.text, 0, 0);\r\n }\r\n c.restore();\r\n d.width = w;\r\n d.height = h;\r\n d.xoff = x;\r\n d.yoff = y;\r\n d.x1 = w >> 1;\r\n d.y1 = h >> 1;\r\n d.x0 = -d.x1;\r\n d.y0 = -d.y1;\r\n d.hasText = true;\r\n x += w;\r\n }\r\n const pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,\r\n sprite = [];\r\n while (--di >= 0) {\r\n d = data[di];\r\n if (!d.hasText) continue;\r\n const w = d.width,\r\n w32 = w >> 5;\r\n let h = d.y1 - d.y0;\r\n // Zero the buffer\r\n for (let i = 0; i < h * w32; i++) sprite[i] = 0;\r\n x = d.xoff;\r\n if (x == null) return;\r\n y = d.yoff;\r\n let seen = 0,\r\n seenRow = -1;\r\n for (let j = 0; j < h; j++) {\r\n for (let i = 0; i < w; i++) {\r\n const k = w32 * j + (i >> 5),\r\n m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;\r\n sprite[k] |= m;\r\n seen |= m;\r\n }\r\n if (seen) seenRow = j;\r\n else {\r\n d.y0++;\r\n h--;\r\n j--;\r\n y++;\r\n }\r\n }\r\n d.y1 = d.y0 + seenRow;\r\n d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);\r\n }\r\n}\r\n\r\n// Use mask-based collision detection.\r\nfunction cloudCollide(tag, board, sw) {\r\n sw >>= 5;\r\n const sprite = tag.sprite,\r\n w = tag.width >> 5,\r\n lx = tag.x - (w << 4),\r\n sx = lx & 0x7f,\r\n msx = 32 - sx,\r\n h = tag.y1 - tag.y0;\r\n let x = (tag.y + tag.y0) * sw + (lx >> 5),\r\n last;\r\n for (let j = 0; j < h; j++) {\r\n last = 0;\r\n for (let i = 0; i <= w; i++) {\r\n if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;\r\n }\r\n x += sw;\r\n }\r\n return false;\r\n}\r\n\r\nfunction cloudBounds(bounds, d) {\r\n const b0 = bounds[0],\r\n b1 = bounds[1];\r\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\r\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\r\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\r\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\r\n}\r\n\r\nfunction collideRects(a, b) {\r\n return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;\r\n}\r\n\r\nfunction archimedeanSpiral(size) {\r\n const e = size[0] / size[1];\r\n return function (t) {\r\n return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)];\r\n };\r\n}\r\n\r\nfunction rectangularSpiral(size) {\r\n const dy = 4,\r\n dx = (dy * size[0]) / size[1];\r\n let x = 0,\r\n y = 0;\r\n return function (t) {\r\n const sign = t < 0 ? -1 : 1;\r\n // See triangular numbers: T_n = n * (n + 1) / 2.\r\n switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {\r\n case 0:\r\n x += dx;\r\n break;\r\n case 1:\r\n y += dy;\r\n break;\r\n case 2:\r\n x -= dx;\r\n break;\r\n default:\r\n y -= dy;\r\n break;\r\n }\r\n return [x, y];\r\n };\r\n}\r\n\r\n// TODO reuse arrays?\r\nfunction zeroArray(n) {\r\n const a = [];\r\n let i = -1;\r\n while (++i < n) a[i] = 0;\r\n return a;\r\n}\r\n\r\nfunction cloudCanvas() {\r\n return document.createElement('canvas');\r\n}\r\n\r\nexport function functor(d) {\r\n return isFunction(d)\r\n ? d\r\n : function () {\r\n return d;\r\n };\r\n}\r\n\r\nconst spirals = {\r\n archimedean: archimedeanSpiral,\r\n rectangular: rectangularSpiral,\r\n};\r\n\r\nfunction tagCloud() {\r\n let size = [256, 256],\r\n font = cloudFont,\r\n fontSize = cloudFontSize,\r\n fontWeight = cloudFontNormal,\r\n rotate = cloudRotate,\r\n padding = cloudPadding,\r\n spiral = archimedeanSpiral,\r\n random = Math.random,\r\n words = [],\r\n timeInterval = Infinity;\r\n\r\n const text = cloudText;\r\n const fontStyle = cloudFontNormal;\r\n const canvas = cloudCanvas;\r\n const cloud: any = {};\r\n\r\n cloud.start = function () {\r\n const [width, height] = size;\r\n const contextAndRatio = getContext(canvas()),\r\n board = cloud.board ? cloud.board : zeroArray((size[0] >> 5) * size[1]),\r\n n = words.length,\r\n tags = [],\r\n data = words\r\n .map(function (d, i, data) {\r\n d.text = text.call(this, d, i, data);\r\n d.font = font.call(this, d, i, data);\r\n d.style = fontStyle.call(this, d, i, data);\r\n d.weight = fontWeight.call(this, d, i, data);\r\n d.rotate = rotate.call(this, d, i, data);\r\n d.size = ~~fontSize.call(this, d, i, data);\r\n d.padding = padding.call(this, d, i, data);\r\n return d;\r\n })\r\n .sort(function (a, b) {\r\n return b.size - a.size;\r\n });\r\n let i = -1,\r\n bounds = !cloud.board\r\n ? null\r\n : [\r\n {\r\n x: 0,\r\n y: 0,\r\n },\r\n {\r\n x: width,\r\n y: height,\r\n },\r\n ];\r\n\r\n step();\r\n\r\n function step() {\r\n const start = Date.now();\r\n while (Date.now() - start < timeInterval && ++i < n) {\r\n const d = data[i];\r\n d.x = (width * (random() + 0.5)) >> 1;\r\n d.y = (height * (random() + 0.5)) >> 1;\r\n cloudSprite(contextAndRatio, d, data, i);\r\n if (d.hasText && place(board, d, bounds)) {\r\n tags.push(d);\r\n if (bounds) {\r\n if (!cloud.hasImage) {\r\n // update bounds if image mask not set\r\n cloudBounds(bounds, d);\r\n }\r\n } else {\r\n bounds = [\r\n { x: d.x + d.x0, y: d.y + d.y0 },\r\n { x: d.x + d.x1, y: d.y + d.y1 },\r\n ];\r\n }\r\n // Temporary hack\r\n d.x -= size[0] >> 1;\r\n d.y -= size[1] >> 1;\r\n }\r\n }\r\n cloud._tags = tags;\r\n cloud._bounds = bounds;\r\n }\r\n\r\n return cloud;\r\n };\r\n\r\n function getContext(canvas: HTMLCanvasElement) {\r\n canvas.width = canvas.height = 1;\r\n const ratio = Math.sqrt(\r\n (canvas.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D)!.getImageData(0, 0, 1, 1).data\r\n .length >> 2\r\n );\r\n canvas.width = (cw << 5) / ratio;\r\n canvas.height = ch / ratio;\r\n\r\n const context = canvas.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D;\r\n context.fillStyle = context.strokeStyle = 'red';\r\n context.textAlign = 'center';\r\n return { context, ratio };\r\n }\r\n\r\n function place(board, tag, bounds) {\r\n // const perimeter = [{ x: 0, y: 0 }, { x: size[0], y: size[1] }],\r\n const startX = tag.x,\r\n startY = tag.y,\r\n maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),\r\n s = spiral(size),\r\n dt = random() < 0.5 ? 1 : -1;\r\n let dxdy,\r\n t = -dt,\r\n dx,\r\n dy;\r\n\r\n while ((dxdy = s((t += dt)))) {\r\n dx = ~~dxdy[0];\r\n dy = ~~dxdy[1];\r\n\r\n if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;\r\n\r\n tag.x = startX + dx;\r\n tag.y = startY + dy;\r\n\r\n if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;\r\n // TODO only check for collisions within current bounds.\r\n if (!bounds || !cloudCollide(tag, board, size[0])) {\r\n if (!bounds || collideRects(tag, bounds)) {\r\n const sprite = tag.sprite,\r\n w = tag.width >> 5,\r\n sw = size[0] >> 5,\r\n lx = tag.x - (w << 4),\r\n sx = lx & 0x7f,\r\n msx = 32 - sx,\r\n h = tag.y1 - tag.y0;\r\n let last,\r\n x = (tag.y + tag.y0) * sw + (lx >> 5);\r\n for (let j = 0; j < h; j++) {\r\n last = 0;\r\n for (let i = 0; i <= w; i++) {\r\n board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);\r\n }\r\n x += sw;\r\n }\r\n delete tag.sprite;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n cloud.createMask = (img: HTMLImageElement) => {\r\n const can: HTMLCanvasElement = document.createElement('canvas');\r\n const [width, height] = size;\r\n\r\n // 当 width 或 height 为 0 时,调用 cxt.getImageData 会报错\r\n if (!width || !height) {\r\n return;\r\n }\r\n const w32 = width >> 5;\r\n const board = zeroArray((width >> 5) * height);\r\n can.width = width;\r\n can.height = height;\r\n const cxt = can.getContext('2d') as CanvasRenderingContext2D;\r\n cxt.drawImage(img, 0, 0, img.width, img.height, 0, 0, width, height);\r\n const imageData = cxt.getImageData(0, 0, width, height).data;\r\n for (let j = 0; j < height; j++) {\r\n for (let i = 0; i < width; i++) {\r\n const k = w32 * j + (i >> 5);\r\n const tmp = (j * width + i) << 2;\r\n const flag = imageData[tmp] >= 250 && imageData[tmp + 1] >= 250 && imageData[tmp + 2] >= 250;\r\n const m = flag ? 1 << (31 - (i % 32)) : 0;\r\n board[k] |= m;\r\n }\r\n }\r\n cloud.board = board;\r\n cloud.hasImage = true;\r\n };\r\n\r\n cloud.timeInterval = function (_) {\r\n timeInterval = _ == null ? Infinity : _;\r\n };\r\n\r\n cloud.words = function (_) {\r\n words = _;\r\n };\r\n\r\n cloud.size = function (_) {\r\n size = [+_[0], +_[1]];\r\n };\r\n\r\n cloud.font = function (_) {\r\n font = functor(_);\r\n };\r\n\r\n cloud.fontWeight = function (_) {\r\n fontWeight = functor(_);\r\n };\r\n\r\n cloud.rotate = function (_) {\r\n rotate = functor(_);\r\n };\r\n\r\n cloud.spiral = function (_) {\r\n spiral = spirals[_] || _;\r\n };\r\n\r\n cloud.fontSize = function (_) {\r\n fontSize = functor(_);\r\n };\r\n\r\n cloud.padding = function (_) {\r\n padding = functor(_);\r\n };\r\n\r\n cloud.random = function (_) {\r\n random = functor(_);\r\n };\r\n\r\n return cloud;\r\n}\r\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "2.4.23";
1
+ export declare const version = "2.4.24";
2
2
  import * as G2 from '@antv/g2';
3
3
  /** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */
4
4
  import { animation, annotation, interaction, legend, scale, theme, tooltip } from './adaptor/common';
package/lib/index.js CHANGED
@@ -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.23';
5
+ exports.version = '2.4.24';
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":";;;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,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,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,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.23';\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,yDAAuD;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,+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,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,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.24';\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"]}
@@ -40,6 +40,7 @@ function geometry(params) {
40
40
  var geometry = ext.geometry;
41
41
  var background = chart.getTheme().background;
42
42
  var customInfo = {
43
+ percent: percent,
43
44
  radius: radius,
44
45
  outline: outline,
45
46
  wave: wave,