@antv/g2plot 2.4.26 → 2.4.28
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
|
@@ -36,11 +36,11 @@ function getLineAttrs(cfg) {
|
|
|
36
36
|
fillOpacity: 0,
|
|
37
37
|
lineWidth: 4,
|
|
38
38
|
};
|
|
39
|
-
var attrs = util_1.mix({}, defaultAttrs, cfg.style);
|
|
39
|
+
var attrs = (0, util_1.mix)({}, defaultAttrs, cfg.style);
|
|
40
40
|
if (cfg.color && !attrs.stroke) {
|
|
41
41
|
attrs.stroke = cfg.color;
|
|
42
42
|
}
|
|
43
|
-
if (util_1.isNumber(cfg.opacity)) {
|
|
43
|
+
if ((0, util_1.isNumber)(cfg.opacity)) {
|
|
44
44
|
attrs.opacity = attrs.strokeOpacity = cfg.opacity;
|
|
45
45
|
}
|
|
46
46
|
return attrs;
|
|
@@ -205,7 +205,7 @@ function addWaterWave(x, y, level, waveCount, waveAttrs, group, clip, radius, wa
|
|
|
205
205
|
// 默认 underfind 开启动画
|
|
206
206
|
if (animation === false)
|
|
207
207
|
return;
|
|
208
|
-
var matrix = matrix_1.transform([['t', waveLength, 0]]);
|
|
208
|
+
var matrix = (0, matrix_1.transform)([['t', waveLength, 0]]);
|
|
209
209
|
wave.stopAnimate();
|
|
210
210
|
wave.animate({ matrix: matrix }, {
|
|
211
211
|
duration: lerp(0.5 * DURATION, DURATION, factor),
|
|
@@ -242,7 +242,7 @@ function pin(x, y, width, height) {
|
|
|
242
242
|
// control point
|
|
243
243
|
var cpX = x;
|
|
244
244
|
var cpY = cy + r / Math.sin(theta);
|
|
245
|
-
return "\n M "
|
|
245
|
+
return "\n M ".concat(x0, " ").concat(y0, "\n A ").concat(r, " ").concat(r, " 0 1 1 ").concat(x0 + dx * 2, " ").concat(y0, "\n Q ").concat(cpX, " ").concat(cpY, " ").concat(x, " ").concat(y + h / 2, "\n Q ").concat(cpX, " ").concat(cpY, " ").concat(x0, " ").concat(y0, "\n Z \n ");
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
*
|
|
@@ -254,7 +254,7 @@ function pin(x, y, width, height) {
|
|
|
254
254
|
function circle(x, y, width, height) {
|
|
255
255
|
var rx = width / 2;
|
|
256
256
|
var ry = height / 2;
|
|
257
|
-
return "\n M "
|
|
257
|
+
return "\n M ".concat(x, " ").concat(y - ry, " \n a ").concat(rx, " ").concat(ry, " 0 1 0 0 ").concat(ry * 2, "\n a ").concat(rx, " ").concat(ry, " 0 1 0 0 ").concat(-ry * 2, "\n Z\n ");
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
260
|
*
|
|
@@ -266,7 +266,7 @@ function circle(x, y, width, height) {
|
|
|
266
266
|
function diamond(x, y, width, height) {
|
|
267
267
|
var h = height / 2;
|
|
268
268
|
var w = width / 2;
|
|
269
|
-
return "\n M "
|
|
269
|
+
return "\n M ".concat(x, " ").concat(y - h, "\n L ").concat(x + w, " ").concat(y, "\n L ").concat(x, " ").concat(y + h, "\n L ").concat(x - w, " ").concat(y, "\n Z\n ");
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
272
272
|
*
|
|
@@ -278,7 +278,7 @@ function diamond(x, y, width, height) {
|
|
|
278
278
|
function triangle(x, y, width, height) {
|
|
279
279
|
var h = height / 2;
|
|
280
280
|
var w = width / 2;
|
|
281
|
-
return "\n M "
|
|
281
|
+
return "\n M ".concat(x, " ").concat(y - h, "\n L ").concat(x + w, " ").concat(y + h, "\n L ").concat(x - w, " ").concat(y + h, "\n Z\n ");
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
*
|
|
@@ -291,7 +291,7 @@ function rect(x, y, width, height) {
|
|
|
291
291
|
var GOLDEN_SECTION_RATIO = 0.618;
|
|
292
292
|
var h = height / 2;
|
|
293
293
|
var w = (width / 2) * GOLDEN_SECTION_RATIO;
|
|
294
|
-
return "\n M "
|
|
294
|
+
return "\n M ".concat(x - w, " ").concat(y - h, "\n L ").concat(x + w, " ").concat(y - h, "\n L ").concat(x + w, " ").concat(y + h, "\n L ").concat(x - w, " ").concat(y + h, "\n Z\n ");
|
|
295
295
|
}
|
|
296
296
|
var builtInShapeByName = {
|
|
297
297
|
pin: pin,
|
|
@@ -300,7 +300,7 @@ var builtInShapeByName = {
|
|
|
300
300
|
triangle: triangle,
|
|
301
301
|
rect: rect,
|
|
302
302
|
};
|
|
303
|
-
g2_1.registerShape('interval', 'liquid-fill-gauge', {
|
|
303
|
+
(0, g2_1.registerShape)('interval', 'liquid-fill-gauge', {
|
|
304
304
|
draw: function (cfg, container) {
|
|
305
305
|
var cx = 0.5;
|
|
306
306
|
var cy = 0.5;
|
|
@@ -311,7 +311,7 @@ g2_1.registerShape('interval', 'liquid-fill-gauge', {
|
|
|
311
311
|
var border = outline.border, distance = outline.distance;
|
|
312
312
|
var waveCount = wave.count, waveLength = wave.length;
|
|
313
313
|
// 获取最小 minX
|
|
314
|
-
var minX = util_1.reduce(cfg.points, function (r, p) {
|
|
314
|
+
var minX = (0, util_1.reduce)(cfg.points, function (r, p) {
|
|
315
315
|
return Math.min(r, p.x);
|
|
316
316
|
}, Infinity);
|
|
317
317
|
var center = this.parsePoint({ x: cx, y: cy });
|
|
@@ -320,7 +320,7 @@ g2_1.registerShape('interval', 'liquid-fill-gauge', {
|
|
|
320
320
|
// 保证半径是 画布宽高最小值的 radius 值
|
|
321
321
|
var radius = Math.min(halfWidth, minXPoint.y * radio);
|
|
322
322
|
var waveAttrs = getFillAttrs(cfg);
|
|
323
|
-
var outlineAttrs = getLineAttrs(util_1.mix({}, cfg, outline));
|
|
323
|
+
var outlineAttrs = getLineAttrs((0, util_1.mix)({}, cfg, outline));
|
|
324
324
|
var innerRadius = radius - border / 2;
|
|
325
325
|
var buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];
|
|
326
326
|
var shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);
|
|
@@ -360,7 +360,7 @@ g2_1.registerShape('interval', 'liquid-fill-gauge', {
|
|
|
360
360
|
// 6. 绘制一个 border 宽的 border
|
|
361
361
|
container.addShape('path', {
|
|
362
362
|
name: 'wrap',
|
|
363
|
-
attrs: util_1.mix(outlineAttrs, {
|
|
363
|
+
attrs: (0, util_1.mix)(outlineAttrs, {
|
|
364
364
|
path: shapePath,
|
|
365
365
|
fill: 'transparent',
|
|
366
366
|
lineWidth: border,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../../src/plots/liquid/shapes/liquid.ts"],"names":[],"mappings":";;;;AACA,+BAAyC;AACzC,mCAAmD;AAEnD,gDAAkD;AAGlD,IAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,MAAc;IACpD,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAe;IACnC,IAAM,KAAK,sBAAK,OAAO,EAAE,CAAC,IAAK,GAAG,CAAC,KAAK,CAAE,CAAC;IAE3C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;KACxB;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAe;IACnC,IAAM,YAAY,GAAG;QACnB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;KACb,CAAC;IACF,IAAM,KAAK,GAAG,UAAG,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QAC9B,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC;KAC1B;IACD,IAAI,eAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACzB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CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,CAAC;gBAChC,MAAM,EAAE,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;aAC3D;SACF,CAAC,CAAC;QAEH,2BAA2B;QAC3B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,UAAG,CAAC,YAAY,EAAE;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,MAAM;aAClB,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, IShape } from '@antv/g-base';\nimport { registerShape } from '@antv/g2';\nimport { isNumber, mix, reduce } from '@antv/util';\nimport { Point, ShapeStyle } from '../../../types';\nimport { transform } from '../../../utils/matrix';\nimport { CustomInfo, LiquidOptions } from '../types';\n\nconst DURATION = 5000;\n\n/**\n * 一个线性映射的函数\n * @param min\n * @param max\n * @param factor\n */\nfunction lerp(min: number, max: number, factor: number) {\n return min + (max - min) * factor;\n}\n\n/**\n * 波浪的 attrs\n * @param cfg\n */\nfunction getFillAttrs(cfg: ShapeStyle) {\n const attrs = { opacity: 1, ...cfg.style };\n\n if (cfg.color && !attrs.fill) {\n attrs.fill = cfg.color;\n }\n\n return attrs;\n}\n\n/**\n * shape 的 attrs\n * @param cfg\n */\nfunction getLineAttrs(cfg: ShapeStyle) {\n const defaultAttrs = {\n fill: '#fff',\n fillOpacity: 0,\n lineWidth: 4,\n };\n const attrs = mix({}, defaultAttrs, cfg.style);\n\n if (cfg.color && !attrs.stroke) {\n attrs.stroke = cfg.color;\n }\n if (isNumber(cfg.opacity)) {\n attrs.opacity = attrs.strokeOpacity = cfg.opacity;\n }\n\n return attrs;\n}\n\n/**\n * 用贝塞尔曲线模拟正弦波\n * Using Bezier curves to fit sine wave.\n * There is 4 control points for each curve of wave,\n * which is at 1/4 wave length of the sine wave.\n *\n * The control points for a wave from (a) to (d) are a-b-c-d:\n * c *----* d\n * b *\n * |\n * ... a * ..................\n *\n * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)\n *\n * @param x x position of the left-most point (a)\n * @param stage 0-3, stating which part of the wave it is\n * @param waveLength wave length of the sine wave\n * @param amplitude wave amplitude\n * @return 正弦片段曲线\n */\nfunction getWaterWavePositions(x: number, stage: number, waveLength: number, amplitude: number) {\n if (stage === 0) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, amplitude],\n [x + waveLength / 4, amplitude],\n ];\n }\n if (stage === 1) {\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n }\n if (stage === 2) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, -amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, -amplitude],\n [x + waveLength / 4, -amplitude],\n ];\n }\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), -amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), -amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n}\n/**\n * 获取水波路径\n * @param radius 半径\n * @param waterLevel 水位\n * @param waveLength 波长\n * @param phase 相位\n * @param amplitude 震幅\n * @param cx 圆心x\n * @param cy 圆心y\n * @return path 路径\n * @reference http://gitlab.alipay-inc.com/datavis/g6/blob/1.2.0/src/graph/utils/path.js#L135\n */\nfunction getWaterWavePath(\n radius: number,\n waterLevel: number,\n waveLength: number,\n phase: number,\n amplitude: number,\n cx: number,\n cy: number\n) {\n const curves = Math.ceil(((2 * radius) / waveLength) * 4) * 4;\n const path = [];\n let _phase = phase;\n\n // map phase to [-Math.PI * 2, 0]\n while (_phase < -Math.PI * 2) {\n _phase += Math.PI * 2;\n }\n while (_phase > 0) {\n _phase -= Math.PI * 2;\n }\n _phase = (_phase / Math.PI / 2) * waveLength;\n\n const left = cx - radius + _phase - radius * 2;\n /**\n * top-left corner as start point\n *\n * draws this point\n * |\n * \\|/\n * ~~~~~~~~\n * | |\n * +------+\n */\n path.push(['M', left, waterLevel]);\n\n /**\n * top wave\n *\n * ~~~~~~~~ <- draws this sine wave\n * | |\n * +------+\n */\n let waveRight = 0;\n for (let c = 0; c < curves; ++c) {\n const stage = c % 4;\n const pos = getWaterWavePositions((c * waveLength) / 4, stage, waveLength, amplitude);\n path.push([\n 'C',\n pos[0][0] + left,\n -pos[0][1] + waterLevel,\n pos[1][0] + left,\n -pos[1][1] + waterLevel,\n pos[2][0] + left,\n -pos[2][1] + waterLevel,\n ]);\n\n if (c === curves - 1) {\n waveRight = pos[2][0];\n }\n }\n\n /**\n * top-right corner\n *\n * ~~~~~~~~\n * 3. draws this line -> | | <- 1. draws this line\n * +------+\n * ^\n * |\n * 2. draws this line\n */\n path.push(['L', waveRight + left, cy + radius]);\n path.push(['L', left, cy + radius]);\n path.push(['Z']);\n // path.push(['L', left, waterLevel]);\n return path;\n}\n\n/**\n * 添加水波\n * @param x 中心x\n * @param y 中心y\n * @param level 水位等级 0~1\n * @param waveCount 水波数\n * @param waveAttrs 色值\n * @param group 图组\n * @param clip 用于剪切的图形\n * @param radius 绘制图形的高度\n * @param waveLength 波的长度\n */\nexport function addWaterWave(\n x: number,\n y: number,\n level: number,\n waveCount: number,\n waveAttrs: ShapeStyle,\n group: IGroup,\n clip: IShape,\n radius: number,\n waveLength: number,\n animation: LiquidOptions['animation']\n) {\n // 盒子属性 颜色 宽高\n const { fill, opacity } = waveAttrs;\n const bbox = clip.getBBox();\n const width = bbox.maxX - bbox.minX;\n const height = bbox.maxY - bbox.minY;\n\n // 循环 waveCount 个数\n for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 1 : idx / (waveCount - 1);\n\n // 画波\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\n // 波形路径配置\n path: getWaterWavePath(\n radius,\n bbox.minY + height * level,\n waveLength,\n 0,\n width / 32, // 波幅高度\n x,\n y\n ),\n fill,\n opacity: lerp(0.2, 0.9, factor) * opacity,\n },\n });\n\n try {\n // 默认 underfind 开启动画\n if (animation === false) return;\n const matrix = transform([['t', waveLength, 0]]);\n\n wave.stopAnimate();\n wave.animate(\n { matrix },\n {\n duration: lerp(0.5 * DURATION, DURATION, factor),\n repeat: true,\n }\n );\n } catch (e) {\n // TODO off-screen canvas 中动画会找不到 canvas\n console.warn('off-screen group animate error!');\n }\n }\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction pin(x: number, y: number, width: number, height: number) {\n const w = (width * 2) / 3;\n const h = Math.max(w, height);\n const r = w / 2;\n\n // attrs of the upper circle\n const cx = x;\n const cy = r + y - h / 2;\n const theta = Math.asin(r / ((h - r) * 0.85));\n const dy = Math.sin(theta) * r;\n const dx = Math.cos(theta) * r;\n\n // the start point of the path\n const x0 = cx - dx;\n const y0 = cy + dy;\n\n // control point\n const cpX = x;\n const cpY = cy + r / Math.sin(theta);\n\n return `\n M ${x0} ${y0}\n A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}\n Q ${cpX} ${cpY} ${x} ${y + h / 2}\n Q ${cpX} ${cpY} ${x0} ${y0}\n Z \n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction circle(x: number, y: number, width: number, height: number) {\n const rx = width / 2;\n const ry = height / 2;\n return `\n M ${x} ${y - ry} \n a ${rx} ${ry} 0 1 0 0 ${ry * 2}\n a ${rx} ${ry} 0 1 0 0 ${-ry * 2}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction diamond(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y}\n L ${x} ${y + h}\n L ${x - w} ${y}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction triangle(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction rect(x: number, y: number, width: number, height: number) {\n const GOLDEN_SECTION_RATIO = 0.618;\n const h = height / 2;\n const w = (width / 2) * GOLDEN_SECTION_RATIO;\n return `\n M ${x - w} ${y - h}\n L ${x + w} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\nconst builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\n};\n\nregisterShape('interval', 'liquid-fill-gauge', {\n draw(cfg: any, container: IGroup) {\n const cx = 0.5;\n const cy = 0.5;\n\n const { customInfo } = cfg;\n const { percent, radius: radio, shape, shapeStyle, background, animation } = customInfo as CustomInfo;\n const outline: LiquidOptions['outline'] = customInfo.outline;\n const wave: LiquidOptions['wave'] = customInfo.wave;\n const { border, distance } = outline;\n const { count: waveCount, length: waveLength } = wave;\n\n // 获取最小 minX\n const minX = reduce(\n cfg.points as Point[],\n (r: number, p: Point) => {\n return Math.min(r, p.x);\n },\n Infinity\n );\n\n const center = this.parsePoint({ x: cx, y: cy });\n const minXPoint = this.parsePoint({ x: minX, y: cy });\n const halfWidth = center.x - minXPoint.x;\n\n // 保证半径是 画布宽高最小值的 radius 值\n const radius = Math.min(halfWidth, minXPoint.y * radio);\n const waveAttrs = getFillAttrs(cfg);\n const outlineAttrs = getLineAttrs(mix({}, cfg, outline));\n const innerRadius = radius - border / 2;\n\n const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];\n const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);\n\n // 1. 当 shapeStyle 不为空时,绘制形状样式作为背景\n if (shapeStyle) {\n container.addShape('path', {\n name: 'shape',\n attrs: {\n path: shapePath,\n ...shapeStyle,\n },\n });\n }\n\n // 比例大于 0 时才绘制水波\n if (percent > 0) {\n // 2. 绘制一个波\n const waves = container.addGroup({\n name: 'waves',\n });\n\n // 3. 波对应的 clip 裁剪形状\n const clipPath = waves.setClip({\n type: 'path',\n attrs: {\n path: shapePath,\n },\n });\n\n // 4. 绘制波形\n addWaterWave(\n center.x,\n center.y,\n 1 - (cfg.points[1] as Point).y,\n waveCount,\n waveAttrs,\n waves,\n clipPath,\n radius * 2,\n waveLength,\n animation\n );\n }\n\n // 5. 绘制一个 distance 宽的 border\n container.addShape('path', {\n name: 'distance',\n attrs: {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border + distance * 2,\n stroke: background === 'transparent' ? '#fff' : background,\n },\n });\n\n // 6. 绘制一个 border 宽的 border\n container.addShape('path', {\n name: 'wrap',\n attrs: mix(outlineAttrs, {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border,\n }),\n });\n\n return container;\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../../src/plots/liquid/shapes/liquid.ts"],"names":[],"mappings":";;;;AACA,+BAAyC;AACzC,mCAAmD;AAEnD,gDAAkD;AAGlD,IAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,E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,EAAC,YAAY,EAAE;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,MAAM;aAClB,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, IShape } from '@antv/g-base';\nimport { registerShape } from '@antv/g2';\nimport { isNumber, mix, reduce } from '@antv/util';\nimport { Point, ShapeStyle } from '../../../types';\nimport { transform } from '../../../utils/matrix';\nimport { CustomInfo, LiquidOptions } from '../types';\n\nconst DURATION = 5000;\n\n/**\n * 一个线性映射的函数\n * @param min\n * @param max\n * @param factor\n */\nfunction lerp(min: number, max: number, factor: number) {\n return min + (max - min) * factor;\n}\n\n/**\n * 波浪的 attrs\n * @param cfg\n */\nfunction getFillAttrs(cfg: ShapeStyle) {\n const attrs = { opacity: 1, ...cfg.style };\n\n if (cfg.color && !attrs.fill) {\n attrs.fill = cfg.color;\n }\n\n return attrs;\n}\n\n/**\n * shape 的 attrs\n * @param cfg\n */\nfunction getLineAttrs(cfg: ShapeStyle) {\n const defaultAttrs = {\n fill: '#fff',\n fillOpacity: 0,\n lineWidth: 4,\n };\n const attrs = mix({}, defaultAttrs, cfg.style);\n\n if (cfg.color && !attrs.stroke) {\n attrs.stroke = cfg.color;\n }\n if (isNumber(cfg.opacity)) {\n attrs.opacity = attrs.strokeOpacity = cfg.opacity;\n }\n\n return attrs;\n}\n\n/**\n * 用贝塞尔曲线模拟正弦波\n * Using Bezier curves to fit sine wave.\n * There is 4 control points for each curve of wave,\n * which is at 1/4 wave length of the sine wave.\n *\n * The control points for a wave from (a) to (d) are a-b-c-d:\n * c *----* d\n * b *\n * |\n * ... a * ..................\n *\n * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)\n *\n * @param x x position of the left-most point (a)\n * @param stage 0-3, stating which part of the wave it is\n * @param waveLength wave length of the sine wave\n * @param amplitude wave amplitude\n * @return 正弦片段曲线\n */\nfunction getWaterWavePositions(x: number, stage: number, waveLength: number, amplitude: number) {\n if (stage === 0) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, amplitude],\n [x + waveLength / 4, amplitude],\n ];\n }\n if (stage === 1) {\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n }\n if (stage === 2) {\n return [\n [x + ((1 / 2) * waveLength) / Math.PI / 2, -amplitude / 2],\n [x + ((1 / 2) * waveLength) / Math.PI, -amplitude],\n [x + waveLength / 4, -amplitude],\n ];\n }\n return [\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), -amplitude],\n [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), -amplitude / 2],\n [x + waveLength / 4, 0],\n ];\n}\n/**\n * 获取水波路径\n * @param radius 半径\n * @param waterLevel 水位\n * @param waveLength 波长\n * @param phase 相位\n * @param amplitude 震幅\n * @param cx 圆心x\n * @param cy 圆心y\n * @return path 路径\n * @reference http://gitlab.alipay-inc.com/datavis/g6/blob/1.2.0/src/graph/utils/path.js#L135\n */\nfunction getWaterWavePath(\n radius: number,\n waterLevel: number,\n waveLength: number,\n phase: number,\n amplitude: number,\n cx: number,\n cy: number\n) {\n const curves = Math.ceil(((2 * radius) / waveLength) * 4) * 4;\n const path = [];\n let _phase = phase;\n\n // map phase to [-Math.PI * 2, 0]\n while (_phase < -Math.PI * 2) {\n _phase += Math.PI * 2;\n }\n while (_phase > 0) {\n _phase -= Math.PI * 2;\n }\n _phase = (_phase / Math.PI / 2) * waveLength;\n\n const left = cx - radius + _phase - radius * 2;\n /**\n * top-left corner as start point\n *\n * draws this point\n * |\n * \\|/\n * ~~~~~~~~\n * | |\n * +------+\n */\n path.push(['M', left, waterLevel]);\n\n /**\n * top wave\n *\n * ~~~~~~~~ <- draws this sine wave\n * | |\n * +------+\n */\n let waveRight = 0;\n for (let c = 0; c < curves; ++c) {\n const stage = c % 4;\n const pos = getWaterWavePositions((c * waveLength) / 4, stage, waveLength, amplitude);\n path.push([\n 'C',\n pos[0][0] + left,\n -pos[0][1] + waterLevel,\n pos[1][0] + left,\n -pos[1][1] + waterLevel,\n pos[2][0] + left,\n -pos[2][1] + waterLevel,\n ]);\n\n if (c === curves - 1) {\n waveRight = pos[2][0];\n }\n }\n\n /**\n * top-right corner\n *\n * ~~~~~~~~\n * 3. draws this line -> | | <- 1. draws this line\n * +------+\n * ^\n * |\n * 2. draws this line\n */\n path.push(['L', waveRight + left, cy + radius]);\n path.push(['L', left, cy + radius]);\n path.push(['Z']);\n // path.push(['L', left, waterLevel]);\n return path;\n}\n\n/**\n * 添加水波\n * @param x 中心x\n * @param y 中心y\n * @param level 水位等级 0~1\n * @param waveCount 水波数\n * @param waveAttrs 色值\n * @param group 图组\n * @param clip 用于剪切的图形\n * @param radius 绘制图形的高度\n * @param waveLength 波的长度\n */\nexport function addWaterWave(\n x: number,\n y: number,\n level: number,\n waveCount: number,\n waveAttrs: ShapeStyle,\n group: IGroup,\n clip: IShape,\n radius: number,\n waveLength: number,\n animation: LiquidOptions['animation']\n) {\n // 盒子属性 颜色 宽高\n const { fill, opacity } = waveAttrs;\n const bbox = clip.getBBox();\n const width = bbox.maxX - bbox.minX;\n const height = bbox.maxY - bbox.minY;\n\n // 循环 waveCount 个数\n for (let idx = 0; idx < waveCount; idx++) {\n const factor = waveCount <= 1 ? 1 : idx / (waveCount - 1);\n\n // 画波\n const wave = group.addShape('path', {\n name: `waterwave-path`,\n attrs: {\n // 波形路径配置\n path: getWaterWavePath(\n radius,\n bbox.minY + height * level,\n waveLength,\n 0,\n width / 32, // 波幅高度\n x,\n y\n ),\n fill,\n opacity: lerp(0.2, 0.9, factor) * opacity,\n },\n });\n\n try {\n // 默认 underfind 开启动画\n if (animation === false) return;\n const matrix = transform([['t', waveLength, 0]]);\n\n wave.stopAnimate();\n wave.animate(\n { matrix },\n {\n duration: lerp(0.5 * DURATION, DURATION, factor),\n repeat: true,\n }\n );\n } catch (e) {\n // TODO off-screen canvas 中动画会找不到 canvas\n console.warn('off-screen group animate error!');\n }\n }\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction pin(x: number, y: number, width: number, height: number) {\n const w = (width * 2) / 3;\n const h = Math.max(w, height);\n const r = w / 2;\n\n // attrs of the upper circle\n const cx = x;\n const cy = r + y - h / 2;\n const theta = Math.asin(r / ((h - r) * 0.85));\n const dy = Math.sin(theta) * r;\n const dx = Math.cos(theta) * r;\n\n // the start point of the path\n const x0 = cx - dx;\n const y0 = cy + dy;\n\n // control point\n const cpX = x;\n const cpY = cy + r / Math.sin(theta);\n\n return `\n M ${x0} ${y0}\n A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}\n Q ${cpX} ${cpY} ${x} ${y + h / 2}\n Q ${cpX} ${cpY} ${x0} ${y0}\n Z \n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction circle(x: number, y: number, width: number, height: number) {\n const rx = width / 2;\n const ry = height / 2;\n return `\n M ${x} ${y - ry} \n a ${rx} ${ry} 0 1 0 0 ${ry * 2}\n a ${rx} ${ry} 0 1 0 0 ${-ry * 2}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction diamond(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y}\n L ${x} ${y + h}\n L ${x - w} ${y}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction triangle(x: number, y: number, width: number, height: number) {\n const h = height / 2;\n const w = width / 2;\n return `\n M ${x} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\n/**\n *\n * @param x 中心 x\n * @param y 中心 y\n * @param width 外接矩形的宽\n * @param height 外接矩形的高\n */\nfunction rect(x: number, y: number, width: number, height: number) {\n const GOLDEN_SECTION_RATIO = 0.618;\n const h = height / 2;\n const w = (width / 2) * GOLDEN_SECTION_RATIO;\n return `\n M ${x - w} ${y - h}\n L ${x + w} ${y - h}\n L ${x + w} ${y + h}\n L ${x - w} ${y + h}\n Z\n `;\n}\n\nconst builtInShapeByName = {\n pin,\n circle,\n diamond,\n triangle,\n rect,\n};\n\nregisterShape('interval', 'liquid-fill-gauge', {\n draw(cfg: any, container: IGroup) {\n const cx = 0.5;\n const cy = 0.5;\n\n const { customInfo } = cfg;\n const { percent, radius: radio, shape, shapeStyle, background, animation } = customInfo as CustomInfo;\n const outline: LiquidOptions['outline'] = customInfo.outline;\n const wave: LiquidOptions['wave'] = customInfo.wave;\n const { border, distance } = outline;\n const { count: waveCount, length: waveLength } = wave;\n\n // 获取最小 minX\n const minX = reduce(\n cfg.points as Point[],\n (r: number, p: Point) => {\n return Math.min(r, p.x);\n },\n Infinity\n );\n\n const center = this.parsePoint({ x: cx, y: cy });\n const minXPoint = this.parsePoint({ x: minX, y: cy });\n const halfWidth = center.x - minXPoint.x;\n\n // 保证半径是 画布宽高最小值的 radius 值\n const radius = Math.min(halfWidth, minXPoint.y * radio);\n const waveAttrs = getFillAttrs(cfg);\n const outlineAttrs = getLineAttrs(mix({}, cfg, outline));\n const innerRadius = radius - border / 2;\n\n const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];\n const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);\n\n // 1. 当 shapeStyle 不为空时,绘制形状样式作为背景\n if (shapeStyle) {\n container.addShape('path', {\n name: 'shape',\n attrs: {\n path: shapePath,\n ...shapeStyle,\n },\n });\n }\n\n // 比例大于 0 时才绘制水波\n if (percent > 0) {\n // 2. 绘制一个波\n const waves = container.addGroup({\n name: 'waves',\n });\n\n // 3. 波对应的 clip 裁剪形状\n const clipPath = waves.setClip({\n type: 'path',\n attrs: {\n path: shapePath,\n },\n });\n\n // 4. 绘制波形\n addWaterWave(\n center.x,\n center.y,\n 1 - (cfg.points[1] as Point).y,\n waveCount,\n waveAttrs,\n waves,\n clipPath,\n radius * 2,\n waveLength,\n animation\n );\n }\n\n // 5. 绘制一个 distance 宽的 border\n container.addShape('path', {\n name: 'distance',\n attrs: {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border + distance * 2,\n stroke: background === 'transparent' ? '#fff' : background,\n },\n });\n\n // 6. 绘制一个 border 宽的 border\n container.addShape('path', {\n name: 'wrap',\n attrs: mix(outlineAttrs, {\n path: shapePath,\n fill: 'transparent',\n lineWidth: border,\n }),\n });\n\n return container;\n },\n});\n"]}
|
|
@@ -3,7 +3,7 @@ import { ColorAttr, Options, ShapeStyle, Statistic, StyleAttr } from '../../type
|
|
|
3
3
|
/**
|
|
4
4
|
* @title 轮廓
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
type Outline = Partial<{
|
|
7
7
|
/**
|
|
8
8
|
* @title 外环的宽度
|
|
9
9
|
* @default "2px"
|
|
@@ -19,7 +19,7 @@ declare type Outline = Partial<{
|
|
|
19
19
|
*/
|
|
20
20
|
readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;
|
|
21
21
|
}>;
|
|
22
|
-
|
|
22
|
+
type Wave = Partial<{
|
|
23
23
|
/**
|
|
24
24
|
* @title 波形的数量
|
|
25
25
|
* @default 3
|
|
@@ -31,7 +31,7 @@ declare type Wave = Partial<{
|
|
|
31
31
|
*/
|
|
32
32
|
readonly length: number;
|
|
33
33
|
}>;
|
|
34
|
-
|
|
34
|
+
type ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];
|
|
35
35
|
/**
|
|
36
36
|
* @title 配置类型定义
|
|
37
37
|
*/
|
|
@@ -80,7 +80,7 @@ export interface LiquidOptions extends Omit<Options, 'data'> {
|
|
|
80
80
|
/**
|
|
81
81
|
* @title 水波图自定义 的 customInfo
|
|
82
82
|
*/
|
|
83
|
-
export
|
|
83
|
+
export type CustomInfo = {
|
|
84
84
|
percent?: LiquidOptions['percent'];
|
|
85
85
|
radius?: LiquidOptions['radius'];
|
|
86
86
|
outline?: LiquidOptions['outline'];
|
package/lib/plots/mix/adaptor.js
CHANGED
|
@@ -16,7 +16,7 @@ var utils_2 = require("./utils");
|
|
|
16
16
|
function multiView(params) {
|
|
17
17
|
var chart = params.chart, options = params.options;
|
|
18
18
|
var views = options.views, legend = options.legend;
|
|
19
|
-
util_1.each(views, function (v) {
|
|
19
|
+
(0, util_1.each)(views, function (v) {
|
|
20
20
|
var region = v.region, data = v.data, meta = v.meta, axes = v.axes, coordinate = v.coordinate, interactions = v.interactions, annotations = v.annotations, tooltip = v.tooltip, geometries = v.geometries;
|
|
21
21
|
// 1. 创建 view
|
|
22
22
|
var viewOfG2 = chart.createView({
|
|
@@ -27,26 +27,26 @@ function multiView(params) {
|
|
|
27
27
|
// 3. meta
|
|
28
28
|
var scales = {};
|
|
29
29
|
if (axes) {
|
|
30
|
-
util_1.each(axes, function (axis, field) {
|
|
31
|
-
scales[field] = utils_1.pick(axis, constant_1.AXIS_META_CONFIG_KEYS);
|
|
30
|
+
(0, util_1.each)(axes, function (axis, field) {
|
|
31
|
+
scales[field] = (0, utils_1.pick)(axis, constant_1.AXIS_META_CONFIG_KEYS);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
scales = utils_1.deepAssign({}, meta, scales);
|
|
34
|
+
scales = (0, utils_1.deepAssign)({}, meta, scales);
|
|
35
35
|
viewOfG2.scale(scales);
|
|
36
36
|
// 4. x y axis
|
|
37
37
|
if (!axes) {
|
|
38
38
|
viewOfG2.axis(false);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
util_1.each(axes, function (axis, field) {
|
|
41
|
+
(0, util_1.each)(axes, function (axis, field) {
|
|
42
42
|
viewOfG2.axis(field, axis);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
// 5. coordinate
|
|
46
46
|
viewOfG2.coordinate(coordinate);
|
|
47
47
|
// 6. geometry
|
|
48
|
-
util_1.each(geometries, function (geometry) {
|
|
49
|
-
var ext = base_1.geometry({
|
|
48
|
+
(0, util_1.each)(geometries, function (geometry) {
|
|
49
|
+
var ext = (0, base_1.geometry)({
|
|
50
50
|
chart: viewOfG2,
|
|
51
51
|
options: geometry,
|
|
52
52
|
}).ext;
|
|
@@ -57,7 +57,7 @@ function multiView(params) {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
// 7. interactions
|
|
60
|
-
util_1.each(interactions, function (interaction) {
|
|
60
|
+
(0, util_1.each)(interactions, function (interaction) {
|
|
61
61
|
if (interaction.enable === false) {
|
|
62
62
|
viewOfG2.removeInteraction(interaction.type);
|
|
63
63
|
}
|
|
@@ -66,7 +66,7 @@ function multiView(params) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
// 8. annotations
|
|
69
|
-
util_1.each(annotations, function (annotation) {
|
|
69
|
+
(0, util_1.each)(annotations, function (annotation) {
|
|
70
70
|
viewOfG2.annotation()[annotation.type](tslib_1.__assign({}, annotation));
|
|
71
71
|
});
|
|
72
72
|
// 9. animation (先做动画)
|
|
@@ -76,7 +76,7 @@ function multiView(params) {
|
|
|
76
76
|
else {
|
|
77
77
|
viewOfG2.animate(true);
|
|
78
78
|
// 9.1 所有的 Geometry 都使用同一动画(各个图形如有区别,todo 自行覆盖)
|
|
79
|
-
util_1.each(viewOfG2.geometries, function (g) {
|
|
79
|
+
(0, util_1.each)(viewOfG2.geometries, function (g) {
|
|
80
80
|
g.animate(v.animation);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -91,7 +91,7 @@ function multiView(params) {
|
|
|
91
91
|
chart.legend(false);
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
util_1.each(legend, function (l, field) {
|
|
94
|
+
(0, util_1.each)(legend, function (l, field) {
|
|
95
95
|
chart.legend(field, l);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -106,19 +106,19 @@ function multiView(params) {
|
|
|
106
106
|
function multiPlot(params) {
|
|
107
107
|
var chart = params.chart, options = params.options;
|
|
108
108
|
var plots = options.plots, _a = options.data, data = _a === void 0 ? [] : _a;
|
|
109
|
-
util_1.each(plots, function (plot) {
|
|
109
|
+
(0, util_1.each)(plots, function (plot) {
|
|
110
110
|
var type = plot.type, region = plot.region, _a = plot.options, options = _a === void 0 ? {} : _a, top = plot.top;
|
|
111
111
|
var tooltip = options.tooltip;
|
|
112
112
|
if (top) {
|
|
113
|
-
utils_2.execPlotAdaptor(type, chart, tslib_1.__assign(tslib_1.__assign({}, options), { data: data }));
|
|
113
|
+
(0, utils_2.execPlotAdaptor)(type, chart, tslib_1.__assign(tslib_1.__assign({}, options), { data: data }));
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
var viewOfG2 = chart.createView(tslib_1.__assign({ region: region }, utils_1.pick(options, plot_1.PLOT_CONTAINER_OPTIONS)));
|
|
116
|
+
var viewOfG2 = chart.createView(tslib_1.__assign({ region: region }, (0, utils_1.pick)(options, plot_1.PLOT_CONTAINER_OPTIONS)));
|
|
117
117
|
if (tooltip) {
|
|
118
118
|
// 配置 tooltip 交互
|
|
119
119
|
viewOfG2.interaction('tooltip');
|
|
120
120
|
}
|
|
121
|
-
utils_2.execPlotAdaptor(type, viewOfG2, tslib_1.__assign({ data: data }, options));
|
|
121
|
+
(0, utils_2.execPlotAdaptor)(type, viewOfG2, tslib_1.__assign({ data: data }, options));
|
|
122
122
|
});
|
|
123
123
|
return params;
|
|
124
124
|
}
|
|
@@ -138,8 +138,8 @@ exports.slider = slider;
|
|
|
138
138
|
* @param options
|
|
139
139
|
*/
|
|
140
140
|
function adaptor(params) {
|
|
141
|
-
return utils_1.flow(common_1.animation, // 多 view 的图,动画配置放到最前面
|
|
142
|
-
multiView, multiPlot, common_1.interaction, common_1.animation, common_1.theme, common_1.tooltip, slider, common_1.annotation()
|
|
141
|
+
return (0, utils_1.flow)(common_1.animation, // 多 view 的图,动画配置放到最前面
|
|
142
|
+
multiView, multiPlot, common_1.interaction, common_1.animation, common_1.theme, common_1.tooltip, slider, (0, common_1.annotation)()
|
|
143
143
|
// ... 其他的 adaptor flow
|
|
144
144
|
)(params);
|
|
145
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/mix/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAAkC;AAClC,+CAA0F;AAC1F,sDAA4E;AAC5E,2CAAuD;AAEvD,wCAAyD;AAIzD,qCAAqD;AAErD,iCAA0C;AAE1C;;;GAGG;AACH,SAAS,SAAS,CAAC,MAA0B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAK,GAAa,OAAO,MAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAElC,WAAI,
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/mix/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAAkC;AAClC,+CAA0F;AAC1F,sDAA4E;AAC5E,2CAAuD;AAEvD,wCAAyD;AAIzD,qCAAqD;AAErD,iCAA0C;AAE1C;;;GAGG;AACH,SAAS,SAAS,CAAC,MAA0B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAK,GAAa,OAAO,MAApB,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAElC,IAAA,WAAI,EAAC,KAAK,EAAE,UAAC,CAAQ;QACX,IAAA,MAAM,GAAm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,MAAA,IAAK,OAAO,EAAG,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,MAAM,CAAC,MAA0B;IACvC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAElC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wBAMC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA0B;IAChD,OAAO,IAAA,YAAI,EACT,kBAAS,EAAE,sBAAsB;IACjC,SAAS,EACT,SAAS,EACT,oBAAW,EACX,kBAAS,EACT,cAAK,EACL,gBAAO,EACP,MAAM,EACN,IAAA,mBAAU,GAAE;IACZ,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAbD,0BAaC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { each } from '@antv/util';\nimport { animation, annotation, interaction, theme, tooltip } from '../../adaptor/common';\nimport { geometry as geometryAdaptor } from '../../adaptor/geometries/base';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { PLOT_CONTAINER_OPTIONS } from '../../core/plot';\nimport { Axis } from '../../types/axis';\nimport { Interaction } from '../../types/interaction';\nimport { Legend } from '../../types/legend';\nimport { deepAssign, flow, pick } from '../../utils';\nimport { IGeometry, IView, MixOptions } from './types';\nimport { execPlotAdaptor } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction multiView(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { views, legend } = options;\n\n each(views, (v: IView) => {\n const { region, data, meta, axes, coordinate, interactions, annotations, tooltip, geometries } = v;\n\n // 1. 创建 view\n const viewOfG2 = chart.createView({\n region,\n });\n\n // 2. data\n viewOfG2.data(data);\n\n // 3. meta\n let scales: Record<string, any> = {};\n if (axes) {\n each(axes, (axis: Axis, field: string) => {\n scales[field] = pick(axis, AXIS_META_CONFIG_KEYS);\n });\n }\n\n scales = deepAssign({}, meta, scales);\n viewOfG2.scale(scales);\n\n // 4. x y axis\n if (!axes) {\n viewOfG2.axis(false);\n } else {\n each(axes, (axis: Axis, field: string) => {\n viewOfG2.axis(field, axis);\n });\n }\n\n // 5. coordinate\n viewOfG2.coordinate(coordinate);\n\n // 6. geometry\n each(geometries, (geometry: IGeometry) => {\n const { ext } = geometryAdaptor({\n chart: viewOfG2,\n options: geometry,\n });\n\n // adjust\n const { adjust } = geometry;\n if (adjust) {\n ext.geometry.adjust(adjust);\n }\n });\n\n // 7. interactions\n each(interactions, (interaction: Interaction) => {\n if (interaction.enable === false) {\n viewOfG2.removeInteraction(interaction.type);\n } else {\n viewOfG2.interaction(interaction.type, interaction.cfg);\n }\n });\n\n // 8. annotations\n each(annotations, (annotation) => {\n viewOfG2.annotation()[annotation.type]({\n ...annotation,\n });\n });\n\n // 9. animation (先做动画)\n if (typeof v.animation === 'boolean') {\n viewOfG2.animate(false);\n } else {\n viewOfG2.animate(true);\n // 9.1 所有的 Geometry 都使用同一动画(各个图形如有区别,todo 自行覆盖)\n each(viewOfG2.geometries, (g: Geometry) => {\n g.animate(v.animation);\n });\n }\n\n if (tooltip) {\n // 10. tooltip\n viewOfG2.interaction('tooltip');\n viewOfG2.tooltip(tooltip);\n }\n });\n\n // legend\n if (!legend) {\n chart.legend(false);\n } else {\n each(legend, (l: Legend, field: string) => {\n chart.legend(field, l);\n });\n }\n\n // tooltip\n chart.tooltip(options.tooltip);\n return params;\n}\n\n/**\n * 支持嵌套使用 g2plot 内置图表\n * @param params\n */\nfunction multiPlot(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n const { plots, data = [] } = options;\n\n each(plots, (plot) => {\n const { type, region, options = {}, top } = plot;\n const { tooltip } = options;\n\n if (top) {\n execPlotAdaptor(type, chart, { ...options, data });\n return;\n }\n\n const viewOfG2 = chart.createView({ region, ...pick(options, PLOT_CONTAINER_OPTIONS) });\n if (tooltip) {\n // 配置 tooltip 交互\n viewOfG2.interaction('tooltip');\n }\n\n execPlotAdaptor(type, viewOfG2, { data, ...options });\n });\n\n return params;\n}\n\n/**\n * 处理缩略轴的 adaptor (mix)\n * @param params\n */\nexport function slider(params: Params<MixOptions>): Params<MixOptions> {\n const { chart, options } = params;\n\n chart.option('slider', options.slider);\n\n return params;\n}\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<MixOptions>) {\n return flow(\n animation, // 多 view 的图,动画配置放到最前面\n multiView,\n multiPlot,\n interaction,\n animation,\n theme,\n tooltip,\n slider,\n annotation()\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
|
|
@@ -38,7 +38,7 @@ var Association = /** @class */ (function (_super) {
|
|
|
38
38
|
var items = [];
|
|
39
39
|
if ((_a = event.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
40
40
|
var data_1 = event.data.data;
|
|
41
|
-
util_1.each(views, function (v) {
|
|
41
|
+
(0, util_1.each)(views, function (v) {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
var field = linkField;
|
|
44
44
|
if (dim === 'x') {
|
|
@@ -53,11 +53,11 @@ var Association = /** @class */ (function (_super) {
|
|
|
53
53
|
if (!field) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
var elements = util_1.map(utils_1.getAllElements(v), function (ele) {
|
|
56
|
+
var elements = (0, util_1.map)((0, utils_1.getAllElements)(v), function (ele) {
|
|
57
57
|
var active = false;
|
|
58
58
|
var inactive = false;
|
|
59
|
-
var dataValue = util_1.isArray(data_1) ? util_1.get(data_1[0], field) : util_1.get(data_1, field);
|
|
60
|
-
if (utils_2.getElementValue(ele, field) === dataValue) {
|
|
59
|
+
var dataValue = (0, util_1.isArray)(data_1) ? (0, util_1.get)(data_1[0], field) : (0, util_1.get)(data_1, field);
|
|
60
|
+
if ((0, utils_2.getElementValue)(ele, field) === dataValue) {
|
|
61
61
|
active = true;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
@@ -74,9 +74,9 @@ var Association = /** @class */ (function (_super) {
|
|
|
74
74
|
* 所有同一层级的 tooltip 显示
|
|
75
75
|
*/
|
|
76
76
|
Association.prototype.showTooltip = function (params) {
|
|
77
|
-
var siblings = utils_1.getSiblingViews(this.context.view);
|
|
77
|
+
var siblings = (0, utils_1.getSiblingViews)(this.context.view);
|
|
78
78
|
var elements = this.getAssociationItems(siblings, params);
|
|
79
|
-
util_1.each(elements, function (ele) {
|
|
79
|
+
(0, util_1.each)(elements, function (ele) {
|
|
80
80
|
if (ele.active) {
|
|
81
81
|
var box = ele.element.shape.getCanvasBBox();
|
|
82
82
|
ele.view.showTooltip({ x: box.minX + box.width / 2, y: box.minY + box.height / 2 });
|
|
@@ -87,8 +87,8 @@ var Association = /** @class */ (function (_super) {
|
|
|
87
87
|
* 隐藏同一层级的 tooltip
|
|
88
88
|
*/
|
|
89
89
|
Association.prototype.hideTooltip = function () {
|
|
90
|
-
var siblings = utils_1.getSiblingViews(this.context.view);
|
|
91
|
-
util_1.each(siblings, function (sibling) {
|
|
90
|
+
var siblings = (0, utils_1.getSiblingViews)(this.context.view);
|
|
91
|
+
(0, util_1.each)(siblings, function (sibling) {
|
|
92
92
|
sibling.hideTooltip();
|
|
93
93
|
});
|
|
94
94
|
};
|
|
@@ -96,9 +96,9 @@ var Association = /** @class */ (function (_super) {
|
|
|
96
96
|
* 设置 active 状态
|
|
97
97
|
*/
|
|
98
98
|
Association.prototype.active = function (params) {
|
|
99
|
-
var views = utils_1.getViews(this.context.view);
|
|
99
|
+
var views = (0, utils_1.getViews)(this.context.view);
|
|
100
100
|
var items = this.getAssociationItems(views, params);
|
|
101
|
-
util_1.each(items, function (item) {
|
|
101
|
+
(0, util_1.each)(items, function (item) {
|
|
102
102
|
var active = item.active, element = item.element;
|
|
103
103
|
if (active) {
|
|
104
104
|
element.setState('active', true);
|
|
@@ -109,9 +109,9 @@ var Association = /** @class */ (function (_super) {
|
|
|
109
109
|
* 设置 selected 状态
|
|
110
110
|
*/
|
|
111
111
|
Association.prototype.selected = function (params) {
|
|
112
|
-
var views = utils_1.getViews(this.context.view);
|
|
112
|
+
var views = (0, utils_1.getViews)(this.context.view);
|
|
113
113
|
var items = this.getAssociationItems(views, params);
|
|
114
|
-
util_1.each(items, function (item) {
|
|
114
|
+
(0, util_1.each)(items, function (item) {
|
|
115
115
|
var active = item.active, element = item.element;
|
|
116
116
|
if (active) {
|
|
117
117
|
element.setState('selected', true);
|
|
@@ -122,9 +122,9 @@ var Association = /** @class */ (function (_super) {
|
|
|
122
122
|
* 进行高亮 => 设置 inactive 状态
|
|
123
123
|
*/
|
|
124
124
|
Association.prototype.highlight = function (params) {
|
|
125
|
-
var views = utils_1.getViews(this.context.view);
|
|
125
|
+
var views = (0, utils_1.getViews)(this.context.view);
|
|
126
126
|
var items = this.getAssociationItems(views, params);
|
|
127
|
-
util_1.each(items, function (item) {
|
|
127
|
+
(0, util_1.each)(items, function (item) {
|
|
128
128
|
var inactive = item.inactive, element = item.element;
|
|
129
129
|
if (inactive) {
|
|
130
130
|
element.setState('inactive', true);
|
|
@@ -132,39 +132,39 @@ var Association = /** @class */ (function (_super) {
|
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
134
|
Association.prototype.reset = function () {
|
|
135
|
-
var views = utils_1.getViews(this.context.view);
|
|
136
|
-
util_1.each(views, function (v) {
|
|
137
|
-
utils_2.clearHighlight(v);
|
|
135
|
+
var views = (0, utils_1.getViews)(this.context.view);
|
|
136
|
+
(0, util_1.each)(views, function (v) {
|
|
137
|
+
(0, utils_2.clearHighlight)(v);
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
return Association;
|
|
141
141
|
}(g2_1.Action));
|
|
142
|
-
g2_1.registerAction('association', Association);
|
|
142
|
+
(0, g2_1.registerAction)('association', Association);
|
|
143
143
|
/**
|
|
144
144
|
* 相邻 view 的 active 联动(相同维值的 tooltip 联动)
|
|
145
145
|
*/
|
|
146
|
-
g2_1.registerInteraction('association-active', {
|
|
146
|
+
(0, g2_1.registerInteraction)('association-active', {
|
|
147
147
|
start: [{ trigger: 'element:mouseenter', action: 'association:active' }],
|
|
148
148
|
end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],
|
|
149
149
|
});
|
|
150
150
|
/**
|
|
151
151
|
* 相邻 view 的 active 联动(相同维值的 tooltip 联动)
|
|
152
152
|
*/
|
|
153
|
-
g2_1.registerInteraction('association-selected', {
|
|
153
|
+
(0, g2_1.registerInteraction)('association-selected', {
|
|
154
154
|
start: [{ trigger: 'element:mouseenter', action: 'association:selected' }],
|
|
155
155
|
end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],
|
|
156
156
|
});
|
|
157
157
|
/**
|
|
158
158
|
* 相邻 view 的 highlight 联动, 突出当前 element
|
|
159
159
|
*/
|
|
160
|
-
g2_1.registerInteraction('association-highlight', {
|
|
160
|
+
(0, g2_1.registerInteraction)('association-highlight', {
|
|
161
161
|
start: [{ trigger: 'element:mouseenter', action: 'association:highlight' }],
|
|
162
162
|
end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],
|
|
163
163
|
});
|
|
164
164
|
/**
|
|
165
165
|
* 相邻 view 的 tooltip 联动,根据 groupField 进行关联(相同维值的 tooltip 联动)
|
|
166
166
|
*/
|
|
167
|
-
g2_1.registerInteraction('association-tooltip', {
|
|
167
|
+
(0, g2_1.registerInteraction)('association-tooltip', {
|
|
168
168
|
start: [{ trigger: 'element:mousemove', action: 'association:showTooltip' }],
|
|
169
169
|
end: [{ trigger: 'element:mouseleave', action: 'association:hideTooltip' }],
|
|
170
170
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"association.js","sourceRoot":"","sources":["../../../../src/plots/mix/interactions/association.ts"],"names":[],"mappings":";;;AAAA,+BAAsF;AACtF,mCAAqD;AACrD,wCAA2E;AAC3E,iCAA0D;AAI1D;;;;;;;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AAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACxE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH;;GAEG;AACH,IAAA,wBAAmB,EAAC,sBAAsB,EAAE;IAC1C,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;IAC1E,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH;;GAEG;AACH,IAAA,wBAAmB,EAAC,uBAAuB,EAAE;IAC3C,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAC3E,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH;;GAEG;AACH,IAAA,wBAAmB,EAAC,qBAAqB,EAAE;IACzC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC5E,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;CAC5E,CAAC,CAAC","sourcesContent":["import { Action, Element, registerAction, registerInteraction, View } from '@antv/g2';\nimport { each, get, isArray, map } from '@antv/util';\nimport { getAllElements, getSiblingViews, getViews } from '../../../utils';\nimport { clearHighlight, getElementValue } from './utils';\n\ntype EventItem = { element: Element; view: View; active: boolean; inactive: boolean };\ntype ActionParams = { linkField?: string; dim?: 'x' | 'y' };\n/**\n * 存在多个 view 时,view 之间的联动交互\n *\n * 提供四个反馈 action,均接受参数:linkField 关联字段,dim 维度\n * 1. showTooltip\n * 2. active\n * 3. highlight\n * 4. selected\n *\n * 附加,两个结束反馈 action:\n * 1. hidetooltip\n * 2. reset 清除激活和高亮状态\n */\nclass Association extends Action {\n /**\n * 获取关联的 elements\n *\n * - 如果 dim 参数存在,根据 dim 获取相应的 field。与 linkField 不匹配则 return\n * - 否则 dim 参数不存在,且 linkField 存在,则作为关联字段\n * - 否则若 linkField 不存在,则获取第一个分类字段\n * @returns EventItem[]\n */\n private getAssociationItems(views: View[], params?: ActionParams): EventItem[] {\n const { event } = this.context;\n const { linkField, dim } = params || {};\n\n const items = [];\n\n if (event.data?.data) {\n const { data } = event.data;\n each(views, (v: View) => {\n let field = linkField;\n if (dim === 'x') {\n field = v.getXScale().field;\n } else if (dim === 'y') {\n field = v.getYScales().find((s) => s.field === field)?.field;\n } else if (!field) {\n field = v.getGroupScales()[0]?.field;\n }\n if (!field) {\n return;\n }\n const elements = map(getAllElements(v), (ele) => {\n let active = false;\n let inactive = false;\n const dataValue = isArray(data) ? get(data[0], field) : get(data, field);\n if (getElementValue(ele, field) === dataValue) {\n active = true;\n } else {\n inactive = true;\n }\n return { element: ele, view: v, active, inactive };\n });\n items.push(...elements);\n });\n }\n\n return items;\n }\n\n /**\n * 所有同一层级的 tooltip 显示\n */\n public showTooltip(params?: ActionParams) {\n const siblings = getSiblingViews(this.context.view);\n const elements = this.getAssociationItems(siblings, params);\n\n each(elements, (ele) => {\n if (ele.active) {\n const box = ele.element.shape.getCanvasBBox();\n ele.view.showTooltip({ x: box.minX + box.width / 2, y: box.minY + box.height / 2 });\n }\n });\n }\n\n /**\n * 隐藏同一层级的 tooltip\n */\n public hideTooltip() {\n const siblings = getSiblingViews(this.context.view);\n each(siblings, (sibling) => {\n sibling.hideTooltip();\n });\n }\n\n /**\n * 设置 active 状态\n */\n public active(params?: ActionParams) {\n const views = getViews(this.context.view);\n const items = this.getAssociationItems(views, params);\n\n each(items, (item: EventItem) => {\n const { active, element } = item;\n if (active) {\n element.setState('active', true);\n }\n });\n }\n\n /**\n * 设置 selected 状态\n */\n public selected(params?: ActionParams) {\n const views = getViews(this.context.view);\n const items = this.getAssociationItems(views, params);\n\n each(items, (item: EventItem) => {\n const { active, element } = item;\n if (active) {\n element.setState('selected', true);\n }\n });\n }\n\n /**\n * 进行高亮 => 设置 inactive 状态\n */\n public highlight(params?: ActionParams) {\n const views = getViews(this.context.view);\n const items = this.getAssociationItems(views, params);\n\n each(items, (item: EventItem) => {\n const { inactive, element } = item;\n if (inactive) {\n element.setState('inactive', true);\n }\n });\n }\n\n public reset() {\n const views = getViews(this.context.view);\n each(views, (v) => {\n clearHighlight(v);\n });\n }\n}\n\nregisterAction('association', Association);\n\n/**\n * 相邻 view 的 active 联动(相同维值的 tooltip 联动)\n */\nregisterInteraction('association-active', {\n start: [{ trigger: 'element:mouseenter', action: 'association:active' }],\n end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],\n});\n\n/**\n * 相邻 view 的 active 联动(相同维值的 tooltip 联动)\n */\nregisterInteraction('association-selected', {\n start: [{ trigger: 'element:mouseenter', action: 'association:selected' }],\n end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],\n});\n\n/**\n * 相邻 view 的 highlight 联动, 突出当前 element\n */\nregisterInteraction('association-highlight', {\n start: [{ trigger: 'element:mouseenter', action: 'association:highlight' }],\n end: [{ trigger: 'element:mouseleave', action: 'association:reset' }],\n});\n\n/**\n * 相邻 view 的 tooltip 联动,根据 groupField 进行关联(相同维值的 tooltip 联动)\n */\nregisterInteraction('association-tooltip', {\n start: [{ trigger: 'element:mousemove', action: 'association:showTooltip' }],\n end: [{ trigger: 'element:mouseleave', action: 'association:hideTooltip' }],\n});\n"]}
|
|
@@ -13,7 +13,7 @@ function getElementValue(element, field) {
|
|
|
13
13
|
var model = element.getModel();
|
|
14
14
|
var record = model.data;
|
|
15
15
|
var value;
|
|
16
|
-
if (util_1.isArray(record)) {
|
|
16
|
+
if ((0, util_1.isArray)(record)) {
|
|
17
17
|
value = record[0][field];
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
@@ -28,8 +28,8 @@ exports.getElementValue = getElementValue;
|
|
|
28
28
|
* @param view View 或者 Chart
|
|
29
29
|
*/
|
|
30
30
|
function clearHighlight(view) {
|
|
31
|
-
var elements = utils_1.getAllElements(view);
|
|
32
|
-
util_1.each(elements, function (el) {
|
|
31
|
+
var elements = (0, utils_1.getAllElements)(view);
|
|
32
|
+
(0, util_1.each)(elements, function (el) {
|
|
33
33
|
if (el.hasState('active')) {
|
|
34
34
|
el.setState('active', false);
|
|
35
35
|
}
|