@antv/g2plot 2.3.39 → 2.3.40
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 +16 -0
- package/dist/g2plot.min.js +17 -2
- package/dist/g2plot.min.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/sankey/helper.js +16 -2
- package/esm/plots/sankey/helper.js.map +1 -1
- package/esm/plots/sankey/types.d.ts +51 -8
- package/esm/plots/sankey/types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/sankey/helper.js +16 -2
- package/lib/plots/sankey/helper.js.map +1 -1
- package/lib/plots/sankey/types.d.ts +51 -8
- package/lib/plots/sankey/types.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/plots/sankey/helper.ts +26 -9
- package/src/plots/sankey/types.ts +52 -8
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,CAAC;AAEd,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE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AO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,eAAe;AACf,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAE/C,oBAAoB;AACpB,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAGzC,2DAA2D;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,uCAAuC;AACvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjD,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AASpF,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrG,MAAM,CAAC,IAAM,QAAQ,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.3.39';\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,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,CAAC;AAEd,QAAQ;AACR,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,8BAA8B;AAC9B,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACtC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,WAAW;AACX,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,aA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C,oBAAoB;AACpB,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAGzC,2DAA2D;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,uCAAuC;AACvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjD,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AASpF,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrG,MAAM,CAAC,IAAM,QAAQ,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export const version = '2.3.40';\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"]}
|
|
@@ -3,6 +3,14 @@ import { isRealNumber, pick } from '../../utils';
|
|
|
3
3
|
import { transformDataToNodeLinkData } from '../../utils/data';
|
|
4
4
|
import { sankeyLayout } from './layout';
|
|
5
5
|
import { cutoffCircle } from './circle';
|
|
6
|
+
/**
|
|
7
|
+
* 是否是 node-link 类型的数据结构
|
|
8
|
+
* @param dataTyp
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function isNodeLink(dataType) {
|
|
12
|
+
return dataType === 'node-link';
|
|
13
|
+
}
|
|
6
14
|
export function getNodeWidthRatio(nodeWidth, nodeWidthRatio, width) {
|
|
7
15
|
return isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;
|
|
8
16
|
}
|
|
@@ -16,8 +24,14 @@ export function getNodePaddingRatio(nodePadding, nodePaddingRatio, height) {
|
|
|
16
24
|
* @param height
|
|
17
25
|
*/
|
|
18
26
|
export function transformToViewsData(options, width, height) {
|
|
19
|
-
var data = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodeAlign = options.nodeAlign, nodeSort = options.nodeSort, nodePadding = options.nodePadding, nodePaddingRatio = options.nodePaddingRatio, nodeWidth = options.nodeWidth, nodeWidthRatio = options.nodeWidthRatio, nodeDepth = options.nodeDepth, _a = options.rawFields, rawFields = _a === void 0 ? [] : _a;
|
|
20
|
-
var sankeyLayoutInputData
|
|
27
|
+
var dataType = options.dataType, data = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodeAlign = options.nodeAlign, nodeSort = options.nodeSort, nodePadding = options.nodePadding, nodePaddingRatio = options.nodePaddingRatio, nodeWidth = options.nodeWidth, nodeWidthRatio = options.nodeWidthRatio, nodeDepth = options.nodeDepth, _a = options.rawFields, rawFields = _a === void 0 ? [] : _a;
|
|
28
|
+
var sankeyLayoutInputData;
|
|
29
|
+
if (!isNodeLink(dataType)) {
|
|
30
|
+
sankeyLayoutInputData = transformDataToNodeLinkData(cutoffCircle(data, sourceField, targetField), sourceField, targetField, weightField, rawFields);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
sankeyLayoutInputData = data;
|
|
34
|
+
}
|
|
21
35
|
// 3. layout 之后的数据
|
|
22
36
|
var _b = sankeyLayout({
|
|
23
37
|
nodeAlign: nodeAlign,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAyB,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC;;;;GAIG;AACH,SAAS,UAAU,CAAC,QAAgB;IAClC,OAAO,QAAQ,KAAK,W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AAC,WAAW,EAAE,gBAAgB,EAAE,MAAM,CAAC;QACvE,SAAS,EAAE,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC;QAC9D,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,EACD,qBAA8C,CAC/C,EATO,KAAK,WAAA,EAAE,KAAK,WASnB,CAAC;IAEF,YAAY;IACZ,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;YACpB,6BACK,IAAI,CAAC,IAAI,kBAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAK,SAAS,EAAE,KAC/C,MAAM,EAAE,IAAI,IACZ;QACJ,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;YACpB,2BACE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EACxB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IACvC,IAAI,CAAC,IAAI,kBAAG,GAAG,EAAE,GAAG,EAAE,OAAO,GAAK,SAAS,EAAE,KAChD,MAAM,EAAE,KAAK,IACb;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import { isRealNumber, pick } from '../../utils';\nimport { transformDataToNodeLinkData } from '../../utils/data';\nimport { Data } from '../../types';\nimport { sankeyLayout, SankeyLayoutInputData } from './layout';\nimport { cutoffCircle } from './circle';\nimport { SankeyOptions } from './types';\n\n/**\n * 是否是 node-link 类型的数据结构\n * @param dataTyp\n * @returns\n */\nfunction isNodeLink(dataType: string) {\n return dataType === 'node-link';\n}\n\nexport function getNodeWidthRatio(nodeWidth: number, nodeWidthRatio: number, width: number) {\n return isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;\n}\n\nexport function getNodePaddingRatio(nodePadding: number, nodePaddingRatio: number, height: number) {\n return isRealNumber(nodePadding) ? nodePadding / height : nodePaddingRatio;\n}\n\n/**\n * 将桑基图配置经过 layout,生成最终的 view 数据\n * @param options\n * @param width\n * @param height\n */\nexport function transformToViewsData(options: SankeyOptions, width: number, height: number) {\n const {\n dataType,\n data,\n sourceField,\n targetField,\n weightField,\n nodeAlign,\n nodeSort,\n nodePadding,\n nodePaddingRatio,\n nodeWidth,\n nodeWidthRatio,\n nodeDepth,\n rawFields = [],\n } = options;\n\n let sankeyLayoutInputData: unknown;\n\n if (!isNodeLink(dataType)) {\n sankeyLayoutInputData = transformDataToNodeLinkData(\n cutoffCircle(data as Data, sourceField, targetField),\n sourceField,\n targetField,\n weightField,\n rawFields\n );\n } else {\n sankeyLayoutInputData = data;\n }\n\n // 3. layout 之后的数据\n const { nodes, links } = sankeyLayout(\n {\n nodeAlign,\n nodePadding: getNodePaddingRatio(nodePadding, nodePaddingRatio, height),\n nodeWidth: getNodeWidthRatio(nodeWidth, nodeWidthRatio, width),\n nodeSort,\n nodeDepth,\n },\n sankeyLayoutInputData as SankeyLayoutInputData\n );\n\n // 4. 生成绘图数据\n return {\n nodes: nodes.map((node) => {\n return {\n ...pick(node, ['x', 'y', 'name', ...rawFields]),\n isNode: true,\n };\n }),\n edges: links.map((link) => {\n return {\n source: link.source.name,\n target: link.target.name,\n name: link.source.name || link.target.name,\n ...pick(link, ['x', 'y', 'value', ...rawFields]),\n isNode: false,\n };\n }),\n };\n}\n"]}
|
|
@@ -1,19 +1,62 @@
|
|
|
1
1
|
import { Data, Options, State, StyleAttr } from '../../types';
|
|
2
2
|
import { NodeDepth, NodeSort } from './layout';
|
|
3
|
+
/**
|
|
4
|
+
* node-link 数据类型的结构
|
|
5
|
+
*/
|
|
6
|
+
export declare type NodeLinkData = {
|
|
7
|
+
/**
|
|
8
|
+
* 节点数据
|
|
9
|
+
*/
|
|
10
|
+
readonly nodes: {
|
|
11
|
+
/**
|
|
12
|
+
* id 唯一即可,一般可以直接等于 name
|
|
13
|
+
*/
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/**
|
|
16
|
+
* 节点的名称,用于 UI 上的现实
|
|
17
|
+
*/
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/**
|
|
20
|
+
* 节点的值,不传则节点大小有来源求和决定
|
|
21
|
+
*/
|
|
22
|
+
readonly fixedValue?: number;
|
|
23
|
+
}[];
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
readonly links: {
|
|
28
|
+
/**
|
|
29
|
+
* 来源节点在 nodes 中的 index
|
|
30
|
+
*/
|
|
31
|
+
readonly source: number;
|
|
32
|
+
/**
|
|
33
|
+
* 目标节点在 nodes 中的 index
|
|
34
|
+
*/
|
|
35
|
+
readonly target: number;
|
|
36
|
+
/**
|
|
37
|
+
* 边的值
|
|
38
|
+
*/
|
|
39
|
+
readonly value: number;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
3
42
|
/** 配置类型定义 */
|
|
4
|
-
export interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxis' | 'yAxis'> {
|
|
43
|
+
export interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {
|
|
5
44
|
/**
|
|
6
|
-
*
|
|
45
|
+
* 数据集的类型,默认为 detail
|
|
7
46
|
*/
|
|
8
|
-
readonly
|
|
47
|
+
readonly dataType?: 'node-link' | 'detail';
|
|
9
48
|
/**
|
|
10
|
-
*
|
|
49
|
+
* 来源字段,dataType = 'node-link' 的时候,不用传
|
|
11
50
|
*/
|
|
12
|
-
readonly
|
|
51
|
+
readonly sourceField?: string;
|
|
13
52
|
/**
|
|
14
|
-
*
|
|
53
|
+
* 去向字段,dataType = 'node-link' 的时候,不用传
|
|
15
54
|
*/
|
|
16
|
-
readonly
|
|
55
|
+
readonly targetField?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 权重字段,dataType = 'node-link' 的时候,不用传
|
|
58
|
+
*/
|
|
59
|
+
readonly weightField?: string;
|
|
17
60
|
/**
|
|
18
61
|
* 附加的 元字段
|
|
19
62
|
*/
|
|
@@ -21,7 +64,7 @@ export interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxi
|
|
|
21
64
|
/**
|
|
22
65
|
* 数据
|
|
23
66
|
*/
|
|
24
|
-
readonly data: Data;
|
|
67
|
+
readonly data: Data | NodeLinkData;
|
|
25
68
|
/**
|
|
26
69
|
* 节点宽度的比如,参考画布的宽度,默认值为 0.008
|
|
27
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/** 配置类型定义 */\nexport interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxis' | 'yAxis'> {\n /**\n *
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/**\n * node-link 数据类型的结构\n */\nexport type NodeLinkData = {\n /**\n * 节点数据\n */\n readonly nodes: {\n /**\n * id 唯一即可,一般可以直接等于 name\n */\n readonly id: string;\n /**\n * 节点的名称,用于 UI 上的现实\n */\n readonly name: string;\n /**\n * 节点的值,不传则节点大小有来源求和决定\n */\n readonly fixedValue?: number;\n }[];\n /**\n *\n */\n readonly links: {\n /**\n * 来源节点在 nodes 中的 index\n */\n readonly source: number;\n /**\n * 目标节点在 nodes 中的 index\n */\n readonly target: number;\n /**\n * 边的值\n */\n readonly value: number;\n }[];\n};\n\n/** 配置类型定义 */\nexport interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {\n /**\n * 数据集的类型,默认为 detail\n */\n readonly dataType?: 'node-link' | 'detail';\n /**\n * 来源字段,dataType = 'node-link' 的时候,不用传\n */\n readonly sourceField?: string;\n /**\n * 去向字段,dataType = 'node-link' 的时候,不用传\n */\n readonly targetField?: string;\n /**\n * 权重字段,dataType = 'node-link' 的时候,不用传\n */\n readonly weightField?: string;\n /**\n * 附加的 元字段\n */\n readonly rawFields?: string[];\n /**\n * 数据\n */\n readonly data: Data | NodeLinkData;\n /**\n * 节点宽度的比如,参考画布的宽度,默认值为 0.008\n */\n readonly nodeWidthRatio?: number;\n /**\n * 节点宽度的像素设置,优先级高于 nodeWidthRatio\n */\n readonly nodeWidth?: number;\n /**\n * 节点之间的间距比例,参考画布高度,默认值为 0.03\n */\n readonly nodePaddingRatio?: number;\n /**\n * 节点间距的像素设置,优先级高于 nodePaddingRatio\n */\n readonly nodePadding?: number;\n /**\n * 节点对齐的方式,默认为 justify\n */\n readonly nodeAlign?: 'left' | 'right' | 'center' | 'justify';\n /**\n * 节点排序方式,默认为空\n */\n readonly nodeSort?: NodeSort;\n /**\n * 节点排放分层的顺序,从 0 开始,并且返回值需要保证所有的层级都有节点\n */\n readonly nodeDepth?: NodeDepth;\n /**\n * 节点样式\n */\n readonly nodeStyle?: StyleAttr;\n /**\n * 节点状态样式\n */\n readonly nodeState?: State;\n /**\n * 边样式\n */\n readonly edgeStyle?: StyleAttr;\n /**\n * 边状态样式\n */\n readonly edgeState?: State;\n /**\n * 节点位置是否可以拖拽,默认为 false\n */\n readonly nodeDraggable?: boolean;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
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.3.
|
|
5
|
+
exports.version = '2.3.40';
|
|
6
6
|
// G2 自定义能力透出
|
|
7
7
|
var G2 = tslib_1.__importStar(require("@antv/g2"));
|
|
8
8
|
exports.G2 =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6B;AAApB,2FAAA,CAAC,OAAA;AAEV,8BAA8B;AAC9B,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AAEzB,eAAe;AACf,mCAA+C;AAAtC,gGAAA,GAAG,OAAa;AAEzB,oBAAoB;AACpB,mCAAyC;AAAhC,0FAAA,GAAG,OAAO;AAGnB,2DAA2D;AAC3D,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAGd,uCAAuC;AACvC,iCAAiD;AAAxC,6FAAA,IAAI,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAE/B,0CAA0C;AAC1C,mDAAoF;AAA3E,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,qGAAA,OAAO,OAAA;AAAE,oGAAA,MAAM,OAAA;AASrD,uCAAuC;AACvC,2CAAqG;AACxF,QAAA,QAAQ,GAAG,EAAE,KAAK,gBAAA,EAAE,MAAM,iBAAA,EAAE,OAAO,kBAAA,EAAE,UAAU,qBAAA,EAAE,WAAW,sBAAA,EAAE,KAAK,gBAAA,EAAE,SAAS,oBAAA,EAAE,CAAC;AAE9F,oDAAoD;AACpD,6BAA4B;AAAnB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.3.39';\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,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,aAAa;AACb,mDAA+B;AACtB,gBAAE;AAEX,QAAQ;AACR,wCAA+C;AAOtC,+FAPA,uBAAc,OAOA;AANvB,yCAA+C;AAC/C,yCAA+C;AAC/C,8BAA8B;AAC9B,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AACtC,uBAAc,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;AAItC,WAAW;AACX,wCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAElB,uBAAuB;AACvB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAKb,SAAS;AACT,kDAAwB;AAExB,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,2DAA2D;AAC3D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AAGb,uDAAuD;AACvD,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAGf,yDAAyD;AACzD,mCAAkC;AAAzB,0FAAA,GAAG,OAAA;AAG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nB,0FAAA,GAAG,OAAA","sourcesContent":["export const version = '2.3.40';\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"]}
|
|
@@ -6,6 +6,14 @@ var utils_1 = require("../../utils");
|
|
|
6
6
|
var data_1 = require("../../utils/data");
|
|
7
7
|
var layout_1 = require("./layout");
|
|
8
8
|
var circle_1 = require("./circle");
|
|
9
|
+
/**
|
|
10
|
+
* 是否是 node-link 类型的数据结构
|
|
11
|
+
* @param dataTyp
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function isNodeLink(dataType) {
|
|
15
|
+
return dataType === 'node-link';
|
|
16
|
+
}
|
|
9
17
|
function getNodeWidthRatio(nodeWidth, nodeWidthRatio, width) {
|
|
10
18
|
return utils_1.isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;
|
|
11
19
|
}
|
|
@@ -21,8 +29,14 @@ exports.getNodePaddingRatio = getNodePaddingRatio;
|
|
|
21
29
|
* @param height
|
|
22
30
|
*/
|
|
23
31
|
function transformToViewsData(options, width, height) {
|
|
24
|
-
var data = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodeAlign = options.nodeAlign, nodeSort = options.nodeSort, nodePadding = options.nodePadding, nodePaddingRatio = options.nodePaddingRatio, nodeWidth = options.nodeWidth, nodeWidthRatio = options.nodeWidthRatio, nodeDepth = options.nodeDepth, _a = options.rawFields, rawFields = _a === void 0 ? [] : _a;
|
|
25
|
-
var sankeyLayoutInputData
|
|
32
|
+
var dataType = options.dataType, data = options.data, sourceField = options.sourceField, targetField = options.targetField, weightField = options.weightField, nodeAlign = options.nodeAlign, nodeSort = options.nodeSort, nodePadding = options.nodePadding, nodePaddingRatio = options.nodePaddingRatio, nodeWidth = options.nodeWidth, nodeWidthRatio = options.nodeWidthRatio, nodeDepth = options.nodeDepth, _a = options.rawFields, rawFields = _a === void 0 ? [] : _a;
|
|
33
|
+
var sankeyLayoutInputData;
|
|
34
|
+
if (!isNodeLink(dataType)) {
|
|
35
|
+
sankeyLayoutInputData = data_1.transformDataToNodeLinkData(circle_1.cutoffCircle(data, sourceField, targetField), sourceField, targetField, weightField, rawFields);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
sankeyLayoutInputData = data;
|
|
39
|
+
}
|
|
26
40
|
// 3. layout 之后的数据
|
|
27
41
|
var _b = layout_1.sankeyLayout({
|
|
28
42
|
nodeAlign: nodeAlign,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";;;;AAAA,qCAAiD;AACjD,yCAA+D;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";;;;AAAA,qCAAiD;AACjD,yCAA+D;AAE/D,mCAA+D;AAC/D,mCAAwC;AAGxC;;;;GAIG;AACH,SAAS,UAAU,CAAC,QAAgB;IAClC,OAAO,QAAQ,KAAK,WAAW,CAAC;AAClC,CAAC;AAED,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,cAAsB,EAAE,KAAa;IACxF,OAAO,oBAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC;AACtE,CAAC;AAFD,8CAEC;AAED,SAAgB,mBAAmB,CAAC,WAAmB,EAAE,gBAAwB,EAAE,MAAc;IAC/F,OAAO,oBAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC7E,CAAC;AAFD,kDAEC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,OAAsB,EAAE,KAAa,EAAE,MAAc;IAEtF,IAAA,QAAQ,GAaN,OAAO,SAbD,EACR,IAAI,GAYF,OAAO,KAZL,EACJ,WAAW,GAWT,OAAO,YAXE,EACX,WAAW,GAUT,OAAO,YAVE,EACX,WAAW,GAST,OAAO,YATE,EACX,SAAS,GAQP,OAAO,UARA,EACT,QAAQ,GAON,OAAO,SAPD,EACR,WAAW,GAMT,OAAO,YANE,EACX,gBAAgB,GAKd,OAAO,iBALO,EAChB,SAAS,GAIP,OAAO,UAJA,EACT,cAAc,GAGZ,OAAO,eAHK,EACd,SAAS,GAEP,OAAO,UAFA,EACT,KACE,OAAO,UADK,EAAd,SAAS,mBAAG,EAAE,KAAA,CACJ;IAEZ,IAAI,qBAA8B,CAAC;IAEnC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACzB,qBAAqB,GAAG,kCAA2B,CACjD,qBAAY,CAAC,IAAY,EAAE,WAAW,EAAE,WAAW,CAAC,EACpD,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,CACV,CAAC;KACH;SAAM;QACL,qBAAqB,GAAG,IAAI,CAAC;KAC9B;IAED,kBAAkB;IACZ,IAAA,KAAmB,qBAAY,CACnC;QACE,SAAS,WAAA;QACT,WAAW,EAAE,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,EAAE,MAAM,CAAC;QACvE,SAAS,EAAE,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC;QAC9D,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,EACD,qBAA8C,CAC/C,EATO,KAAK,WAAA,EAAE,KAAK,WASnB,CAAC;IAEF,YAAY;IACZ,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;YACpB,6CACK,YAAI,CAAC,IAAI,0BAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAK,SAAS,EAAE,KAC/C,MAAM,EAAE,IAAI,IACZ;QACJ,CAAC,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;YACpB,2CACE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EACxB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IACvC,YAAI,CAAC,IAAI,0BAAG,GAAG,EAAE,GAAG,EAAE,OAAO,GAAK,SAAS,EAAE,KAChD,MAAM,EAAE,KAAK,IACb;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AA7DD,oDA6DC","sourcesContent":["import { isRealNumber, pick } from '../../utils';\nimport { transformDataToNodeLinkData } from '../../utils/data';\nimport { Data } from '../../types';\nimport { sankeyLayout, SankeyLayoutInputData } from './layout';\nimport { cutoffCircle } from './circle';\nimport { SankeyOptions } from './types';\n\n/**\n * 是否是 node-link 类型的数据结构\n * @param dataTyp\n * @returns\n */\nfunction isNodeLink(dataType: string) {\n return dataType === 'node-link';\n}\n\nexport function getNodeWidthRatio(nodeWidth: number, nodeWidthRatio: number, width: number) {\n return isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;\n}\n\nexport function getNodePaddingRatio(nodePadding: number, nodePaddingRatio: number, height: number) {\n return isRealNumber(nodePadding) ? nodePadding / height : nodePaddingRatio;\n}\n\n/**\n * 将桑基图配置经过 layout,生成最终的 view 数据\n * @param options\n * @param width\n * @param height\n */\nexport function transformToViewsData(options: SankeyOptions, width: number, height: number) {\n const {\n dataType,\n data,\n sourceField,\n targetField,\n weightField,\n nodeAlign,\n nodeSort,\n nodePadding,\n nodePaddingRatio,\n nodeWidth,\n nodeWidthRatio,\n nodeDepth,\n rawFields = [],\n } = options;\n\n let sankeyLayoutInputData: unknown;\n\n if (!isNodeLink(dataType)) {\n sankeyLayoutInputData = transformDataToNodeLinkData(\n cutoffCircle(data as Data, sourceField, targetField),\n sourceField,\n targetField,\n weightField,\n rawFields\n );\n } else {\n sankeyLayoutInputData = data;\n }\n\n // 3. layout 之后的数据\n const { nodes, links } = sankeyLayout(\n {\n nodeAlign,\n nodePadding: getNodePaddingRatio(nodePadding, nodePaddingRatio, height),\n nodeWidth: getNodeWidthRatio(nodeWidth, nodeWidthRatio, width),\n nodeSort,\n nodeDepth,\n },\n sankeyLayoutInputData as SankeyLayoutInputData\n );\n\n // 4. 生成绘图数据\n return {\n nodes: nodes.map((node) => {\n return {\n ...pick(node, ['x', 'y', 'name', ...rawFields]),\n isNode: true,\n };\n }),\n edges: links.map((link) => {\n return {\n source: link.source.name,\n target: link.target.name,\n name: link.source.name || link.target.name,\n ...pick(link, ['x', 'y', 'value', ...rawFields]),\n isNode: false,\n };\n }),\n };\n}\n"]}
|
|
@@ -1,19 +1,62 @@
|
|
|
1
1
|
import { Data, Options, State, StyleAttr } from '../../types';
|
|
2
2
|
import { NodeDepth, NodeSort } from './layout';
|
|
3
|
+
/**
|
|
4
|
+
* node-link 数据类型的结构
|
|
5
|
+
*/
|
|
6
|
+
export declare type NodeLinkData = {
|
|
7
|
+
/**
|
|
8
|
+
* 节点数据
|
|
9
|
+
*/
|
|
10
|
+
readonly nodes: {
|
|
11
|
+
/**
|
|
12
|
+
* id 唯一即可,一般可以直接等于 name
|
|
13
|
+
*/
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/**
|
|
16
|
+
* 节点的名称,用于 UI 上的现实
|
|
17
|
+
*/
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/**
|
|
20
|
+
* 节点的值,不传则节点大小有来源求和决定
|
|
21
|
+
*/
|
|
22
|
+
readonly fixedValue?: number;
|
|
23
|
+
}[];
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
readonly links: {
|
|
28
|
+
/**
|
|
29
|
+
* 来源节点在 nodes 中的 index
|
|
30
|
+
*/
|
|
31
|
+
readonly source: number;
|
|
32
|
+
/**
|
|
33
|
+
* 目标节点在 nodes 中的 index
|
|
34
|
+
*/
|
|
35
|
+
readonly target: number;
|
|
36
|
+
/**
|
|
37
|
+
* 边的值
|
|
38
|
+
*/
|
|
39
|
+
readonly value: number;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
3
42
|
/** 配置类型定义 */
|
|
4
|
-
export interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxis' | 'yAxis'> {
|
|
43
|
+
export interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {
|
|
5
44
|
/**
|
|
6
|
-
*
|
|
45
|
+
* 数据集的类型,默认为 detail
|
|
7
46
|
*/
|
|
8
|
-
readonly
|
|
47
|
+
readonly dataType?: 'node-link' | 'detail';
|
|
9
48
|
/**
|
|
10
|
-
*
|
|
49
|
+
* 来源字段,dataType = 'node-link' 的时候,不用传
|
|
11
50
|
*/
|
|
12
|
-
readonly
|
|
51
|
+
readonly sourceField?: string;
|
|
13
52
|
/**
|
|
14
|
-
*
|
|
53
|
+
* 去向字段,dataType = 'node-link' 的时候,不用传
|
|
15
54
|
*/
|
|
16
|
-
readonly
|
|
55
|
+
readonly targetField?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 权重字段,dataType = 'node-link' 的时候,不用传
|
|
58
|
+
*/
|
|
59
|
+
readonly weightField?: string;
|
|
17
60
|
/**
|
|
18
61
|
* 附加的 元字段
|
|
19
62
|
*/
|
|
@@ -21,7 +64,7 @@ export interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxi
|
|
|
21
64
|
/**
|
|
22
65
|
* 数据
|
|
23
66
|
*/
|
|
24
|
-
readonly data: Data;
|
|
67
|
+
readonly data: Data | NodeLinkData;
|
|
25
68
|
/**
|
|
26
69
|
* 节点宽度的比如,参考画布的宽度,默认值为 0.008
|
|
27
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/** 配置类型定义 */\nexport interface SankeyOptions extends Omit<Options, 'xField' | 'yField' | 'xAxis' | 'yAxis'> {\n /**\n *
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/sankey/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Data, Options, State, StyleAttr } from '../../types';\nimport { NodeDepth, NodeSort } from './layout';\n\n/**\n * node-link 数据类型的结构\n */\nexport type NodeLinkData = {\n /**\n * 节点数据\n */\n readonly nodes: {\n /**\n * id 唯一即可,一般可以直接等于 name\n */\n readonly id: string;\n /**\n * 节点的名称,用于 UI 上的现实\n */\n readonly name: string;\n /**\n * 节点的值,不传则节点大小有来源求和决定\n */\n readonly fixedValue?: number;\n }[];\n /**\n *\n */\n readonly links: {\n /**\n * 来源节点在 nodes 中的 index\n */\n readonly source: number;\n /**\n * 目标节点在 nodes 中的 index\n */\n readonly target: number;\n /**\n * 边的值\n */\n readonly value: number;\n }[];\n};\n\n/** 配置类型定义 */\nexport interface SankeyOptions extends Omit<Options, 'data' | 'xField' | 'yField' | 'xAxis' | 'yAxis'> {\n /**\n * 数据集的类型,默认为 detail\n */\n readonly dataType?: 'node-link' | 'detail';\n /**\n * 来源字段,dataType = 'node-link' 的时候,不用传\n */\n readonly sourceField?: string;\n /**\n * 去向字段,dataType = 'node-link' 的时候,不用传\n */\n readonly targetField?: string;\n /**\n * 权重字段,dataType = 'node-link' 的时候,不用传\n */\n readonly weightField?: string;\n /**\n * 附加的 元字段\n */\n readonly rawFields?: string[];\n /**\n * 数据\n */\n readonly data: Data | NodeLinkData;\n /**\n * 节点宽度的比如,参考画布的宽度,默认值为 0.008\n */\n readonly nodeWidthRatio?: number;\n /**\n * 节点宽度的像素设置,优先级高于 nodeWidthRatio\n */\n readonly nodeWidth?: number;\n /**\n * 节点之间的间距比例,参考画布高度,默认值为 0.03\n */\n readonly nodePaddingRatio?: number;\n /**\n * 节点间距的像素设置,优先级高于 nodePaddingRatio\n */\n readonly nodePadding?: number;\n /**\n * 节点对齐的方式,默认为 justify\n */\n readonly nodeAlign?: 'left' | 'right' | 'center' | 'justify';\n /**\n * 节点排序方式,默认为空\n */\n readonly nodeSort?: NodeSort;\n /**\n * 节点排放分层的顺序,从 0 开始,并且返回值需要保证所有的层级都有节点\n */\n readonly nodeDepth?: NodeDepth;\n /**\n * 节点样式\n */\n readonly nodeStyle?: StyleAttr;\n /**\n * 节点状态样式\n */\n readonly nodeState?: State;\n /**\n * 边样式\n */\n readonly edgeStyle?: StyleAttr;\n /**\n * 边状态样式\n */\n readonly edgeState?: State;\n /**\n * 节点位置是否可以拖拽,默认为 false\n */\n readonly nodeDraggable?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2plot",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.40",
|
|
4
4
|
"description": "An nteractive and responsive charting library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"homepage": "https://g2plot.antv.vision",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/antvis/
|
|
24
|
+
"url": "https://github.com/antvis/G2plot"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "npm run site:clean && npm run site:develop",
|
|
28
28
|
"site:develop": "cross-env PORT=8080 gatsby develop --open -H 0.0.0.0",
|
|
29
|
-
"site:build": "npm run site:clean && gatsby build --prefix-paths",
|
|
29
|
+
"site:build": "NODE_OPTIONS=--max_old_space_size=8192 npm run site:clean && gatsby build --prefix-paths",
|
|
30
30
|
"site:clean": "gatsby clean",
|
|
31
|
-
"site:deploy": "
|
|
31
|
+
"site:deploy": "npm run build && npm run site:build && gh-pages -d public",
|
|
32
32
|
"fix": "eslint --ext .ts ./src ./__tests__ --fix && prettier --write ./src ./__tests__ && lint-md --fix ./examples ./docs",
|
|
33
33
|
"build": "run-s clean lib dist size",
|
|
34
34
|
"size": "limit-size",
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { isRealNumber, pick } from '../../utils';
|
|
2
2
|
import { transformDataToNodeLinkData } from '../../utils/data';
|
|
3
|
-
import {
|
|
3
|
+
import { Data } from '../../types';
|
|
4
|
+
import { sankeyLayout, SankeyLayoutInputData } from './layout';
|
|
4
5
|
import { cutoffCircle } from './circle';
|
|
5
6
|
import { SankeyOptions } from './types';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* 是否是 node-link 类型的数据结构
|
|
10
|
+
* @param dataTyp
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function isNodeLink(dataType: string) {
|
|
14
|
+
return dataType === 'node-link';
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
export function getNodeWidthRatio(nodeWidth: number, nodeWidthRatio: number, width: number) {
|
|
8
18
|
return isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;
|
|
9
19
|
}
|
|
@@ -20,6 +30,7 @@ export function getNodePaddingRatio(nodePadding: number, nodePaddingRatio: numbe
|
|
|
20
30
|
*/
|
|
21
31
|
export function transformToViewsData(options: SankeyOptions, width: number, height: number) {
|
|
22
32
|
const {
|
|
33
|
+
dataType,
|
|
23
34
|
data,
|
|
24
35
|
sourceField,
|
|
25
36
|
targetField,
|
|
@@ -34,13 +45,19 @@ export function transformToViewsData(options: SankeyOptions, width: number, heig
|
|
|
34
45
|
rawFields = [],
|
|
35
46
|
} = options;
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
let sankeyLayoutInputData: unknown;
|
|
49
|
+
|
|
50
|
+
if (!isNodeLink(dataType)) {
|
|
51
|
+
sankeyLayoutInputData = transformDataToNodeLinkData(
|
|
52
|
+
cutoffCircle(data as Data, sourceField, targetField),
|
|
53
|
+
sourceField,
|
|
54
|
+
targetField,
|
|
55
|
+
weightField,
|
|
56
|
+
rawFields
|
|
57
|
+
);
|
|
58
|
+
} else {
|
|
59
|
+
sankeyLayoutInputData = data;
|
|
60
|
+
}
|
|
44
61
|
|
|
45
62
|
// 3. layout 之后的数据
|
|
46
63
|
const { nodes, links } = sankeyLayout(
|
|
@@ -51,7 +68,7 @@ export function transformToViewsData(options: SankeyOptions, width: number, heig
|
|
|
51
68
|
nodeSort,
|
|
52
69
|
nodeDepth,
|
|
53
70
|
},
|
|
54
|
-
sankeyLayoutInputData
|
|
71
|
+
sankeyLayoutInputData as SankeyLayoutInputData
|
|
55
72
|
);
|
|
56
73
|
|
|
57
74
|
// 4. 生成绘图数据
|