@antv/g2plot 2.4.5 → 2.4.7
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/CHANGELOG.md +22 -0
- package/dist/g2plot.min.js +4 -4
- package/dist/g2plot.min.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/area/constants.js +1 -0
- package/esm/plots/area/constants.js.map +1 -1
- package/esm/plots/bar/constants.js +3 -0
- package/esm/plots/bar/constants.js.map +1 -1
- package/esm/plots/column/constants.js +3 -0
- package/esm/plots/column/constants.js.map +1 -1
- package/esm/plots/gauge/adaptor.js +1 -0
- package/esm/plots/gauge/adaptor.js.map +1 -1
- package/esm/plots/line/adaptor.js +2 -2
- package/esm/plots/line/adaptor.js.map +1 -1
- package/esm/plots/line/constants.js +1 -0
- package/esm/plots/line/constants.js.map +1 -1
- package/esm/plots/liquid/adaptor.js +2 -1
- package/esm/plots/liquid/adaptor.js.map +1 -1
- package/esm/plots/liquid/shapes/liquid.js +5 -3
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +1 -0
- package/esm/plots/liquid/types.js.map +1 -1
- package/esm/plots/pie/adaptor.js +2 -0
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/contants.js +1 -0
- package/esm/plots/pie/contants.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -0
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/rose/constant.js +1 -0
- package/esm/plots/rose/constant.js.map +1 -1
- package/esm/plots/scatter/adaptor.d.ts +1 -1
- package/esm/plots/scatter/adaptor.js +2 -2
- package/esm/plots/scatter/adaptor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/constants.js +1 -0
- package/lib/plots/area/constants.js.map +1 -1
- package/lib/plots/bar/constants.js +3 -0
- package/lib/plots/bar/constants.js.map +1 -1
- package/lib/plots/column/constants.js +3 -0
- package/lib/plots/column/constants.js.map +1 -1
- package/lib/plots/gauge/adaptor.js +1 -0
- package/lib/plots/gauge/adaptor.js.map +1 -1
- package/lib/plots/line/adaptor.js +1 -1
- package/lib/plots/line/adaptor.js.map +1 -1
- package/lib/plots/line/constants.js +1 -0
- package/lib/plots/line/constants.js.map +1 -1
- package/lib/plots/liquid/adaptor.js +2 -1
- package/lib/plots/liquid/adaptor.js.map +1 -1
- package/lib/plots/liquid/shapes/liquid.js +5 -3
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +1 -0
- package/lib/plots/liquid/types.js.map +1 -1
- package/lib/plots/pie/adaptor.js +2 -0
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/contants.js +1 -0
- package/lib/plots/pie/contants.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -0
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/rose/constant.js +1 -0
- package/lib/plots/rose/constant.js.map +1 -1
- package/lib/plots/scatter/adaptor.d.ts +1 -1
- package/lib/plots/scatter/adaptor.js +1 -1
- package/lib/plots/scatter/adaptor.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/plots/area/constants.ts +1 -0
- package/src/plots/bar/constants.ts +3 -0
- package/src/plots/column/constants.ts +3 -0
- package/src/plots/gauge/adaptor.ts +1 -0
- package/src/plots/line/adaptor.ts +12 -1
- package/src/plots/line/constants.ts +1 -0
- package/src/plots/liquid/adaptor.ts +2 -1
- package/src/plots/liquid/shapes/liquid.ts +6 -3
- package/src/plots/liquid/types.ts +1 -0
- package/src/plots/pie/adaptor.ts +2 -0
- package/src/plots/pie/contants.ts +1 -0
- package/src/plots/progress/adaptor.ts +1 -0
- package/src/plots/rose/constant.ts +1 -0
- package/src/plots/scatter/adaptor.ts +3 -1
package/esm/index.d.ts
CHANGED
package/esm/index.js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,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.4.5';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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AE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.4.7';\n\n// G2 自定义能力透出\nimport * as G2 from '@antv/g2';\nexport { G2 };\n\n// 国际化处理\nimport { registerLocale } from './core/locale';\nimport { EN_US_LOCALE } from './locales/en_US';\nimport { ZH_CN_LOCALE } from './locales/zh_CN';\n/** default locale register */\nregisterLocale('en-US', EN_US_LOCALE);\nregisterLocale('zh-CN', ZH_CN_LOCALE);\n/** 透出 国际化 工具函数,便于使用 */\nexport { registerLocale };\n\n/** 全局变量 */\nexport { setGlobal } from './core/global';\n\n/** G2Plot 的 Plot 基类 */\nexport { Plot } from './core/plot';\n\n/** Adaptor 及其参数的类型定义 */\nexport type { Adaptor, Params } from './core/adaptor';\n\n// 类型定义导出\nexport * from './types';\n\n// 折线图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Line } from './plots/line';\nexport type { LineOptions } from './plots/line';\n\n// 面积图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Area } from './plots/area';\nexport type { AreaOptions } from './plots/area';\n\n// 柱形图及类型定义 | author by [zqlu](https://github.com/zqlu)\nexport { Column } from './plots/column';\nexport type { ColumnOptions } from './plots/column';\n\n// 条形图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ)\nexport { Bar } from './plots/bar';\nexport type { BarOptions } from './plots/bar';\n\n// 饼图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Pie } from './plots/pie';\nexport type { PieOptions } from './plots/pie';\n\n// 玫瑰图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { Rose } from './plots/rose';\nexport type { RoseOptions } from './plots/rose';\n\n// 词云图及类型定义 | author by [zhangzhonghe](https://github.com/zhangzhonghe)\nexport { WordCloud } from './plots/word-cloud';\nexport type { WordCloudOptions } from './plots/word-cloud';\n\n// 散点图及类型定义 | author by [lxfu1](https://github.com/lxfu1)\nexport { Scatter } from './plots/scatter';\nexport type { ScatterOptions } from './plots/scatter';\n\n// 雷达图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Radar } from './plots/radar';\nexport type { RadarOptions } from './plots/radar';\n\n// 混合图形 | author by [liuzhenying](https://github.com/liuzhenying)\nexport { DualAxes } from './plots/dual-axes';\nexport type { DualAxesOptions } from './plots/dual-axes';\n\n// 迷你折线图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyLine } from './plots/tiny-line';\nexport type { TinyLineOptions } from './plots/tiny-line';\n\n// 迷你柱形图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyColumn } from './plots/tiny-column';\nexport type { TinyColumnOptions } from './plots/tiny-column';\n\n// 迷你面积图及类型定义 | author by [connono](https://github.com/connono)\nexport { TinyArea } from './plots/tiny-area';\nexport type { TinyAreaOptions } from './plots/tiny-area';\n\n// 直方图及类型定义 | author by [arcsin1](https://github.com/arcsin1), [visiky](https://github.com/visiky)\nexport { Histogram } from './plots/histogram';\nexport type { HistogramOptions } from './plots/histogram';\n\n// 进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { Progress } from './plots/progress';\nexport type { ProgressOptions } from './plots/progress';\n\n// 环形进度图及类型定义 | author by [connono](https://github.com/connono)\nexport { RingProgress } from './plots/ring-progress';\nexport type { RingProgressOptions } from './plots/ring-progress';\n\n// 热力图及类型定义 | author by [jiazhewang](https://github.com/jiazhewang)\nexport { Heatmap } from './plots/heatmap';\nexport type { HeatmapOptions } from './plots/heatmap';\n\n// 箱线图及类型定义 | author by [BBSQQ](https://github.com/BBSQQ), [visiky](https://github.com/visiky)\nexport { Box } from './plots/box';\nexport type { BoxOptions } from './plots/box';\n\n// 小提琴图及类型定义 | author by [YiSiWang](https://github.com/YiSiWang), [visiky](https://github.com/visiky)\nexport { Violin } from './plots/violin';\nexport type { ViolinOptions } from './plots/violin';\n\n// 韦恩图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Venn } from './plots/venn';\nexport type { VennOptions } from './plots/venn';\n\n// K线图及类型定义 | author by [jhwong](https://github.com/jinhuiWong), [visiky](https://github.com/visiky)\nexport { Stock } from './plots/stock';\nexport type { StockOptions } from './plots/stock';\n\n// 漏斗图及类型定义\nexport { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';\nexport type { FunnelOptions } from './plots/funnel';\n\n// 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)\nexport { Liquid } from './plots/liquid';\nexport type { LiquidOptions } from './plots/liquid';\n\n// 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { Bullet } from './plots/bullet';\nexport type { BulletOptions } from './plots/bullet';\n\n// 旭日图及类型定义 | author by [lxfu1](https://github.com/lxfu1), [visiky](https://github.com/visiky)\nexport { Sunburst } from './plots/sunburst';\nexport type { SunburstOptions } from './plots/sunburst';\n\n// 仪表盘及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Gauge } from './plots/gauge';\nexport type { GaugeOptions } from './plots/gauge';\n\n// 瀑布图 | author by [visiky](https://github.com/visiky)\nexport { Waterfall } from './plots/waterfall';\nexport type { WaterfallOptions } from './plots/waterfall';\n\n// 玉珏图 | author by [yujs](https://github.com/yujs) | updated by [visiky](https://github.com/visiky)\nexport { RadialBar } from './plots/radial-bar';\nexport type { RadialBarOptions } from './plots/radial-bar';\n\n// 对称条形图及类型定义 | author by [arcsin1](https://github.com/arcsin1)\nexport { BidirectionalBar } from './plots/bidirectional-bar';\nexport type { BidirectionalBarOptions } from './plots/bidirectional-bar';\n\n// 矩形树图\nexport { Treemap } from './plots/treemap';\nexport type { TreemapOptions } from './plots/treemap';\n\n// 桑基图及类型定义 | author by [hustcc](https://github.com/hustcc)\nexport { Sankey } from './plots/sankey';\nexport type { SankeyOptions } from './plots/sankey';\n\n// 弦图及类型定义 | author by [MrSmallLiu](https://github.com/MrSmallLiu), [visiky](https://github.com/visiky)\nexport { Chord } from './plots/chord';\nexport type { ChordOptions } from './plots/chord';\n\n// circle-packing 及类型定义 | author by [visiky](https://github.com/visiky), [Angeli](https://github.com/Angelii)\nexport { CirclePacking } from './plots/circle-packing';\nexport type { CirclePackingOptions } from './plots/circle-packing';\n\n// 以下开放自定义图表开发的能力(目前仅仅是孵化中)\n/** 所有开放图表都使用 G2Plot.P 作为入口开发,理论上官方的所有图表都可以走 G2Plot.P 的入口(暂时不处理) */\nexport { P } from './plugin';\n\n/** 开放 getCanvasPatterng 方法 */\nexport { getCanvasPattern } from './utils/pattern';\n\n// 已经废弃,更名为 Mix\nexport { Mix as MultiView } from './plots/mix';\nexport type { MixOptions as MultiViewOptions } from './plots/mix';\n/** 开放多图层图表 (mix) */\nexport { Mix as Mix } from './plots/mix';\nexport type { MixOptions } from './plots/mix';\n\n// 分面图及类型定义 | author by [visiky](https://github.com/visiky)\nexport { Facet } from './plots/facet';\nexport type { FacetOptions } from './plots/facet';\n\n/** 开发 adaptor 可能会用到的方法或一些工具方法,不强制使用 */\nexport { flow, measureTextWidth } from './utils';\n\n/** 各个 geometry 的 adaptor,可以让开发者更快的构造图形 */\nexport { line, interval, area, point, polygon, schema } from './adaptor/geometries';\nexport type {\n LineGeometryOptions,\n IntervalGeometryOptions,\n AreaGeometryOptions,\n PointGeometryOptions,\n PolygonGeometryOptions,\n SchemaGeometryOptions,\n} from './adaptor/geometries';\n/** 开放一些通用的 adaptor 通道方法,实验阶段:不保证稳定性 */\nimport { scale, legend, tooltip, annotation, interaction, theme, animation } from './adaptor/common';\nexport const adaptors = { scale, legend, tooltip, annotation, interaction, theme, animation };\n\n/** 对于没有开发完成的图表,可以暂时先放到 Lab 下面,先做体验,稳定后放到根 export */\nexport { Lab } from './lab';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/area/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,OAAO,EAAE,IAAI;IACb,OAAO;IACP,IAAI,EAAE,EAAE;IACR,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/area/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,OAAO,EAAE,IAAI;IACb,OAAO;IACP,IAAI,EAAE,EAAE;IACR,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,EAAE;KACV;CACF,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 面积图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n tooltip: {\n shared: true,\n showMarkers: true,\n showCrosshairs: true,\n crosshairs: {\n type: 'x',\n },\n },\n isStack: true,\n // 默认开启\n line: {},\n legend: {\n position: 'top-left',\n radio: {},\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/bar/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,CAAC,GAAG,EAAE;IACnB,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 条形图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n barWidthRatio: 0.6,\n marginRatio: 1 / 32,\n tooltip: {\n shared: true,\n showMarkers: false,\n offset: 20,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/bar/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,CAAC,GAAG,EAAE;IACnB,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 条形图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n barWidthRatio: 0.6,\n marginRatio: 1 / 32,\n tooltip: {\n shared: true,\n showMarkers: false,\n offset: 20,\n },\n legend: {\n radio: {},\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/column/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,gBAAgB,EAAE,GAAG;IACrB,WAAW,EAAE,CAAC,GAAG,EAAE;IACnB,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 柱形图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n columnWidthRatio: 0.6,\n marginRatio: 1 / 32,\n tooltip: {\n shared: true,\n showMarkers: false,\n offset: 20,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/column/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,gBAAgB,EAAE,GAAG;IACrB,WAAW,EAAE,CAAC,GAAG,EAAE;IACnB,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 柱形图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n columnWidthRatio: 0.6,\n marginRatio: 1 / 32,\n tooltip: {\n shared: true,\n showMarkers: false,\n offset: 20,\n },\n legend: {\n radio: {},\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,a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,CAAC,CAAC,MAAG;gBACzC,KAAK,EAAE;oBACL,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,MAAM;oBAChB,UAAU,EAAE,CAAC;oBACb,SAAS,EAAE,QAAQ;oBACnB,KAAK,EAAE,qBAAqB;iBAC7B;aACF,EACD,aAAa,CACd,CAAC;SACH;QACD,oBAAoB,CAAC,KAAK,EAAE,EAAE,SAAS,wBAAO,SAAS,KAAE,OAAO,EAAE,gBAAgB,GAAE,EAAE,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;KACtG;IAED,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA4B;IACjC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAErB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,IAAI,CACT,KAAK;IACL,+CAA+C;IAC/C,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,WAAW,EACX,UAAU,EAAE,EACZ,KAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { each, isArray } from '@antv/util';
|
|
3
|
-
import { tooltip, slider, interaction, animation, theme, scale, annotation, limitInPlot } from '../../adaptor/common';
|
|
3
|
+
import { tooltip, slider, interaction, animation, theme, scale, annotation, limitInPlot, scrollbar, } from '../../adaptor/common';
|
|
4
4
|
import { findGeometry, transformLabel, deepAssign } from '../../utils';
|
|
5
5
|
import { point, line, area } from '../../adaptor/geometries';
|
|
6
6
|
import { flow } from '../../utils';
|
|
@@ -160,6 +160,6 @@ export function adjust(params) {
|
|
|
160
160
|
*/
|
|
161
161
|
export function adaptor(params) {
|
|
162
162
|
// flow 的方式处理所有的配置到 G2 API
|
|
163
|
-
return flow(geometry, meta, adjust, theme, coordinate, axis, legend, tooltip, label, slider, interaction, animation, annotation(), limitInPlot)(params);
|
|
163
|
+
return flow(geometry, meta, adjust, theme, coordinate, axis, legend, tooltip, label, slider, scrollbar, interaction, animation, annotation(), limitInPlot)(params);
|
|
164
164
|
}
|
|
165
165
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/line/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/line/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EACL,OAAO,EACP,MAAM,EACN,WAAW,EACX,SAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD;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CACT,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,KAAK,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EAAE,EACZ,WAAW,CACZ,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { each, isArray } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport {\n tooltip,\n slider,\n interaction,\n animation,\n theme,\n scale,\n annotation,\n limitInPlot,\n scrollbar,\n} from '../../adaptor/common';\nimport { findGeometry, transformLabel, deepAssign } from '../../utils';\nimport { point, line, area } from '../../adaptor/geometries';\nimport { flow } from '../../utils';\nimport { adjustYMetaByZero } from '../../utils/data';\nimport { LineOptions } from './types';\n\n/**\n * geometry 配置处理\n * @param params\n */\nfunction geometry(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { data, color, lineStyle, lineShape, point: pointMapping, area: areaMapping, seriesField } = options;\n const pointState = pointMapping?.state;\n const areaState = areaMapping?.state;\n\n chart.data(data);\n\n // line geometry 处理\n const primary = deepAssign({}, params, {\n options: {\n shapeField: seriesField,\n line: {\n color,\n style: lineStyle,\n shape: lineShape,\n },\n // 颜色保持一致,因为如果颜色不一致,会导致 tooltip 中元素重复。\n // 如果存在,才设置,否则为空\n point: pointMapping && {\n color,\n shape: 'circle',\n ...pointMapping,\n },\n // 面积配置\n area: areaMapping && {\n color,\n ...areaMapping,\n },\n // label 不传递给各个 geometry adaptor,由 label adaptor 处理\n label: undefined,\n },\n });\n const second = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });\n const areaParams = deepAssign({}, primary, { options: { tooltip: false, state: areaState } });\n\n line(primary);\n point(second);\n area(areaParams);\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nexport function meta(params: Params<LineOptions>): Params<LineOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField, data } = options;\n\n return flow(\n scale(\n {\n [xField]: xAxis,\n [yField]: yAxis,\n },\n {\n [xField]: {\n type: 'cat',\n },\n [yField]: adjustYMetaByZero(data, yField),\n }\n )\n )(params);\n}\n\n/**\n * 坐标系配置. 支持 reflect 镜像处理\n * @param params\n */\nfunction coordinate(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { reflect } = options;\n if (reflect) {\n let p = reflect as any;\n if (!isArray(p)) {\n p = [p];\n }\n const actions = p.map((d) => ['reflect', d]);\n\n chart.coordinate({ type: 'rect', actions });\n }\n\n return params;\n}\n\n/**\n * axis 配置\n * @param params\n */\nexport function axis(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n chart.axis(xField, false);\n } else {\n chart.axis(xField, xAxis);\n }\n\n if (yAxis === false) {\n chart.axis(yField, false);\n } else {\n chart.axis(yField, yAxis);\n }\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nexport function legend(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { legend, seriesField } = options;\n\n if (legend && seriesField) {\n chart.legend(seriesField, legend);\n } else if (legend === false) {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * 数据标签\n * @param params\n */\nfunction label(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { label, yField } = options;\n\n const lineGeometry = findGeometry(chart, 'line');\n\n // label 为 false, 空 则不显示 label\n if (!label) {\n lineGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n lineGeometry.label({\n fields: [yField],\n callback,\n cfg: {\n layout: [\n { type: 'limit-in-plot' },\n { type: 'path-adjust-position' },\n { type: 'point-adjust-position' },\n { type: 'limit-in-plot', cfg: { action: 'hide' } },\n ],\n ...transformLabel(cfg),\n },\n });\n }\n\n return params;\n}\n\n/**\n * 统一处理 adjust\n * @param params\n */\nexport function adjust(params: Params<Pick<LineOptions, 'isStack'>>): Params<any> {\n const { chart, options } = params;\n const { isStack } = options;\n\n if (isStack) {\n each(chart.geometries, (g: Geometry) => {\n g.adjust('stack');\n });\n }\n\n return params;\n}\n\n/**\n * 折线图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LineOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n geometry,\n meta,\n adjust,\n theme,\n coordinate,\n axis,\n legend,\n tooltip,\n label,\n slider,\n scrollbar,\n interaction,\n animation,\n annotation(),\n limitInPlot\n )(params);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,EAAE;KACV;IACD,OAAO,EAAE,KAAK;CACf,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 折线图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n tooltip: {\n shared: true,\n showMarkers: true,\n showCrosshairs: true,\n crosshairs: {\n type: 'x',\n },\n },\n legend: {\n position: 'top-left',\n radio: {},\n },\n isStack: false,\n});\n"]}
|
|
@@ -10,7 +10,7 @@ import { getLiquidData } from './utils';
|
|
|
10
10
|
*/
|
|
11
11
|
function geometry(params) {
|
|
12
12
|
var chart = params.chart, options = params.options;
|
|
13
|
-
var percent = options.percent, liquidStyle = options.liquidStyle, radius = options.radius, outline = options.outline, wave = options.wave, shape = options.shape;
|
|
13
|
+
var percent = options.percent, liquidStyle = options.liquidStyle, radius = options.radius, outline = options.outline, wave = options.wave, shape = options.shape, animation = options.animation;
|
|
14
14
|
chart.scale({
|
|
15
15
|
percent: {
|
|
16
16
|
min: 0,
|
|
@@ -42,6 +42,7 @@ function geometry(params) {
|
|
|
42
42
|
wave: wave,
|
|
43
43
|
shape: shape,
|
|
44
44
|
background: background,
|
|
45
|
+
animation: animation,
|
|
45
46
|
};
|
|
46
47
|
// 将 radius 传入到自定义 shape 中
|
|
47
48
|
geometry.customInfo(customInfo);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/liquid/adaptor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eA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AAC,YAAY,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9C,IAAM,aAAa,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAG,CAAC,CAAC,GAAG,GAAG,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 { interaction, animation, theme, scale, pattern } from '../../adaptor/common';\nimport { Params } from '../../core/adaptor';\nimport { flow, deepAssign, renderStatistic } from '../../utils';\nimport { interval } from '../../adaptor/geometries';\nimport { LiquidOptions, CustomInfo } 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, 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 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"]}
|
|
@@ -178,7 +178,7 @@ function getWaterWavePath(radius, waterLevel, waveLength, phase, amplitude, cx,
|
|
|
178
178
|
* @param radius 绘制图形的高度
|
|
179
179
|
* @param waveLength 波的长度
|
|
180
180
|
*/
|
|
181
|
-
function addWaterWave(x, y, level, waveCount, waveAttrs, group, clip, radius, waveLength) {
|
|
181
|
+
function addWaterWave(x, y, level, waveCount, waveAttrs, group, clip, radius, waveLength, animation) {
|
|
182
182
|
var fill = waveAttrs.fill, opacity = waveAttrs.opacity;
|
|
183
183
|
var bbox = clip.getBBox();
|
|
184
184
|
var width = bbox.maxX - bbox.minX;
|
|
@@ -195,6 +195,8 @@ function addWaterWave(x, y, level, waveCount, waveAttrs, group, clip, radius, wa
|
|
|
195
195
|
},
|
|
196
196
|
});
|
|
197
197
|
try {
|
|
198
|
+
if (animation === false)
|
|
199
|
+
return;
|
|
198
200
|
var matrix = transform([['t', waveLength, 0]]);
|
|
199
201
|
wave.stopAnimate();
|
|
200
202
|
wave.animate({ matrix: matrix }, {
|
|
@@ -287,7 +289,7 @@ registerShape('interval', 'liquid-fill-gauge', {
|
|
|
287
289
|
var cx = 0.5;
|
|
288
290
|
var cy = 0.5;
|
|
289
291
|
var customInfo = cfg.customInfo;
|
|
290
|
-
var _a = customInfo, radio = _a.radius, shape = _a.shape, background = _a.background;
|
|
292
|
+
var _a = customInfo, radio = _a.radius, shape = _a.shape, background = _a.background, animation = _a.animation;
|
|
291
293
|
var outline = customInfo.outline;
|
|
292
294
|
var wave = customInfo.wave;
|
|
293
295
|
var border = outline.border, distance = outline.distance;
|
|
@@ -325,7 +327,7 @@ registerShape('interval', 'liquid-fill-gauge', {
|
|
|
325
327
|
},
|
|
326
328
|
});
|
|
327
329
|
// 4. 绘制波形
|
|
328
|
-
addWaterWave(center.x, center.y, 1 - cfg.points[1].y, waveCount, waveAttrs, waves, clipPath, radius * 2, waveLength);
|
|
330
|
+
addWaterWave(center.x, center.y, 1 - cfg.points[1].y, waveCount, waveAttrs, waves, clipPath, radius * 2, waveLength, animation);
|
|
329
331
|
// 2. 绘制一个 distance 宽的 border
|
|
330
332
|
container.addShape('path', {
|
|
331
333
|
name: 'distance',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../../src/plots/liquid/shapes/liquid.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,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;QACZ,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;KACb,CAAC;IACF,IAAM,KAAK,GAAG,GAAG,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE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AAC,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 { registerShape } from '@antv/g2';\nimport { IGroup, IShape } from '@antv/g-base';\nimport { reduce, isNumber, mix } from '@antv/util';\nimport { transform } from '../../../utils/matrix';\nimport { Point, ShapeStyle } from '../../../types';\nimport { LiquidOptions, CustomInfo } 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 */\nfunction 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) {\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 for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 0 : idx / (waveCount - 1);\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\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 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\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, background } = 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 const builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\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. 绘制一个波\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 );\n\n // 2. 绘制一个 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 // 3. 绘制一个 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":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,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;QACZ,WAAW,EAAE,CAAC;QACd,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AU;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 { registerShape } from '@antv/g2';\nimport { IGroup, IShape } from '@antv/g-base';\nimport { reduce, isNumber, mix } from '@antv/util';\nimport { transform } from '../../../utils/matrix';\nimport { Point, ShapeStyle } from '../../../types';\nimport { LiquidOptions, CustomInfo } 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 */\nfunction 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 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 for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 0 : idx / (waveCount - 1);\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\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 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\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, 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 const builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\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. 绘制一个波\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 // 2. 绘制一个 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 // 3. 绘制一个 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/liquid/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PathCommand } from '@antv/g-base';\nimport { Options, StyleAttr, ColorAttr, Statistic, ShapeStyle } from '../../types';\n\n/** 轮廓的配置 */\ntype Outline = Partial<{\n /** 外环的宽度,默认为 2px */\n readonly border: number;\n /** 内外的边距,默认为 0px */\n readonly distance: number;\n /** 外环的样式 */\n readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;\n // /** 外边框的形状,可以有 circle,rect,默认为 circle */\n // readonly containerShape?: 'circle' | 'rect';\n}>;\n\ntype Wave = Partial<{\n /** 波形的数量,默认为 3 */\n readonly count: number;\n /** 波形的长度,默认是 192 */\n readonly length: number;\n}>;\n\ntype ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];\n\n/** 配置类型定义 */\nexport interface LiquidOptions extends Omit<Options, 'data'> {\n /** 指标比例 */\n readonly percent: number;\n /** 配置水波图的颜色,使用默认色板的颜色 */\n readonly color?: ColorAttr;\n /** 水波的外半径, 0 ~ 1,默认为 0.9 */\n readonly radius?: number;\n /** 配置水波图的样式 */\n readonly liquidStyle?: StyleAttr;\n /** 指标文本组件 */\n readonly statistic?: Statistic;\n /** 外环轮廓的配置 */\n readonly outline?: Outline;\n /** 波的配置 */\n readonly wave?: Wave;\n /** 波的形状配置('circle' | 'rect' | 'triangle' | 'diamond')*/\n readonly shape?: string | ShapeCallback;\n}\n\n/** 水波图自定义 的 customInfo */\nexport type CustomInfo = {\n radius?: LiquidOptions['radius'];\n outline?: LiquidOptions['outline'];\n wave?: LiquidOptions['wave'];\n shape?: LiquidOptions['shape'];\n background?: string;\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 { Options, StyleAttr, ColorAttr, Statistic, ShapeStyle } from '../../types';\n\n/** 轮廓的配置 */\ntype Outline = Partial<{\n /** 外环的宽度,默认为 2px */\n readonly border: number;\n /** 内外的边距,默认为 0px */\n readonly distance: number;\n /** 外环的样式 */\n readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;\n // /** 外边框的形状,可以有 circle,rect,默认为 circle */\n // readonly containerShape?: 'circle' | 'rect';\n}>;\n\ntype Wave = Partial<{\n /** 波形的数量,默认为 3 */\n readonly count: number;\n /** 波形的长度,默认是 192 */\n readonly length: number;\n}>;\n\ntype ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];\n\n/** 配置类型定义 */\nexport interface LiquidOptions extends Omit<Options, 'data'> {\n /** 指标比例 */\n readonly percent: number;\n /** 配置水波图的颜色,使用默认色板的颜色 */\n readonly color?: ColorAttr;\n /** 水波的外半径, 0 ~ 1,默认为 0.9 */\n readonly radius?: number;\n /** 配置水波图的样式 */\n readonly liquidStyle?: StyleAttr;\n /** 指标文本组件 */\n readonly statistic?: Statistic;\n /** 外环轮廓的配置 */\n readonly outline?: Outline;\n /** 波的配置 */\n readonly wave?: Wave;\n /** 波的形状配置('circle' | 'rect' | 'triangle' | 'diamond')*/\n readonly shape?: string | ShapeCallback;\n}\n\n/** 水波图自定义 的 customInfo */\nexport type CustomInfo = {\n radius?: LiquidOptions['radius'];\n outline?: LiquidOptions['outline'];\n wave?: LiquidOptions['wave'];\n shape?: LiquidOptions['shape'];\n background?: string;\n animation?: LiquidOptions['animation'];\n};\n"]}
|
package/esm/plots/pie/adaptor.js
CHANGED