@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
package/lib/utils/color/blend.js
CHANGED
|
@@ -45,12 +45,13 @@ var blendObject = {
|
|
|
45
45
|
/**
|
|
46
46
|
* 获取混合方法
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
var innerBlend = function (mode) {
|
|
49
49
|
if (!blendObject[mode]) {
|
|
50
50
|
throw new Error('unknown blend mode ' + mode);
|
|
51
51
|
}
|
|
52
52
|
return blendObject[mode];
|
|
53
53
|
};
|
|
54
|
+
exports.innerBlend = innerBlend;
|
|
54
55
|
/**
|
|
55
56
|
* 混合颜色,并处理透明度情况
|
|
56
57
|
* 参考:https://www.w3.org/TR/compositing/#blending
|
|
@@ -62,14 +63,14 @@ exports.innerBlend = function (mode) {
|
|
|
62
63
|
function blend(c0, c1, mode) {
|
|
63
64
|
if (mode === void 0) { mode = 'normal'; }
|
|
64
65
|
// blendRgbArr: 生成不考虑透明度的 blend color: [r, g, b]
|
|
65
|
-
var blendRgbArr = each(exports.innerBlend(mode))(colorToArr(c0), colorToArr(c1));
|
|
66
|
+
var blendRgbArr = each((0, exports.innerBlend)(mode))(colorToArr(c0), colorToArr(c1));
|
|
66
67
|
var _a = colorToArr(c0), r0 = _a[0], g0 = _a[1], b0 = _a[2], a0 = _a[3];
|
|
67
68
|
var _b = colorToArr(c1), r1 = _b[0], g1 = _b[1], b1 = _b[2], a1 = _b[3];
|
|
68
69
|
var a = Number((a0 + a1 * (1 - a0)).toFixed(2));
|
|
69
70
|
var r = Math.round(((a0 * (1 - a1) * (r0 / 255) + a0 * a1 * (blendRgbArr[0] / 255) + (1 - a0) * a1 * (r1 / 255)) / a) * 255);
|
|
70
71
|
var g = Math.round(((a0 * (1 - a1) * (g0 / 255) + a0 * a1 * (blendRgbArr[1] / 255) + (1 - a0) * a1 * (g1 / 255)) / a) * 255);
|
|
71
72
|
var b = Math.round(((a0 * (1 - a1) * (b0 / 255) + a0 * a1 * (blendRgbArr[2] / 255) + (1 - a0) * a1 * (b1 / 255)) / a) * 255);
|
|
72
|
-
return "rgba("
|
|
73
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")");
|
|
73
74
|
}
|
|
74
75
|
exports.blend = blend;
|
|
75
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blend.js","sourceRoot":"","sources":["../../../src/utils/color/blend.ts"],"names":[],"mappings":";;;;AAAA,wEAAyC;AACzC;;;GAGG;AAEH,IAAM,IAAI,GACR,UAAC,CAAC;IACF,OAAA,UAAC,EAAY,EAAE,EAAY;QACzB,IAAM,GAAG,GAAG,EAAE,CAAC;QACf,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;AAND,CAMC,CAAC;AAEJ;;GAEG;AACH,IAAM,WAAW,GAAG;IAClB,MAAM,EAAE,UAAC,CAAS,IAAK,OAAA,CAAC,EAAD,CAAC;IACxB,QAAQ,EAAE,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAb,CAAa;IACjD,MAAM,EAAE,UAAC,CAAS,EAAE,CAAS,IAAK,OAAA,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,EAAzC,CAAyC;IAC3E,OAAO,EAAE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I,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE/F,4BAA4B;IAC5B,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAA0B;IAErG,qBAAqB;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,KAAK,IAAK,OAAA,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAvC,CAAuC,CAAC,CAAC;AAC/E,CAAC;AAjBD,gCAiBC","sourcesContent":["import colorUtil from '@antv/color-util';\n/*\n * interpolates between a set of colors uzing a bezier spline\n * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/\n */\n\nconst each =\n (f) =>\n (c0: number[], c1: number[]): number[] => {\n const out = [];\n out[0] = f(c0[0], c1[0]);\n out[1] = f(c0[1], c1[1]);\n out[2] = f(c0[2], c1[2]);\n return out;\n };\n\n/**\n * 混合方法集合\n */\nconst blendObject = {\n normal: (a: number) => a,\n multiply: (a: number, b: number) => (a * b) / 255,\n screen: (a: number, b: number) => 255 * (1 - (1 - a / 255) * (1 - b / 255)),\n overlay: (a: number, b: number) => (b < 128 ? (2 * a * b) / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255))),\n darken: (a: number, b: number) => (a > b ? b : a),\n lighten: (a: number, b: number) => (a > b ? a : b),\n dodge: (a: number, b: number) => {\n if (a === 255) return 255;\n a = (255 * (b / 255)) / (1 - a / 255);\n return a > 255 ? 255 : a;\n },\n burn: (a: number, b: number) => {\n // 参考 w3c 的写法,考虑除数为 0 的情况\n if (b === 255) return 255;\n else if (a === 0) return 0;\n else return 255 * (1 - Math.min(1, (1 - b / 255) / (a / 255)));\n },\n};\n\n/**\n * 获取混合方法\n */\nexport const innerBlend = (mode: string) => {\n if (!blendObject[mode]) {\n throw new Error('unknown blend mode ' + mode);\n }\n return blendObject[mode];\n};\n\n/**\n * 混合颜色,并处理透明度情况\n * 参考:https://www.w3.org/TR/compositing/#blending\n * @param c0\n * @param c1\n * @param mode 混合模式\n * @return rbga\n */\nexport function blend(c0: string, c1: string, mode = 'normal') {\n // blendRgbArr: 生成不考虑透明度的 blend color: [r, g, b]\n const blendRgbArr = each(innerBlend(mode))(colorToArr(c0), colorToArr(c1));\n\n const [r0, g0, b0, a0] = colorToArr(c0);\n const [r1, g1, b1, a1] = colorToArr(c1);\n\n const a = Number((a0 + a1 * (1 - a0)).toFixed(2));\n\n const r = Math.round(\n ((a0 * (1 - a1) * (r0 / 255) + a0 * a1 * (blendRgbArr[0] / 255) + (1 - a0) * a1 * (r1 / 255)) / a) * 255\n );\n const g = Math.round(\n ((a0 * (1 - a1) * (g0 / 255) + a0 * a1 * (blendRgbArr[1] / 255) + (1 - a0) * a1 * (g1 / 255)) / a) * 255\n );\n const b = Math.round(\n ((a0 * (1 - a1) * (b0 / 255) + a0 * a1 * (blendRgbArr[2] / 255) + (1 - a0) * a1 * (b1 / 255)) / a) * 255\n );\n\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n}\n\n/**\n * 统一颜色输入的格式 [r, g, b, a]\n * 参考:https://www.w3.org/TR/compositing/#blending\n * @param c color\n * @return [r, g, b, a]\n */\nexport function colorToArr(c: string): number[] {\n const color = c.replace('/s+/g', ''); // 去除所有空格\n let rgbaArr: any[];\n\n // 'red' -> [r, g, b, 1]\n if (typeof color === 'string' && !color.startsWith('rgba') && !color.startsWith('#')) {\n return (rgbaArr = colorUtil.rgb2arr(colorUtil.toRGB(color)).concat([1]));\n }\n\n // rgba(255, 200, 125, 0.5) -> [r, g, b, a]\n if (color.startsWith('rgba')) rgbaArr = color.replace('rgba(', '').replace(')', '').split(',');\n\n // '#fff000' -> [r, g, b, 1]\n if (color.startsWith('#')) rgbaArr = colorUtil.rgb2arr(color).concat([1]); // 如果是 16 进制(6 位数),默认透明度 1\n\n // [r, g, b, a] 前三位取整\n return rgbaArr.map((item, index) => (index === 3 ? Number(item) : item | 0));\n}\n"]}
|
package/lib/utils/conversion.js
CHANGED
|
@@ -8,7 +8,7 @@ var util_1 = require("@antv/util");
|
|
|
8
8
|
* @param next
|
|
9
9
|
*/
|
|
10
10
|
function conversionTagFormatter(prev, next) {
|
|
11
|
-
if (!util_1.isNumber(prev) || !util_1.isNumber(next)) {
|
|
11
|
+
if (!(0, util_1.isNumber)(prev) || !(0, util_1.isNumber)(next)) {
|
|
12
12
|
return '-';
|
|
13
13
|
}
|
|
14
14
|
// 0 / 0 没有意义
|
|
@@ -21,7 +21,7 @@ function conversionTagFormatter(prev, next) {
|
|
|
21
21
|
if (prev === 0) {
|
|
22
22
|
return '∞';
|
|
23
23
|
}
|
|
24
|
-
return ((100 * next) / prev).toFixed(2)
|
|
24
|
+
return "".concat(((100 * next) / prev).toFixed(2), "%");
|
|
25
25
|
}
|
|
26
26
|
exports.conversionTagFormatter = conversionTagFormatter;
|
|
27
27
|
//# sourceMappingURL=conversion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AACtC;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,IAAY,EAAE,IAAY;IAC/D,IAAI,CAAC,eAAQ,
|
|
1
|
+
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../src/utils/conversion.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AACtC;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,IAAY,EAAE,IAAY;IAC/D,IAAI,CAAC,IAAA,eAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE;QACtC,OAAO,GAAG,CAAC;KACZ;IAED,aAAa;IACb,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,IAAI,KAAK,CAAC,EAAE;QACd,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,UAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,CAAC;AAChD,CAAC;AAnBD,wDAmBC","sourcesContent":["import { isNumber } from '@antv/util';\n/**\n * 转化率的计算方式\n * @param prev\n * @param next\n */\nexport function conversionTagFormatter(prev: number, next: number): string {\n if (!isNumber(prev) || !isNumber(next)) {\n return '-';\n }\n\n // 0 / 0 没有意义\n if (prev === 0 && next === 0) {\n return '-';\n }\n\n if (prev === next) {\n return '100%';\n }\n\n if (prev === 0) {\n return '∞';\n }\n\n return `${((100 * next) / prev).toFixed(2)}%`;\n}\n"]}
|
package/lib/utils/data.js
CHANGED
|
@@ -15,11 +15,11 @@ function adjustYMetaByZero(data, field) {
|
|
|
15
15
|
return {};
|
|
16
16
|
// 过滤出数字数据
|
|
17
17
|
var numberData = data.filter(function (datum) {
|
|
18
|
-
var v = util_1.get(datum, [field]);
|
|
19
|
-
return util_1.isNumber(v) && !isNaN(v);
|
|
18
|
+
var v = (0, util_1.get)(datum, [field]);
|
|
19
|
+
return (0, util_1.isNumber)(v) && !isNaN(v);
|
|
20
20
|
});
|
|
21
|
-
var gtZero = numberData.every(function (datum) { return util_1.get(datum, [field]) >= 0; });
|
|
22
|
-
var ltZero = numberData.every(function (datum) { return util_1.get(datum, [field]) <= 0; });
|
|
21
|
+
var gtZero = numberData.every(function (datum) { return (0, util_1.get)(datum, [field]) >= 0; });
|
|
22
|
+
var ltZero = numberData.every(function (datum) { return (0, util_1.get)(datum, [field]) <= 0; });
|
|
23
23
|
// 目前是增量更新,对 { min: 0, max: undefined } 进行 update({ max: 0 }) 会得到 { min: 0, max: 0 }
|
|
24
24
|
if (gtZero) {
|
|
25
25
|
return { min: 0 };
|
|
@@ -56,7 +56,7 @@ function transformDataToNodeLinkData(data, sourceField, targetField, weightField
|
|
|
56
56
|
var source = datum[sourceField];
|
|
57
57
|
var target = datum[targetField];
|
|
58
58
|
var weight = datum[weightField];
|
|
59
|
-
var rawData = pick_1.pick(datum, rawFields);
|
|
59
|
+
var rawData = (0, pick_1.pick)(datum, rawFields);
|
|
60
60
|
// source node
|
|
61
61
|
if (!nodesMap[source]) {
|
|
62
62
|
nodesMap[source] = tslib_1.__assign({ id: ++nodesIndex, name: source }, rawData);
|
|
@@ -83,12 +83,12 @@ exports.transformDataToNodeLinkData = transformDataToNodeLinkData;
|
|
|
83
83
|
* @param angleField
|
|
84
84
|
*/
|
|
85
85
|
function processIllegalData(data, field) {
|
|
86
|
-
var processData = util_1.filter(data, function (d) {
|
|
86
|
+
var processData = (0, util_1.filter)(data, function (d) {
|
|
87
87
|
var v = d[field];
|
|
88
88
|
return v === null || (typeof v === 'number' && !isNaN(v));
|
|
89
89
|
});
|
|
90
90
|
// 打印异常数据情况
|
|
91
|
-
invariant_1.log(invariant_1.LEVEL.WARN, processData.length === data.length, 'illegal data existed in chart data.');
|
|
91
|
+
(0, invariant_1.log)(invariant_1.LEVEL.WARN, processData.length === data.length, 'illegal data existed in chart data.');
|
|
92
92
|
return processData;
|
|
93
93
|
}
|
|
94
94
|
exports.processIllegalData = processIllegalData;
|
package/lib/utils/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;;;AAAA,mCAAmD;AAGnD,yCAAyC;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AAsB;YACtB,sBAAsB;YACtB,KAAK,EAAE,MAAM,IACV,OAAO,EACV,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO;QACL,cAAc;QACd,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAX,CAAW,CAAC;QAC1D,KAAK,OAAA;KACN,CAAC;AACJ,CAAC;AAzDD,kEAyDC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,IAAqB,EAAE,KAAa;IACrE,IAAM,WAAW,GAAG,IAAA,aAAM,EAAC,IAAI,EAAE,UAAC,CAAC;QACjC,IAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,WAAW;IACX,IAAA,eAAG,EAAC,iBAAK,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,qCAAqC,CAAC,CAAC;IAE3F,OAAO,WAAW,CAAC;AACrB,CAAC;AAVD,gDAUC","sourcesContent":["import { filter, get, isNumber } from '@antv/util';\nimport { Data, Datum, Meta, Options } from '../types';\nimport { Node, NodeLinkData } from '../types/relation-data';\nimport { LEVEL, log } from './invariant';\nimport { pick } from './pick';\n\n/**\n * 查看数据是否是全负数、或者全正数\n * @param data\n * @param field\n */\nexport function adjustYMetaByZero(data: Data, field: string): Meta {\n if (!data) return {};\n // 过滤出数字数据\n const numberData = data.filter((datum: Datum) => {\n const v = get(datum, [field]);\n return isNumber(v) && !isNaN(v);\n });\n\n const gtZero = numberData.every((datum: Datum) => get(datum, [field]) >= 0);\n const ltZero = numberData.every((datum: Datum) => get(datum, [field]) <= 0);\n\n // 目前是增量更新,对 { min: 0, max: undefined } 进行 update({ max: 0 }) 会得到 { min: 0, max: 0 }\n if (gtZero) {\n return { min: 0 };\n }\n if (ltZero) {\n return { max: 0 };\n }\n return {};\n}\n\n/**\n * 转换数据格式为带有节点与边的数据格式\n * @param data\n * @param sourceField\n * @param targetField\n * @param weightField\n * @param rawFields 存放一些原数据\n */\nexport function transformDataToNodeLinkData(\n data: Data,\n sourceField: string,\n targetField: string,\n weightField: string,\n rawFields: string[] = []\n): NodeLinkData {\n if (!Array.isArray(data)) {\n return {\n nodes: [],\n links: [],\n };\n }\n\n // const nodes = [];\n const links = [];\n // 先使用对象方式存储\n const nodesMap: Record<string, Node> = {};\n let nodesIndex = -1;\n // 数组变换成 chord layout 的数据结构\n data.forEach((datum: Datum) => {\n const source = datum[sourceField];\n const target = datum[targetField];\n const weight = datum[weightField];\n\n const rawData = pick(datum, rawFields);\n\n // source node\n if (!nodesMap[source]) {\n nodesMap[source] = {\n id: ++nodesIndex,\n name: source,\n ...rawData,\n };\n }\n if (!nodesMap[target]) {\n nodesMap[target] = {\n id: ++nodesIndex,\n name: target,\n ...rawData,\n };\n }\n // links\n links.push({\n source: nodesMap[source].id,\n target: nodesMap[target].id,\n // sourceName: source,\n // targetName: target,\n value: weight,\n ...rawData,\n });\n });\n return {\n // 需要按照 id 的顺序\n nodes: Object.values(nodesMap).sort((a, b) => a.id - b.id),\n links,\n };\n}\n\n/**\n * 处理不合法的数据(过滤 非数值型 和 NaN,保留 null)\n * @param data\n * @param angleField\n */\nexport function processIllegalData(data: Options['data'], field: string) {\n const processData = filter(data, (d) => {\n const v = d[field];\n return v === null || (typeof v === 'number' && !isNaN(v));\n });\n\n // 打印异常数据情况\n log(LEVEL.WARN, processData.length === data.length, 'illegal data existed in chart data.');\n\n return processData;\n}\n"]}
|
package/lib/utils/deep-assign.js
CHANGED
|
@@ -76,7 +76,7 @@ var deep = function (dist, src, level, maxLevel) {
|
|
|
76
76
|
* 不同点在于 deepAssign 会将 null undefined 等类型直接覆盖给 source
|
|
77
77
|
* 详细参考: __tests__/unit/utils/deep-assign-spec.ts
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
var deepAssign = function (rst) {
|
|
80
80
|
var args = [];
|
|
81
81
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
82
82
|
args[_i - 1] = arguments[_i];
|
|
@@ -86,4 +86,5 @@ exports.deepAssign = function (rst) {
|
|
|
86
86
|
}
|
|
87
87
|
return rst;
|
|
88
88
|
};
|
|
89
|
+
exports.deepAssign = deepAssign;
|
|
89
90
|
//# sourceMappingURL=deep-assign.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-assign.js","sourceRoot":"","sources":["../../src/utils/deep-assign.ts"],"names":[],"mappings":";;;AAAA,IAAM,aAAa,GAAG,CAAC,CAAC,CAAC,SAAS;AAElC,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AAE7B,OAAO;AACP,IAAM,MAAM,GAAG,UAAC,KAAU,EAAE,IAAY,IAAc,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,GAAG,EAAhD,CAAgD,CAAC;AAEvG,IAAM,OAAO,GAAG,UAAC,KAAU;IACzB,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,IAAM,YAAY,GAAG,UAAC,KAAU;IAC9B;;;;OAIG;IACH,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG,UAAC,KAAU;IAC/B;;;;OAIG;IACH,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;QACpD,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,OAAO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EAAd,IAAc;QAAd,6BAAc;;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACvC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACpB;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AALW,QAAA,UAAU,cAKrB","sourcesContent":["const MAX_MIX_LEVEL = 5; // 最大比对层级\n\nconst toString = {}.toString;\n\n// 类型检测\nconst isType = (value: any, type: string): boolean => toString.call(value) === '[object ' + type + ']';\n\nconst isArray = (value: any): value is Array<any> => {\n return isType(value, 'Array');\n};\n\nconst isObjectLike = (value: any): value is object => {\n /**\n * isObjectLike({}) => true\n * isObjectLike([1, 2, 3]) => true\n * isObjectLike(Function) => false\n */\n return typeof value === 'object' && value !== null;\n};\n\nconst isPlainObject = (value: any): value is object => {\n /**\n * isObjectLike(new Foo) => false\n * isObjectLike([1, 2, 3]) => false\n * isObjectLike({ x: 0, y: 0 }) => true\n */\n if (!isObjectLike(value) || !isType(value, 'Object')) {\n return false;\n }\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n};\n\n/***\n * @param {any} dist\n * @param {any} src\n * @param {number} level 当前层级\n * @param {number} maxLevel 最大层级\n */\nconst deep = (dist, src, level?, maxLevel?) => {\n level = level || 0;\n maxLevel = maxLevel || MAX_MIX_LEVEL;\n for (const key in src) {\n if (Object.prototype.hasOwnProperty.call(src, key)) {\n const value = src[key];\n if (!value) {\n // null 、 undefined 等情况直接赋值\n dist[key] = value;\n } else {\n if (isPlainObject(value)) {\n if (!isPlainObject(dist[key])) {\n dist[key] = {};\n }\n if (level < maxLevel) {\n deep(dist[key], value, level + 1, maxLevel);\n } else {\n // 层级过深直接赋值,性能问题\n dist[key] = src[key];\n }\n } else if (isArray(value)) {\n dist[key] = [];\n dist[key] = dist[key].concat(value);\n } else {\n dist[key] = value;\n }\n }\n }\n }\n};\n\n/**\n * deepAssign 功能类似 deepMix\n * 不同点在于 deepAssign 会将 null undefined 等类型直接覆盖给 source\n * 详细参考: __tests__/unit/utils/deep-assign-spec.ts\n */\nexport const deepAssign = (rst: any, ...args: any[]) => {\n for (let i = 0; i < args.length; i += 1) {\n deep(rst, args[i]);\n }\n return rst;\n};\n"]}
|
package/lib/utils/flow.d.ts
CHANGED
package/lib/utils/geometry.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.findGeometry = findGeometry;
|
|
|
15
15
|
* 获取 View 的 所有 elements
|
|
16
16
|
*/
|
|
17
17
|
function getAllElements(view) {
|
|
18
|
-
return util_1.reduce(view.geometries, function (r, geometry) {
|
|
18
|
+
return (0, util_1.reduce)(view.geometries, function (r, geometry) {
|
|
19
19
|
return r.concat(geometry.elements);
|
|
20
20
|
}, []);
|
|
21
21
|
}
|
|
@@ -24,10 +24,10 @@ exports.getAllElements = getAllElements;
|
|
|
24
24
|
* 递归获取 View 的 所有 elements, 包括 View 的子 View
|
|
25
25
|
*/
|
|
26
26
|
function getAllElementsRecursively(view) {
|
|
27
|
-
if (util_1.get(view, ['views', 'length'], 0) <= 0) {
|
|
27
|
+
if ((0, util_1.get)(view, ['views', 'length'], 0) <= 0) {
|
|
28
28
|
return getAllElements(view);
|
|
29
29
|
}
|
|
30
|
-
return util_1.reduce(view.views, function (ele, subView) {
|
|
30
|
+
return (0, util_1.reduce)(view.views, function (ele, subView) {
|
|
31
31
|
return ele.concat(getAllElementsRecursively(subView));
|
|
32
32
|
}, getAllElements(view));
|
|
33
33
|
}
|
|
@@ -36,10 +36,10 @@ exports.getAllElementsRecursively = getAllElementsRecursively;
|
|
|
36
36
|
* 递归获取 View 的 所有 geometries, 包括 View 的子 View
|
|
37
37
|
*/
|
|
38
38
|
function getAllGeometriesRecursively(view) {
|
|
39
|
-
if (util_1.get(view, ['views', 'length'], 0) <= 0) {
|
|
39
|
+
if ((0, util_1.get)(view, ['views', 'length'], 0) <= 0) {
|
|
40
40
|
return view.geometries;
|
|
41
41
|
}
|
|
42
|
-
return util_1.reduce(view.views, function (ele, subView) {
|
|
42
|
+
return (0, util_1.reduce)(view.views, function (ele, subView) {
|
|
43
43
|
return ele.concat(subView.geometries);
|
|
44
44
|
}, view.geometries);
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/utils/geometry.ts"],"names":[],"mappings":";;;AACA,mCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAU,EAAE,IAAY;IACnD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAC,CAAW,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,IAAI,EAAf,CAAe,CAAC,CAAC;AAChE,CAAC;AAFD,oCAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAU;IACvC,OAAO,aAAM,
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/utils/geometry.ts"],"names":[],"mappings":";;;AACA,mCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAU,EAAE,IAAY;IACnD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAC,CAAW,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,IAAI,EAAf,CAAe,CAAC,CAAC;AAChE,CAAC;AAFD,oCAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAU;IACvC,OAAO,IAAA,aAAM,EACX,IAAI,CAAC,UAAU,EACf,UAAC,CAAY,EAAE,QAAkB;QAC/B,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC;AARD,wCAQC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,IAAU;IAClD,IAAI,IAAA,UAAG,EAAC,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;QAC1C,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;KAC7B;IAED,OAAO,IAAA,aAAM,EACX,IAAI,CAAC,KAAK,EACV,UAAC,GAAc,EAAE,OAAa;QAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC,EACD,cAAc,CAAC,IAAI,CAAC,CACrB,CAAC;AACJ,CAAC;AAZD,8DAYC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,IAAU;IACpD,IAAI,IAAA,UAAG,EAAC,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC,UAAU,CAAC;KACxB;IAED,OAAO,IAAA,aAAM,EACX,IAAI,CAAC,KAAK,EACV,UAAC,GAAe,EAAE,OAAa;QAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC,EACD,IAAI,CAAC,UAAU,CAChB,CAAC;AACJ,CAAC;AAZD,kEAYC","sourcesContent":["import { Element, Geometry, View } from '@antv/g2';\nimport { get, reduce } from '@antv/util';\n\n/**\n * 在 View 中查找第一个指定 type 类型的 geometry\n * @param view\n * @param type\n */\nexport function findGeometry(view: View, type: string): Geometry {\n return view.geometries.find((g: Geometry) => g.type === type);\n}\n\n/**\n * 获取 View 的 所有 elements\n */\nexport function getAllElements(view: View): Element[] {\n return reduce(\n view.geometries,\n (r: Element[], geometry: Geometry) => {\n return r.concat(geometry.elements);\n },\n []\n );\n}\n\n/**\n * 递归获取 View 的 所有 elements, 包括 View 的子 View\n */\nexport function getAllElementsRecursively(view: View): Element[] {\n if (get(view, ['views', 'length'], 0) <= 0) {\n return getAllElements(view);\n }\n\n return reduce(\n view.views,\n (ele: Element[], subView: View) => {\n return ele.concat(getAllElementsRecursively(subView));\n },\n getAllElements(view)\n );\n}\n\n/**\n * 递归获取 View 的 所有 geometries, 包括 View 的子 View\n */\nexport function getAllGeometriesRecursively(view: View): Geometry[] {\n if (get(view, ['views', 'length'], 0) <= 0) {\n return view.geometries;\n }\n\n return reduce(\n view.views,\n (ele: Geometry[], subView: View) => {\n return ele.concat(subView.geometries);\n },\n view.geometries\n );\n}\n"]}
|
|
@@ -12,14 +12,14 @@ var DEFAULT_OPTIONS = {
|
|
|
12
12
|
sort: function (a, b) { return b.value - a.value; },
|
|
13
13
|
};
|
|
14
14
|
function pack(data, options) {
|
|
15
|
-
options = util_1.assign({}, DEFAULT_OPTIONS, options);
|
|
15
|
+
options = (0, util_1.assign)({}, DEFAULT_OPTIONS, options);
|
|
16
16
|
var as = options.as;
|
|
17
|
-
if (!util_1.isArray(as) || as.length !== 3) {
|
|
17
|
+
if (!(0, util_1.isArray)(as) || as.length !== 3) {
|
|
18
18
|
throw new TypeError('Invalid as: it must be an array with 3 strings (e.g. [ "x", "y", "r" ])!');
|
|
19
19
|
}
|
|
20
20
|
var field;
|
|
21
21
|
try {
|
|
22
|
-
field = util_2.getField(options);
|
|
22
|
+
field = (0, util_2.getField)(options);
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
25
|
console.warn(e);
|
|
@@ -39,7 +39,7 @@ function pack(data, options) {
|
|
|
39
39
|
node[y] = node.y;
|
|
40
40
|
node[r] = node.r;
|
|
41
41
|
});
|
|
42
|
-
return util_2.getAllNodes(root);
|
|
42
|
+
return (0, util_2.getAllNodes)(root);
|
|
43
43
|
}
|
|
44
44
|
exports.pack = pack;
|
|
45
45
|
//# sourceMappingURL=pack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/pack.ts"],"names":[],"mappings":";;;;AAAA,mCAA6C;AAC7C,gEAA4C;AAE5C,+BAA+C;A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W,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAC5D,WAAW;aACR,SAAS,CAAC,IAAI,CAAC;aACf,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,KAAK,CAAC,EAAR,CAAQ,CAAC;aACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CACtB;IALD,CAKC,CAAC;IAEJ,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE9B,IAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAChB,IAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAChB,IAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,UAAC,IAAI;QACb,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACjB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACjB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAlCD,oBAkCC","sourcesContent":["import { assign, isArray } from '@antv/util';\nimport * as d3Hierarchy from 'd3-hierarchy';\nimport { HierarchyOption } from './types';\nimport { getAllNodes, getField } from './util';\n\ntype Options = Omit<HierarchyOption, 'as'> & { as?: [string, string, string] };\n\nconst DEFAULT_OPTIONS: Options = {\n field: 'value',\n as: ['x', 'y', 'r'],\n // 默认降序\n sort: (a, b) => b.value - a.value,\n};\n\nexport function pack(data: any, options: Options): any[] {\n options = assign({} as Options, DEFAULT_OPTIONS, options);\n const as = options.as;\n if (!isArray(as) || as.length !== 3) {\n throw new TypeError('Invalid as: it must be an array with 3 strings (e.g. [ \"x\", \"y\", \"r\" ])!');\n }\n\n let field;\n try {\n field = getField(options);\n } catch (e) {\n console.warn(e);\n }\n\n const packLayout = (data) =>\n d3Hierarchy.pack().size(options.size).padding(options.padding)(\n d3Hierarchy\n .hierarchy(data)\n .sum((d) => d[field])\n .sort(options.sort)\n );\n\n const root = packLayout(data);\n\n const x = as[0];\n const y = as[1];\n const r = as[2];\n root.each((node) => {\n node[x] = node.x;\n node[y] = node.y;\n node[r] = node.r;\n });\n\n return getAllNodes(root);\n}\n"]}
|
|
@@ -17,14 +17,14 @@ var DEFAULT_OPTIONS = {
|
|
|
17
17
|
ignoreParentValue: true,
|
|
18
18
|
};
|
|
19
19
|
function partition(data, options) {
|
|
20
|
-
options = util_1.assign({}, DEFAULT_OPTIONS, options);
|
|
20
|
+
options = (0, util_1.assign)({}, DEFAULT_OPTIONS, options);
|
|
21
21
|
var as = options.as;
|
|
22
|
-
if (!util_1.isArray(as) || as.length !== 2) {
|
|
22
|
+
if (!(0, util_1.isArray)(as) || as.length !== 2) {
|
|
23
23
|
throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ "x", "y" ])!');
|
|
24
24
|
}
|
|
25
25
|
var field;
|
|
26
26
|
try {
|
|
27
|
-
field = util_2.getField(options);
|
|
27
|
+
field = (0, util_2.getField)(options);
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
console.warn(e);
|
|
@@ -41,10 +41,10 @@ function partition(data, options) {
|
|
|
41
41
|
d3Hierarchy
|
|
42
42
|
.hierarchy(data)
|
|
43
43
|
.sum(function (d) {
|
|
44
|
-
return util_1.size(d.children)
|
|
44
|
+
return (0, util_1.size)(d.children)
|
|
45
45
|
? options.ignoreParentValue
|
|
46
46
|
? 0
|
|
47
|
-
: d[field] - util_1.reduce(d.children, function (a, b) { return a + b[field]; }, 0)
|
|
47
|
+
: d[field] - (0, util_1.reduce)(d.children, function (a, b) { return a + b[field]; }, 0)
|
|
48
48
|
: d[field];
|
|
49
49
|
})
|
|
50
50
|
.sort(options.sort));
|
|
@@ -70,7 +70,7 @@ function partition(data, options) {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
-
return util_2.getAllNodes(root);
|
|
73
|
+
return (0, util_2.getAllNodes)(root);
|
|
74
74
|
}
|
|
75
75
|
exports.partition = partition;
|
|
76
76
|
//# sourceMappingURL=partition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/partition.ts"],"names":[],"mappings":";;;;AAAA,mCAA2D;AAC3D,gEAA4C;AAC5C,+BAA+C;AAE/C,IAAM,eAAe,GAAY;IAC/B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,EAAjB,CAAiB;IACjC,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACd,6CAA6C;IAC7C,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAcF,SAAgB,SAAS,CAAC,IAAS,EAAE,OAAgB;IACnD,OAAO,GAAG,aAAM,
|
|
1
|
+
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/partition.ts"],"names":[],"mappings":";;;;AAAA,mCAA2D;AAC3D,gEAA4C;AAC5C,+BAA+C;AAE/C,IAAM,eAAe,GAAY;IAC/B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,EAAjB,CAAiB;IACjC,EA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import { getAllNodes, getField } from './util';\n\nconst DEFAULT_OPTIONS: Options = {\n field: 'value',\n size: [1, 1], // width, height\n round: false,\n padding: 0,\n // 默认降序\n sort: (a, b) => b.value - a.value,\n as: ['x', 'y'],\n // 是否忽略 parentValue, 当设置为 true 时,父节点的权重由子元素决定\n ignoreParentValue: true,\n};\n\nexport interface Options {\n field: string;\n size?: [number, number];\n round?: boolean;\n ratio?: number;\n padding?: number;\n sort?: (a: any, b: any) => any; // Function;\n as?: [string, string];\n\n ignoreParentValue?: boolean;\n}\n\nexport function partition(data: any, options: Options): any[] {\n options = assign({} as Options, DEFAULT_OPTIONS, options);\n const as = options.as;\n if (!isArray(as) || as.length !== 2) {\n throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ \"x\", \"y\" ])!');\n }\n\n let field;\n try {\n field = getField(options);\n } catch (e) {\n console.warn(e);\n }\n\n const partition = (data) =>\n d3Hierarchy.partition().size(options.size).round(options.round).padding(options.padding)(\n /**\n * d3Hierarchy 布局中需指定 sum 函数计算 node 值,规则是:从当前 node 开始以 post-order traversal 的次序为当前节点以及每个后代节点调用指定的 value 函数,并返回当前 node。\n * for example:\n * { node: 'parent', value: 10, children: [{node: 'child1', value: 5}, {node: 'child2', value: 5}, ]}\n * parent 所得的计算值是 sum(node(parent)) + sum(node(child1)) + sum(node(child2))\n * sum 函数中,d 为用户传入的 data, children 为保留字段\n */\n d3Hierarchy\n .hierarchy(data)\n .sum((d) =>\n size(d.children)\n ? options.ignoreParentValue\n ? 0\n : d[field] - reduce(d.children, (a, b) => a + b[field], 0)\n : d[field]\n )\n .sort(options.sort)\n );\n const root = partition(data);\n\n /*\n * points:\n * 3 2\n * 0 1\n */\n const x = as[0];\n const y = as[1];\n\n root.each((node) => {\n node[x] = [node.x0, node.x1, node.x1, node.x0];\n node[y] = [node.y1, node.y1, node.y0, node.y0];\n // 旭日图兼容下 旧版本\n node.name = node.name || node.data?.name || node.data?.label;\n node.data.name = node.name;\n\n ['x0', 'x1', 'y0', 'y1'].forEach((prop) => {\n if (as.indexOf(prop) === -1) {\n delete node[prop];\n }\n });\n });\n\n return getAllNodes(root);\n}\n"]}
|
|
@@ -29,14 +29,14 @@ function getTileMethod(tile, ratio) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.getTileMethod = getTileMethod;
|
|
31
31
|
function treemap(data, options) {
|
|
32
|
-
options = util_1.assign({}, DEFAULT_OPTIONS, options);
|
|
32
|
+
options = (0, util_1.assign)({}, DEFAULT_OPTIONS, options);
|
|
33
33
|
var as = options.as;
|
|
34
|
-
if (!util_1.isArray(as) || as.length !== 2) {
|
|
34
|
+
if (!(0, util_1.isArray)(as) || as.length !== 2) {
|
|
35
35
|
throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ "x", "y" ])!');
|
|
36
36
|
}
|
|
37
37
|
var field;
|
|
38
38
|
try {
|
|
39
|
-
field = util_2.getField(options);
|
|
39
|
+
field = (0, util_2.getField)(options);
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
42
|
console.warn(e);
|
|
@@ -86,7 +86,7 @@ function treemap(data, options) {
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
|
-
return util_2.getAllNodes(root);
|
|
89
|
+
return (0, util_2.getAllNodes)(root);
|
|
90
90
|
}
|
|
91
91
|
exports.treemap = treemap;
|
|
92
92
|
//# sourceMappingURL=treemap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treemap.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/treemap.ts"],"names":[],"mappings":";;;;AAAA,mCAA6C;AAC7C,gEAA4C;AAE5C,+BAA+C;AAE/C,IAAM,eAAe,GAAoB;IACvC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,KAAK;IACZ,iBAAiB,EAAE,IAAI;IACvB,OAAO,EAAE,CAAC;IACV,YAA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AI,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AA/DD,0BA+DC","sourcesContent":["import { assign, isArray } from '@antv/util';\nimport * as d3Hierarchy from 'd3-hierarchy';\nimport { HierarchyOption } from './types';\nimport { getAllNodes, getField } from './util';\n\nconst DEFAULT_OPTIONS: HierarchyOption = {\n field: 'value',\n tile: 'treemapSquarify', // treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify\n size: [1, 1], // width, height\n round: false,\n ignoreParentValue: true,\n padding: 0,\n paddingInner: 0,\n paddingOuter: 0,\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n as: ['x', 'y'],\n // 默认降序\n sort: (a, b) => b.value - a.value,\n // 纵横比, treemapSquarify 布局时可用,默认黄金分割比例\n ratio: 0.5 * (1 + Math.sqrt(5)),\n};\n\nexport function getTileMethod(tile: string, ratio: number) {\n return tile === 'treemapSquarify' ? d3Hierarchy[tile].ratio(ratio) : d3Hierarchy[tile];\n}\n\nexport function treemap(data: any, options: HierarchyOption): any[] {\n options = assign({} as HierarchyOption, DEFAULT_OPTIONS, options);\n const as = options.as;\n if (!isArray(as) || as.length !== 2) {\n throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ \"x\", \"y\" ])!');\n }\n\n let field;\n try {\n field = getField(options);\n } catch (e) {\n console.warn(e);\n }\n\n const tileMethod = getTileMethod(options.tile, options.ratio);\n\n const partition = (data) =>\n d3Hierarchy\n .treemap()\n .tile(tileMethod)\n .size(options.size)\n .round(options.round)\n .padding(options.padding)\n .paddingInner(options.paddingInner)\n .paddingOuter(options.paddingOuter)\n .paddingTop(options.paddingTop)\n .paddingRight(options.paddingRight)\n .paddingBottom(options.paddingBottom)\n .paddingLeft(options.paddingLeft)(\n /**\n * d3Hierarchy 布局中需指定 sum 函数计算 node 值,规则是:从当前 node 开始以 post-order traversal 的次序为当前节点以及每个后代节点调用指定的 value 函数,并返回当前 node。\n * for example:\n * { node: 'parent', value: 10, children: [{node: 'child1', value: 5}, {node: 'child2', value: 5}, ]}\n * parent 所得的计算值是 sum(node(parent)) + sum(node(child1)) + sum(node(child2))\n * ignoreParentValue 为 true(默认) 时,父元素的值由子元素累加而来,该值为 0 + 5 + 5 = 10\n * ignoreParentValue 为 false 时,父元素的值由当前节点 及子元素累加而来,该值为 10 + 5 + 5 = 20\n * sum 函数中,d 为用户传入的 data, children 为保留字段\n */\n d3Hierarchy\n .hierarchy(data)\n .sum((d) => (options.ignoreParentValue && d.children ? 0 : d[field]))\n .sort(options.sort)\n );\n const root = partition(data);\n\n /*\n * points:\n * 3 2\n * 0 1\n */\n const x = as[0];\n const y = as[1];\n root.each((node) => {\n node[x] = [node.x0, node.x1, node.x1, node.x0];\n node[y] = [node.y1, node.y1, node.y0, node.y0];\n ['x0', 'x1', 'y0', 'y1'].forEach((prop) => {\n if (as.indexOf(prop) === -1) {\n delete node[prop];\n }\n });\n });\n\n return getAllNodes(root);\n}\n"]}
|
|
@@ -12,18 +12,18 @@ exports.NODE_ANCESTORS_FIELD = 'nodeAncestor';
|
|
|
12
12
|
var INVALID_FIELD_ERR_MSG = 'Invalid field: it must be a string!';
|
|
13
13
|
function getField(options, defaultField) {
|
|
14
14
|
var field = options.field, fields = options.fields;
|
|
15
|
-
if (util_1.isString(field)) {
|
|
15
|
+
if ((0, util_1.isString)(field)) {
|
|
16
16
|
return field;
|
|
17
17
|
}
|
|
18
|
-
if (util_1.isArray(field)) {
|
|
18
|
+
if ((0, util_1.isArray)(field)) {
|
|
19
19
|
console.warn(INVALID_FIELD_ERR_MSG);
|
|
20
20
|
return field[0];
|
|
21
21
|
}
|
|
22
|
-
console.warn(INVALID_FIELD_ERR_MSG
|
|
23
|
-
if (util_1.isString(fields)) {
|
|
22
|
+
console.warn("".concat(INVALID_FIELD_ERR_MSG, " will try to get fields instead."));
|
|
23
|
+
if ((0, util_1.isString)(fields)) {
|
|
24
24
|
return fields;
|
|
25
25
|
}
|
|
26
|
-
if (util_1.isArray(fields) && fields.length) {
|
|
26
|
+
if ((0, util_1.isArray)(fields) && fields.length) {
|
|
27
27
|
return fields[0];
|
|
28
28
|
}
|
|
29
29
|
if (defaultField) {
|
|
@@ -47,7 +47,7 @@ function getAllNodes(root) {
|
|
|
47
47
|
else {
|
|
48
48
|
index_1 += 1;
|
|
49
49
|
}
|
|
50
|
-
var ancestors = util_1.filter((((_a = node.ancestors) === null || _a === void 0 ? void 0 : _a.call(node)) || []).map(function (d) { return nodes.find(function (n) { return n.name === d.name; }) || d; }), function (_a) {
|
|
50
|
+
var ancestors = (0, util_1.filter)((((_a = node.ancestors) === null || _a === void 0 ? void 0 : _a.call(node)) || []).map(function (d) { return nodes.find(function (n) { return n.name === d.name; }) || d; }), function (_a) {
|
|
51
51
|
var depth = _a.depth;
|
|
52
52
|
return depth > 0 && depth < node.depth;
|
|
53
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/util.ts"],"names":[],"mappings":";;;AAAA,mCAAuD;AAEvD,oBAAoB;AACpB,yBAAyB;AACZ,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAC5C,iBAAiB;AACJ,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,cAAc;AACD,QAAA,oBAAoB,GAAG,cAAc,CAAC;AAEnD,IAAM,qBAAqB,GAAG,qCAAqC,CAAC;AAOpE,SAAgB,QAAQ,CAAC,OAAgB,EAAE,YAAqB;IACtD,IAAA,KAAK,GAAa,OAAO,MAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAClC,IAAI,eAAQ,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/utils/hierarchy/util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AAM,KAAK,QAAM,EAAE;gBAC1B,QAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBACrB,OAAK,GAAG,CAAC,CAAC;aACX;iBAAM;gBACL,OAAK,IAAI,CAAC,CAAC;aACZ;YACD,IAAM,SAAS,GAAG,IAAA,aAAM,EACtB,CAAC,CAAA,MAAA,IAAI,CAAC,SAAS,oDAAI,KAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAM,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAjB,CAAiB,CAAC,IAAI,CAAC,EAAzC,CAAyC,CAAC,EACrF,UAAC,EAAS;oBAAP,KAAK,WAAA;gBAAO,OAAA,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK;YAA/B,CAA+B,CAC/C,CAAC;YAEF,IAAI,CAAC,4BAAoB,CAAC,GAAG,SAAS,CAAC;YACvC,IAAI,CAAC,wBAAgB,CAAC,GAAG,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,KAAI,CAAC,CAAC;YACpD,IAAI,CAAC,wBAAgB,CAAC,GAAG,OAAK,CAAC;YAE/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;KACJ;SAAM,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;QAChC,kBAAkB;QAClB,IAAI,CAAC,QAAQ,CAAC,UAAC,IAAS;YACtB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AA/BD,kCA+BC","sourcesContent":["import { filter, isArray, isString } from '@antv/util';\n\n/** export 一些字段常量 */\n/** 在同层级,同一父节点下的节点索引顺序 */\nexport const NODE_INDEX_FIELD = 'nodeIndex';\n/** child 节点数量 */\nexport const CHILD_NODE_COUNT = 'childNodeCount';\n/** 节点的祖先节点 */\nexport const NODE_ANCESTORS_FIELD = 'nodeAncestor';\n\nconst INVALID_FIELD_ERR_MSG = 'Invalid field: it must be a string!';\n\ninterface Options {\n field?: string | string[];\n fields?: string | string[];\n}\n\nexport function getField(options: Options, defaultField?: string): string {\n const { field, fields } = options;\n if (isString(field)) {\n return field;\n }\n if (isArray(field)) {\n console.warn(INVALID_FIELD_ERR_MSG);\n return field[0];\n }\n console.warn(`${INVALID_FIELD_ERR_MSG} will try to get fields instead.`);\n if (isString(fields)) {\n return fields;\n }\n if (isArray(fields) && fields.length) {\n return fields[0];\n }\n if (defaultField) {\n return defaultField;\n }\n throw new TypeError(INVALID_FIELD_ERR_MSG);\n}\n\nexport function getAllNodes(root: any) {\n const nodes: any[] = [];\n if (root && root.each) {\n let parent;\n let index;\n // d3-hierarchy: Invokes the specified function for node and each descendant in **breadth-first order**\n root.each((node: any) => {\n if (node.parent !== parent) {\n parent = node.parent;\n index = 0;\n } else {\n index += 1;\n }\n const ancestors = filter(\n (node.ancestors?.() || []).map((d: any) => nodes.find((n) => n.name === d.name) || d),\n ({ depth }) => depth > 0 && depth < node.depth\n );\n\n node[NODE_ANCESTORS_FIELD] = ancestors;\n node[CHILD_NODE_COUNT] = node.children?.length || 0;\n node[NODE_INDEX_FIELD] = index;\n\n nodes.push(node);\n });\n } else if (root && root.eachNode) {\n // @antv/hierarchy\n root.eachNode((node: any) => {\n nodes.push(node);\n });\n }\n return nodes;\n}\n"]}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getViews = exports.getSiblingViews = exports.findViewById = exports.addViewAnimation = exports.template = exports.renderStatistic = exports.renderGaugeStatistic = exports.pick = exports.getSplinePath = exports.isRealNumber = exports.isBetween = exports.measureTextWidth = exports.transformLabel = exports.kebabCase = exports.log = exports.LEVEL = exports.invariant = exports.flow = exports.getContainerSize = exports.deepAssign = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
tslib_1.__exportStar(require("./data"), exports);
|
|
5
6
|
var deep_assign_1 = require("./deep-assign");
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;AAAA,iDAAuB;AACvB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6BAAyC;AAAhC,uGAAA,gBAAgB,OAAA;AACzB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,qDAA2B;AAC3B,yCAAoD;AAA3C,sGAAA,SAAS,OAAA;AAAE,kGAAA,KAAK,OAAA;AAAE,gGAAA,GAAG,OAAA;AAC9B,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,iCAAyC;AAAhC,uGAAA,cAAc,OAAA;AACvB,+CAAkD;AAAzC,gHAAA,gBAAgB,OAAA;AACzB,mCAAmD;AAA1C,mGAAA,SAAS,OAAA;AAAE,sGAAA,YAAY,OAAA;AAChC,oDAA0B;AAC1B,+BAAuC;AAA9B,qGAAA,aAAa,OAAA;AACtB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAoE;AAA3D,iHAAA,oBAAoB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAC9C,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+BAAmF;AAA1E,wGAAA,gBAAgB,OAAA;AAAE,oGAAA,YAAY,OAAA;AAAE,uGAAA,eAAe,OAAA;AAAE,gGAAA,QAAQ,OAAA","sourcesContent":["export * from './data';\nexport { deepAssign } from './deep-assign';\nexport { getContainerSize } from './dom';\nexport { flow } from './flow';\nexport * from './geometry';\nexport { invariant, LEVEL, log } from './invariant';\nexport { kebabCase } from './kebab-case';\nexport { transformLabel } from './label';\nexport { measureTextWidth } from './measure-text';\nexport { isBetween, isRealNumber } from './number';\nexport * from './padding';\nexport { getSplinePath } from './path';\nexport { pick } from './pick';\nexport { renderGaugeStatistic, renderStatistic } from './statistic';\nexport { template } from './template';\nexport { addViewAnimation, findViewById, getSiblingViews, getViews } from './view';\n"]}
|
package/lib/utils/invariant.js
CHANGED
|
@@ -23,7 +23,7 @@ function getMessage(format) {
|
|
|
23
23
|
args[_i - 1] = arguments[_i];
|
|
24
24
|
}
|
|
25
25
|
var argIndex = 0;
|
|
26
|
-
return BRAND
|
|
26
|
+
return "".concat(BRAND, ": ").concat(format.replace(/%s/g, function () { return "".concat(args[argIndex++]); }));
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* invariant error
|
|
@@ -37,7 +37,7 @@ function invariant(condition, format) {
|
|
|
37
37
|
args[_i - 2] = arguments[_i];
|
|
38
38
|
}
|
|
39
39
|
if (!condition) {
|
|
40
|
-
var error = new Error(getMessage.apply(void 0, tslib_1.
|
|
40
|
+
var error = new Error(getMessage.apply(void 0, tslib_1.__spreadArray([format], args, false)));
|
|
41
41
|
error.name = BRAND;
|
|
42
42
|
// error.framesToPop = 1; // we don't care about invariant's own frame
|
|
43
43
|
throw error;
|
|
@@ -57,7 +57,7 @@ function log(level, condition, format) {
|
|
|
57
57
|
args[_i - 3] = arguments[_i];
|
|
58
58
|
}
|
|
59
59
|
if (!condition) {
|
|
60
|
-
console[level](getMessage.apply(void 0, tslib_1.
|
|
60
|
+
console[level](getMessage.apply(void 0, tslib_1.__spreadArray([format], args, false)));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.log = log;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../../src/utils/invariant.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,sBAAa,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AG,CAAC,KAAY,EAAE,SAAkB,EAAE,MAAM;IAAE,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAC1E,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,sCAAC,MAAM,GAAK,IAAI,UAAE,CAAC;KAC7C;AACH,CAAC;AAJD,kBAIC","sourcesContent":["/**\n * Simplified from https://github.com/zertosh/invariant.\n */\n\nexport enum LEVEL {\n ERROR = 'error',\n WARN = 'warn',\n INFO = 'log',\n}\n\nconst BRAND = 'AntV/G2Plot';\n\n/**\n * 获取错误消息\n * @param format\n * @param args\n */\nfunction getMessage(format: string, ...args: any[]): string {\n let argIndex = 0;\n return `${BRAND}: ${format.replace(/%s/g, (): string => `${args[argIndex++]}`)}`;\n}\n\n/**\n * invariant error\n * @param condition\n * @param format\n * @param args\n */\nexport function invariant(condition: boolean, format: string, ...args: any[]): void {\n if (!condition) {\n const error = new Error(getMessage(format, ...args));\n error.name = BRAND;\n // error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\n/**\n * 打印语句\n * @param level\n * @param condition\n * @param format\n * @param args\n */\nexport function log(level: LEVEL, condition: boolean, format, ...args: any[]): void {\n if (!condition) {\n console[level](getMessage(format, ...args));\n }\n}\n"]}
|
package/lib/utils/label.js
CHANGED
|
@@ -8,7 +8,7 @@ var util_1 = require("@antv/util");
|
|
|
8
8
|
* @param labelOptions
|
|
9
9
|
*/
|
|
10
10
|
function transformLabel(labelOptions) {
|
|
11
|
-
if (!util_1.isType(labelOptions, 'Object')) {
|
|
11
|
+
if (!(0, util_1.isType)(labelOptions, 'Object')) {
|
|
12
12
|
return labelOptions;
|
|
13
13
|
}
|
|
14
14
|
var label = tslib_1.__assign({}, labelOptions);
|
package/lib/utils/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.ts"],"names":[],"mappings":";;;;AAAA,mCAAoC;AACpC;;;GAGG;AACH,SAAgB,cAAc,CAAC,YAAiB;IAC9C,IAAI,CAAC,aAAM,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.ts"],"names":[],"mappings":";;;;AAAA,mCAAoC;AACpC;;;GAGG;AACH,SAAgB,cAAc,CAAC,YAAiB;IAC9C,IAAI,CAAC,IAAA,aAAM,EAAC,YAAY,EAAE,QAAQ,CAAC,EAAE;QACnC,OAAO,YAAY,CAAC;KACrB;IACD,IAAM,KAAK,wBAAQ,YAAY,CAAE,CAAC;IAClC,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;QACrC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;KACjC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AATD,wCASC","sourcesContent":["import { isType } from '@antv/util';\n/**\n * 兼容 v1 label formatter\n * @param labelOptions\n */\nexport function transformLabel(labelOptions: any) {\n if (!isType(labelOptions, 'Object')) {\n return labelOptions;\n }\n const label = { ...labelOptions };\n if (label.formatter && !label.content) {\n label.content = label.formatter;\n }\n return label;\n}\n"]}
|