@antv/g2plot 2.4.26 → 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 -2
- 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 +5 -5
- 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 +12 -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/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 -1669
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ShapeAttrs } from '@antv/g-base';
|
|
2
|
+
import { GeometryOptions } from '../../adaptor/geometries';
|
|
2
3
|
import { Options } from '../../types';
|
|
3
4
|
import { BarOptions } from '../bar';
|
|
4
5
|
/** 配置类型定义 */
|
|
5
|
-
export interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'> {
|
|
6
|
+
export interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'>, Pick<GeometryOptions, 'customInfo'> {
|
|
6
7
|
/**
|
|
7
8
|
* @title x轴字段
|
|
8
9
|
*/
|
|
@@ -54,4 +55,9 @@ export interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackgrou
|
|
|
54
55
|
* @default false
|
|
55
56
|
*/
|
|
56
57
|
readonly isGroup?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @title 自定义玉珏图
|
|
60
|
+
* @description interval/line 图形元素展示形状
|
|
61
|
+
*/
|
|
62
|
+
readonly shape?: string;
|
|
57
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radial-bar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g-base';\nimport { Options } from '../../types';\nimport { BarOptions } from '../bar';\n\n/** 配置类型定义 */\nexport interface RadialBarOptions
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radial-bar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g-base';\nimport { GeometryOptions } from '../../adaptor/geometries';\nimport { Options } from '../../types';\nimport { BarOptions } from '../bar';\n\n/** 配置类型定义 */\nexport interface RadialBarOptions\n extends Options,\n Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'>,\n Pick<GeometryOptions, 'customInfo'> {\n /**\n * @title x轴字段\n */\n readonly xField?: string;\n /**\n * @title y轴字段\n */\n readonly yField?: string;\n /**\n * @title 样式\n */\n readonly barStyle?: ShapeAttrs;\n /**\n * @title 最大旋转角度\n * @description 范围0-360\n */\n readonly maxAngle?: number;\n /**\n * @title 圆半径\n */\n readonly radius?: number;\n /**\n * @title 圆内半径\n */\n readonly innerRadius?: number;\n /**\n * @title 圆环的开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 圆环的结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 颜色字段\n */\n readonly colorField?: string;\n /**\n * @title 类型\n */\n readonly type?: string;\n /**\n * @title 是否叠加\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 是否分组\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 自定义玉珏图\n * @description interval/line 图形元素展示形状\n */\n readonly shape?: string;\n}\n"]}
|
|
@@ -31,14 +31,14 @@ function statistic(params, updated) {
|
|
|
31
31
|
chart.getController('annotation').clear(true);
|
|
32
32
|
/** 中心文本 指标卡 */
|
|
33
33
|
if (innerRadius && statistic) {
|
|
34
|
-
var metaFormatter = util_1.get(meta, ['percent', 'formatter']) || (function (v) { return (v * 100).toFixed(2)
|
|
34
|
+
var metaFormatter = (0, util_1.get)(meta, ['percent', 'formatter']) || (function (v) { return "".concat((v * 100).toFixed(2), "%"); });
|
|
35
35
|
var contentOpt = statistic.content;
|
|
36
36
|
if (contentOpt) {
|
|
37
|
-
contentOpt = utils_1.deepAssign({}, contentOpt, {
|
|
38
|
-
content: !util_1.isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),
|
|
37
|
+
contentOpt = (0, utils_1.deepAssign)({}, contentOpt, {
|
|
38
|
+
content: !(0, util_1.isNil)(contentOpt.content) ? contentOpt.content : metaFormatter(percent),
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
utils_1.renderStatistic(chart, { statistic: tslib_1.__assign(tslib_1.__assign({}, statistic), { content: contentOpt }), plotType: 'ring-progress' }, { percent: percent });
|
|
41
|
+
(0, utils_1.renderStatistic)(chart, { statistic: tslib_1.__assign(tslib_1.__assign({}, statistic), { content: contentOpt }), plotType: 'ring-progress' }, { percent: percent });
|
|
42
42
|
}
|
|
43
43
|
if (updated) {
|
|
44
44
|
chart.render(true);
|
|
@@ -52,7 +52,7 @@ exports.statistic = statistic;
|
|
|
52
52
|
* @param options
|
|
53
53
|
*/
|
|
54
54
|
function adaptor(params) {
|
|
55
|
-
return utils_1.flow(adaptor_1.geometry, common_1.scale({}), coordinate, statistic, common_1.animation, common_1.theme, common_1.annotation())(params);
|
|
55
|
+
return (0, utils_1.flow)(adaptor_1.geometry, (0, common_1.scale)({}), coordinate, statistic, common_1.animation, common_1.theme, (0, common_1.annotation)())(params);
|
|
56
56
|
}
|
|
57
57
|
exports.adaptor = adaptor;
|
|
58
58
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/ring-progress/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAwC;AACxC,+CAA2E;AAE3E,qCAAgE;AAChE,+CAA+C;AAG/C;;;GAGG;AACH,SAAS,UAAU,CAAC,MAAmC;IAC7C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,WAAW,GAAa,OAAO,YAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAExC,aAAa;IACb,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE;QACxB,WAAW,aAAA;QACX,MAAM,QAAA;KACP,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAmC,EAAE,OAAiB;IACtE,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,WAAW,GAA+B,OAAO,YAAtC,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S,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,UAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,EAA1B,CAA0B,CAAC,CAAC;QACjG,IAAI,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC;QACnC,IAAI,UAAU,EAAE;YACd,UAAU,GAAG,IAAA,kBAAU,EAAC,EAAE,EAAE,UAAU,EAAE;gBACtC,OAAO,EAAE,CAAC,IAAA,YAAK,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;aAClF,CAAC,CAAC;SACJ;QACD,IAAA,uBAAe,EACb,KAAK,EACL,EAAE,SAAS,wCAAO,SAAS,KAAE,OAAO,EAAE,UAAU,GAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,EAC/E,EAAE,OAAO,SAAA,EAAE,CACZ,CAAC;KACH;IAED,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA5BD,8BA4BC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAAmC;IACzD,OAAO,IAAA,YAAI,EAAC,kBAAQ,EAAE,IAAA,cAAK,EAAC,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAS,EAAE,cAAK,EAAE,IAAA,mBAAU,GAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AAClG,CAAC;AAFD,0BAEC","sourcesContent":["import { get, isNil } from '@antv/util';\nimport { animation, annotation, scale, theme } from '../../adaptor/common';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, renderStatistic } from '../../utils';\nimport { geometry } from '../progress/adaptor';\nimport { RingProgressOptions } from './types';\n\n/**\n * coordinate 配置\n * @param params\n */\nfunction coordinate(params: Params<RingProgressOptions>): Params<RingProgressOptions> {\n const { chart, options } = params;\n const { innerRadius, radius } = options;\n\n // coordinate\n chart.coordinate('theta', {\n innerRadius,\n radius,\n });\n\n return params;\n}\n\n/**\n * statistic 配置\n * @param params\n */\nexport function statistic(params: Params<RingProgressOptions>, updated?: boolean): Params<RingProgressOptions> {\n const { chart, options } = params;\n const { innerRadius, statistic, percent, meta } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n /** 中心文本 指标卡 */\n if (innerRadius && statistic) {\n const metaFormatter = get(meta, ['percent', 'formatter']) || ((v) => `${(v * 100).toFixed(2)}%`);\n let contentOpt = statistic.content;\n if (contentOpt) {\n contentOpt = deepAssign({}, contentOpt, {\n content: !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),\n });\n }\n renderStatistic(\n chart,\n { statistic: { ...statistic, content: contentOpt }, plotType: 'ring-progress' },\n { percent }\n );\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * 环形进度图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<RingProgressOptions>) {\n return flow(geometry, scale({}), coordinate, statistic, animation, theme, annotation())(params);\n}\n"]}
|
|
@@ -29,9 +29,9 @@ var RingProgress = /** @class */ (function (_super) {
|
|
|
29
29
|
RingProgress.prototype.changeData = function (percent) {
|
|
30
30
|
this.chart.emit(g2_1.VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, g2_1.Event.fromData(this.chart, g2_1.VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
|
|
31
31
|
this.updateOption({ percent: percent });
|
|
32
|
-
this.chart.data(utils_1.getProgressData(percent));
|
|
32
|
+
this.chart.data((0, utils_1.getProgressData)(percent));
|
|
33
33
|
// todo 后续让 G2 层在 afterrender 之后,来重绘 annotations
|
|
34
|
-
adaptor_1.statistic({ chart: this.chart, options: this.options }, true);
|
|
34
|
+
(0, adaptor_1.statistic)({ chart: this.chart, options: this.options }, true);
|
|
35
35
|
this.chart.emit(g2_1.VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, g2_1.Event.fromData(this.chart, g2_1.VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
|
|
36
36
|
};
|
|
37
37
|
RingProgress.prototype.getDefaultOptions = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/ring-progress/index.ts"],"names":[],"mappings":";;;;AAAA,+BAAmD;AAEnD,wCAAuC;AACvC,2CAAoD;AACpD,qCAA+C;AAC/C,yCAA8C;AAK9C;IAAkC,wCAAyB;IAA3D;QAAA,qEA2CC;QAlCC,WAAW;QACJ,UAAI,GAAW,cAAc,CAAC;;IAiCvC,CAAC;IA1CC;;;OAGG;IACI,8BAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;;OAGG;IACI,iCAAU,GAAjB,UAAkB,OAAe;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,qBAAgB,CAAC,kBAAkB,EACnC,UAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CACtE,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/ring-progress/index.ts"],"names":[],"mappings":";;;;AAAA,+BAAmD;AAEnD,wCAAuC;AACvC,2CAAoD;AACpD,qCAA+C;AAC/C,yCAA8C;AAK9C;IAAkC,wCAAyB;IAA3D;QAAA,qEA2CC;QAlCC,WAAW;QACJ,UAAI,GAAW,cAAc,CAAC;;IAiCvC,CAAC;IA1CC;;;OAGG;IACI,8BAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;;OAGG;IACI,iCAAU,GAAjB,UAAkB,OAAe;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,qBAAgB,CAAC,kBAAkB,EACnC,UAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CACtE,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,uBAAe,EAAC,OAAO,CAAC,CAAC,CAAC;QAC1C,gDAAgD;QAChD,IAAA,mBAAS,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;QAE9D,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,qBAAgB,CAAC,iBAAiB,EAClC,UAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAgB,CAAC,iBAAiB,EAAE,IAAI,CAAC,CACrE,CAAC;IACJ,CAAC;IAES,wCAAiB,GAA3B;QACE,OAAO,YAAY,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,uCAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,mBAAC;AAAD,CAAC,AA3CD,CAAkC,WAAI,GA2CrC;AA3CY,oCAAY","sourcesContent":["import { Event, VIEW_LIFE_CIRCLE } from '@antv/g2';\nimport { Adaptor } from '../../core/adaptor';\nimport { Plot } from '../../core/plot';\nimport { getProgressData } from '../progress/utils';\nimport { adaptor, statistic } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\nimport { RingProgressOptions } from './types';\n\nexport type { RingProgressOptions };\n\nexport class RingProgress extends Plot<RingProgressOptions> {\n /**\n * 获取默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<RingProgressOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public type: string = 'ring-process';\n\n /**\n * 更新数据\n * @param percent\n */\n public changeData(percent: number) {\n this.chart.emit(\n VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA,\n Event.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null)\n );\n this.updateOption({ percent });\n\n this.chart.data(getProgressData(percent));\n // todo 后续让 G2 层在 afterrender 之后,来重绘 annotations\n statistic({ chart: this.chart, options: this.options }, true);\n\n this.chart.emit(\n VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA,\n Event.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null)\n );\n }\n\n protected getDefaultOptions() {\n return RingProgress.getDefaultOptions();\n }\n\n /**\n * 获取 环形进度图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<RingProgressOptions> {\n return adaptor;\n }\n}\n"]}
|
|
@@ -12,15 +12,16 @@ var utils_1 = require("../../utils");
|
|
|
12
12
|
*/
|
|
13
13
|
function geometry(params) {
|
|
14
14
|
var chart = params.chart, options = params.options;
|
|
15
|
-
var data = options.data, sectorStyle = options.sectorStyle, color = options.color;
|
|
15
|
+
var data = options.data, sectorStyle = options.sectorStyle, shape = options.shape, color = options.color;
|
|
16
16
|
// 装载数据
|
|
17
17
|
chart.data(data);
|
|
18
|
-
utils_1.flow(geometries_1.interval)(utils_1.deepAssign({}, params, {
|
|
18
|
+
(0, utils_1.flow)(geometries_1.interval)((0, utils_1.deepAssign)({}, params, {
|
|
19
19
|
options: {
|
|
20
20
|
marginRatio: 1,
|
|
21
21
|
interval: {
|
|
22
22
|
style: sectorStyle,
|
|
23
23
|
color: color,
|
|
24
|
+
shape: shape,
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
}));
|
|
@@ -33,30 +34,30 @@ function geometry(params) {
|
|
|
33
34
|
function label(params) {
|
|
34
35
|
var chart = params.chart, options = params.options;
|
|
35
36
|
var label = options.label, xField = options.xField;
|
|
36
|
-
var geometry = utils_1.findGeometry(chart, 'interval');
|
|
37
|
+
var geometry = (0, utils_1.findGeometry)(chart, 'interval');
|
|
37
38
|
// label 为 false 不显示 label
|
|
38
39
|
if (label === false) {
|
|
39
40
|
geometry.label(false);
|
|
40
41
|
}
|
|
41
|
-
else if (util_1.isObject(label)) {
|
|
42
|
+
else if ((0, util_1.isObject)(label)) {
|
|
42
43
|
var callback = label.callback, fields = label.fields, cfg = tslib_1.__rest(label, ["callback", "fields"]);
|
|
43
44
|
var offset = cfg.offset;
|
|
44
45
|
var layout = cfg.layout;
|
|
45
46
|
// 当 label 在 shape 外部显示时,设置 'limit-in-shape' 会
|
|
46
47
|
// 造成 label 不显示。
|
|
47
48
|
if (offset === undefined || offset >= 0) {
|
|
48
|
-
layout = layout ? (util_1.isArray(layout) ? layout : [layout]) : [];
|
|
49
|
-
cfg.layout = util_1.filter(layout, function (v) { return v.type !== 'limit-in-shape'; });
|
|
49
|
+
layout = layout ? ((0, util_1.isArray)(layout) ? layout : [layout]) : [];
|
|
50
|
+
cfg.layout = (0, util_1.filter)(layout, function (v) { return v.type !== 'limit-in-shape'; });
|
|
50
51
|
cfg.layout.length || delete cfg.layout;
|
|
51
52
|
}
|
|
52
53
|
geometry.label({
|
|
53
54
|
fields: fields || [xField],
|
|
54
55
|
callback: callback,
|
|
55
|
-
cfg: utils_1.transformLabel(cfg),
|
|
56
|
+
cfg: (0, utils_1.transformLabel)(cfg),
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
|
-
utils_1.log(utils_1.LEVEL.WARN, label === null, 'the label option must be an Object.');
|
|
60
|
+
(0, utils_1.log)(utils_1.LEVEL.WARN, label === null, 'the label option must be an Object.');
|
|
60
61
|
geometry.label({ fields: [xField] });
|
|
61
62
|
}
|
|
62
63
|
return params;
|
|
@@ -103,7 +104,7 @@ function meta(params) {
|
|
|
103
104
|
var _a;
|
|
104
105
|
var options = params.options;
|
|
105
106
|
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField;
|
|
106
|
-
return utils_1.flow(common_1.scale((_a = {},
|
|
107
|
+
return (0, utils_1.flow)((0, common_1.scale)((_a = {},
|
|
107
108
|
_a[xField] = xAxis,
|
|
108
109
|
_a[yField] = yAxis,
|
|
109
110
|
_a)))(params);
|
|
@@ -137,7 +138,7 @@ function axis(params) {
|
|
|
137
138
|
*/
|
|
138
139
|
function adaptor(params) {
|
|
139
140
|
// flow 的方式处理所有的配置到 G2 API
|
|
140
|
-
utils_1.flow(common_1.pattern('sectorStyle'), geometry, meta, label, coordinate, axis, legend, common_1.tooltip, common_1.interaction, common_1.animation, common_1.theme, common_1.annotation(), common_1.state)(params);
|
|
141
|
+
(0, utils_1.flow)((0, common_1.pattern)('sectorStyle'), geometry, meta, label, coordinate, axis, legend, common_1.tooltip, common_1.interaction, common_1.animation, common_1.theme, (0, common_1.annotation)(), common_1.state)(params);
|
|
141
142
|
}
|
|
142
143
|
exports.adaptor = adaptor;
|
|
143
144
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/rose/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAuD;AACvD,+CAAiH;AACjH,uDAAoD;AAEpD,qCAAyF;AAGzF;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA2B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/rose/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAuD;AACvD,+CAAiH;AACjH,uDAAoD;AAEpD,qCAAyF;AAGzF;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA2B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,I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,EAAE;QACV,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC3B;SAAM;QACL,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC3B;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA2B;IACjD,0BAA0B;IAC1B,IAAA,YAAI,EACF,IAAA,gBAAO,EAAC,aAAa,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,gBAAO,EACP,oBAAW,EACX,kBAAS,EACT,cAAK,EACL,IAAA,mBAAU,GAAE,EACZ,cAAK,CACN,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAjBD,0BAiBC","sourcesContent":["import { filter, isArray, isObject } from '@antv/util';\nimport { animation, annotation, interaction, pattern, scale, state, theme, tooltip } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, findGeometry, flow, LEVEL, log, transformLabel } from '../../utils';\nimport { RoseOptions } from './types';\n\n/**\n * geometry 配置处理\n * @param params\n */\nfunction geometry(params: Params<RoseOptions>): Params<RoseOptions> {\n const { chart, options } = params;\n const { data, sectorStyle, shape, color } = options;\n\n // 装载数据\n chart.data(data);\n\n flow(interval)(\n deepAssign({}, params, {\n options: {\n marginRatio: 1,\n interval: {\n style: sectorStyle,\n color,\n shape: shape,\n },\n },\n })\n );\n\n return params;\n}\n\n/**\n * label 配置\n * @param params\n */\nfunction label(params: Params<RoseOptions>): Params<RoseOptions> {\n const { chart, options } = params;\n const { label, xField } = options;\n const geometry = findGeometry(chart, 'interval');\n\n // label 为 false 不显示 label\n if (label === false) {\n geometry.label(false);\n } else if (isObject(label)) {\n const { callback, fields, ...cfg } = label;\n const { offset } = cfg;\n let layout = cfg.layout;\n\n // 当 label 在 shape 外部显示时,设置 'limit-in-shape' 会\n // 造成 label 不显示。\n if (offset === undefined || offset >= 0) {\n layout = layout ? (isArray(layout) ? layout : [layout]) : [];\n cfg.layout = filter(layout, (v) => v.type !== 'limit-in-shape');\n cfg.layout.length || delete cfg.layout;\n }\n\n geometry.label({\n fields: fields || [xField],\n callback,\n cfg: transformLabel(cfg),\n });\n } else {\n log(LEVEL.WARN, label === null, 'the label option must be an Object.');\n geometry.label({ fields: [xField] });\n }\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nexport function legend(params: Params<RoseOptions>): Params<RoseOptions> {\n const { chart, options } = params;\n const { legend, seriesField } = options;\n\n if (legend === false) {\n chart.legend(false);\n } else if (seriesField) {\n chart.legend(seriesField, legend);\n }\n\n return params;\n}\n\n/**\n * coord 配置\n * @param params\n */\nfunction coordinate(params: Params<RoseOptions>): Params<RoseOptions> {\n const { chart, options } = params;\n const { radius, innerRadius, startAngle, endAngle } = options;\n\n chart.coordinate({\n type: 'polar',\n cfg: {\n radius,\n innerRadius,\n startAngle,\n endAngle,\n },\n });\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<RoseOptions>): Params<RoseOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n return flow(\n scale({\n [xField]: xAxis,\n [yField]: yAxis,\n })\n )(params);\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<RoseOptions>): Params<RoseOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n // 为 falsy 则是不显示轴\n if (!xAxis) {\n chart.axis(xField, false);\n } else {\n chart.axis(xField, xAxis);\n }\n\n if (!yAxis) {\n chart.axis(yField, false);\n } else {\n chart.axis(yField, yAxis);\n }\n\n return params;\n}\n\n/**\n * 玫瑰图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<RoseOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n flow(\n pattern('sectorStyle'),\n geometry,\n meta,\n label,\n coordinate,\n axis,\n legend,\n tooltip,\n interaction,\n animation,\n theme,\n annotation(),\n state\n )(params);\n}\n"]}
|
|
@@ -6,7 +6,7 @@ var utils_1 = require("../../utils");
|
|
|
6
6
|
/**
|
|
7
7
|
* 玫瑰图 默认配置项
|
|
8
8
|
*/
|
|
9
|
-
exports.DEFAULT_OPTIONS = utils_1.deepAssign({}, plot_1.Plot.getDefaultOptions(), {
|
|
9
|
+
exports.DEFAULT_OPTIONS = (0, utils_1.deepAssign)({}, plot_1.Plot.getDefaultOptions(), {
|
|
10
10
|
xAxis: false,
|
|
11
11
|
yAxis: false,
|
|
12
12
|
legend: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/rose/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/rose/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,EAAE;KACV;IACD,WAAW,EAAE;QACX,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,CAAC;KACb;IACD,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,gBAAgB;SACvB;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;KACnB;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 玫瑰图 默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n xAxis: false,\n yAxis: false,\n legend: {\n position: 'right',\n radio: {},\n },\n sectorStyle: {\n stroke: '#fff',\n lineWidth: 1,\n },\n label: {\n layout: {\n type: 'limit-in-shape',\n },\n },\n tooltip: {\n shared: true,\n showMarkers: false,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { GeometryOptions, IntervalGeometryOptions } from '../../adaptor/geometries';
|
|
1
2
|
import { Options, StyleAttr } from '../../types';
|
|
2
|
-
export interface RoseOptions extends Options {
|
|
3
|
+
export interface RoseOptions extends Options, Pick<GeometryOptions, 'customInfo'> {
|
|
3
4
|
/**
|
|
4
5
|
* @title 扇形切片分类所对应的数据字段名
|
|
5
6
|
* @description 每个扇形的弧度相等
|
|
@@ -46,4 +47,9 @@ export interface RoseOptions extends Options {
|
|
|
46
47
|
* @description sectorStyle 中的fill会覆盖 color 的配置,sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式
|
|
47
48
|
*/
|
|
48
49
|
readonly sectorStyle?: StyleAttr;
|
|
50
|
+
/**
|
|
51
|
+
* @title 扇形自定义形状
|
|
52
|
+
* @description interval 图形元素展示形状
|
|
53
|
+
*/
|
|
54
|
+
readonly shape?: Required<IntervalGeometryOptions>['interval']['shape'];
|
|
49
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/rose/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface RoseOptions extends Options {\n /**\n * @title 扇形切片分类所对应的数据字段名\n * @description 每个扇形的弧度相等\n */\n readonly xField: string;\n /**\n * @title 扇形切片半径长度所对应的数据字段名\n */\n readonly yField: string;\n /**\n * @title 拆分字段\n */\n readonly seriesField?: string;\n /**\n * @title 是否分组玫瑰图\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 是否堆积玫瑰图\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 玫瑰图的半径\n * @description 原点为画布中心。配置值域为 (0,1] 1 代表玫瑰图大小为 1,即撑满绘图区域\n */\n readonly radius?: number;\n /**\n * @title 内部空心圆的半径\n * @description 规则与 radius 一致\n */\n readonly innerRadius?: number;\n /**\n * @title 玫瑰图开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 玫瑰图结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 设置扇形样式\n * @description sectorStyle 中的fill会覆盖 color 的配置,sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式\n */\n readonly sectorStyle?: StyleAttr;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/rose/types.ts"],"names":[],"mappings":"","sourcesContent":["import { GeometryOptions, IntervalGeometryOptions } from '../../adaptor/geometries';\nimport { Options, StyleAttr } from '../../types';\n\nexport interface RoseOptions extends Options, Pick<GeometryOptions, 'customInfo'> {\n /**\n * @title 扇形切片分类所对应的数据字段名\n * @description 每个扇形的弧度相等\n */\n readonly xField: string;\n /**\n * @title 扇形切片半径长度所对应的数据字段名\n */\n readonly yField: string;\n /**\n * @title 拆分字段\n */\n readonly seriesField?: string;\n /**\n * @title 是否分组玫瑰图\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 是否堆积玫瑰图\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 玫瑰图的半径\n * @description 原点为画布中心。配置值域为 (0,1] 1 代表玫瑰图大小为 1,即撑满绘图区域\n */\n readonly radius?: number;\n /**\n * @title 内部空心圆的半径\n * @description 规则与 radius 一致\n */\n readonly innerRadius?: number;\n /**\n * @title 玫瑰图开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 玫瑰图结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 设置扇形样式\n * @description sectorStyle 中的fill会覆盖 color 的配置,sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式\n */\n readonly sectorStyle?: StyleAttr;\n /**\n * @title 扇形自定义形状\n * @description interval 图形元素展示形状\n */\n readonly shape?: Required<IntervalGeometryOptions>['interval']['shape'];\n}\n"]}
|
|
@@ -16,13 +16,13 @@ var helper_1 = require("./helper");
|
|
|
16
16
|
function defaultOptions(params) {
|
|
17
17
|
var options = params.options;
|
|
18
18
|
var _a = options.rawFields, rawFields = _a === void 0 ? [] : _a;
|
|
19
|
-
return utils_1.deepAssign({}, {
|
|
19
|
+
return (0, utils_1.deepAssign)({}, {
|
|
20
20
|
options: {
|
|
21
21
|
tooltip: {
|
|
22
|
-
fields: util_1.uniq(tslib_1.
|
|
22
|
+
fields: (0, util_1.uniq)(tslib_1.__spreadArray(['name', 'source', 'target', 'value', 'isNode'], rawFields, true)),
|
|
23
23
|
},
|
|
24
24
|
label: {
|
|
25
|
-
fields: util_1.uniq(tslib_1.
|
|
25
|
+
fields: (0, util_1.uniq)(tslib_1.__spreadArray(['x', 'name'], rawFields, true)),
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
}, params);
|
|
@@ -42,18 +42,18 @@ function geometry(params) {
|
|
|
42
42
|
chart.coordinate().reflect('y');
|
|
43
43
|
// 2. node edge views
|
|
44
44
|
// @ts-ignore
|
|
45
|
-
var _b = helper_1.transformToViewsData(options, chart.width, chart.height), nodes = _b.nodes, edges = _b.edges;
|
|
45
|
+
var _b = (0, helper_1.transformToViewsData)(options, chart.width, chart.height), nodes = _b.nodes, edges = _b.edges;
|
|
46
46
|
// edge view
|
|
47
47
|
var edgeView = chart.createView({ id: constant_1.EDGES_VIEW_ID });
|
|
48
48
|
edgeView.data(edges);
|
|
49
|
-
geometries_1.edge({
|
|
49
|
+
(0, geometries_1.edge)({
|
|
50
50
|
chart: edgeView,
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
options: {
|
|
53
53
|
xField: constant_1.X_FIELD,
|
|
54
54
|
yField: constant_1.Y_FIELD,
|
|
55
55
|
seriesField: constant_1.COLOR_FIELD,
|
|
56
|
-
rawFields: tslib_1.
|
|
56
|
+
rawFields: tslib_1.__spreadArray(['source', 'target'], rawFields, true),
|
|
57
57
|
edge: {
|
|
58
58
|
color: color,
|
|
59
59
|
style: edgeStyle,
|
|
@@ -65,7 +65,7 @@ function geometry(params) {
|
|
|
65
65
|
});
|
|
66
66
|
var nodeView = chart.createView({ id: constant_1.NODES_VIEW_ID });
|
|
67
67
|
nodeView.data(nodes);
|
|
68
|
-
geometries_1.polygon({
|
|
68
|
+
(0, geometries_1.polygon)({
|
|
69
69
|
chart: nodeView,
|
|
70
70
|
options: {
|
|
71
71
|
xField: constant_1.X_FIELD,
|
|
@@ -96,8 +96,8 @@ function geometry(params) {
|
|
|
96
96
|
function animation(params) {
|
|
97
97
|
var chart = params.chart, options = params.options;
|
|
98
98
|
var animation = options.animation;
|
|
99
|
-
var geometries = tslib_1.
|
|
100
|
-
view_1.addViewAnimation(chart, animation, geometries);
|
|
99
|
+
var geometries = tslib_1.__spreadArray(tslib_1.__spreadArray([], chart.views[0].geometries, true), chart.views[1].geometries, true);
|
|
100
|
+
(0, view_1.addViewAnimation)(chart, animation, geometries);
|
|
101
101
|
return params;
|
|
102
102
|
}
|
|
103
103
|
exports.animation = animation;
|
|
@@ -127,8 +127,8 @@ function interaction(params) {
|
|
|
127
127
|
var _a = options.interactions, interactions = _a === void 0 ? [] : _a;
|
|
128
128
|
var nodeInteractions = [].concat(interactions, options.nodeInteractions || []);
|
|
129
129
|
var edgeInteractions = [].concat(interactions, options.edgeInteractions || []);
|
|
130
|
-
var nodeView = utils_1.findViewById(chart, constant_1.NODES_VIEW_ID);
|
|
131
|
-
var edgeView = utils_1.findViewById(chart, constant_1.EDGES_VIEW_ID);
|
|
130
|
+
var nodeView = (0, utils_1.findViewById)(chart, constant_1.NODES_VIEW_ID);
|
|
131
|
+
var edgeView = (0, utils_1.findViewById)(chart, constant_1.EDGES_VIEW_ID);
|
|
132
132
|
nodeInteractions.forEach(function (i) {
|
|
133
133
|
if ((i === null || i === void 0 ? void 0 : i.enable) === false) {
|
|
134
134
|
nodeView.removeInteraction(i.type);
|
|
@@ -154,7 +154,7 @@ function interaction(params) {
|
|
|
154
154
|
*/
|
|
155
155
|
function adaptor(params) {
|
|
156
156
|
// flow 的方式处理所有的配置到 G2 API
|
|
157
|
-
return utils_1.flow(defaultOptions, geometry, interaction, nodeDraggable, animation, common_1.theme
|
|
157
|
+
return (0, utils_1.flow)(defaultOptions, geometry, interaction, nodeDraggable, animation, common_1.theme
|
|
158
158
|
// ... 其他的 adaptor flow
|
|
159
159
|
)(params);
|
|
160
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/sankey/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAkC;AAClC,+CAA6C;AAC7C,uDAAyD;AAEzD,qCAA6D;AAC7D,yCAAoD;AACpD,uCAAyF;AACzF,mCAAgD;AAGhD;;;GAGG;AACH,SAAS,cAAc,CAAC,MAA6B;IAC3C,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,KAAmB,OAAO,UAAZ,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAa;IAEnC,OAAO,kBAAU,
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/sankey/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAAkC;AAClC,+CAA6C;AAC7C,uDAAyD;AAEzD,qCAA6D;AAC7D,yCAAoD;AACpD,uCAAyF;AACzF,mCAAgD;AAGhD;;;GAGG;AACH,SAAS,cAAc,CAAC,MAA6B;IAC3C,IAAA,OAAO,GAAK,MAAM,QAAX,CAAY;IACnB,IAAA,KAAmB,OAAO,UAAZ,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAa;IAEnC,OAAO,IAAA,kBAAU,EACf,EA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{ uniq } from '@antv/util';\nimport { theme } from '../../adaptor/common';\nimport { edge, polygon } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, findViewById, flow } from '../../utils';\nimport { addViewAnimation } from '../../utils/view';\nimport { COLOR_FIELD, EDGES_VIEW_ID, NODES_VIEW_ID, X_FIELD, Y_FIELD } from './constant';\nimport { transformToViewsData } from './helper';\nimport { SankeyOptions } from './types';\n\n/**\n * 默认配置项 处理\n * @param params\n */\nfunction defaultOptions(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { options } = params;\n const { rawFields = [] } = options;\n\n return deepAssign(\n {},\n {\n options: {\n tooltip: {\n fields: uniq(['name', 'source', 'target', 'value', 'isNode', ...rawFields]),\n },\n label: {\n fields: uniq(['x', 'name', ...rawFields]),\n },\n },\n },\n params\n );\n}\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { color, nodeStyle, edgeStyle, label, tooltip, nodeState, edgeState, rawFields = [] } = options;\n\n // 1. 组件,优先设置,因为子 view 会继承配置\n chart.legend(false);\n chart.tooltip(tooltip);\n chart.axis(false);\n // y 镜像一下,防止图形顺序和数据顺序反了\n chart.coordinate().reflect('y');\n\n // 2. node edge views\n // @ts-ignore\n const { nodes, edges } = transformToViewsData(options, chart.width, chart.height);\n\n // edge view\n const edgeView = chart.createView({ id: EDGES_VIEW_ID });\n edgeView.data(edges);\n\n edge({\n chart: edgeView,\n // @ts-ignore\n options: {\n xField: X_FIELD,\n yField: Y_FIELD,\n seriesField: COLOR_FIELD,\n rawFields: ['source', 'target', ...rawFields],\n edge: {\n color,\n style: edgeStyle,\n shape: 'arc',\n },\n tooltip,\n state: edgeState,\n },\n });\n\n const nodeView = chart.createView({ id: NODES_VIEW_ID });\n nodeView.data(nodes);\n\n polygon({\n chart: nodeView,\n options: {\n xField: X_FIELD,\n yField: Y_FIELD,\n seriesField: COLOR_FIELD,\n polygon: {\n color,\n style: nodeStyle,\n },\n label,\n tooltip,\n state: nodeState,\n },\n });\n\n chart.interaction('element-active');\n\n // scale\n chart.scale({\n x: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },\n y: { sync: true, nice: true, min: 0, max: 1, minLimit: 0, maxLimit: 1 },\n name: { sync: 'color', type: 'cat' },\n });\n\n return params;\n}\n\n/**\n * 动画\n * @param params\n */\nexport function animation(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { animation } = options;\n\n const geometries = [...chart.views[0].geometries, ...chart.views[1].geometries];\n\n addViewAnimation(chart, animation, geometries);\n\n return params;\n}\n\n/**\n * 节点拖动\n * @param params\n */\nexport function nodeDraggable(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { nodeDraggable } = options;\n\n const DRAG_INTERACTION = 'sankey-node-draggable';\n\n if (nodeDraggable) {\n chart.interaction(DRAG_INTERACTION);\n } else {\n chart.removeInteraction(DRAG_INTERACTION);\n }\n\n return params;\n}\n\n/**\n * Interaction 配置\n * @param params\n */\nfunction interaction(params: Params<SankeyOptions>): Params<SankeyOptions> {\n const { chart, options } = params;\n const { interactions = [] } = options;\n\n const nodeInteractions = [].concat(interactions, options.nodeInteractions || []);\n const edgeInteractions = [].concat(interactions, options.edgeInteractions || []);\n\n const nodeView = findViewById(chart, NODES_VIEW_ID);\n const edgeView = findViewById(chart, EDGES_VIEW_ID);\n\n nodeInteractions.forEach((i) => {\n if (i?.enable === false) {\n nodeView.removeInteraction(i.type);\n } else {\n nodeView.interaction(i.type, i.cfg || {});\n }\n });\n\n edgeInteractions.forEach((i) => {\n if (i?.enable === false) {\n edgeView.removeInteraction(i.type);\n } else {\n edgeView.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<SankeyOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n defaultOptions,\n geometry,\n interaction,\n nodeDraggable,\n animation,\n theme\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
|
|
@@ -44,7 +44,7 @@ exports.getMatrix = getMatrix;
|
|
|
44
44
|
* @param targetField
|
|
45
45
|
*/
|
|
46
46
|
function cutoffCircle(edges, sourceField, targetField) {
|
|
47
|
-
if (!util_1.isArray(edges))
|
|
47
|
+
if (!(0, util_1.isArray)(edges))
|
|
48
48
|
return [];
|
|
49
49
|
// 待删除的环状结构
|
|
50
50
|
var removedData = [];
|
|
@@ -67,7 +67,7 @@ function cutoffCircle(edges, sourceField, targetField) {
|
|
|
67
67
|
// 当前节点在访问中,再次被访问,证明有环,移动到 removeData
|
|
68
68
|
if (visited[node] == 1) {
|
|
69
69
|
// 拼接为字符串,方便最后过滤
|
|
70
|
-
removedData.push(dfsNode
|
|
70
|
+
removedData.push("".concat(dfsNode, "_").concat(node));
|
|
71
71
|
}
|
|
72
72
|
else if (visited[node] == -1) {
|
|
73
73
|
// 当前结点及后边的结点都被访问过,直接跳至下一个结点
|
|
@@ -90,10 +90,10 @@ function cutoffCircle(edges, sourceField, targetField) {
|
|
|
90
90
|
DFS(node);
|
|
91
91
|
});
|
|
92
92
|
if (removedData.length !== 0) {
|
|
93
|
-
console.warn("sankey data contains circle, "
|
|
93
|
+
console.warn("sankey data contains circle, ".concat(removedData.length, " records removed."), removedData);
|
|
94
94
|
}
|
|
95
95
|
// 过滤 remove 路径
|
|
96
|
-
return edges.filter(function (edge) { return removedData.findIndex(function (i) { return i === edge[sourceField]
|
|
96
|
+
return edges.filter(function (edge) { return removedData.findIndex(function (i) { return i === "".concat(edge[sourceField], "_").concat(edge[targetField]); }) < 0; });
|
|
97
97
|
}
|
|
98
98
|
exports.cutoffCircle = cutoffCircle;
|
|
99
99
|
//# sourceMappingURL=circle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../src/plots/sankey/circle.ts"],"names":[],"mappings":";;;AAAA,m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AAC;IAED,iBAAiB;IACjB,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;QACjB,oBAAoB;QACpB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;YACvB,OAAO;SACR;QACD,GAAG,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,CAAC,IAAI,CAAC,uCAAgC,WAAW,CAAC,MAAM,sBAAmB,EAAE,WAAW,CAAC,CAAC;KAClG;IAED,eAAe;IACf,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,WAAW,CAAC,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,KAAK,UAAG,IAAI,CAAC,WAAW,CAAC,cAAI,IAAI,CAAC,WAAW,CAAC,CAAE,EAAjD,CAAiD,CAAC,GAAG,CAAC,EAAnF,CAAmF,CAAC,CAAC;AACrH,CAAC;AAvDD,oCAuDC","sourcesContent":["import { isArray } from '@antv/util';\nimport { Data } from '../../types';\n\n/**\n * 根据 edges 获取对应的 node 结构\n */\nexport function getNodes(edges: Data, sourceField: string, targetField: string): string[] {\n const nodes = [];\n edges.forEach((e) => {\n const source = e[sourceField] as string;\n const target = e[targetField] as string;\n if (!nodes.includes(source)) {\n nodes.push(source);\n }\n if (!nodes.includes(target)) {\n nodes.push(target);\n }\n });\n return nodes;\n}\n\n/**\n * 根据 edges 获取对应的 dfs 邻接矩阵\n */\nexport function getMatrix(\n edges: Data,\n nodes: string[],\n sourceField: string,\n targetField: string\n): Record<string, Record<string, number>> {\n const graphMatrix = {};\n\n nodes.forEach((pre) => {\n graphMatrix[pre] = {};\n nodes.forEach((next) => {\n graphMatrix[pre][next] = 0;\n });\n });\n\n edges.forEach((edge) => {\n graphMatrix[edge[sourceField]][edge[targetField]] = 1;\n });\n\n return graphMatrix;\n}\n\n/**\n * 使用 DFS 思路切断桑基图数据中的环(会丢失数据),保证顺序\n * @param data\n * @param sourceField\n * @param targetField\n */\nexport function cutoffCircle(edges: Data, sourceField: string, targetField: string): Data {\n if (!isArray(edges)) return [];\n\n // 待删除的环状结构\n const removedData = [];\n\n // 获取所有的节点\n const nodes = getNodes(edges, sourceField, targetField);\n // 获取节点与边的邻接矩阵\n const graphMatrix = getMatrix(edges, nodes, sourceField, targetField);\n\n // visited:标记节点访问状态, 0:未访问,1:访问中, -1:已访问\n const visited = {};\n // 初始化visited\n nodes.forEach((node) => {\n visited[node] = 0;\n });\n\n // 图的深度遍历函数\n function DFS(dfsNode) {\n // 节点状态置为正在访问\n visited[dfsNode] = 1;\n nodes.forEach((node) => {\n if (graphMatrix[dfsNode][node] != 0) {\n // 当前节点在访问中,再次被访问,证明有环,移动到 removeData\n if (visited[node] == 1) {\n // 拼接为字符串,方便最后过滤\n removedData.push(`${dfsNode}_${node}`);\n } else if (visited[node] == -1) {\n // 当前结点及后边的结点都被访问过,直接跳至下一个结点\n return;\n } else {\n DFS(node); // 否则递归访问\n }\n }\n });\n //遍历过所有相连的结点后,把本节点标记为-1\n visited[dfsNode] = -1;\n }\n\n // 对每个节点执行 dfs 操作\n nodes.forEach((node) => {\n //该结点后边的结点都被访问过了,跳过它\n if (visited[node] == -1) {\n return;\n }\n DFS(node);\n });\n\n if (removedData.length !== 0) {\n console.warn(`sankey data contains circle, ${removedData.length} records removed.`, removedData);\n }\n\n // 过滤 remove 路径\n return edges.filter((edge) => removedData.findIndex((i) => i === `${edge[sourceField]}_${edge[targetField]}`) < 0);\n}\n"]}
|
|
@@ -15,11 +15,11 @@ function isNodeLink(dataType) {
|
|
|
15
15
|
return dataType === 'node-link';
|
|
16
16
|
}
|
|
17
17
|
function getNodeWidthRatio(nodeWidth, nodeWidthRatio, width) {
|
|
18
|
-
return utils_1.isRealNumber(nodeWidth) ? nodeWidth / width : nodeWidthRatio;
|
|
18
|
+
return (0, utils_1.isRealNumber)(nodeWidth) ? nodeWidth / width : nodeWidthRatio;
|
|
19
19
|
}
|
|
20
20
|
exports.getNodeWidthRatio = getNodeWidthRatio;
|
|
21
21
|
function getNodePaddingRatio(nodePadding, nodePaddingRatio, height) {
|
|
22
|
-
return utils_1.isRealNumber(nodePadding) ? nodePadding / height : nodePaddingRatio;
|
|
22
|
+
return (0, utils_1.isRealNumber)(nodePadding) ? nodePadding / height : nodePaddingRatio;
|
|
23
23
|
}
|
|
24
24
|
exports.getNodePaddingRatio = getNodePaddingRatio;
|
|
25
25
|
/**
|
|
@@ -32,13 +32,13 @@ function transformToViewsData(options, width, height) {
|
|
|
32
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
33
|
var sankeyLayoutInputData;
|
|
34
34
|
if (!isNodeLink(dataType)) {
|
|
35
|
-
sankeyLayoutInputData = data_1.transformDataToNodeLinkData(circle_1.cutoffCircle(data, sourceField, targetField), sourceField, targetField, weightField, rawFields);
|
|
35
|
+
sankeyLayoutInputData = (0, data_1.transformDataToNodeLinkData)((0, circle_1.cutoffCircle)(data, sourceField, targetField), sourceField, targetField, weightField, rawFields);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
sankeyLayoutInputData = data;
|
|
39
39
|
}
|
|
40
40
|
// 3. layout 之后的数据
|
|
41
|
-
var _b = layout_1.sankeyLayout({
|
|
41
|
+
var _b = (0, layout_1.sankeyLayout)({
|
|
42
42
|
nodeAlign: nodeAlign,
|
|
43
43
|
nodePadding: getNodePaddingRatio(nodePadding, nodePaddingRatio, height),
|
|
44
44
|
nodeWidth: getNodeWidthRatio(nodeWidth, nodeWidthRatio, width),
|
|
@@ -48,10 +48,10 @@ function transformToViewsData(options, width, height) {
|
|
|
48
48
|
// 4. 生成绘图数据
|
|
49
49
|
return {
|
|
50
50
|
nodes: nodes.map(function (node) {
|
|
51
|
-
return tslib_1.__assign(tslib_1.__assign({}, utils_1.pick(node, tslib_1.
|
|
51
|
+
return tslib_1.__assign(tslib_1.__assign({}, (0, utils_1.pick)(node, tslib_1.__spreadArray(['x', 'y', 'name'], rawFields, true))), { isNode: true });
|
|
52
52
|
}),
|
|
53
53
|
edges: links.map(function (link) {
|
|
54
|
-
return tslib_1.__assign(tslib_1.__assign({ source: link.source.name, target: link.target.name, name: link.source.name || link.target.name }, utils_1.pick(link, tslib_1.
|
|
54
|
+
return tslib_1.__assign(tslib_1.__assign({ source: link.source.name, target: link.target.name, name: link.source.name || link.target.name }, (0, utils_1.pick)(link, tslib_1.__spreadArray(['x', 'y', 'value'], rawFields, true))), { isNode: false });
|
|
55
55
|
}),
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";;;;AACA,qCAAiD;AACjD,yCAA+D;AAC/D,mCAAwC;AACxC,mCAA+D;AAG/D;;;;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,
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/plots/sankey/helper.ts"],"names":[],"mappings":";;;;AACA,qCAAiD;AACjD,yCAA+D;AAC/D,mCAAwC;AACxC,mCAA+D;AAG/D;;;;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,IAAA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AS,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,IAAA,YAAI,EAAC,IAAI,yBAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAK,SAAS,QAAE,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,IAAA,YAAI,EAAC,IAAI,yBAAG,GAAG,EAAE,GAAG,EAAE,OAAO,GAAK,SAAS,QAAE,KAChD,MAAM,EAAE,KAAK,IACb;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AA7DD,oDA6DC","sourcesContent":["import { Data } from '../../types';\nimport { isRealNumber, pick } from '../../utils';\nimport { transformDataToNodeLinkData } from '../../utils/data';\nimport { cutoffCircle } from './circle';\nimport { sankeyLayout, SankeyLayoutInputData } from './layout';\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"]}
|
|
@@ -69,7 +69,7 @@ var Sankey = /** @class */ (function (_super) {
|
|
|
69
69
|
shared: false,
|
|
70
70
|
// 内置:node 不显示 tooltip,edge 显示 tooltip
|
|
71
71
|
showContent: function (items) {
|
|
72
|
-
return !util_1.get(items, [0, 'data', 'isNode']);
|
|
72
|
+
return !(0, util_1.get)(items, [0, 'data', 'isNode']);
|
|
73
73
|
},
|
|
74
74
|
formatter: function (datum) {
|
|
75
75
|
var source = datum.source, target = datum.target, value = datum.value;
|
|
@@ -97,9 +97,9 @@ var Sankey = /** @class */ (function (_super) {
|
|
|
97
97
|
*/
|
|
98
98
|
Sankey.prototype.changeData = function (data) {
|
|
99
99
|
this.updateOption({ data: data });
|
|
100
|
-
var _a = helper_1.transformToViewsData(this.options, this.chart.width, this.chart.height), nodes = _a.nodes, edges = _a.edges;
|
|
101
|
-
var nodesView = utils_1.findViewById(this.chart, constant_1.NODES_VIEW_ID);
|
|
102
|
-
var edgesView = utils_1.findViewById(this.chart, constant_1.EDGES_VIEW_ID);
|
|
100
|
+
var _a = (0, helper_1.transformToViewsData)(this.options, this.chart.width, this.chart.height), nodes = _a.nodes, edges = _a.edges;
|
|
101
|
+
var nodesView = (0, utils_1.findViewById)(this.chart, constant_1.NODES_VIEW_ID);
|
|
102
|
+
var edgesView = (0, utils_1.findViewById)(this.chart, constant_1.EDGES_VIEW_ID);
|
|
103
103
|
nodesView.changeData(nodes);
|
|
104
104
|
edgesView.changeData(edges);
|
|
105
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/sankey/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAiC;AAEjC,wCAAuC;AAEvC,qCAA2C;AAC3C,qCAAoC;AACpC,uCAA0D;AAC1D,mCAAgD;AAChD,UAAU;AACV,0BAAwB;AAKxB;;GAEG;AACH;IAA4B,kCAAmB;IAA/C;QAAA,qEAqGC;QApGC,WAAW;QACJ,UAAI,GAAW,QAAQ,CAAC;;IAmGjC,CAAC;IAjGQ,wBAAiB,GAAxB;QACE,OAAO;YACL,aAAa,EAAE,CAAC;YAChB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE;gBACT,OAAO,EAAE,CAAC;gBACV,WAAW,EAAE,CAAC;gBACd,SAAS,EAAE,CAAC;aACb;YACD,SAAS,EAAE;gBACT,OAAO,EAAE,GAAG;gBACZ,SAAS,EAAE,CAAC;aACb;YACD,SAAS,EAAE;gBACT,MAAM,EAAE;oBACN,KAAK,EAAE;wBACL,OAAO,EAAE,GAAG;wBACZ,SAAS,EA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;YACtB,SAAS,EAAE;gBACT,MAAM,EAAE;oBACN,SAAS,EAAE,SAAS;iBACrB;gBACD,KAAK,EAAE;oBACL,SAAS,EAAE,SAAS;iBACrB;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,2BAAU,GAAjB,UAAkB,IAAU;QAC1B,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QAEtB,IAAA,KAAmB,IAAA,6BAAoB,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAxF,KAAK,WAAA,EAAE,KAAK,WAA4E,CAAC;QAEjG,IAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,EAAE,wBAAa,CAAC,CAAC;QAC1D,IAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,EAAE,wBAAa,CAAC,CAAC;QAE1D,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC5B,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACO,iCAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,kCAAiB,GAA3B;QACE,OAAO,MAAM,CAAC,iBAAiB,EAAE,CAAC;IACpC,CAAC;IACH,aAAC;AAAD,CAAC,AArGD,CAA4B,WAAI,GAqG/B;AArGY,wBAAM","sourcesContent":["import { get } from '@antv/util';\nimport { Adaptor } from '../../core/adaptor';\nimport { Plot } from '../../core/plot';\nimport { Data, Datum } from '../../types';\nimport { findViewById } from '../../utils';\nimport { adaptor } from './adaptor';\nimport { EDGES_VIEW_ID, NODES_VIEW_ID } from './constant';\nimport { transformToViewsData } from './helper';\n// 桑基图内置交互\nimport './interactions';\nimport { SankeyOptions } from './types';\n\nexport type { SankeyOptions };\n\n/**\n * 桑基图 Sankey\n */\nexport class Sankey extends Plot<SankeyOptions> {\n /** 图表类型 */\n public type: string = 'sankey';\n\n static getDefaultOptions(): Partial<SankeyOptions> {\n return {\n appendPadding: 8,\n syncViewPadding: true,\n nodeStyle: {\n opacity: 1,\n fillOpacity: 1,\n lineWidth: 1,\n },\n edgeStyle: {\n opacity: 0.3,\n lineWidth: 0,\n },\n edgeState: {\n active: {\n style: {\n opacity: 0.8,\n lineWidth: 0,\n },\n },\n },\n label: {\n formatter: ({ name }) => name,\n callback: (x: number[]) => {\n const isLast = x[1] === 1; // 最后一列靠边的节点\n return {\n style: {\n fill: '#545454',\n textAlign: isLast ? 'end' : 'start',\n },\n offsetX: isLast ? -8 : 8,\n };\n },\n layout: [\n {\n type: 'hide-overlap',\n },\n ],\n },\n tooltip: {\n showTitle: false,\n showMarkers: false,\n shared: false,\n // 内置:node 不显示 tooltip,edge 显示 tooltip\n showContent: (items) => {\n return !get(items, [0, 'data', 'isNode']);\n },\n formatter: (datum: Datum) => {\n const { source, target, value } = datum;\n return {\n name: source + ' -> ' + target,\n value,\n };\n },\n },\n nodeWidthRatio: 0.008,\n nodePaddingRatio: 0.01,\n animation: {\n appear: {\n animation: 'wave-in',\n },\n enter: {\n animation: 'wave-in',\n },\n },\n };\n }\n\n /**\n * @override\n * @param data\n */\n public changeData(data: Data) {\n this.updateOption({ data });\n\n const { nodes, edges } = transformToViewsData(this.options, this.chart.width, this.chart.height);\n\n const nodesView = findViewById(this.chart, NODES_VIEW_ID);\n const edgesView = findViewById(this.chart, EDGES_VIEW_ID);\n\n nodesView.changeData(nodes);\n edgesView.changeData(edges);\n }\n\n /**\n * 获取适配器\n */\n protected getSchemaAdaptor(): Adaptor<SankeyOptions> {\n return adaptor;\n }\n\n /**\n * 获取 条形图 默认配置\n */\n protected getDefaultOptions() {\n return Sankey.getDefaultOptions();\n }\n}\n"]}
|