@antv/g2plot 2.4.25 → 2.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g2plot.min.js +2 -17
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/brush.d.ts +1 -1
- package/esm/adaptor/common.js +2 -2
- package/esm/adaptor/common.js.map +1 -1
- package/esm/adaptor/conversion-tag.js +4 -4
- package/esm/adaptor/conversion-tag.js.map +1 -1
- package/esm/adaptor/geometries/area.js +5 -2
- package/esm/adaptor/geometries/area.js.map +1 -1
- package/esm/adaptor/geometries/base.d.ts +3 -3
- package/esm/adaptor/geometries/base.js +6 -6
- package/esm/adaptor/geometries/base.js.map +1 -1
- package/esm/adaptor/pattern.d.ts +6 -1
- package/esm/adaptor/pattern.js +2 -2
- package/esm/adaptor/pattern.js.map +1 -1
- package/esm/core/adaptor.d.ts +2 -2
- package/esm/core/adaptor.js +1 -0
- package/esm/core/plot.d.ts +1 -1
- package/esm/core/plot.js +2 -2
- package/esm/core/plot.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/interactions/actions/drill-down.d.ts +2 -2
- package/esm/interactions/actions/drill-down.js +3 -3
- package/esm/interactions/actions/drill-down.js.map +1 -1
- package/esm/interactions/actions/reset-button.js.map +1 -1
- package/esm/interactions/brush.d.ts +2 -2
- package/esm/interactions/brush.js +34 -34
- package/esm/interactions/brush.js.map +1 -1
- package/esm/lab.js +3 -3
- package/esm/lab.js.map +1 -1
- package/esm/plots/_template/adaptor.js +1 -1
- package/esm/plots/_template/adaptor.js.map +1 -1
- package/esm/plots/_template/types.js +1 -0
- package/esm/plots/area/adaptor.js +6 -2
- package/esm/plots/area/adaptor.js.map +1 -1
- package/esm/plots/area/types.d.ts +5 -1
- package/esm/plots/area/types.js +1 -0
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/types.js +1 -0
- package/esm/plots/bidirectional-bar/adaptor.js.map +1 -1
- package/esm/plots/bidirectional-bar/types.js +1 -0
- package/esm/plots/box/types.js +1 -0
- package/esm/plots/bullet/adaptor.js +11 -11
- package/esm/plots/bullet/adaptor.js.map +1 -1
- package/esm/plots/bullet/types.d.ts +2 -2
- package/esm/plots/bullet/types.js +1 -0
- package/esm/plots/bullet/utils.d.ts +1 -1
- package/esm/plots/bullet/utils.js +2 -2
- package/esm/plots/bullet/utils.js.map +1 -1
- package/esm/plots/chord/adaptor.js +3 -3
- package/esm/plots/chord/adaptor.js.map +1 -1
- package/esm/plots/chord/constant.js +1 -1
- package/esm/plots/chord/constant.js.map +1 -1
- package/esm/plots/chord/types.js +1 -0
- package/esm/plots/circle-packing/adaptor.js +5 -5
- package/esm/plots/circle-packing/adaptor.js.map +1 -1
- package/esm/plots/circle-packing/types.js +1 -0
- package/esm/plots/circle-packing/utils.js +1 -1
- package/esm/plots/circle-packing/utils.js.map +1 -1
- package/esm/plots/column/adaptor.js +10 -6
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/column/types.d.ts +1 -1
- package/esm/plots/column/types.js +1 -0
- package/esm/plots/dual-axes/adaptor.js.map +1 -1
- package/esm/plots/dual-axes/types.d.ts +5 -5
- package/esm/plots/dual-axes/util/legend.js +1 -1
- package/esm/plots/dual-axes/util/legend.js.map +1 -1
- package/esm/plots/dual-axes/util/option.js.map +1 -1
- package/esm/plots/facet/adaptor.d.ts +1 -1
- package/esm/plots/facet/index.d.ts +1 -1
- package/esm/plots/facet/types.d.ts +5 -5
- package/esm/plots/facet/types.js +1 -0
- package/esm/plots/funnel/adaptor.js +3 -3
- package/esm/plots/funnel/adaptor.js.map +1 -1
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/interactions/index.js +1 -1
- package/esm/plots/funnel/interactions/index.js.map +1 -1
- package/esm/plots/funnel/types.d.ts +1 -1
- package/esm/plots/funnel/types.js +1 -0
- package/esm/plots/gauge/adaptor.js +4 -4
- package/esm/plots/gauge/adaptor.js.map +1 -1
- package/esm/plots/gauge/shapes/indicator.js.map +1 -1
- package/esm/plots/gauge/shapes/meter-gauge.js.map +1 -1
- package/esm/plots/gauge/types.d.ts +4 -4
- package/esm/plots/gauge/utils.js +1 -1
- package/esm/plots/gauge/utils.js.map +1 -1
- package/esm/plots/heatmap/adaptor.js.map +1 -1
- package/esm/plots/heatmap/shapes/circle.js.map +1 -1
- package/esm/plots/heatmap/shapes/square.js.map +1 -1
- package/esm/plots/heatmap/types.js +1 -0
- package/esm/plots/histogram/types.js +1 -0
- package/esm/plots/line/types.js +1 -0
- package/esm/plots/liquid/adaptor.js +1 -1
- package/esm/plots/liquid/adaptor.js.map +1 -1
- package/esm/plots/liquid/shapes/liquid.js +5 -5
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +4 -4
- package/esm/plots/liquid/types.js +1 -0
- package/esm/plots/mix/interactions/association.js.map +1 -1
- package/esm/plots/mix/types.d.ts +3 -3
- package/esm/plots/mix/types.js +1 -0
- package/esm/plots/mix/utils.d.ts +2 -2
- package/esm/plots/mix/utils.js +1 -1
- package/esm/plots/mix/utils.js.map +1 -1
- package/esm/plots/pie/adaptor.js +2 -2
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/types.d.ts +1 -1
- package/esm/plots/pie/types.js +1 -0
- package/esm/plots/progress/types.js +1 -0
- package/esm/plots/progress/utils.js +2 -2
- package/esm/plots/progress/utils.js.map +1 -1
- package/esm/plots/radar/types.js +1 -0
- package/esm/plots/radial-bar/adaptor.js +2 -2
- package/esm/plots/radial-bar/adaptor.js.map +1 -1
- package/esm/plots/radial-bar/types.d.ts +7 -1
- package/esm/plots/radial-bar/types.js +1 -0
- package/esm/plots/radial-bar/types.js.map +1 -1
- package/esm/plots/ring-progress/adaptor.js +1 -1
- package/esm/plots/ring-progress/adaptor.js.map +1 -1
- package/esm/plots/ring-progress/types.js +1 -0
- package/esm/plots/rose/adaptor.js +2 -1
- package/esm/plots/rose/adaptor.js.map +1 -1
- package/esm/plots/rose/types.d.ts +7 -1
- package/esm/plots/rose/types.js +1 -0
- package/esm/plots/rose/types.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +7 -6
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/sankey/circle.js +3 -3
- package/esm/plots/sankey/circle.js.map +1 -1
- package/esm/plots/sankey/helper.js +3 -3
- package/esm/plots/sankey/helper.js.map +1 -1
- package/esm/plots/sankey/interactions/actions/node-drag.js +2 -2
- package/esm/plots/sankey/interactions/actions/node-drag.js.map +1 -1
- package/esm/plots/sankey/layout.d.ts +11 -11
- package/esm/plots/sankey/layout.js.map +1 -1
- package/esm/plots/sankey/sankey/sankey.d.ts +1 -1
- package/esm/plots/sankey/types.d.ts +1 -1
- package/esm/plots/sankey/types.js +1 -0
- package/esm/plots/scatter/adaptor.js +18 -4
- package/esm/plots/scatter/adaptor.js.map +1 -1
- package/esm/plots/scatter/index.js.map +1 -1
- package/esm/plots/scatter/types.d.ts +16 -1
- package/esm/plots/scatter/types.js +1 -0
- package/esm/plots/scatter/types.js.map +1 -1
- package/esm/plots/scatter/util.d.ts +15 -1
- package/esm/plots/scatter/util.js +45 -2
- package/esm/plots/scatter/util.js.map +1 -1
- package/esm/plots/stock/types.js +1 -0
- package/esm/plots/sunburst/adaptor.js +6 -5
- package/esm/plots/sunburst/adaptor.js.map +1 -1
- package/esm/plots/sunburst/types.d.ts +7 -1
- package/esm/plots/sunburst/types.js +1 -0
- package/esm/plots/sunburst/types.js.map +1 -1
- package/esm/plots/sunburst/utils.js +4 -4
- package/esm/plots/sunburst/utils.js.map +1 -1
- package/esm/plots/tiny-area/types.js +1 -0
- package/esm/plots/tiny-column/constants.js +1 -1
- package/esm/plots/tiny-column/constants.js.map +1 -1
- package/esm/plots/tiny-column/types.js +1 -0
- package/esm/plots/tiny-line/constants.js +1 -1
- package/esm/plots/tiny-line/constants.js.map +1 -1
- package/esm/plots/tiny-line/types.js +1 -0
- package/esm/plots/tiny-line/utils.js +1 -1
- package/esm/plots/tiny-line/utils.js.map +1 -1
- package/esm/plots/treemap/adaptor.js +3 -3
- package/esm/plots/treemap/adaptor.js.map +1 -1
- package/esm/plots/treemap/types.js +1 -0
- package/esm/plots/venn/layout/layout.js +1 -0
- package/esm/plots/venn/layout/layout.js.map +1 -1
- package/esm/plots/venn/shape.js.map +1 -1
- package/esm/plots/venn/types.d.ts +2 -2
- package/esm/plots/venn/utils.d.ts +1 -1
- package/esm/plots/violin/constant.js +2 -0
- package/esm/plots/violin/constant.js.map +1 -1
- package/esm/plots/violin/types.js +1 -0
- package/esm/plots/violin/utils.d.ts +2 -2
- package/esm/plots/waterfall/adaptor.js +5 -4
- package/esm/plots/waterfall/adaptor.js.map +1 -1
- package/esm/plots/waterfall/shape.js.map +1 -1
- package/esm/plots/waterfall/types.d.ts +9 -3
- package/esm/plots/waterfall/types.js +1 -0
- package/esm/plots/waterfall/types.js.map +1 -1
- package/esm/plots/waterfall/utils.js +1 -1
- package/esm/plots/waterfall/utils.js.map +1 -1
- package/esm/plots/word-cloud/adaptor.js +2 -2
- package/esm/plots/word-cloud/adaptor.js.map +1 -1
- package/esm/plots/word-cloud/shapes/word-cloud.js.map +1 -1
- package/esm/plots/word-cloud/types.d.ts +2 -2
- package/esm/plots/word-cloud/types.js +1 -0
- package/esm/types/animation.d.ts +1 -1
- package/esm/types/animation.js +1 -0
- package/esm/types/annotation.d.ts +2 -2
- package/esm/types/annotation.js +1 -0
- package/esm/types/attr.d.ts +7 -7
- package/esm/types/attr.js +1 -0
- package/esm/types/axis.d.ts +1 -1
- package/esm/types/axis.js +1 -0
- package/esm/types/button.d.ts +1 -1
- package/esm/types/button.js +1 -0
- package/esm/types/common.d.ts +13 -13
- package/esm/types/common.js +1 -0
- package/esm/types/coordinate.d.ts +1 -1
- package/esm/types/coordinate.js +1 -0
- package/esm/types/drill-down.d.ts +1 -1
- package/esm/types/drill-down.js +1 -0
- package/esm/types/index.d.ts +1 -1
- package/esm/types/interaction.d.ts +2 -2
- package/esm/types/interaction.js +1 -0
- package/esm/types/label.d.ts +1 -1
- package/esm/types/label.js +1 -0
- package/esm/types/legend.d.ts +1 -1
- package/esm/types/legend.js +1 -0
- package/esm/types/locale.d.ts +1 -1
- package/esm/types/locale.js +1 -0
- package/esm/types/meta.d.ts +1 -1
- package/esm/types/meta.js +1 -0
- package/esm/types/pattern.d.ts +4 -4
- package/esm/types/pattern.js +1 -0
- package/esm/types/relation-data.d.ts +3 -3
- package/esm/types/relation-data.js +1 -0
- package/esm/types/scrollbar.d.ts +1 -1
- package/esm/types/scrollbar.js +1 -0
- package/esm/types/slider.d.ts +1 -1
- package/esm/types/slider.js +1 -0
- package/esm/types/state.d.ts +4 -4
- package/esm/types/state.js +1 -0
- package/esm/types/statistic.d.ts +3 -3
- package/esm/types/statistic.js +1 -0
- package/esm/types/tooltip.d.ts +3 -3
- package/esm/types/tooltip.js +1 -0
- package/esm/utils/color/blend.js +1 -1
- package/esm/utils/color/blend.js.map +1 -1
- package/esm/utils/conversion.js +1 -1
- package/esm/utils/conversion.js.map +1 -1
- package/esm/utils/flow.d.ts +1 -1
- package/esm/utils/hierarchy/pack.d.ts +1 -1
- package/esm/utils/hierarchy/partition.d.ts +1 -1
- package/esm/utils/hierarchy/partition.js.map +1 -1
- package/esm/utils/hierarchy/types.js +1 -0
- package/esm/utils/hierarchy/util.js +1 -1
- package/esm/utils/hierarchy/util.js.map +1 -1
- package/esm/utils/invariant.js +4 -4
- package/esm/utils/invariant.js.map +1 -1
- package/esm/utils/matrix.js +2 -2
- package/esm/utils/matrix.js.map +1 -1
- package/esm/utils/measure-text.js +3 -3
- package/esm/utils/measure-text.js.map +1 -1
- package/esm/utils/pattern/index.d.ts +1 -1
- package/esm/utils/pattern/line.js +1 -1
- package/esm/utils/pattern/line.js.map +1 -1
- package/esm/utils/pattern/util.js +2 -2
- package/esm/utils/pattern/util.js.map +1 -1
- package/esm/utils/statistic.js +9 -9
- package/esm/utils/statistic.js.map +1 -1
- package/esm/utils/template.js +1 -1
- package/esm/utils/template.js.map +1 -1
- package/esm/utils/tooltip.js +1 -1
- package/esm/utils/tooltip.js.map +1 -1
- package/esm/utils/transform/chord.d.ts +4 -4
- package/esm/utils/transform/chord.js +4 -4
- package/esm/utils/transform/chord.js.map +1 -1
- package/esm/utils/transform/histogram.d.ts +1 -1
- package/esm/utils/transform/histogram.js +3 -3
- package/esm/utils/transform/histogram.js.map +1 -1
- package/esm/utils/transform/percent.js +2 -2
- package/esm/utils/transform/percent.js.map +1 -1
- package/esm/utils/transform/word-cloud.d.ts +1 -1
- package/esm/utils/transform/word-cloud.js +2 -1
- package/esm/utils/transform/word-cloud.js.map +1 -1
- package/lib/adaptor/brush.d.ts +1 -1
- package/lib/adaptor/brush.js +3 -3
- package/lib/adaptor/brush.js.map +1 -1
- package/lib/adaptor/common.js +10 -10
- package/lib/adaptor/common.js.map +1 -1
- package/lib/adaptor/connected-area.js +2 -2
- package/lib/adaptor/connected-area.js.map +1 -1
- package/lib/adaptor/conversion-tag.js +9 -9
- package/lib/adaptor/conversion-tag.js.map +1 -1
- package/lib/adaptor/geometries/area.js +7 -4
- package/lib/adaptor/geometries/area.js.map +1 -1
- package/lib/adaptor/geometries/base.d.ts +3 -3
- package/lib/adaptor/geometries/base.js +17 -17
- package/lib/adaptor/geometries/base.js.map +1 -1
- package/lib/adaptor/geometries/edge.js +2 -2
- package/lib/adaptor/geometries/edge.js.map +1 -1
- package/lib/adaptor/geometries/index.js +1 -0
- package/lib/adaptor/geometries/index.js.map +1 -1
- package/lib/adaptor/geometries/interval.js +4 -4
- package/lib/adaptor/geometries/interval.js.map +1 -1
- package/lib/adaptor/geometries/line.js +3 -3
- package/lib/adaptor/geometries/line.js.map +1 -1
- package/lib/adaptor/geometries/point.js +2 -2
- package/lib/adaptor/geometries/point.js.map +1 -1
- package/lib/adaptor/geometries/polygon.js +2 -2
- package/lib/adaptor/geometries/polygon.js.map +1 -1
- package/lib/adaptor/geometries/schema.js +2 -2
- package/lib/adaptor/geometries/schema.js.map +1 -1
- package/lib/adaptor/geometries/violin.js +2 -2
- package/lib/adaptor/geometries/violin.js.map +1 -1
- package/lib/adaptor/pattern.d.ts +6 -1
- package/lib/adaptor/pattern.js +4 -4
- package/lib/adaptor/pattern.js.map +1 -1
- package/lib/core/adaptor.d.ts +2 -2
- package/lib/core/global.js +1 -1
- package/lib/core/global.js.map +1 -1
- package/lib/core/locale.js +1 -1
- package/lib/core/locale.js.map +1 -1
- package/lib/core/plot.d.ts +1 -1
- package/lib/core/plot.js +13 -13
- package/lib/core/plot.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/lib/interactions/actions/drill-down.d.ts +2 -2
- package/lib/interactions/actions/drill-down.js +12 -12
- package/lib/interactions/actions/drill-down.js.map +1 -1
- package/lib/interactions/actions/reset-button.js +3 -3
- package/lib/interactions/actions/reset-button.js.map +1 -1
- package/lib/interactions/brush.d.ts +2 -2
- package/lib/interactions/brush.js +42 -42
- package/lib/interactions/brush.js.map +1 -1
- package/lib/interactions/drag-move.js +1 -1
- package/lib/interactions/drag-move.js.map +1 -1
- package/lib/interactions/drill-down.js +4 -4
- package/lib/interactions/drill-down.js.map +1 -1
- package/lib/lab.js +3 -3
- package/lib/lab.js.map +1 -1
- package/lib/plots/_template/adaptor.js +3 -3
- package/lib/plots/_template/adaptor.js.map +1 -1
- package/lib/plots/area/adaptor.js +17 -13
- package/lib/plots/area/adaptor.js.map +1 -1
- package/lib/plots/area/constants.js +1 -1
- package/lib/plots/area/constants.js.map +1 -1
- package/lib/plots/area/index.js +2 -2
- package/lib/plots/area/index.js.map +1 -1
- package/lib/plots/area/types.d.ts +5 -1
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/adaptor.js +6 -6
- package/lib/plots/bar/adaptor.js.map +1 -1
- package/lib/plots/bar/constants.js +1 -1
- package/lib/plots/bar/constants.js.map +1 -1
- package/lib/plots/bar/index.js +2 -2
- package/lib/plots/bar/index.js.map +1 -1
- package/lib/plots/bidirectional-bar/adaptor.js +41 -41
- package/lib/plots/bidirectional-bar/adaptor.js.map +1 -1
- package/lib/plots/bidirectional-bar/index.js +4 -4
- package/lib/plots/bidirectional-bar/index.js.map +1 -1
- package/lib/plots/bidirectional-bar/utils.js +1 -1
- package/lib/plots/bidirectional-bar/utils.js.map +1 -1
- package/lib/plots/box/adaptor.js +10 -10
- package/lib/plots/box/adaptor.js.map +1 -1
- package/lib/plots/box/constant.js +1 -1
- package/lib/plots/box/constant.js.map +1 -1
- package/lib/plots/box/index.js +1 -1
- package/lib/plots/box/index.js.map +1 -1
- package/lib/plots/box/utils.js +3 -2
- package/lib/plots/box/utils.js.map +1 -1
- package/lib/plots/bullet/adaptor.js +37 -37
- package/lib/plots/bullet/adaptor.js.map +1 -1
- package/lib/plots/bullet/constant.js +1 -1
- package/lib/plots/bullet/constant.js.map +1 -1
- package/lib/plots/bullet/index.js +2 -2
- package/lib/plots/bullet/index.js.map +1 -1
- package/lib/plots/bullet/types.d.ts +2 -2
- package/lib/plots/bullet/utils.d.ts +1 -1
- package/lib/plots/bullet/utils.js +2 -2
- package/lib/plots/bullet/utils.js.map +1 -1
- package/lib/plots/chord/adaptor.js +8 -8
- package/lib/plots/chord/adaptor.js.map +1 -1
- package/lib/plots/chord/constant.js +2 -2
- package/lib/plots/chord/constant.js.map +1 -1
- package/lib/plots/circle-packing/adaptor.js +20 -20
- package/lib/plots/circle-packing/adaptor.js.map +1 -1
- package/lib/plots/circle-packing/utils.js +4 -4
- package/lib/plots/circle-packing/utils.js.map +1 -1
- package/lib/plots/column/adaptor.js +23 -19
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/column/constants.js +1 -1
- package/lib/plots/column/constants.js.map +1 -1
- package/lib/plots/column/index.js +2 -2
- package/lib/plots/column/index.js.map +1 -1
- package/lib/plots/column/types.d.ts +1 -1
- package/lib/plots/dual-axes/adaptor.js +63 -63
- package/lib/plots/dual-axes/adaptor.js.map +1 -1
- package/lib/plots/dual-axes/index.js +1 -1
- package/lib/plots/dual-axes/index.js.map +1 -1
- package/lib/plots/dual-axes/types.d.ts +5 -5
- package/lib/plots/dual-axes/util/geometry.js +9 -9
- package/lib/plots/dual-axes/util/geometry.js.map +1 -1
- package/lib/plots/dual-axes/util/legend.js +9 -9
- package/lib/plots/dual-axes/util/legend.js.map +1 -1
- package/lib/plots/dual-axes/util/option.js +8 -8
- package/lib/plots/dual-axes/util/option.js.map +1 -1
- package/lib/plots/dual-axes/util/render-sider.js +6 -5
- package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
- package/lib/plots/facet/adaptor.d.ts +1 -1
- package/lib/plots/facet/adaptor.js +10 -10
- package/lib/plots/facet/adaptor.js.map +1 -1
- package/lib/plots/facet/index.d.ts +1 -1
- package/lib/plots/facet/types.d.ts +5 -5
- package/lib/plots/facet/utils.js +9 -9
- package/lib/plots/facet/utils.js.map +1 -1
- package/lib/plots/funnel/adaptor.js +14 -14
- package/lib/plots/funnel/adaptor.js.map +1 -1
- package/lib/plots/funnel/geometries/basic.js +10 -10
- package/lib/plots/funnel/geometries/basic.js.map +1 -1
- package/lib/plots/funnel/geometries/common.js +6 -6
- package/lib/plots/funnel/geometries/common.js.map +1 -1
- package/lib/plots/funnel/geometries/compare.js +12 -12
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/geometries/dynamic-height.js +9 -9
- package/lib/plots/funnel/geometries/dynamic-height.js.map +1 -1
- package/lib/plots/funnel/geometries/facet.js +2 -2
- package/lib/plots/funnel/geometries/facet.js.map +1 -1
- package/lib/plots/funnel/index.js +5 -5
- package/lib/plots/funnel/index.js.map +1 -1
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js +5 -5
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -1
- package/lib/plots/funnel/interactions/index.js +3 -3
- package/lib/plots/funnel/interactions/index.js.map +1 -1
- package/lib/plots/funnel/types.d.ts +1 -1
- package/lib/plots/gauge/adaptor.js +16 -16
- package/lib/plots/gauge/adaptor.js.map +1 -1
- package/lib/plots/gauge/index.js +3 -3
- package/lib/plots/gauge/index.js.map +1 -1
- package/lib/plots/gauge/shapes/indicator.js +1 -1
- package/lib/plots/gauge/shapes/indicator.js.map +1 -1
- package/lib/plots/gauge/shapes/meter-gauge.js +2 -2
- package/lib/plots/gauge/shapes/meter-gauge.js.map +1 -1
- package/lib/plots/gauge/types.d.ts +4 -4
- package/lib/plots/gauge/utils.js +4 -4
- package/lib/plots/gauge/utils.js.map +1 -1
- package/lib/plots/heatmap/adaptor.js +10 -10
- package/lib/plots/heatmap/adaptor.js.map +1 -1
- package/lib/plots/heatmap/constant.js +1 -1
- package/lib/plots/heatmap/constant.js.map +1 -1
- package/lib/plots/heatmap/shapes/circle.js +1 -1
- package/lib/plots/heatmap/shapes/circle.js.map +1 -1
- package/lib/plots/heatmap/shapes/square.js +1 -1
- package/lib/plots/heatmap/shapes/square.js.map +1 -1
- package/lib/plots/histogram/adaptor.js +7 -7
- package/lib/plots/histogram/adaptor.js.map +1 -1
- package/lib/plots/histogram/constant.js +1 -1
- package/lib/plots/histogram/constant.js.map +1 -1
- package/lib/plots/histogram/index.js +1 -1
- package/lib/plots/histogram/index.js.map +1 -1
- package/lib/plots/line/adaptor.js +13 -13
- package/lib/plots/line/adaptor.js.map +1 -1
- package/lib/plots/line/constants.js +1 -1
- package/lib/plots/line/constants.js.map +1 -1
- package/lib/plots/line/index.js +1 -1
- package/lib/plots/line/index.js.map +1 -1
- package/lib/plots/line/interactions/index.js +2 -2
- package/lib/plots/line/interactions/index.js.map +1 -1
- package/lib/plots/line/interactions/marker-active.js +5 -5
- package/lib/plots/line/interactions/marker-active.js.map +1 -1
- package/lib/plots/liquid/adaptor.js +8 -8
- package/lib/plots/liquid/adaptor.js.map +1 -1
- package/lib/plots/liquid/index.js +3 -3
- package/lib/plots/liquid/index.js.map +1 -1
- package/lib/plots/liquid/shapes/liquid.js +12 -12
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +4 -4
- package/lib/plots/mix/adaptor.js +17 -17
- package/lib/plots/mix/adaptor.js.map +1 -1
- package/lib/plots/mix/interactions/association.js +22 -22
- package/lib/plots/mix/interactions/association.js.map +1 -1
- package/lib/plots/mix/interactions/utils.js +3 -3
- package/lib/plots/mix/interactions/utils.js.map +1 -1
- package/lib/plots/mix/types.d.ts +3 -3
- package/lib/plots/mix/utils.d.ts +2 -2
- package/lib/plots/mix/utils.js +2 -2
- package/lib/plots/mix/utils.js.map +1 -1
- package/lib/plots/pie/adaptor.js +38 -38
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/contants.js +1 -1
- package/lib/plots/pie/contants.js.map +1 -1
- package/lib/plots/pie/index.js +4 -4
- package/lib/plots/pie/index.js.map +1 -1
- package/lib/plots/pie/interactions/actions/legend-active.js +3 -3
- package/lib/plots/pie/interactions/actions/legend-active.js.map +1 -1
- package/lib/plots/pie/interactions/actions/statistic-active.js +7 -7
- package/lib/plots/pie/interactions/actions/statistic-active.js.map +1 -1
- package/lib/plots/pie/interactions/index.js +4 -4
- package/lib/plots/pie/interactions/index.js.map +1 -1
- package/lib/plots/pie/types.d.ts +1 -1
- package/lib/plots/pie/utils.js +4 -4
- package/lib/plots/pie/utils.js.map +1 -1
- package/lib/plots/progress/adaptor.js +5 -5
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/index.js +1 -1
- package/lib/plots/progress/index.js.map +1 -1
- package/lib/plots/progress/utils.js +3 -3
- package/lib/plots/progress/utils.js.map +1 -1
- package/lib/plots/radar/adaptor.js +10 -10
- package/lib/plots/radar/adaptor.js.map +1 -1
- package/lib/plots/radar/index.js +1 -1
- package/lib/plots/radar/index.js.map +1 -1
- package/lib/plots/radar/interactions/index.js +2 -2
- package/lib/plots/radar/interactions/index.js.map +1 -1
- package/lib/plots/radar/interactions/radar-tooltip-action.js +3 -3
- package/lib/plots/radar/interactions/radar-tooltip-action.js.map +1 -1
- package/lib/plots/radial-bar/adaptor.js +13 -13
- package/lib/plots/radial-bar/adaptor.js.map +1 -1
- package/lib/plots/radial-bar/constant.js +1 -1
- package/lib/plots/radial-bar/constant.js.map +1 -1
- package/lib/plots/radial-bar/index.js +1 -1
- package/lib/plots/radial-bar/index.js.map +1 -1
- package/lib/plots/radial-bar/types.d.ts +7 -1
- package/lib/plots/radial-bar/types.js.map +1 -1
- package/lib/plots/ring-progress/adaptor.js +5 -5
- package/lib/plots/ring-progress/adaptor.js.map +1 -1
- package/lib/plots/ring-progress/index.js +2 -2
- package/lib/plots/ring-progress/index.js.map +1 -1
- package/lib/plots/rose/adaptor.js +11 -10
- package/lib/plots/rose/adaptor.js.map +1 -1
- package/lib/plots/rose/constant.js +1 -1
- package/lib/plots/rose/constant.js.map +1 -1
- package/lib/plots/rose/types.d.ts +7 -1
- package/lib/plots/rose/types.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +13 -12
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/sankey/circle.js +4 -4
- package/lib/plots/sankey/circle.js.map +1 -1
- package/lib/plots/sankey/helper.js +6 -6
- package/lib/plots/sankey/helper.js.map +1 -1
- package/lib/plots/sankey/index.js +4 -4
- package/lib/plots/sankey/index.js.map +1 -1
- package/lib/plots/sankey/interactions/actions/node-drag.js +8 -8
- package/lib/plots/sankey/interactions/actions/node-drag.js.map +1 -1
- package/lib/plots/sankey/interactions/node-draggable.js +2 -2
- package/lib/plots/sankey/interactions/node-draggable.js.map +1 -1
- package/lib/plots/sankey/layout.d.ts +11 -11
- package/lib/plots/sankey/layout.js +3 -3
- package/lib/plots/sankey/layout.js.map +1 -1
- package/lib/plots/sankey/sankey/align.js +1 -1
- package/lib/plots/sankey/sankey/align.js.map +1 -1
- package/lib/plots/sankey/sankey/index.js +1 -1
- package/lib/plots/sankey/sankey/sankey.d.ts +1 -1
- package/lib/plots/sankey/sankey/sankey.js +9 -9
- package/lib/plots/sankey/sankey/sankey.js.map +1 -1
- package/lib/plots/sankey/types.d.ts +1 -1
- package/lib/plots/scatter/adaptor.js +33 -19
- package/lib/plots/scatter/adaptor.js.map +1 -1
- package/lib/plots/scatter/constant.js +1 -1
- package/lib/plots/scatter/constant.js.map +1 -1
- package/lib/plots/scatter/index.js +4 -4
- package/lib/plots/scatter/index.js.map +1 -1
- package/lib/plots/scatter/types.d.ts +16 -1
- package/lib/plots/scatter/types.js.map +1 -1
- package/lib/plots/scatter/util.d.ts +15 -1
- package/lib/plots/scatter/util.js +61 -15
- package/lib/plots/scatter/util.js.map +1 -1
- package/lib/plots/stock/adaptor.js +7 -7
- package/lib/plots/stock/adaptor.js.map +1 -1
- package/lib/plots/stock/constant.js +1 -1
- package/lib/plots/stock/constant.js.map +1 -1
- package/lib/plots/stock/index.js +1 -1
- package/lib/plots/stock/index.js.map +1 -1
- package/lib/plots/stock/utils.js +2 -2
- package/lib/plots/stock/utils.js.map +1 -1
- package/lib/plots/sunburst/adaptor.js +22 -21
- package/lib/plots/sunburst/adaptor.js.map +1 -1
- package/lib/plots/sunburst/constant.js +1 -1
- package/lib/plots/sunburst/constant.js.map +1 -1
- package/lib/plots/sunburst/types.d.ts +7 -1
- package/lib/plots/sunburst/types.js.map +1 -1
- package/lib/plots/sunburst/utils.js +4 -4
- package/lib/plots/sunburst/utils.js.map +1 -1
- package/lib/plots/tiny-area/adaptor.js +11 -11
- package/lib/plots/tiny-area/adaptor.js.map +1 -1
- package/lib/plots/tiny-area/index.js +2 -2
- package/lib/plots/tiny-area/index.js.map +1 -1
- package/lib/plots/tiny-column/adaptor.js +4 -4
- package/lib/plots/tiny-column/adaptor.js.map +1 -1
- package/lib/plots/tiny-column/constants.js +1 -1
- package/lib/plots/tiny-column/constants.js.map +1 -1
- package/lib/plots/tiny-column/index.js +2 -2
- package/lib/plots/tiny-column/index.js.map +1 -1
- package/lib/plots/tiny-line/adaptor.js +6 -6
- package/lib/plots/tiny-line/adaptor.js.map +1 -1
- package/lib/plots/tiny-line/constants.js +1 -1
- package/lib/plots/tiny-line/constants.js.map +1 -1
- package/lib/plots/tiny-line/index.js +2 -2
- package/lib/plots/tiny-line/index.js.map +1 -1
- package/lib/plots/tiny-line/utils.js +1 -1
- package/lib/plots/tiny-line/utils.js.map +1 -1
- package/lib/plots/treemap/adaptor.js +13 -13
- package/lib/plots/treemap/adaptor.js.map +1 -1
- package/lib/plots/treemap/index.js +3 -3
- package/lib/plots/treemap/index.js.map +1 -1
- package/lib/plots/treemap/utils.js +4 -4
- package/lib/plots/treemap/utils.js.map +1 -1
- package/lib/plots/venn/adaptor.js +18 -18
- package/lib/plots/venn/adaptor.js.map +1 -1
- package/lib/plots/venn/interactions/actions/active.js +2 -2
- package/lib/plots/venn/interactions/actions/active.js.map +1 -1
- package/lib/plots/venn/interactions/actions/highlight.js +2 -2
- package/lib/plots/venn/interactions/actions/highlight.js.map +1 -1
- package/lib/plots/venn/interactions/actions/selected.js +4 -4
- package/lib/plots/venn/interactions/actions/selected.js.map +1 -1
- package/lib/plots/venn/interactions/index.js +10 -10
- package/lib/plots/venn/interactions/index.js.map +1 -1
- package/lib/plots/venn/label.js +1 -1
- package/lib/plots/venn/label.js.map +1 -1
- package/lib/plots/venn/layout/diagram.js +10 -10
- package/lib/plots/venn/layout/diagram.js.map +1 -1
- package/lib/plots/venn/layout/layout.js +14 -13
- package/lib/plots/venn/layout/layout.js.map +1 -1
- package/lib/plots/venn/shape.js +3 -3
- package/lib/plots/venn/shape.js.map +1 -1
- package/lib/plots/venn/types.d.ts +2 -2
- package/lib/plots/venn/utils.d.ts +1 -1
- package/lib/plots/venn/utils.js +8 -8
- package/lib/plots/venn/utils.js.map +1 -1
- package/lib/plots/violin/adaptor.js +22 -22
- package/lib/plots/violin/adaptor.js.map +1 -1
- package/lib/plots/violin/constant.js +3 -1
- package/lib/plots/violin/constant.js.map +1 -1
- package/lib/plots/violin/index.js +1 -1
- package/lib/plots/violin/index.js.map +1 -1
- package/lib/plots/violin/utils.d.ts +2 -2
- package/lib/plots/violin/utils.js +18 -15
- package/lib/plots/violin/utils.js.map +1 -1
- package/lib/plots/waterfall/adaptor.js +21 -20
- package/lib/plots/waterfall/adaptor.js.map +1 -1
- package/lib/plots/waterfall/index.js +1 -1
- package/lib/plots/waterfall/index.js.map +1 -1
- package/lib/plots/waterfall/shape.js +3 -3
- package/lib/plots/waterfall/shape.js.map +1 -1
- package/lib/plots/waterfall/types.d.ts +9 -3
- package/lib/plots/waterfall/types.js.map +1 -1
- package/lib/plots/waterfall/utils.js +5 -5
- package/lib/plots/waterfall/utils.js.map +1 -1
- package/lib/plots/word-cloud/adaptor.js +6 -6
- package/lib/plots/word-cloud/adaptor.js.map +1 -1
- package/lib/plots/word-cloud/constant.js +1 -1
- package/lib/plots/word-cloud/constant.js.map +1 -1
- package/lib/plots/word-cloud/index.js +2 -2
- package/lib/plots/word-cloud/index.js.map +1 -1
- package/lib/plots/word-cloud/shapes/word-cloud.js +1 -1
- package/lib/plots/word-cloud/shapes/word-cloud.js.map +1 -1
- package/lib/plots/word-cloud/types.d.ts +2 -2
- package/lib/plots/word-cloud/utils.js +13 -13
- package/lib/plots/word-cloud/utils.js.map +1 -1
- package/lib/plugin/index.js +1 -1
- package/lib/plugin/index.js.map +1 -1
- package/lib/types/animation.d.ts +1 -1
- package/lib/types/annotation.d.ts +2 -2
- package/lib/types/attr.d.ts +7 -7
- package/lib/types/axis.d.ts +1 -1
- package/lib/types/button.d.ts +1 -1
- package/lib/types/common.d.ts +13 -13
- package/lib/types/coordinate.d.ts +1 -1
- package/lib/types/drill-down.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/interaction.d.ts +2 -2
- package/lib/types/label.d.ts +1 -1
- package/lib/types/legend.d.ts +1 -1
- package/lib/types/locale.d.ts +1 -1
- package/lib/types/meta.d.ts +1 -1
- package/lib/types/pattern.d.ts +4 -4
- package/lib/types/relation-data.d.ts +3 -3
- package/lib/types/scrollbar.d.ts +1 -1
- package/lib/types/slider.d.ts +1 -1
- package/lib/types/state.d.ts +4 -4
- package/lib/types/statistic.d.ts +3 -3
- package/lib/types/tooltip.d.ts +3 -3
- package/lib/utils/color/blend.js +4 -3
- package/lib/utils/color/blend.js.map +1 -1
- package/lib/utils/conversion.js +2 -2
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/data.js +7 -7
- package/lib/utils/data.js.map +1 -1
- package/lib/utils/deep-assign.js +2 -1
- package/lib/utils/deep-assign.js.map +1 -1
- package/lib/utils/flow.d.ts +1 -1
- package/lib/utils/geometry.js +5 -5
- package/lib/utils/geometry.js.map +1 -1
- package/lib/utils/hierarchy/pack.d.ts +1 -1
- package/lib/utils/hierarchy/pack.js +4 -4
- package/lib/utils/hierarchy/pack.js.map +1 -1
- package/lib/utils/hierarchy/partition.d.ts +1 -1
- package/lib/utils/hierarchy/partition.js +6 -6
- package/lib/utils/hierarchy/partition.js.map +1 -1
- package/lib/utils/hierarchy/treemap.js +4 -4
- package/lib/utils/hierarchy/treemap.js.map +1 -1
- package/lib/utils/hierarchy/util.js +6 -6
- package/lib/utils/hierarchy/util.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/invariant.js +3 -3
- package/lib/utils/invariant.js.map +1 -1
- package/lib/utils/label.js +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/utils/matrix.js +1 -1
- package/lib/utils/matrix.js.map +1 -1
- package/lib/utils/measure-text.js +5 -5
- package/lib/utils/measure-text.js.map +1 -1
- package/lib/utils/padding.js +2 -2
- package/lib/utils/padding.js.map +1 -1
- package/lib/utils/path.js +3 -2
- package/lib/utils/path.js.map +1 -1
- package/lib/utils/pattern/dot.js +7 -7
- package/lib/utils/pattern/dot.js.map +1 -1
- package/lib/utils/pattern/index.d.ts +1 -1
- package/lib/utils/pattern/index.js +3 -3
- package/lib/utils/pattern/index.js.map +1 -1
- package/lib/utils/pattern/line.js +6 -6
- package/lib/utils/pattern/line.js.map +1 -1
- package/lib/utils/pattern/square.js +7 -7
- package/lib/utils/pattern/square.js.map +1 -1
- package/lib/utils/pattern/util.js +2 -2
- package/lib/utils/pattern/util.js.map +1 -1
- package/lib/utils/statistic.js +24 -22
- package/lib/utils/statistic.js.map +1 -1
- package/lib/utils/template.js +2 -2
- package/lib/utils/template.js.map +1 -1
- package/lib/utils/tooltip.js +3 -3
- package/lib/utils/tooltip.js.map +1 -1
- package/lib/utils/transform/chord.d.ts +4 -4
- package/lib/utils/transform/chord.js +8 -8
- package/lib/utils/transform/chord.js.map +1 -1
- package/lib/utils/transform/histogram.d.ts +1 -1
- package/lib/utils/transform/histogram.js +14 -14
- package/lib/utils/transform/histogram.js.map +1 -1
- package/lib/utils/transform/percent.js +10 -10
- package/lib/utils/transform/percent.js.map +1 -1
- package/lib/utils/transform/word-cloud.d.ts +1 -1
- package/lib/utils/transform/word-cloud.js +5 -4
- package/lib/utils/transform/word-cloud.js.map +1 -1
- package/lib/utils/view.js +2 -2
- package/lib/utils/view.js.map +1 -1
- package/package.json +7 -7
- package/src/adaptor/geometries/area.ts +8 -5
- package/src/index.ts +1 -1
- package/src/plots/area/adaptor.ts +6 -1
- package/src/plots/area/types.ts +10 -1
- package/src/plots/bidirectional-bar/adaptor.ts +1 -1
- package/src/plots/column/adaptor.ts +1 -1
- package/src/plots/radial-bar/adaptor.ts +2 -2
- package/src/plots/radial-bar/types.ts +10 -1
- package/src/plots/rose/adaptor.ts +2 -1
- package/src/plots/rose/types.ts +7 -1
- package/src/plots/sankey/adaptor.ts +2 -1
- package/src/plots/sankey/layout.ts +1 -1
- package/src/plots/scatter/adaptor.ts +20 -2
- package/src/plots/scatter/types.ts +16 -0
- package/src/plots/scatter/util.ts +55 -2
- package/src/plots/sunburst/adaptor.ts +2 -1
- package/src/plots/sunburst/types.ts +9 -1
- package/src/plots/waterfall/adaptor.ts +20 -4
- package/src/plots/waterfall/types.ts +7 -1
- package/src/utils/hierarchy/partition.ts +1 -1
- package/CHANGELOG.md +0 -1659
|
@@ -20,7 +20,7 @@ var SankeyNodeDragAction = /** @class */ (function (_super) {
|
|
|
20
20
|
* 当前操作的是否是 element
|
|
21
21
|
*/
|
|
22
22
|
SankeyNodeDragAction.prototype.isNodeElement = function () {
|
|
23
|
-
var shape = util_1.get(this.context, 'event.target');
|
|
23
|
+
var shape = (0, util_1.get)(this.context, 'event.target');
|
|
24
24
|
if (shape) {
|
|
25
25
|
var element = shape.get('element');
|
|
26
26
|
return element && element.getModel().data.isNode;
|
|
@@ -28,10 +28,10 @@ var SankeyNodeDragAction = /** @class */ (function (_super) {
|
|
|
28
28
|
return false;
|
|
29
29
|
};
|
|
30
30
|
SankeyNodeDragAction.prototype.getNodeView = function () {
|
|
31
|
-
return utils_1.findViewById(this.context.view, constant_1.NODES_VIEW_ID);
|
|
31
|
+
return (0, utils_1.findViewById)(this.context.view, constant_1.NODES_VIEW_ID);
|
|
32
32
|
};
|
|
33
33
|
SankeyNodeDragAction.prototype.getEdgeView = function () {
|
|
34
|
-
return utils_1.findViewById(this.context.view, constant_1.EDGES_VIEW_ID);
|
|
34
|
+
return (0, utils_1.findViewById)(this.context.view, constant_1.EDGES_VIEW_ID);
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* 获取当前操作的 index
|
|
@@ -47,8 +47,8 @@ var SankeyNodeDragAction = /** @class */ (function (_super) {
|
|
|
47
47
|
// 记录开始了的状态
|
|
48
48
|
if (this.isNodeElement()) {
|
|
49
49
|
this.prevPoint = {
|
|
50
|
-
x: util_1.get(this.context, 'event.x'),
|
|
51
|
-
y: util_1.get(this.context, 'event.y'),
|
|
50
|
+
x: (0, util_1.get)(this.context, 'event.x'),
|
|
51
|
+
y: (0, util_1.get)(this.context, 'event.y'),
|
|
52
52
|
};
|
|
53
53
|
var element = this.context.event.target.get('element');
|
|
54
54
|
var idx = this.getCurrentDatumIdx(element);
|
|
@@ -72,8 +72,8 @@ var SankeyNodeDragAction = /** @class */ (function (_super) {
|
|
|
72
72
|
if (this.isDragging) {
|
|
73
73
|
var chart = this.context.view;
|
|
74
74
|
var currentPoint = {
|
|
75
|
-
x: util_1.get(this.context, 'event.x'),
|
|
76
|
-
y: util_1.get(this.context, 'event.y'),
|
|
75
|
+
x: (0, util_1.get)(this.context, 'event.x'),
|
|
76
|
+
y: (0, util_1.get)(this.context, 'event.y'),
|
|
77
77
|
};
|
|
78
78
|
var x = currentPoint.x - this.prevPoint.x;
|
|
79
79
|
var y = currentPoint.y - this.prevPoint.y;
|
|
@@ -91,7 +91,7 @@ var SankeyNodeDragAction = /** @class */ (function (_super) {
|
|
|
91
91
|
var nextDatum = tslib_1.__assign(tslib_1.__assign({}, prevDatum), { x: prevDatum.x.map(function (x) { return (x += datumGap_1.x); }), y: prevDatum.y.map(function (y) { return (y += datumGap_1.y); }) });
|
|
92
92
|
// 处理一下在 [0, 1] 范围
|
|
93
93
|
// 1. 更新 node 数据
|
|
94
|
-
var newData = tslib_1.
|
|
94
|
+
var newData = tslib_1.__spreadArray([], data, true);
|
|
95
95
|
newData[this.currentElementIdx] = nextDatum;
|
|
96
96
|
nodeView.data(newData);
|
|
97
97
|
// 2. 更新 edge 数据
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-drag.js","sourceRoot":"","sources":["../../../../../src/plots/sankey/interactions/actions/node-drag.ts"],"names":[],"mappings":";;;;AAAA,+BAA2C;AAC3C,mCAAiC;AAEjC,2CAAiD;AACjD,2CAA8D;AAE9D;IAA0C,gDAAM;IAAhD;QAAA,qEAwKC;QAvKC;;WAEG;QACK,gBAAU,GAAG,KAAK,CAAC;;IAoK7B,CAAC;IAjJC;;OAEG;IACK,4CAAa,GAArB;QACE,IAAM,KAAK,GAAG,UAAG,
|
|
1
|
+
{"version":3,"file":"node-drag.js","sourceRoot":"","sources":["../../../../../src/plots/sankey/interactions/actions/node-drag.ts"],"names":[],"mappings":";;;;AAAA,+BAA2C;AA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AC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACtD,CAAC;IACH,2BAAC;AAAD,CAAC,AAxKD,CAA0C,WAAM,GAwK/C;AAxKY,oDAAoB","sourcesContent":["import { Action, Element } from '@antv/g2';\nimport { get } from '@antv/util';\nimport { Datum, Point } from '../../../../types';\nimport { findViewById } from '../../../../utils';\nimport { EDGES_VIEW_ID, NODES_VIEW_ID } from '../../constant';\n\nexport class SankeyNodeDragAction extends Action {\n /**\n * 是否在拖拽中的标记\n */\n private isDragging = false;\n\n /**\n * 鼠标上一次的位置的坐标点\n */\n private prevPoint: Point;\n /**\n * 之前的节点动画配置\n */\n private prevNodeAnimateCfg: any;\n /**\n * 之前的边动画配置\n */\n private prevEdgeAnimateCfg: any;\n /**\n * 当前拖拽的 element 索引\n */\n private currentElementIdx: number;\n\n /**\n * 当前操作的是否是 element\n */\n private isNodeElement() {\n const shape = get(this.context, 'event.target');\n if (shape) {\n const element = shape.get('element');\n return element && element.getModel().data.isNode;\n }\n return false;\n }\n\n private getNodeView() {\n return findViewById(this.context.view, NODES_VIEW_ID);\n }\n\n private getEdgeView() {\n return findViewById(this.context.view, EDGES_VIEW_ID);\n }\n\n /**\n * 获取当前操作的 index\n * @param element\n */\n private getCurrentDatumIdx(element: Element) {\n return this.getNodeView().geometries[0].elements.indexOf(element);\n }\n\n /**\n * 点击下去,开始\n */\n public start() {\n // 记录开始了的状态\n if (this.isNodeElement()) {\n this.prevPoint = {\n x: get(this.context, 'event.x'),\n y: get(this.context, 'event.y'),\n };\n\n const element = this.context.event.target.get('element');\n const idx = this.getCurrentDatumIdx(element);\n\n if (idx === -1) {\n return;\n }\n\n this.currentElementIdx = idx;\n this.context.isDragging = true;\n this.isDragging = true;\n\n // 关闭动画并暂存配置\n this.prevNodeAnimateCfg = this.getNodeView().getOptions().animate;\n this.prevEdgeAnimateCfg = this.getEdgeView().getOptions().animate;\n this.getNodeView().animate(false);\n this.getEdgeView().animate(false);\n }\n }\n\n /**\n * 移动过程中,平移\n */\n public translate() {\n if (this.isDragging) {\n const chart = this.context.view;\n\n const currentPoint = {\n x: get(this.context, 'event.x'),\n y: get(this.context, 'event.y'),\n };\n\n const x = currentPoint.x - this.prevPoint.x;\n const y = currentPoint.y - this.prevPoint.y;\n\n const nodeView = this.getNodeView();\n const element = nodeView.geometries[0].elements[this.currentElementIdx];\n\n // 修改数据\n if (element && element.getModel()) {\n const prevDatum: Datum = element.getModel().data;\n const data = nodeView.getOptions().data;\n const coordinate = nodeView.getCoordinate();\n\n const datumGap = {\n x: x / coordinate.getWidth(),\n y: y / coordinate.getHeight(),\n };\n\n const nextDatum = {\n ...prevDatum,\n x: prevDatum.x.map((x: number) => (x += datumGap.x)),\n y: prevDatum.y.map((y: number) => (y += datumGap.y)),\n };\n // 处理一下在 [0, 1] 范围\n\n // 1. 更新 node 数据\n const newData = [...data];\n newData[this.currentElementIdx] = nextDatum;\n nodeView.data(newData);\n\n // 2. 更新 edge 数据\n const name = prevDatum.name;\n const edgeView = this.getEdgeView();\n const edgeData = edgeView.getOptions().data;\n\n edgeData.forEach((datum) => {\n // 2.1 以该 node 为 source 的边,修改 [x0, x1, x2, x3] 中的 x0, x1\n if (datum.source === name) {\n datum.x[0] += datumGap.x;\n datum.x[1] += datumGap.x;\n datum.y[0] += datumGap.y;\n datum.y[1] += datumGap.y;\n }\n\n // 2.2 以该 node 为 target 的边,修改 [x0, x1, x2, x3] 中的 x2, x3\n if (datum.target === name) {\n datum.x[2] += datumGap.x;\n datum.x[3] += datumGap.x;\n datum.y[2] += datumGap.y;\n datum.y[3] += datumGap.y;\n }\n });\n edgeView.data(edgeData);\n\n // 3. 更新最新位置\n this.prevPoint = currentPoint;\n\n // node edge 都改变了,所以要从底层 render\n chart.render(true);\n }\n }\n }\n\n /**\n * 结论,清除状态\n */\n public end() {\n this.isDragging = false;\n this.context.isDragging = false;\n this.prevPoint = null;\n this.currentElementIdx = null;\n\n // 还原动画\n this.getNodeView().animate(this.prevNodeAnimateCfg);\n this.getEdgeView().animate(this.prevEdgeAnimateCfg);\n }\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var g2_1 = require("@antv/g2");
|
|
4
4
|
var node_drag_1 = require("./actions/node-drag");
|
|
5
|
-
g2_1.registerAction('sankey-node-drag', node_drag_1.SankeyNodeDragAction);
|
|
6
|
-
g2_1.registerInteraction('sankey-node-draggable', {
|
|
5
|
+
(0, g2_1.registerAction)('sankey-node-drag', node_drag_1.SankeyNodeDragAction);
|
|
6
|
+
(0, g2_1.registerInteraction)('sankey-node-draggable', {
|
|
7
7
|
showEnable: [
|
|
8
8
|
{ trigger: 'polygon:mouseenter', action: 'cursor:pointer' },
|
|
9
9
|
{ trigger: 'polygon:mouseleave', action: 'cursor:default' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-draggable.js","sourceRoot":"","sources":["../../../../src/plots/sankey/interactions/node-draggable.ts"],"names":[],"mappings":";;AAAA,+BAA+D;AAC/D,iDAA2D;AAE3D,mBAAc,
|
|
1
|
+
{"version":3,"file":"node-draggable.js","sourceRoot":"","sources":["../../../../src/plots/sankey/interactions/node-draggable.ts"],"names":[],"mappings":";;AAAA,+BAA+D;AAC/D,iDAA2D;AAE3D,IAAA,mBAAc,EAAC,kBAAkB,EAAE,gCAAoB,CAAC,CAAC;AAEzD,IAAA,wBAAmB,EAAC,uBAAuB,EAAE;IAC3C,UAAU,EAAE;QACV,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,gBAAgB,EAAE;QAC3D,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,gBAAgB,EAAE;KAC5D;IACD,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC;IAC3E,UAAU,EAAE;QACV,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,4BAA4B,EAAE;QACnE,EAAE,QAAQ,EAAE,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE;KAChG;IACD,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import { registerAction, registerInteraction } from '@antv/g2';\nimport { SankeyNodeDragAction } from './actions/node-drag';\n\nregisterAction('sankey-node-drag', SankeyNodeDragAction);\n\nregisterInteraction('sankey-node-draggable', {\n showEnable: [\n { trigger: 'polygon:mouseenter', action: 'cursor:pointer' },\n { trigger: 'polygon:mouseleave', action: 'cursor:default' },\n ],\n start: [{ trigger: 'polygon:mousedown', action: 'sankey-node-drag:start' }],\n processing: [\n { trigger: 'plot:mousemove', action: 'sankey-node-drag:translate' },\n { isEnable: (context) => context.isDragging, trigger: 'plot:mousemove', action: 'cursor:move' },\n ],\n end: [{ trigger: 'plot:mouseup', action: 'sankey-node-drag:end' }],\n});\n"]}
|
|
@@ -6,15 +6,15 @@ declare const ALIGN_METHOD: {
|
|
|
6
6
|
center: typeof center;
|
|
7
7
|
justify: typeof justify;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type InputNode = {
|
|
10
10
|
readonly name: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type InputLink = {
|
|
13
13
|
readonly source: number;
|
|
14
14
|
readonly target: number;
|
|
15
15
|
readonly value: number;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
type OutputNode = {
|
|
18
18
|
readonly name: string;
|
|
19
19
|
readonly x0: number;
|
|
20
20
|
readonly x1: number;
|
|
@@ -25,7 +25,7 @@ declare type OutputNode = {
|
|
|
25
25
|
x: number[];
|
|
26
26
|
y: number[];
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
type OutputLink = {
|
|
29
29
|
readonly source: OutputNode;
|
|
30
30
|
readonly target: OutputNode;
|
|
31
31
|
readonly value: number;
|
|
@@ -38,30 +38,30 @@ declare type OutputLink = {
|
|
|
38
38
|
/**
|
|
39
39
|
* 桑基图布局的数据结构定义
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type SankeyLayoutInputData = {
|
|
42
42
|
readonly nodes: InputNode[];
|
|
43
43
|
readonly links: InputLink[];
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
type SankeyLayoutOutputData = {
|
|
46
46
|
readonly nodes: OutputNode[];
|
|
47
47
|
readonly links: OutputLink[];
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* 对齐方式的类型定义
|
|
51
51
|
*/
|
|
52
|
-
export
|
|
52
|
+
export type NodeAlign = keyof typeof ALIGN_METHOD | ((...args: any[]) => any);
|
|
53
53
|
/**
|
|
54
54
|
* 节点的 depth 自定义
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type NodeDepth = (datum: Datum, maxDepth: number) => number;
|
|
57
57
|
/**
|
|
58
58
|
* 节点排序方法的类型定义
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export type NodeSort = (a: Datum, b: Datum) => number;
|
|
61
61
|
/**
|
|
62
62
|
* 布局参数的定义
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export type SankeyLayoutOptions = {
|
|
65
65
|
readonly nodeId?: (node: Datum) => any;
|
|
66
66
|
readonly nodeSort?: (a: any, b: any) => number;
|
|
67
67
|
readonly nodeAlign?: NodeAlign;
|
|
@@ -74,7 +74,7 @@ export declare type SankeyLayoutOptions = {
|
|
|
74
74
|
* @param nodeAlign
|
|
75
75
|
* @param nodeDepth
|
|
76
76
|
*/
|
|
77
|
-
export declare function getNodeAlignFunction(nodeAlign: NodeAlign):
|
|
77
|
+
export declare function getNodeAlignFunction(nodeAlign: NodeAlign): (...args: any[]) => any;
|
|
78
78
|
export declare function getDefaultOptions(sankeyLayoutOptions: SankeyLayoutOptions): Partial<SankeyLayoutOptions> & SankeyLayoutOptions;
|
|
79
79
|
/**
|
|
80
80
|
* 桑基图利用数据进行布局的函数,最终返回节点、边的位置(0 - 1 的信息)
|
|
@@ -25,12 +25,12 @@ var DEFAULT_OPTIONS = {
|
|
|
25
25
|
* @param nodeDepth
|
|
26
26
|
*/
|
|
27
27
|
function getNodeAlignFunction(nodeAlign) {
|
|
28
|
-
var func = util_1.isString(nodeAlign) ? ALIGN_METHOD[nodeAlign] : util_1.isFunction(nodeAlign) ? nodeAlign : null;
|
|
28
|
+
var func = (0, util_1.isString)(nodeAlign) ? ALIGN_METHOD[nodeAlign] : (0, util_1.isFunction)(nodeAlign) ? nodeAlign : null;
|
|
29
29
|
return func || sankey_1.justify;
|
|
30
30
|
}
|
|
31
31
|
exports.getNodeAlignFunction = getNodeAlignFunction;
|
|
32
32
|
function getDefaultOptions(sankeyLayoutOptions) {
|
|
33
|
-
return util_1.assign({}, DEFAULT_OPTIONS, sankeyLayoutOptions);
|
|
33
|
+
return (0, util_1.assign)({}, DEFAULT_OPTIONS, sankeyLayoutOptions);
|
|
34
34
|
}
|
|
35
35
|
exports.getDefaultOptions = getDefaultOptions;
|
|
36
36
|
/**
|
|
@@ -42,7 +42,7 @@ exports.getDefaultOptions = getDefaultOptions;
|
|
|
42
42
|
function sankeyLayout(sankeyLayoutOptions, data) {
|
|
43
43
|
var options = getDefaultOptions(sankeyLayoutOptions);
|
|
44
44
|
var nodeId = options.nodeId, nodeSort = options.nodeSort, nodeAlign = options.nodeAlign, nodeWidth = options.nodeWidth, nodePadding = options.nodePadding, nodeDepth = options.nodeDepth;
|
|
45
|
-
var sankeyProcessor = sankey_1.sankey()
|
|
45
|
+
var sankeyProcessor = (0, sankey_1.sankey)()
|
|
46
46
|
// .links((d: any) => d.links)
|
|
47
47
|
// .nodes((d: any) => d.nodes)
|
|
48
48
|
.nodeSort(nodeSort)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/plots/sankey/layout.ts"],"names":[],"mappings":";;;AAAA,mCAA0D;AAE1D,mCAAgE;AAEhE,IAAM,YAAY,GAAG;IACnB,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,MAAM,iBAAA;IACN,OAAO,kBAAA;CACR,CAAC;AAqFF;;GAEG;AACH,IAAM,eAAe,GAAiC;IACpD,MAAM,EAAE,UAAC,IAAW,IAAK,OAAA,IAAI,CAAC,KAAK,EAAV,CAAU;IACnC,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,SAAoB;IACvD,IAAM,IAAI,GAAG,eAAQ,
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/plots/sankey/layout.ts"],"names":[],"mappings":";;;AAAA,mCAA0D;AAE1D,mCAAgE;AAEhE,IAAM,YAAY,GAAG;IACnB,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,MAAM,iBAAA;IACN,OAAO,kBAAA;CACR,CAAC;AAqFF;;GAEG;AACH,IAAM,eAAe,GAAiC;IACpD,MAAM,EAAE,UAAC,IAAW,IAAK,OAAA,IAAI,CAAC,KAAK,EAAV,CAAU;IACnC,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,SAAoB;IACvD,IAAM,IAAI,GAAG,IAAA,eAAQ,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,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AAC1B,CAAC;AA5DD,oCA4DC","sourcesContent":["import { assign, isFunction, isString } from '@antv/util';\nimport { Datum } from '../../types';\nimport { center, justify, left, right, sankey } from './sankey';\n\nconst ALIGN_METHOD = {\n left,\n right,\n center,\n justify,\n};\n\ntype InputNode = {\n readonly name: string;\n};\n\ntype InputLink = {\n readonly source: number;\n readonly target: number;\n readonly value: number;\n};\n\ntype OutputNode = {\n readonly name: string;\n readonly x0: number;\n readonly x1: number;\n readonly y0: number;\n readonly y1: number;\n readonly depth: number;\n readonly value: number;\n\n // 用于绘制 polygon\n x: number[];\n y: number[];\n};\n\ntype OutputLink = {\n readonly source: OutputNode;\n readonly target: OutputNode;\n readonly value: number;\n readonly width: number;\n readonly y0: number;\n readonly y1: number;\n\n // 用于绘制 edge\n x?: number[];\n y?: number[];\n};\n\n/**\n * 桑基图布局的数据结构定义\n */\nexport type SankeyLayoutInputData = {\n readonly nodes: InputNode[];\n readonly links: InputLink[];\n};\n\ntype SankeyLayoutOutputData = {\n readonly nodes: OutputNode[];\n readonly links: OutputLink[];\n};\n\n/**\n * 对齐方式的类型定义\n */\nexport type NodeAlign = keyof typeof ALIGN_METHOD | ((...args: any[]) => any);\n\n/**\n * 节点的 depth 自定义\n */\nexport type NodeDepth = (datum: Datum, maxDepth: number) => number;\n\n/**\n * 节点排序方法的类型定义\n */\nexport type NodeSort = (a: Datum, b: Datum) => number;\n\n/**\n * 布局参数的定义\n */\nexport type SankeyLayoutOptions = {\n readonly nodeId?: (node: Datum) => any;\n // readonly value?: (node: Datum) => any;\n // readonly source?: (edge: Datum) => any;\n // readonly target?: (edge: Datum) => any;\n // sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.\n // sankey.nodeSort(null) specifies the input order of nodes and never sorts.\n // sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.\n readonly nodeSort?: (a: any, b: any) => number;\n readonly nodeAlign?: NodeAlign;\n readonly nodeWidth?: number;\n readonly nodePadding?: number;\n readonly nodeDepth?: NodeDepth;\n};\n\n/**\n * 默认值\n */\nconst DEFAULT_OPTIONS: Partial<SankeyLayoutOptions> = {\n nodeId: (node: Datum) => node.index,\n nodeAlign: 'justify',\n nodeWidth: 0.008,\n nodePadding: 0.03,\n nodeSort: undefined,\n};\n\n/**\n * 获得 align function\n * @param nodeAlign\n * @param nodeDepth\n */\nexport function getNodeAlignFunction(nodeAlign: NodeAlign) {\n const func = isString(nodeAlign) ? ALIGN_METHOD[nodeAlign] : isFunction(nodeAlign) ? nodeAlign : null;\n\n return func || justify;\n}\n\nexport function getDefaultOptions(sankeyLayoutOptions: SankeyLayoutOptions) {\n return assign({}, DEFAULT_OPTIONS, sankeyLayoutOptions);\n}\n\n/**\n * 桑基图利用数据进行布局的函数,最终返回节点、边的位置(0 - 1 的信息)\n * 将会修改 data 数据\n * @param sankeyLayoutOptions\n * @param data\n */\nexport function sankeyLayout(\n sankeyLayoutOptions: SankeyLayoutOptions,\n data: SankeyLayoutInputData\n): SankeyLayoutOutputData {\n const options = getDefaultOptions(sankeyLayoutOptions);\n\n const { nodeId, nodeSort, nodeAlign, nodeWidth, nodePadding, nodeDepth } = options;\n\n const sankeyProcessor = sankey()\n // .links((d: any) => d.links)\n // .nodes((d: any) => d.nodes)\n .nodeSort(nodeSort)\n .nodeWidth(nodeWidth)\n .nodePadding(nodePadding)\n .nodeDepth(nodeDepth)\n .nodeAlign(getNodeAlignFunction(nodeAlign))\n .extent([\n [0, 0],\n [1, 1],\n ])\n .nodeId(nodeId);\n\n // 进行桑基图布局处理\n const layoutData: SankeyLayoutOutputData = sankeyProcessor(data);\n\n // post process (x, y), etc.\n const nodes = layoutData.nodes\n .map((node) => {\n const { x0, x1, y0, y1 } = node;\n /* points\n * 3---2\n * | |\n * 0---1\n */\n node.x = [x0, x1, x1, x0];\n node.y = [y0, y0, y1, y1];\n\n return node;\n })\n .filter((node) => {\n return node.name !== null;\n });\n\n const links = layoutData.links\n .map((edge) => {\n const { source, target } = edge;\n const sx = source.x1;\n const tx = target.x0;\n edge.x = [sx, sx, tx, tx];\n const offset = edge.width / 2;\n edge.y = [edge.y0 + offset, edge.y0 - offset, edge.y1 + offset, edge.y1 - offset];\n\n return edge;\n })\n .filter((edge) => {\n const { source, target } = edge;\n return source.name !== null && target.name !== null;\n });\n\n return { nodes, links };\n}\n"]}
|
|
@@ -18,7 +18,7 @@ function justify(node, n) {
|
|
|
18
18
|
}
|
|
19
19
|
exports.justify = justify;
|
|
20
20
|
function center(node) {
|
|
21
|
-
return node.targetLinks.length ? node.depth : node.sourceLinks.length ? util_1.minBy(node.sourceLinks, targetDepth) - 1 : 0;
|
|
21
|
+
return node.targetLinks.length ? node.depth : node.sourceLinks.length ? (0, util_1.minBy)(node.sourceLinks, targetDepth) - 1 : 0;
|
|
22
22
|
}
|
|
23
23
|
exports.center = center;
|
|
24
24
|
//# sourceMappingURL=align.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"align.js","sourceRoot":"","sources":["../../../../src/plots/sankey/sankey/align.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,SAAS,WAAW,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AACxB,CAAC;AAED,SAAgB,IAAI,CAAC,IAAI;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC;AAFD,oBAEC;AAED,SAAgB,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;AAC7B,CAAC;AAFD,sBAEC;AAED,SAAgB,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAFD,0BAEC;AAED,SAAgB,MAAM,CAAC,IAAI;IACzB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,YAAK,
|
|
1
|
+
{"version":3,"file":"align.js","sourceRoot":"","sources":["../../../../src/plots/sankey/sankey/align.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,SAAS,WAAW,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AACxB,CAAC;AAED,SAAgB,IAAI,CAAC,IAAI;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC;AAFD,oBAEC;AAED,SAAgB,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;AAC7B,CAAC;AAFD,sBAEC;AAED,SAAgB,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAFD,0BAEC;AAED,SAAgB,MAAM,CAAC,IAAI;IACzB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,YAAK,EAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC;AAFD,wBAEC","sourcesContent":["import { minBy } from '@antv/util';\n\nfunction targetDepth(d) {\n return d.target.depth;\n}\n\nexport function left(node) {\n return node.depth;\n}\n\nexport function right(node, n) {\n return n - 1 - node.height;\n}\n\nexport function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n}\n\nexport function center(node) {\n return node.targetLinks.length ? node.depth : node.sourceLinks.length ? minBy(node.sourceLinks, targetDepth) - 1 : 0;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sankey = void 0;
|
|
3
|
+
exports.sankey = exports.right = exports.left = exports.justify = exports.center = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 桑基图布局代码,Fork from https://github.com/d3/d3-sankey/tree/master/src
|
|
6
6
|
* 主要修改:
|
|
@@ -9,7 +9,7 @@ export declare function Sankey(): {
|
|
|
9
9
|
};
|
|
10
10
|
update(graph: any): any;
|
|
11
11
|
nodeId(_: any): typeof defaultId;
|
|
12
|
-
nodeAlign(_: any): typeof justify
|
|
12
|
+
nodeAlign(_: any): typeof justify;
|
|
13
13
|
nodeDepth(_: any): any;
|
|
14
14
|
nodeSort(_: any): any;
|
|
15
15
|
nodeWidth(_: any): number | any;
|
|
@@ -78,10 +78,10 @@ function Sankey() {
|
|
|
78
78
|
return graph;
|
|
79
79
|
};
|
|
80
80
|
sankey.nodeId = function (_) {
|
|
81
|
-
return arguments.length ? ((id = typeof _ === 'function' ? _ : helper_1.constant(_)), sankey) : id;
|
|
81
|
+
return arguments.length ? ((id = typeof _ === 'function' ? _ : (0, helper_1.constant)(_)), sankey) : id;
|
|
82
82
|
};
|
|
83
83
|
sankey.nodeAlign = function (_) {
|
|
84
|
-
return arguments.length ? ((align = typeof _ === 'function' ? _ : helper_1.constant(_)), sankey) : align;
|
|
84
|
+
return arguments.length ? ((align = typeof _ === 'function' ? _ : (0, helper_1.constant)(_)), sankey) : align;
|
|
85
85
|
};
|
|
86
86
|
sankey.nodeDepth = function (_) {
|
|
87
87
|
return arguments.length ? ((depth = typeof _ === 'function' ? _ : _), sankey) : depth;
|
|
@@ -96,10 +96,10 @@ function Sankey() {
|
|
|
96
96
|
return arguments.length ? ((dy = py = +_), sankey) : dy;
|
|
97
97
|
};
|
|
98
98
|
sankey.nodes = function (_) {
|
|
99
|
-
return arguments.length ? ((nodes = typeof _ === 'function' ? _ : helper_1.constant(_)), sankey) : nodes;
|
|
99
|
+
return arguments.length ? ((nodes = typeof _ === 'function' ? _ : (0, helper_1.constant)(_)), sankey) : nodes;
|
|
100
100
|
};
|
|
101
101
|
sankey.links = function (_) {
|
|
102
|
-
return arguments.length ? ((links = typeof _ === 'function' ? _ : helper_1.constant(_)), sankey) : links;
|
|
102
|
+
return arguments.length ? ((links = typeof _ === 'function' ? _ : (0, helper_1.constant)(_)), sankey) : links;
|
|
103
103
|
};
|
|
104
104
|
sankey.linkSort = function (_) {
|
|
105
105
|
return arguments.length ? ((linkSort = _), sankey) : linkSort;
|
|
@@ -150,7 +150,7 @@ function Sankey() {
|
|
|
150
150
|
var node = nodes_3[_i];
|
|
151
151
|
node.value =
|
|
152
152
|
node.fixedValue === undefined
|
|
153
|
-
? Math.max(helper_1.sumBy(node.sourceLinks, value), helper_1.sumBy(node.targetLinks, value))
|
|
153
|
+
? Math.max((0, helper_1.sumBy)(node.sourceLinks, value), (0, helper_1.sumBy)(node.targetLinks, value))
|
|
154
154
|
: node.fixedValue;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -175,7 +175,7 @@ function Sankey() {
|
|
|
175
175
|
}
|
|
176
176
|
// 如果配置了 depth,则设置自定义 depth
|
|
177
177
|
if (depth) {
|
|
178
|
-
var maxDepth = Math.max(helper_1.maxValueBy(nodes, function (d) { return d.depth; }) + 1, 0);
|
|
178
|
+
var maxDepth = Math.max((0, helper_1.maxValueBy)(nodes, function (d) { return d.depth; }) + 1, 0);
|
|
179
179
|
var node = void 0;
|
|
180
180
|
for (var i = 0; i < nodes.length; i++) {
|
|
181
181
|
node = nodes[i];
|
|
@@ -205,7 +205,7 @@ function Sankey() {
|
|
|
205
205
|
}
|
|
206
206
|
function computeNodeLayers(_a) {
|
|
207
207
|
var nodes = _a.nodes;
|
|
208
|
-
var x = Math.max(helper_1.maxValueBy(nodes, function (d) { return d.depth; }) + 1, 0);
|
|
208
|
+
var x = Math.max((0, helper_1.maxValueBy)(nodes, function (d) { return d.depth; }) + 1, 0);
|
|
209
209
|
var kx = (x1 - x0 - dx) / (x - 1);
|
|
210
210
|
var columns = new Array(x).fill(0).map(function () { return []; });
|
|
211
211
|
for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
|
|
@@ -227,7 +227,7 @@ function Sankey() {
|
|
|
227
227
|
return columns;
|
|
228
228
|
}
|
|
229
229
|
function initializeNodeBreadths(columns) {
|
|
230
|
-
var ky = helper_1.minValueBy(columns, function (c) { return (y1 - y0 - (c.length - 1) * py) / helper_1.sumBy(c, value); });
|
|
230
|
+
var ky = (0, helper_1.minValueBy)(columns, function (c) { return (y1 - y0 - (c.length - 1) * py) / (0, helper_1.sumBy)(c, value); });
|
|
231
231
|
for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
|
232
232
|
var nodes_6 = columns_2[_i];
|
|
233
233
|
var y = y0;
|
|
@@ -252,7 +252,7 @@ function Sankey() {
|
|
|
252
252
|
}
|
|
253
253
|
function computeNodeBreadths(graph) {
|
|
254
254
|
var columns = computeNodeLayers(graph);
|
|
255
|
-
py = Math.min(dy, (y1 - y0) / (helper_1.maxValueBy(columns, function (c) { return c.length; }) - 1));
|
|
255
|
+
py = Math.min(dy, (y1 - y0) / ((0, helper_1.maxValueBy)(columns, function (c) { return c.length; }) - 1));
|
|
256
256
|
initializeNodeBreadths(columns);
|
|
257
257
|
for (var i = 0; i < iterations; ++i) {
|
|
258
258
|
var alpha = Math.pow(0.99, i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sankey.js","sourceRoot":"","sources":["../../../../src/plots/sankey/sankey/sankey.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,mCAAmE;AAEnE,SAAS,sBAAsB,CAAC,CAAC,EAAE,CAAC;IAClC,OAAO,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MA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AAC;IACX,CAAC;IAED,gFAAgF;IAChF,SAAS,SAAS,CAAC,MAAM,EAAE,MAAM;QAC/B,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC/D,KAAsC,UAAkB,EAAlB,KAAA,MAAM,CAAC,WAAW,EAAlB,cAAkB,EAAlB,IAAkB,EAAE;YAA/C,IAAA,WAAuB,EAAb,IAAI,YAAA,EAAE,KAAK,WAAA;YAC9B,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM;YAC3B,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;SACjB;QACD,KAAsC,UAAkB,EAAlB,KAAA,MAAM,CAAC,WAAW,EAAlB,cAAkB,EAAlB,IAAkB,EAAE;YAA/C,IAAA,WAAuB,EAAb,IAAI,YAAA,EAAE,KAAK,WAAA;YAC9B,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM;YAC3B,CAAC,IAAI,KAAK,CAAC;SACZ;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAhWD,wBAgWC","sourcesContent":["import { justify } from './align';\nimport { constant, maxValueBy, minValueBy, sumBy } from './helper';\n\nfunction ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n}\n\nfunction ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n}\n\nfunction ascendingBreadth(a, b) {\n return a.y0 - b.y0;\n}\n\nfunction value(d) {\n return d.value;\n}\n\nfunction defaultId(d) {\n return d.index;\n}\n\nfunction defaultNodes(graph) {\n return graph.nodes;\n}\n\nfunction defaultLinks(graph) {\n return graph.links;\n}\n\nfunction find(nodeById, id) {\n const node = nodeById.get(id);\n if (!node) throw new Error('missing: ' + id);\n return node;\n}\n\nfunction computeLinkBreadths({ nodes }) {\n for (const node of nodes) {\n let y0 = node.y0;\n let y1 = y0;\n for (const link of node.sourceLinks) {\n link.y0 = y0 + link.width / 2;\n y0 += link.width;\n }\n for (const link of node.targetLinks) {\n link.y1 = y1 + link.width / 2;\n y1 += link.width;\n }\n }\n}\n\nexport function Sankey() {\n let x0 = 0,\n y0 = 0,\n x1 = 1,\n y1 = 1; // extent\n let dx = 24; // nodeWidth\n let dy = 8,\n py; // nodePadding\n let id = defaultId;\n let align = justify;\n let depth;\n let sort;\n let linkSort;\n let nodes = defaultNodes;\n let links = defaultLinks;\n let iterations = 6;\n\n function sankey(arg) {\n const graph = {\n nodes: nodes(arg),\n links: links(arg),\n };\n computeNodeLinks(graph);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n computeNodeHeights(graph);\n computeNodeBreadths(graph);\n computeLinkBreadths(graph);\n return graph;\n }\n\n sankey.update = function (graph) {\n computeLinkBreadths(graph);\n return graph;\n };\n\n sankey.nodeId = function (_) {\n return arguments.length ? ((id = typeof _ === 'function' ? _ : constant(_)), sankey) : id;\n };\n\n sankey.nodeAlign = function (_) {\n return arguments.length ? ((align = typeof _ === 'function' ? _ : constant(_)), sankey) : align;\n };\n\n sankey.nodeDepth = function (_) {\n return arguments.length ? ((depth = typeof _ === 'function' ? _ : _), sankey) : depth;\n };\n\n sankey.nodeSort = function (_) {\n return arguments.length ? ((sort = _), sankey) : sort;\n };\n\n sankey.nodeWidth = function (_) {\n return arguments.length ? ((dx = +_), sankey) : dx;\n };\n\n sankey.nodePadding = function (_) {\n return arguments.length ? ((dy = py = +_), sankey) : dy;\n };\n\n sankey.nodes = function (_) {\n return arguments.length ? ((nodes = typeof _ === 'function' ? _ : constant(_)), sankey) : nodes;\n };\n\n sankey.links = function (_) {\n return arguments.length ? ((links = typeof _ === 'function' ? _ : constant(_)), sankey) : links;\n };\n\n sankey.linkSort = function (_) {\n return arguments.length ? ((linkSort = _), sankey) : linkSort;\n };\n\n sankey.size = function (_) {\n return arguments.length ? ((x0 = y0 = 0), (x1 = +_[0]), (y1 = +_[1]), sankey) : [x1 - x0, y1 - y0];\n };\n\n sankey.extent = function (_) {\n return arguments.length\n ? ((x0 = +_[0][0]), (x1 = +_[1][0]), (y0 = +_[0][1]), (y1 = +_[1][1]), sankey)\n : [\n [x0, y0],\n [x1, y1],\n ];\n };\n\n sankey.iterations = function (_) {\n return arguments.length ? ((iterations = +_), sankey) : iterations;\n };\n\n function computeNodeLinks({ nodes, links }) {\n nodes.forEach((node, idx) => {\n node.index = idx;\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n\n const nodeById = new Map(nodes.map((d) => [id(d), d]));\n\n links.forEach((link, idx) => {\n link.index = idx;\n let { source, target } = link;\n if (typeof source !== 'object') source = link.source = find(nodeById, source);\n if (typeof target !== 'object') target = link.target = find(nodeById, target);\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n\n if (linkSort != null) {\n for (const { sourceLinks, targetLinks } of nodes) {\n sourceLinks.sort(linkSort);\n targetLinks.sort(linkSort);\n }\n }\n }\n\n function computeNodeValues({ nodes }) {\n for (const node of nodes) {\n node.value =\n node.fixedValue === undefined\n ? Math.max(sumBy(node.sourceLinks, value), sumBy(node.targetLinks, value))\n : node.fixedValue;\n }\n }\n\n function computeNodeDepths({ nodes }) {\n const n = nodes.length;\n let current = new Set<any>(nodes);\n let next = new Set();\n let x = 0;\n while (current.size) {\n current.forEach((node) => {\n node.depth = x;\n for (const { target } of node.sourceLinks) {\n next.add(target);\n }\n });\n if (++x > n) throw new Error('circular link');\n current = next;\n next = new Set();\n }\n\n // 如果配置了 depth,则设置自定义 depth\n if (depth) {\n const maxDepth = Math.max(maxValueBy(nodes, (d: any) => d.depth) + 1, 0);\n\n let node;\n for (let i = 0; i < nodes.length; i++) {\n node = nodes[i];\n node.depth = depth.call(null, node, maxDepth);\n }\n }\n }\n\n function computeNodeHeights({ nodes }) {\n const n = nodes.length;\n let current = new Set<any>(nodes);\n let next = new Set();\n let x = 0;\n while (current.size) {\n current.forEach((node) => {\n node.height = x;\n for (const { source } of node.targetLinks) {\n next.add(source);\n }\n });\n if (++x > n) throw new Error('circular link');\n current = next;\n next = new Set();\n }\n }\n\n function computeNodeLayers({ nodes }) {\n const x = Math.max(maxValueBy(nodes, (d: any) => d.depth) + 1, 0);\n const kx = (x1 - x0 - dx) / (x - 1);\n const columns = new Array(x).fill(0).map(() => []);\n for (const node of nodes) {\n const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));\n node.layer = i;\n node.x0 = x0 + i * kx;\n node.x1 = node.x0 + dx;\n if (columns[i]) columns[i].push(node);\n else columns[i] = [node];\n }\n if (sort)\n for (const column of columns) {\n column.sort(sort);\n }\n return columns;\n }\n\n function initializeNodeBreadths(columns) {\n const ky = minValueBy(columns, (c: any[]) => (y1 - y0 - (c.length - 1) * py) / sumBy(c, value)) as any as number;\n for (const nodes of columns) {\n let y = y0;\n for (const node of nodes) {\n node.y0 = y;\n node.y1 = y + node.value * ky;\n y = node.y1 + py;\n for (const link of node.sourceLinks) {\n link.width = link.value * ky;\n }\n }\n y = (y1 - y + py) / (nodes.length + 1);\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n node.y0 += y * (i + 1);\n node.y1 += y * (i + 1);\n }\n reorderLinks(nodes);\n }\n }\n\n function computeNodeBreadths(graph) {\n const columns = computeNodeLayers(graph);\n py = Math.min(dy, (y1 - y0) / ((maxValueBy(columns, (c: any[]) => c.length) as any as number) - 1));\n initializeNodeBreadths(columns);\n for (let i = 0; i < iterations; ++i) {\n const alpha = Math.pow(0.99, i);\n const beta = Math.max(1 - alpha, (i + 1) / iterations);\n relaxRightToLeft(columns, alpha, beta);\n relaxLeftToRight(columns, alpha, beta);\n }\n }\n\n // Reposition each node based on its incoming (target) links.\n function relaxLeftToRight(columns, alpha, beta) {\n for (let i = 1, n = columns.length; i < n; ++i) {\n const column = columns[i];\n for (const target of column) {\n let y = 0;\n let w = 0;\n for (const { source, value } of target.targetLinks) {\n const v = value * (target.layer - source.layer);\n y += targetTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n const dy = (y / w - target.y0) * alpha;\n target.y0 += dy;\n target.y1 += dy;\n reorderNodeLinks(target);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n if (column.length) resolveCollisions(column, beta);\n }\n }\n\n // Reposition each node based on its outgoing (source) links.\n function relaxRightToLeft(columns, alpha, beta) {\n for (let n = columns.length, i = n - 2; i >= 0; --i) {\n const column = columns[i];\n for (const source of column) {\n let y = 0;\n let w = 0;\n for (const { target, value } of source.sourceLinks) {\n const v = value * (target.layer - source.layer);\n y += sourceTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n const dy = (y / w - source.y0) * alpha;\n source.y0 += dy;\n source.y1 += dy;\n reorderNodeLinks(source);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n if (column.length) resolveCollisions(column, beta);\n }\n }\n\n function resolveCollisions(nodes, alpha) {\n const i = nodes.length >> 1;\n const subject = nodes[i];\n resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);\n resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);\n resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);\n resolveCollisionsTopToBottom(nodes, y0, 0, alpha);\n }\n\n // Push any overlapping nodes down.\n function resolveCollisionsTopToBottom(nodes, y, i, alpha) {\n for (; i < nodes.length; ++i) {\n const node = nodes[i];\n const dy = (y - node.y0) * alpha;\n if (dy > 1e-6) (node.y0 += dy), (node.y1 += dy);\n y = node.y1 + py;\n }\n }\n\n // Push any overlapping nodes up.\n function resolveCollisionsBottomToTop(nodes, y, i, alpha) {\n for (; i >= 0; --i) {\n const node = nodes[i];\n const dy = (node.y1 - y) * alpha;\n if (dy > 1e-6) (node.y0 -= dy), (node.y1 -= dy);\n y = node.y0 - py;\n }\n }\n\n function reorderNodeLinks({ sourceLinks, targetLinks }) {\n if (linkSort === undefined) {\n for (const {\n source: { sourceLinks },\n } of targetLinks) {\n sourceLinks.sort(ascendingTargetBreadth);\n }\n for (const {\n target: { targetLinks },\n } of sourceLinks) {\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n function reorderLinks(nodes) {\n if (linkSort === undefined) {\n for (const { sourceLinks, targetLinks } of nodes) {\n sourceLinks.sort(ascendingTargetBreadth);\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n // Returns the target.y0 that would produce an ideal link from source to target.\n function targetTop(source, target) {\n let y = source.y0 - ((source.sourceLinks.length - 1) * py) / 2;\n for (const { target: node, width } of source.sourceLinks) {\n if (node === target) break;\n y += width + py;\n }\n for (const { source: node, width } of target.targetLinks) {\n if (node === source) break;\n y -= width;\n }\n return y;\n }\n\n // Returns the source.y0 that would produce an ideal link from source to target.\n function sourceTop(source, target) {\n let y = target.y0 - ((target.targetLinks.length - 1) * py) / 2;\n for (const { source: node, width } of target.targetLinks) {\n if (node === source) break;\n y += width + py;\n }\n for (const { target: node, width } of source.sourceLinks) {\n if (node === target) break;\n y -= width;\n }\n return y;\n }\n\n return sankey;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sankey.js","sourceRoot":"","sources":["../../../../src/plots/sankey/sankey/sankey.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,mCAAmE;AAEnE,SAAS,sBAAsB,CAAC,CAAC,EAAE,CAAC;IAClC,OAAO,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC;AAED,SAAS,sBAAsB,CAAC,CAAC,EAAE,CAAC;IAClC,OAAO,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,C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CAAC,WAAW,EAAlB,cAAkB,EAAlB,IAAkB,EAAE;YAA/C,IAAA,WAAuB,EAAb,IAAI,YAAA,EAAE,KAAK,WAAA;YAC9B,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM;YAC3B,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;SACjB;QACD,KAAsC,UAAkB,EAAlB,KAAA,MAAM,CAAC,WAAW,EAAlB,cAAkB,EAAlB,IAAkB,EAAE;YAA/C,IAAA,WAAuB,EAAb,IAAI,YAAA,EAAE,KAAK,WAAA;YAC9B,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM;YAC3B,CAAC,IAAI,KAAK,CAAC;SACZ;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAhWD,wBAgWC","sourcesContent":["import { justify } from './align';\nimport { constant, maxValueBy, minValueBy, sumBy } from './helper';\n\nfunction ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n}\n\nfunction ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n}\n\nfunction ascendingBreadth(a, b) {\n return a.y0 - b.y0;\n}\n\nfunction value(d) {\n return d.value;\n}\n\nfunction defaultId(d) {\n return d.index;\n}\n\nfunction defaultNodes(graph) {\n return graph.nodes;\n}\n\nfunction defaultLinks(graph) {\n return graph.links;\n}\n\nfunction find(nodeById, id) {\n const node = nodeById.get(id);\n if (!node) throw new Error('missing: ' + id);\n return node;\n}\n\nfunction computeLinkBreadths({ nodes }) {\n for (const node of nodes) {\n let y0 = node.y0;\n let y1 = y0;\n for (const link of node.sourceLinks) {\n link.y0 = y0 + link.width / 2;\n y0 += link.width;\n }\n for (const link of node.targetLinks) {\n link.y1 = y1 + link.width / 2;\n y1 += link.width;\n }\n }\n}\n\nexport function Sankey() {\n let x0 = 0,\n y0 = 0,\n x1 = 1,\n y1 = 1; // extent\n let dx = 24; // nodeWidth\n let dy = 8,\n py; // nodePadding\n let id = defaultId;\n let align = justify;\n let depth;\n let sort;\n let linkSort;\n let nodes = defaultNodes;\n let links = defaultLinks;\n let iterations = 6;\n\n function sankey(arg) {\n const graph = {\n nodes: nodes(arg),\n links: links(arg),\n };\n computeNodeLinks(graph);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n computeNodeHeights(graph);\n computeNodeBreadths(graph);\n computeLinkBreadths(graph);\n return graph;\n }\n\n sankey.update = function (graph) {\n computeLinkBreadths(graph);\n return graph;\n };\n\n sankey.nodeId = function (_) {\n return arguments.length ? ((id = typeof _ === 'function' ? _ : constant(_)), sankey) : id;\n };\n\n sankey.nodeAlign = function (_) {\n return arguments.length ? ((align = typeof _ === 'function' ? _ : constant(_)), sankey) : align;\n };\n\n sankey.nodeDepth = function (_) {\n return arguments.length ? ((depth = typeof _ === 'function' ? _ : _), sankey) : depth;\n };\n\n sankey.nodeSort = function (_) {\n return arguments.length ? ((sort = _), sankey) : sort;\n };\n\n sankey.nodeWidth = function (_) {\n return arguments.length ? ((dx = +_), sankey) : dx;\n };\n\n sankey.nodePadding = function (_) {\n return arguments.length ? ((dy = py = +_), sankey) : dy;\n };\n\n sankey.nodes = function (_) {\n return arguments.length ? ((nodes = typeof _ === 'function' ? _ : constant(_)), sankey) : nodes;\n };\n\n sankey.links = function (_) {\n return arguments.length ? ((links = typeof _ === 'function' ? _ : constant(_)), sankey) : links;\n };\n\n sankey.linkSort = function (_) {\n return arguments.length ? ((linkSort = _), sankey) : linkSort;\n };\n\n sankey.size = function (_) {\n return arguments.length ? ((x0 = y0 = 0), (x1 = +_[0]), (y1 = +_[1]), sankey) : [x1 - x0, y1 - y0];\n };\n\n sankey.extent = function (_) {\n return arguments.length\n ? ((x0 = +_[0][0]), (x1 = +_[1][0]), (y0 = +_[0][1]), (y1 = +_[1][1]), sankey)\n : [\n [x0, y0],\n [x1, y1],\n ];\n };\n\n sankey.iterations = function (_) {\n return arguments.length ? ((iterations = +_), sankey) : iterations;\n };\n\n function computeNodeLinks({ nodes, links }) {\n nodes.forEach((node, idx) => {\n node.index = idx;\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n\n const nodeById = new Map(nodes.map((d) => [id(d), d]));\n\n links.forEach((link, idx) => {\n link.index = idx;\n let { source, target } = link;\n if (typeof source !== 'object') source = link.source = find(nodeById, source);\n if (typeof target !== 'object') target = link.target = find(nodeById, target);\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n\n if (linkSort != null) {\n for (const { sourceLinks, targetLinks } of nodes) {\n sourceLinks.sort(linkSort);\n targetLinks.sort(linkSort);\n }\n }\n }\n\n function computeNodeValues({ nodes }) {\n for (const node of nodes) {\n node.value =\n node.fixedValue === undefined\n ? Math.max(sumBy(node.sourceLinks, value), sumBy(node.targetLinks, value))\n : node.fixedValue;\n }\n }\n\n function computeNodeDepths({ nodes }) {\n const n = nodes.length;\n let current = new Set<any>(nodes);\n let next = new Set();\n let x = 0;\n while (current.size) {\n current.forEach((node) => {\n node.depth = x;\n for (const { target } of node.sourceLinks) {\n next.add(target);\n }\n });\n if (++x > n) throw new Error('circular link');\n current = next;\n next = new Set();\n }\n\n // 如果配置了 depth,则设置自定义 depth\n if (depth) {\n const maxDepth = Math.max(maxValueBy(nodes, (d: any) => d.depth) + 1, 0);\n\n let node;\n for (let i = 0; i < nodes.length; i++) {\n node = nodes[i];\n node.depth = depth.call(null, node, maxDepth);\n }\n }\n }\n\n function computeNodeHeights({ nodes }) {\n const n = nodes.length;\n let current = new Set<any>(nodes);\n let next = new Set();\n let x = 0;\n while (current.size) {\n current.forEach((node) => {\n node.height = x;\n for (const { source } of node.targetLinks) {\n next.add(source);\n }\n });\n if (++x > n) throw new Error('circular link');\n current = next;\n next = new Set();\n }\n }\n\n function computeNodeLayers({ nodes }) {\n const x = Math.max(maxValueBy(nodes, (d: any) => d.depth) + 1, 0);\n const kx = (x1 - x0 - dx) / (x - 1);\n const columns = new Array(x).fill(0).map(() => []);\n for (const node of nodes) {\n const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));\n node.layer = i;\n node.x0 = x0 + i * kx;\n node.x1 = node.x0 + dx;\n if (columns[i]) columns[i].push(node);\n else columns[i] = [node];\n }\n if (sort)\n for (const column of columns) {\n column.sort(sort);\n }\n return columns;\n }\n\n function initializeNodeBreadths(columns) {\n const ky = minValueBy(columns, (c: any[]) => (y1 - y0 - (c.length - 1) * py) / sumBy(c, value)) as any as number;\n for (const nodes of columns) {\n let y = y0;\n for (const node of nodes) {\n node.y0 = y;\n node.y1 = y + node.value * ky;\n y = node.y1 + py;\n for (const link of node.sourceLinks) {\n link.width = link.value * ky;\n }\n }\n y = (y1 - y + py) / (nodes.length + 1);\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n node.y0 += y * (i + 1);\n node.y1 += y * (i + 1);\n }\n reorderLinks(nodes);\n }\n }\n\n function computeNodeBreadths(graph) {\n const columns = computeNodeLayers(graph);\n py = Math.min(dy, (y1 - y0) / ((maxValueBy(columns, (c: any[]) => c.length) as any as number) - 1));\n initializeNodeBreadths(columns);\n for (let i = 0; i < iterations; ++i) {\n const alpha = Math.pow(0.99, i);\n const beta = Math.max(1 - alpha, (i + 1) / iterations);\n relaxRightToLeft(columns, alpha, beta);\n relaxLeftToRight(columns, alpha, beta);\n }\n }\n\n // Reposition each node based on its incoming (target) links.\n function relaxLeftToRight(columns, alpha, beta) {\n for (let i = 1, n = columns.length; i < n; ++i) {\n const column = columns[i];\n for (const target of column) {\n let y = 0;\n let w = 0;\n for (const { source, value } of target.targetLinks) {\n const v = value * (target.layer - source.layer);\n y += targetTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n const dy = (y / w - target.y0) * alpha;\n target.y0 += dy;\n target.y1 += dy;\n reorderNodeLinks(target);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n if (column.length) resolveCollisions(column, beta);\n }\n }\n\n // Reposition each node based on its outgoing (source) links.\n function relaxRightToLeft(columns, alpha, beta) {\n for (let n = columns.length, i = n - 2; i >= 0; --i) {\n const column = columns[i];\n for (const source of column) {\n let y = 0;\n let w = 0;\n for (const { target, value } of source.sourceLinks) {\n const v = value * (target.layer - source.layer);\n y += sourceTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n const dy = (y / w - source.y0) * alpha;\n source.y0 += dy;\n source.y1 += dy;\n reorderNodeLinks(source);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n if (column.length) resolveCollisions(column, beta);\n }\n }\n\n function resolveCollisions(nodes, alpha) {\n const i = nodes.length >> 1;\n const subject = nodes[i];\n resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);\n resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);\n resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);\n resolveCollisionsTopToBottom(nodes, y0, 0, alpha);\n }\n\n // Push any overlapping nodes down.\n function resolveCollisionsTopToBottom(nodes, y, i, alpha) {\n for (; i < nodes.length; ++i) {\n const node = nodes[i];\n const dy = (y - node.y0) * alpha;\n if (dy > 1e-6) (node.y0 += dy), (node.y1 += dy);\n y = node.y1 + py;\n }\n }\n\n // Push any overlapping nodes up.\n function resolveCollisionsBottomToTop(nodes, y, i, alpha) {\n for (; i >= 0; --i) {\n const node = nodes[i];\n const dy = (node.y1 - y) * alpha;\n if (dy > 1e-6) (node.y0 -= dy), (node.y1 -= dy);\n y = node.y0 - py;\n }\n }\n\n function reorderNodeLinks({ sourceLinks, targetLinks }) {\n if (linkSort === undefined) {\n for (const {\n source: { sourceLinks },\n } of targetLinks) {\n sourceLinks.sort(ascendingTargetBreadth);\n }\n for (const {\n target: { targetLinks },\n } of sourceLinks) {\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n function reorderLinks(nodes) {\n if (linkSort === undefined) {\n for (const { sourceLinks, targetLinks } of nodes) {\n sourceLinks.sort(ascendingTargetBreadth);\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n // Returns the target.y0 that would produce an ideal link from source to target.\n function targetTop(source, target) {\n let y = source.y0 - ((source.sourceLinks.length - 1) * py) / 2;\n for (const { target: node, width } of source.sourceLinks) {\n if (node === target) break;\n y += width + py;\n }\n for (const { source: node, width } of target.targetLinks) {\n if (node === source) break;\n y -= width;\n }\n return y;\n }\n\n // Returns the source.y0 that would produce an ideal link from source to target.\n function sourceTop(source, target) {\n let y = target.y0 - ((target.targetLinks.length - 1) * py) / 2;\n for (const { source: node, width } of target.targetLinks) {\n if (node === source) break;\n y += width + py;\n }\n for (const { target: node, width } of source.sourceLinks) {\n if (node === target) break;\n y -= width;\n }\n return y;\n }\n\n return sankey;\n}\n"]}
|