@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var g2_1 = require("@antv/g2");
|
|
5
|
-
g2_1.registerShape('polygon', 'circle', {
|
|
5
|
+
(0, g2_1.registerShape)('polygon', 'circle', {
|
|
6
6
|
draw: function (cfg, group) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
var cx = cfg.x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../../src/plots/heatmap/shapes/circle.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAExD,kBAAa,
|
|
1
|
+
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../../src/plots/heatmap/shapes/circle.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAExD,IAAA,kBAAa,EAAC,SAAS,EAAE,QAAQ,EAAE;IACjC,IAAI,YAAC,GAAoB,EAAE,KAAa;;QACtC,IAAM,EAAE,GAAG,GAAG,CAAC,CAAW,CAAC;QAC3B,IAAM,EAAE,GAAG,GAAG,CAAC,CAAW,CAAC;QAE3B,IAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAE9C,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAM,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAM,IAAI,GAAG,CAAA,MAAA,GAAG,CAAC,KAAK,0CAAE,IAAI,KAAI,GAAG,CAAC,KAAK,KAAI,MAAA,GAAG,CAAC,YAAY,0CAAE,IAAI,CAAA,CAAC;QACpE,IAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACvC,KAAK,uDACH,CAAC,EAAE,EAAE,EACL,CAAC,EAAE,EAAE,EACL,CAAC,EAAE,MAAM,IACN,GAAG,CAAC,YAAY,GAChB,GAAG,CAAC,KAAK,KACZ,IAAI,MAAA,GACL;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, registerShape, Types } from '@antv/g2';\n\nregisterShape('polygon', 'circle', {\n draw(cfg: Types.ShapeInfo, group: IGroup) {\n const cx = cfg.x as number;\n const cy = cfg.y as number;\n\n const points = this.parsePoints(cfg.points);\n const width = Math.abs(points[2].x - points[1].x);\n const height = Math.abs(points[1].y - points[0].y);\n const maxRadius = Math.min(width, height) / 2;\n\n const value = Number(cfg.shape[1]);\n const sizeRatio = Number(cfg.shape[2]);\n const radiusRatio = Math.sqrt(sizeRatio);\n const radius = maxRadius * radiusRatio * Math.sqrt(value);\n const fill = cfg.style?.fill || cfg.color || cfg.defaultStyle?.fill;\n const polygon = group.addShape('circle', {\n attrs: {\n x: cx,\n y: cy,\n r: radius,\n ...cfg.defaultStyle,\n ...cfg.style,\n fill,\n },\n });\n return polygon;\n },\n});\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var g2_1 = require("@antv/g2");
|
|
5
|
-
g2_1.registerShape('polygon', 'square', {
|
|
5
|
+
(0, g2_1.registerShape)('polygon', 'square', {
|
|
6
6
|
draw: function (cfg, group) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
var cx = cfg.x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"square.js","sourceRoot":"","sources":["../../../../src/plots/heatmap/shapes/square.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAExD,kBAAa,
|
|
1
|
+
{"version":3,"file":"square.js","sourceRoot":"","sources":["../../../../src/plots/heatmap/shapes/square.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAExD,IAAA,kBAAa,EAAC,SAAS,EAAE,QAAQ,EAAE;IACjC,IAAI,YAAC,GAAoB,EAAE,KAAa;;QACtC,IAAM,EAAE,GAAG,GAAG,CAAC,CAAW,CAAC;QAC3B,IAAM,EAAE,GAAG,GAAG,CAAC,CAAW,CAAC;QAE3B,IAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,IAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAE9C,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAM,IAAI,GAAG,CAAA,MAAA,GAAG,CAAC,KAAK,0CAAE,IAAI,KAAI,GAAG,CAAC,KAAK,KAAI,MAAA,GAAG,CAAC,YAAY,0CAAE,IAAI,CAAA,CAAC;QACpE,IAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;YACrC,KAAK,uDACH,CAAC,EAAE,EAAE,GAAG,UAAU,GAAG,CAAC,EACtB,CAAC,EAAE,EAAE,GAAG,UAAU,GAAG,CAAC,EACtB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,IACf,GAAG,CAAC,YAAY,GAChB,GAAG,CAAC,KAAK,KACZ,IAAI,MAAA,GACL;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup, registerShape, Types } from '@antv/g2';\n\nregisterShape('polygon', 'square', {\n draw(cfg: Types.ShapeInfo, group: IGroup) {\n const cx = cfg.x as number;\n const cy = cfg.y as number;\n\n const points = this.parsePoints(cfg.points);\n const width = Math.abs(points[2].x - points[1].x);\n const height = Math.abs(points[1].y - points[0].y);\n const maxSideLength = Math.min(width, height);\n\n const value = Number(cfg.shape[1]);\n const sizeRatio = Number(cfg.shape[2]);\n const lenRatio = Math.sqrt(sizeRatio);\n const sideLength = maxSideLength * lenRatio * Math.sqrt(value);\n const fill = cfg.style?.fill || cfg.color || cfg.defaultStyle?.fill;\n const polygon = group.addShape('rect', {\n attrs: {\n x: cx - sideLength / 2,\n y: cy - sideLength / 2,\n width: sideLength,\n height: sideLength,\n ...cfg.defaultStyle,\n ...cfg.style,\n fill,\n },\n });\n return polygon;\n },\n});\n"]}
|
|
@@ -16,9 +16,9 @@ function geometry(params) {
|
|
|
16
16
|
var chart = params.chart, options = params.options;
|
|
17
17
|
var data = options.data, binField = options.binField, binNumber = options.binNumber, binWidth = options.binWidth, color = options.color, stackField = options.stackField, legend = options.legend, columnStyle = options.columnStyle;
|
|
18
18
|
// 处理数据
|
|
19
|
-
var plotData = histogram_1.binHistogram(data, binField, binWidth, binNumber, stackField);
|
|
19
|
+
var plotData = (0, histogram_1.binHistogram)(data, binField, binWidth, binNumber, stackField);
|
|
20
20
|
chart.data(plotData);
|
|
21
|
-
var p = utils_1.deepAssign({}, params, {
|
|
21
|
+
var p = (0, utils_1.deepAssign)({}, params, {
|
|
22
22
|
options: {
|
|
23
23
|
xField: constant_1.HISTOGRAM_X_FIELD,
|
|
24
24
|
yField: constant_1.HISTOGRAM_Y_FIELD,
|
|
@@ -30,7 +30,7 @@ function geometry(params) {
|
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
|
-
geometries_1.interval(p);
|
|
33
|
+
(0, geometries_1.interval)(p);
|
|
34
34
|
// 图例
|
|
35
35
|
if (legend && stackField) {
|
|
36
36
|
chart.legend(stackField, legend);
|
|
@@ -48,7 +48,7 @@ function meta(params) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
var options = params.options;
|
|
50
50
|
var xAxis = options.xAxis, yAxis = options.yAxis;
|
|
51
|
-
return utils_1.flow(common_1.scale((_a = {},
|
|
51
|
+
return (0, utils_1.flow)((0, common_1.scale)((_a = {},
|
|
52
52
|
_a[constant_1.HISTOGRAM_X_FIELD] = xAxis,
|
|
53
53
|
_a[constant_1.HISTOGRAM_Y_FIELD] = yAxis,
|
|
54
54
|
_a)))(params);
|
|
@@ -82,7 +82,7 @@ function axis(params) {
|
|
|
82
82
|
function label(params) {
|
|
83
83
|
var chart = params.chart, options = params.options;
|
|
84
84
|
var label = options.label;
|
|
85
|
-
var geometry = utils_1.findGeometry(chart, 'interval');
|
|
85
|
+
var geometry = (0, utils_1.findGeometry)(chart, 'interval');
|
|
86
86
|
if (!label) {
|
|
87
87
|
geometry.label(false);
|
|
88
88
|
}
|
|
@@ -91,7 +91,7 @@ function label(params) {
|
|
|
91
91
|
geometry.label({
|
|
92
92
|
fields: [constant_1.HISTOGRAM_Y_FIELD],
|
|
93
93
|
callback: callback,
|
|
94
|
-
cfg: utils_1.transformLabel(cfg),
|
|
94
|
+
cfg: (0, utils_1.transformLabel)(cfg),
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
return params;
|
|
@@ -103,7 +103,7 @@ function label(params) {
|
|
|
103
103
|
*/
|
|
104
104
|
function adaptor(params) {
|
|
105
105
|
// flow 的方式处理所有的配置到 G2 API
|
|
106
|
-
return utils_1.flow(common_1.theme, pattern_1.pattern('columnStyle'), geometry, meta, axis, common_1.state, label, common_1.tooltip, common_1.interaction, common_1.animation)(params);
|
|
106
|
+
return (0, utils_1.flow)(common_1.theme, (0, pattern_1.pattern)('columnStyle'), geometry, meta, axis, common_1.state, label, common_1.tooltip, common_1.interaction, common_1.animation)(params);
|
|
107
107
|
}
|
|
108
108
|
exports.adaptor = adaptor;
|
|
109
109
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/histogram/adaptor.ts"],"names":[],"mappings":";;;;AAAA,+CAA4F;AAC5F,uDAAoD;AACpD,iDAAgD;AAEhD,qCAA6E;AAC7E,6DAA+D;AAC/D,uCAAkE;AAGlE;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAAgC;IACxC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,GAA4E,OAAO,KAAnF,EAAE,QAAQ,GAAkE,OAAO,SAAzE,EAAE,SAAS,GAAuD,OAAO,UAA9D,EAAE,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MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAK,GAAK,OAAO,MAAZ,CAAa;IAE1B,IAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAEjD,IAAI,CAAC,KAAK,EAAE;QACV,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACvB;SAAM;QACG,IAAA,QAAQ,GAAa,KAAK,SAAlB,EAAK,GAAG,kBAAK,KAAK,EAA5B,YAAoB,CAAF,CAAW;QACnC,QAAQ,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,CAAC,4BAAiB,CAAC;YAC3B,QAAQ,UAAA;YACR,GAAG,EAAE,IAAA,sBAAc,EAAC,GAAG,CAAC;SACzB,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAAgC;IACtD,0BAA0B;IAC1B,OAAO,IAAA,YAAI,EACT,cAAK,EACL,IAAA,iBAAO,EAAC,aAAa,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,cAAK,EACL,KAAK,EACL,gBAAO,EACP,oBAAW,EACX,kBAAS,CACV,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAdD,0BAcC","sourcesContent":["import { animation, interaction, scale, state, theme, tooltip } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { pattern } from '../../adaptor/pattern';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, findGeometry, flow, transformLabel } from '../../utils';\nimport { binHistogram } from '../../utils/transform/histogram';\nimport { HISTOGRAM_X_FIELD, HISTOGRAM_Y_FIELD } from './constant';\nimport { HistogramOptions } from './types';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<HistogramOptions>): Params<HistogramOptions> {\n const { chart, options } = params;\n const { data, binField, binNumber, binWidth, color, stackField, legend, columnStyle } = options;\n\n // 处理数据\n const plotData = binHistogram(data, binField, binWidth, binNumber, stackField);\n\n chart.data(plotData);\n\n const p = deepAssign({}, params, {\n options: {\n xField: HISTOGRAM_X_FIELD,\n yField: HISTOGRAM_Y_FIELD,\n seriesField: stackField,\n isStack: true,\n interval: {\n color,\n style: columnStyle,\n },\n },\n });\n\n interval(p);\n\n // 图例\n if (legend && stackField) {\n chart.legend(stackField, legend);\n } else {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<HistogramOptions>): Params<HistogramOptions> {\n const { options } = params;\n const { xAxis, yAxis } = options;\n\n return flow(\n scale({\n [HISTOGRAM_X_FIELD]: xAxis,\n [HISTOGRAM_Y_FIELD]: yAxis,\n })\n )(params);\n}\n\n/**\n * axis 配置\n * @param params\n */\nfunction axis(params: Params<HistogramOptions>): Params<HistogramOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis } = options;\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n chart.axis(HISTOGRAM_X_FIELD, false);\n } else {\n chart.axis(HISTOGRAM_X_FIELD, xAxis);\n }\n\n if (yAxis === false) {\n chart.axis(HISTOGRAM_Y_FIELD, false);\n } else {\n chart.axis(HISTOGRAM_Y_FIELD, yAxis);\n }\n\n return params;\n}\n\n/**\n * label 配置\n * @param params\n */\nfunction label(params: Params<HistogramOptions>): Params<HistogramOptions> {\n const { chart, options } = params;\n const { label } = options;\n\n const geometry = findGeometry(chart, 'interval');\n\n if (!label) {\n geometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n geometry.label({\n fields: [HISTOGRAM_Y_FIELD],\n callback,\n cfg: transformLabel(cfg),\n });\n }\n\n return params;\n}\n\n/**\n * 直方图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<HistogramOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n pattern('columnStyle'),\n geometry,\n meta,\n axis,\n state,\n label,\n tooltip,\n interaction,\n animation\n )(params);\n}\n"]}
|
|
@@ -10,7 +10,7 @@ exports.HISTOGRAM_Y_FIELD = 'count';
|
|
|
10
10
|
/**
|
|
11
11
|
* 默认配置项
|
|
12
12
|
*/
|
|
13
|
-
exports.DEFAULT_OPTIONS = utils_1.deepAssign({}, plot_1.Plot.getDefaultOptions(), {
|
|
13
|
+
exports.DEFAULT_OPTIONS = (0, utils_1.deepAssign)({}, plot_1.Plot.getDefaultOptions(), {
|
|
14
14
|
columnStyle: {
|
|
15
15
|
stroke: '#FFFFFF',
|
|
16
16
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/histogram/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC,iBAAiB;AACJ,QAAA,iBAAiB,GAAG,OAAO,CAAC;AACzC,iBAAiB;AACJ,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/histogram/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC,iBAAiB;AACJ,QAAA,iBAAiB,GAAG,OAAO,CAAC;AACzC,iBAAiB;AACJ,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,WAAW,EAAE;QACX,MAAM,EAAE,SAAS;KAClB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;KACnB;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/** 直方图 xField */\nexport const HISTOGRAM_X_FIELD = 'range';\n/** 直方图 yField */\nexport const HISTOGRAM_Y_FIELD = 'count';\n\n/**\n * 默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n columnStyle: {\n stroke: '#FFFFFF',\n },\n tooltip: {\n shared: true,\n showMarkers: false,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
|
|
@@ -24,7 +24,7 @@ var Histogram = /** @class */ (function (_super) {
|
|
|
24
24
|
Histogram.prototype.changeData = function (data) {
|
|
25
25
|
this.updateOption({ data: data });
|
|
26
26
|
var _a = this.options, binField = _a.binField, binNumber = _a.binNumber, binWidth = _a.binWidth, stackField = _a.stackField;
|
|
27
|
-
this.chart.changeData(histogram_1.binHistogram(data, binField, binWidth, binNumber, stackField));
|
|
27
|
+
this.chart.changeData((0, histogram_1.binHistogram)(data, binField, binWidth, binNumber, stackField));
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* 获取直方图的适配器
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/histogram/index.ts"],"names":[],"mappings":";;;;AACA,wCAAuC;AACvC,6DAA+D;AAC/D,qCAAoC;AACpC,uCAA6C;AAK7C;IAA+B,qCAAsB;IAArD;QAAA,qEAgCC;QAvBC,WAAW;QACJ,UAAI,GAAW,WAAW,CAAC;;IAsBpC,CAAC;IA/BC;;;OAGG;IACI,2BAAiB,GAAxB;QACE,OAAO,0BAAe,CAAC;IACzB,CAAC;IAKM,8BAAU,GAAjB,UAAkB,IAA8B;QAC9C,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QAEtB,IAAA,KAAgD,IAAI,CAAC,OAAO,EAA1D,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,UAAU,gBAAiB,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,wBAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/histogram/index.ts"],"names":[],"mappings":";;;;AACA,wCAAuC;AACvC,6DAA+D;AAC/D,qCAAoC;AACpC,uCAA6C;AAK7C;IAA+B,qCAAsB;IAArD;QAAA,qEAgCC;QAvBC,WAAW;QACJ,UAAI,GAAW,WAAW,CAAC;;IAsBpC,CAAC;IA/BC;;;OAGG;IACI,2BAAiB,GAAxB;QACE,OAAO,0BAAe,CAAC;IACzB,CAAC;IAKM,8BAAU,GAAjB,UAAkB,IAA8B;QAC9C,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QAEtB,IAAA,KAAgD,IAAI,CAAC,OAAO,EAA1D,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,UAAU,gBAAiB,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAA,wBAAY,EAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACO,qCAAiB,GAA3B;QACE,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;IACvC,CAAC;IAED;;OAEG;IACO,oCAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,gBAAC;AAAD,CAAC,AAhCD,CAA+B,WAAI,GAgClC;AAhCY,8BAAS","sourcesContent":["import { Adaptor } from '../../core/adaptor';\nimport { Plot } from '../../core/plot';\nimport { binHistogram } from '../../utils/transform/histogram';\nimport { adaptor } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constant';\nimport { HistogramOptions } from './types';\n\nexport type { HistogramOptions };\n\nexport class Histogram extends Plot<HistogramOptions> {\n /**\n * 获取 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<HistogramOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public type: string = 'histogram';\n\n public changeData(data: HistogramOptions['data']) {\n this.updateOption({ data });\n\n const { binField, binNumber, binWidth, stackField } = this.options;\n this.chart.changeData(binHistogram(data, binField, binWidth, binNumber, stackField));\n }\n\n /**\n * 获取直方图的适配器\n */\n protected getDefaultOptions() {\n return Histogram.getDefaultOptions();\n }\n\n /**\n * 获取直方图的适配器\n */\n protected getSchemaAdaptor(): Adaptor<HistogramOptions> {\n return adaptor;\n }\n}\n"]}
|
|
@@ -18,7 +18,7 @@ function geometry(params) {
|
|
|
18
18
|
var areaState = areaMapping === null || areaMapping === void 0 ? void 0 : areaMapping.state;
|
|
19
19
|
chart.data(data);
|
|
20
20
|
// line geometry 处理
|
|
21
|
-
var primary = utils_1.deepAssign({}, params, {
|
|
21
|
+
var primary = (0, utils_1.deepAssign)({}, params, {
|
|
22
22
|
options: {
|
|
23
23
|
shapeField: seriesField,
|
|
24
24
|
line: {
|
|
@@ -35,11 +35,11 @@ function geometry(params) {
|
|
|
35
35
|
label: undefined,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
|
-
var second = utils_1.deepAssign({}, primary, { options: { tooltip: false, state: pointState } });
|
|
39
|
-
var areaParams = utils_1.deepAssign({}, primary, { options: { tooltip: false, state: areaState } });
|
|
40
|
-
geometries_1.line(primary);
|
|
41
|
-
geometries_1.point(second);
|
|
42
|
-
geometries_1.area(areaParams);
|
|
38
|
+
var second = (0, utils_1.deepAssign)({}, primary, { options: { tooltip: false, state: pointState } });
|
|
39
|
+
var areaParams = (0, utils_1.deepAssign)({}, primary, { options: { tooltip: false, state: areaState } });
|
|
40
|
+
(0, geometries_1.line)(primary);
|
|
41
|
+
(0, geometries_1.point)(second);
|
|
42
|
+
(0, geometries_1.area)(areaParams);
|
|
43
43
|
return params;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -50,14 +50,14 @@ function meta(params) {
|
|
|
50
50
|
var _a, _b;
|
|
51
51
|
var options = params.options;
|
|
52
52
|
var xAxis = options.xAxis, yAxis = options.yAxis, xField = options.xField, yField = options.yField, data = options.data;
|
|
53
|
-
return utils_1.flow(common_1.scale((_a = {},
|
|
53
|
+
return (0, utils_1.flow)((0, common_1.scale)((_a = {},
|
|
54
54
|
_a[xField] = xAxis,
|
|
55
55
|
_a[yField] = yAxis,
|
|
56
56
|
_a), (_b = {},
|
|
57
57
|
_b[xField] = {
|
|
58
58
|
type: 'cat',
|
|
59
59
|
},
|
|
60
|
-
_b[yField] = data_1.adjustYMetaByZero(data, yField),
|
|
60
|
+
_b[yField] = (0, data_1.adjustYMetaByZero)(data, yField),
|
|
61
61
|
_b)))(params);
|
|
62
62
|
}
|
|
63
63
|
exports.meta = meta;
|
|
@@ -70,7 +70,7 @@ function coordinate(params) {
|
|
|
70
70
|
var reflect = options.reflect;
|
|
71
71
|
if (reflect) {
|
|
72
72
|
var p = reflect;
|
|
73
|
-
if (!util_1.isArray(p)) {
|
|
73
|
+
if (!(0, util_1.isArray)(p)) {
|
|
74
74
|
p = [p];
|
|
75
75
|
}
|
|
76
76
|
var actions = p.map(function (d) { return ['reflect', d]; });
|
|
@@ -124,7 +124,7 @@ exports.legend = legend;
|
|
|
124
124
|
function label(params) {
|
|
125
125
|
var chart = params.chart, options = params.options;
|
|
126
126
|
var label = options.label, yField = options.yField;
|
|
127
|
-
var lineGeometry = utils_1.findGeometry(chart, 'line');
|
|
127
|
+
var lineGeometry = (0, utils_1.findGeometry)(chart, 'line');
|
|
128
128
|
// label 为 false, 空 则不显示 label
|
|
129
129
|
if (!label) {
|
|
130
130
|
lineGeometry.label(false);
|
|
@@ -139,7 +139,7 @@ function label(params) {
|
|
|
139
139
|
{ type: 'path-adjust-position' },
|
|
140
140
|
{ type: 'point-adjust-position' },
|
|
141
141
|
{ type: 'limit-in-plot', cfg: { action: 'hide' } },
|
|
142
|
-
] }, utils_1.transformLabel(cfg)),
|
|
142
|
+
] }, (0, utils_1.transformLabel)(cfg)),
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
return params;
|
|
@@ -152,7 +152,7 @@ function adjust(params) {
|
|
|
152
152
|
var chart = params.chart, options = params.options;
|
|
153
153
|
var isStack = options.isStack;
|
|
154
154
|
if (isStack) {
|
|
155
|
-
util_1.each(chart.geometries, function (g) {
|
|
155
|
+
(0, util_1.each)(chart.geometries, function (g) {
|
|
156
156
|
g.adjust('stack');
|
|
157
157
|
});
|
|
158
158
|
}
|
|
@@ -166,7 +166,7 @@ exports.adjust = adjust;
|
|
|
166
166
|
*/
|
|
167
167
|
function adaptor(params) {
|
|
168
168
|
// flow 的方式处理所有的配置到 G2 API
|
|
169
|
-
return utils_1.flow(geometry, meta, adjust, common_1.theme, coordinate, axis, legend, common_1.tooltip, label, common_1.slider, common_1.scrollbar, common_1.interaction, common_1.animation, common_1.annotation(), common_1.limitInPlot)(params);
|
|
169
|
+
return (0, utils_1.flow)(geometry, meta, adjust, common_1.theme, coordinate, axis, legend, common_1.tooltip, label, common_1.slider, common_1.scrollbar, common_1.interaction, common_1.animation, (0, common_1.annotation)(), common_1.limitInPlot)(params);
|
|
170
170
|
}
|
|
171
171
|
exports.adaptor = adaptor;
|
|
172
172
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/line/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAA2C;AAC3C,+CAU8B;AAC9B,uDAA6D;AAE7D,qCAA6E;AAC7E,yCAAqD;AAGrD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA2B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,GAAuF,OAAO,KAA9F,EAAE,KAAK,GAAgF,OAAO,MAAvF,EAAE,SAAS,GAAqE,OAAO,UAA5E,EAAE,SAAS,GAA0D,OAAO,UAAjE,EAAS,YAAY,GAAqC,OAAO,MAA5C,EAAQ,WAAW,GAAkB,OAAO,KAAzB,EAAE,WAAW,GAAK,OAAO,YAAZ,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ACE,IAAA,sBAAc,EAAC,GAAG,CAAC,CACvB;SACF,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,MAAM,CAAC,MAA4C;IACzD,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;IAE5B,IAAI,OAAO,EAAE;QACX,IAAA,WAAI,EAAC,KAAK,CAAC,UAAU,EAAE,UAAC,CAAW;YACjC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,wBAWC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA2B;IACjD,0BAA0B;IAC1B,OAAO,IAAA,YAAI,EACT,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,cAAK,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,gBAAO,EACP,KAAK,EACL,eAAM,EACN,kBAAS,EACT,oBAAW,EACX,kBAAS,EACT,IAAA,mBAAU,GAAE,EACZ,oBAAW,CACZ,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAnBD,0BAmBC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { each, isArray } from '@antv/util';\nimport {\n animation,\n annotation,\n interaction,\n limitInPlot,\n scale,\n scrollbar,\n slider,\n theme,\n tooltip,\n} from '../../adaptor/common';\nimport { area, line, point } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, findGeometry, flow, transformLabel } from '../../utils';\nimport { adjustYMetaByZero } from '../../utils/data';\nimport { LineOptions } from './types';\n\n/**\n * geometry 配置处理\n * @param params\n */\nfunction geometry(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { data, color, lineStyle, lineShape, point: pointMapping, area: areaMapping, seriesField } = options;\n const pointState = pointMapping?.state;\n const areaState = areaMapping?.state;\n\n chart.data(data);\n\n // line geometry 处理\n const primary = deepAssign({}, params, {\n options: {\n shapeField: seriesField,\n line: {\n color,\n style: lineStyle,\n shape: lineShape,\n },\n // 颜色保持一致,因为如果颜色不一致,会导致 tooltip 中元素重复。\n // 如果存在,才设置,否则为空\n point: pointMapping && {\n color,\n shape: 'circle',\n ...pointMapping,\n },\n // 面积配置\n area: areaMapping && {\n color,\n ...areaMapping,\n },\n // label 不传递给各个 geometry adaptor,由 label adaptor 处理\n label: undefined,\n },\n });\n const second = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });\n const areaParams = deepAssign({}, primary, { options: { tooltip: false, state: areaState } });\n\n line(primary);\n point(second);\n area(areaParams);\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nexport function meta(params: Params<LineOptions>): Params<LineOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField, data } = options;\n\n return flow(\n scale(\n {\n [xField]: xAxis,\n [yField]: yAxis,\n },\n {\n [xField]: {\n type: 'cat',\n },\n [yField]: adjustYMetaByZero(data, yField),\n }\n )\n )(params);\n}\n\n/**\n * 坐标系配置. 支持 reflect 镜像处理\n * @param params\n */\nfunction coordinate(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { reflect } = options;\n if (reflect) {\n let p = reflect as any;\n if (!isArray(p)) {\n p = [p];\n }\n const actions = p.map((d) => ['reflect', d]);\n\n chart.coordinate({ type: 'rect', actions });\n }\n\n return params;\n}\n\n/**\n * axis 配置\n * @param params\n */\nexport function axis(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n chart.axis(xField, false);\n } else {\n chart.axis(xField, xAxis);\n }\n\n if (yAxis === false) {\n chart.axis(yField, false);\n } else {\n chart.axis(yField, yAxis);\n }\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nexport function legend(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { legend, seriesField } = options;\n\n if (legend && seriesField) {\n chart.legend(seriesField, legend);\n } else if (legend === false) {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * 数据标签\n * @param params\n */\nfunction label(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { label, yField } = options;\n\n const lineGeometry = findGeometry(chart, 'line');\n\n // label 为 false, 空 则不显示 label\n if (!label) {\n lineGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n lineGeometry.label({\n fields: [yField],\n callback,\n cfg: {\n layout: [\n { type: 'limit-in-plot' },\n { type: 'path-adjust-position' },\n { type: 'point-adjust-position' },\n { type: 'limit-in-plot', cfg: { action: 'hide' } },\n ],\n ...transformLabel(cfg),\n },\n });\n }\n\n return params;\n}\n\n/**\n * 统一处理 adjust\n * @param params\n */\nexport function adjust(params: Params<Pick<LineOptions, 'isStack'>>): Params<any> {\n const { chart, options } = params;\n const { isStack } = options;\n\n if (isStack) {\n each(chart.geometries, (g: Geometry) => {\n g.adjust('stack');\n });\n }\n\n return params;\n}\n\n/**\n * 折线图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LineOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n geometry,\n meta,\n adjust,\n theme,\n coordinate,\n axis,\n legend,\n tooltip,\n label,\n slider,\n scrollbar,\n interaction,\n animation,\n annotation(),\n limitInPlot\n )(params);\n}\n"]}
|
|
@@ -6,7 +6,7 @@ var utils_1 = require("../../utils");
|
|
|
6
6
|
/**
|
|
7
7
|
* 折线图默认配置项
|
|
8
8
|
*/
|
|
9
|
-
exports.DEFAULT_OPTIONS = utils_1.deepAssign({}, plot_1.Plot.getDefaultOptions(), {
|
|
9
|
+
exports.DEFAULT_OPTIONS = (0, utils_1.deepAssign)({}, plot_1.Plot.getDefaultOptions(), {
|
|
10
10
|
tooltip: {
|
|
11
11
|
shared: true,
|
|
12
12
|
showMarkers: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,EAAE;KACV;IACD,OAAO,EAAE,KAAK;CACf,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 折线图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n tooltip: {\n shared: true,\n showMarkers: true,\n showCrosshairs: true,\n crosshairs: {\n type: 'x',\n },\n },\n legend: {\n position: 'top-left',\n radio: {},\n },\n isStack: false,\n});\n"]}
|
package/lib/plots/line/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var Line = /** @class */ (function (_super) {
|
|
|
28
28
|
Line.prototype.changeData = function (data) {
|
|
29
29
|
this.updateOption({ data: data });
|
|
30
30
|
var _a = this, chart = _a.chart, options = _a.options;
|
|
31
|
-
adaptor_1.meta({ chart: chart, options: options });
|
|
31
|
+
(0, adaptor_1.meta)({ chart: chart, options: options });
|
|
32
32
|
this.chart.changeData(data);
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/line/index.ts"],"names":[],"mappings":";;;;AACA,wCAAuC;AACvC,qCAA0C;AAC1C,yCAA8C;AAC9C,0BAAwB;AAKxB;IAA0B,gCAAiB;IAA3C;QAAA,qEAoCC;QA3BC,WAAW;QACJ,UAAI,GAAW,MAAM,CAAC;;IA0B/B,CAAC;IAnCC;;;OAGG;IACI,sBAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;;OAGG;IACI,yBAAU,GAAjB,UAAkB,IAAyB;QACzC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QAChC,cAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/line/index.ts"],"names":[],"mappings":";;;;AACA,wCAAuC;AACvC,qCAA0C;AAC1C,yCAA8C;AAC9C,0BAAwB;AAKxB;IAA0B,gCAAiB;IAA3C;QAAA,qEAoCC;QA3BC,WAAW;QACJ,UAAI,GAAW,MAAM,CAAC;;IA0B/B,CAAC;IAnCC;;;OAGG;IACI,sBAAiB,GAAxB;QACE,OAAO,2BAAe,CAAC;IACzB,CAAC;IAKD;;;OAGG;IACI,yBAAU,GAAjB,UAAkB,IAAyB;QACzC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACtB,IAAA,KAAqB,IAAI,EAAvB,KAAK,WAAA,EAAE,OAAO,aAAS,CAAC;QAChC,IAAA,cAAI,EAAC,EAAE,KAAK,OAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACO,gCAAiB,GAA3B;QACE,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACO,+BAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,WAAC;AAAD,CAAC,AApCD,CAA0B,WAAI,GAoC7B;AApCY,oBAAI","sourcesContent":["import { Adaptor } from '../../core/adaptor';\nimport { Plot } from '../../core/plot';\nimport { adaptor, meta } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\nimport './interactions';\nimport { LineOptions } from './types';\n\nexport type { LineOptions };\n\nexport class Line extends Plot<LineOptions> {\n /**\n * 获取 折线图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<LineOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public type: string = 'line';\n\n /**\n * @override\n * @param data\n */\n public changeData(data: LineOptions['data']) {\n this.updateOption({ data });\n const { chart, options } = this;\n meta({ chart, options });\n this.chart.changeData(data);\n }\n\n /**\n * 获取 折线图 默认配置\n */\n protected getDefaultOptions() {\n return Line.getDefaultOptions();\n }\n\n /**\n * 获取 折线图 的适配器\n */\n protected getSchemaAdaptor(): Adaptor<LineOptions> {\n return adaptor;\n }\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var g2_1 = require("@antv/g2");
|
|
4
4
|
var marker_active_1 = require("./marker-active");
|
|
5
|
-
g2_1.registerAction('marker-active', marker_active_1.MarkerActiveAction);
|
|
6
|
-
g2_1.registerInteraction('marker-active', {
|
|
5
|
+
(0, g2_1.registerAction)('marker-active', marker_active_1.MarkerActiveAction);
|
|
6
|
+
(0, g2_1.registerInteraction)('marker-active', {
|
|
7
7
|
start: [
|
|
8
8
|
{
|
|
9
9
|
trigger: 'tooltip:show',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plots/line/interactions/index.ts"],"names":[],"mappings":";;AAAA,+BAA+D;AAC/D,iDAAqD;AAErD,mBAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plots/line/interactions/index.ts"],"names":[],"mappings":";;AAAA,+BAA+D;AAC/D,iDAAqD;AAErD,IAAA,mBAAc,EAAC,eAAe,EAAE,kCAAkB,CAAC,CAAC;AACpD,IAAA,wBAAmB,EAAC,eAAe,EAAE;IACnC,KAAK,EAAE;QACL;YACE,OAAO,EAAE,cAAc;YACvB,MAAM,EAAE,sBAAsB;SAC/B;KACF;IACD,GAAG,EAAE;QACH;YACE,OAAO,EAAE,cAAc;YACvB,MAAM,EAAE,qBAAqB;SAC9B;KACF;CACF,CAAC,CAAC","sourcesContent":["import { registerAction, registerInteraction } from '@antv/g2';\nimport { MarkerActiveAction } from './marker-active';\n\nregisterAction('marker-active', MarkerActiveAction);\nregisterInteraction('marker-active', {\n start: [\n {\n trigger: 'tooltip:show',\n action: 'marker-active:active',\n },\n ],\n end: [\n {\n trigger: 'tooltip:hide',\n action: 'marker-active:reset',\n },\n ],\n});\n"]}
|
|
@@ -16,9 +16,9 @@ var MarkerActiveAction = /** @class */ (function (_super) {
|
|
|
16
16
|
// items: 数组对象,当前 tooltip 显示的每条内容
|
|
17
17
|
var items_1 = evt.data.items;
|
|
18
18
|
var points = view.geometries.filter(function (geom) { return geom.type === 'point'; });
|
|
19
|
-
util_1.each(points, function (point) {
|
|
20
|
-
util_1.each(point.elements, function (element) {
|
|
21
|
-
var active = util_1.findIndex(items_1, function (item) { return item.data === element.data; }) !== -1;
|
|
19
|
+
(0, util_1.each)(points, function (point) {
|
|
20
|
+
(0, util_1.each)(point.elements, function (element) {
|
|
21
|
+
var active = (0, util_1.findIndex)(items_1, function (item) { return item.data === element.data; }) !== -1;
|
|
22
22
|
element.setState('active', active);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
@@ -27,8 +27,8 @@ var MarkerActiveAction = /** @class */ (function (_super) {
|
|
|
27
27
|
MarkerActiveAction.prototype.reset = function () {
|
|
28
28
|
var view = this.getView();
|
|
29
29
|
var points = view.geometries.filter(function (geom) { return geom.type === 'point'; });
|
|
30
|
-
util_1.each(points, function (point) {
|
|
31
|
-
util_1.each(point.elements, function (element) {
|
|
30
|
+
(0, util_1.each)(points, function (point) {
|
|
31
|
+
(0, util_1.each)(point.elements, function (element) {
|
|
32
32
|
element.setState('active', false);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker-active.js","sourceRoot":"","sources":["../../../../src/plots/line/interactions/marker-active.ts"],"names":[],"mappings":";;;;AAAA,+BAA6D;AAC7D,mCAA6C;AAE7C;IAAwC,8CAAiB;IAAzD;;IA8BA,CAAC;IA7BQ,mCAAM,GAAb;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC/B,IAAI,GAAG,CAAC,IAAI,EAAE;YACZ,iCAAiC;YACzB,IAAA,OAAK,GAAK,GAAG,CAAC,IAAI,MAAb,CAAc;YAC3B,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,KAAK,OAAO,EAArB,CAAqB,CAAC,CAAC;YACvE,WAAI,
|
|
1
|
+
{"version":3,"file":"marker-active.js","sourceRoot":"","sources":["../../../../src/plots/line/interactions/marker-active.ts"],"names":[],"mappings":";;;;AAAA,+BAA6D;AAC7D,mCAA6C;AAE7C;IAAwC,8CAAiB;IAAzD;;IA8BA,CAAC;IA7BQ,mCAAM,GAAb;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC/B,IAAI,GAAG,CAAC,IAAI,EAAE;YACZ,iCAAiC;YACzB,IAAA,OAAK,GAAK,GAAG,CAAC,IAAI,MAAb,CAAc;YAC3B,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,KAAK,OAAO,EAArB,CAAqB,CAAC,CAAC;YACvE,IAAA,WAAI,EAAC,MAAM,EAAE,UAAC,KAAe;gBAC3B,IAAA,WAAI,EAAC,KAAK,CAAC,QAAQ,EAAE,UAAC,OAAO;oBAC3B,IAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,OAAK,EAAE,UAAC,IAAI,IAAK,OAAC,IAAY,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAnC,CAAmC,CAAC,KAAK,CAAC,CAAC,CAAC;oBACtF,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAEM,kCAAK,GAAZ;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,KAAK,OAAO,EAArB,CAAqB,CAAC,CAAC;QACvE,IAAA,WAAI,EAAC,MAAM,EAAE,UAAC,KAAe;YAC3B,IAAA,WAAI,EAAC,KAAK,CAAC,QAAQ,EAAE,UAAC,OAAO;gBAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,oCAAO,GAAf;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IACH,yBAAC;AAAD,CAAC,AA9BD,CAAwC,sBAAiB,GA8BxD;AA9BY,gDAAkB","sourcesContent":["import { Geometry, InteractionAction, View } from '@antv/g2';\nimport { each, findIndex } from '@antv/util';\n\nexport class MarkerActiveAction extends InteractionAction {\n public active() {\n const view = this.getView();\n const evt = this.context.event;\n if (evt.data) {\n // items: 数组对象,当前 tooltip 显示的每条内容\n const { items } = evt.data;\n const points = view.geometries.filter((geom) => geom.type === 'point');\n each(points, (point: Geometry) => {\n each(point.elements, (element) => {\n const active = findIndex(items, (item) => (item as any).data === element.data) !== -1;\n element.setState('active', active);\n });\n });\n }\n }\n\n public reset() {\n const view = this.getView();\n const points = view.geometries.filter((geom) => geom.type === 'point');\n each(points, (point: Geometry) => {\n each(point.elements, (element) => {\n element.setState('active', false);\n });\n });\n }\n\n private getView(): View {\n return this.context.view;\n }\n}\n"]}
|
|
@@ -20,9 +20,9 @@ function geometry(params) {
|
|
|
20
20
|
max: 1,
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
|
-
chart.data(utils_2.getLiquidData(percent));
|
|
23
|
+
chart.data((0, utils_2.getLiquidData)(percent));
|
|
24
24
|
var color = options.color || chart.getTheme().defaultColor;
|
|
25
|
-
var p = utils_1.deepAssign({}, params, {
|
|
25
|
+
var p = (0, utils_1.deepAssign)({}, params, {
|
|
26
26
|
options: {
|
|
27
27
|
xField: 'type',
|
|
28
28
|
yField: 'percent',
|
|
@@ -36,7 +36,7 @@ function geometry(params) {
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
|
-
var ext = geometries_1.interval(p).ext;
|
|
39
|
+
var ext = (0, geometries_1.interval)(p).ext;
|
|
40
40
|
var geometry = ext.geometry;
|
|
41
41
|
var background = chart.getTheme().background;
|
|
42
42
|
var customInfo = {
|
|
@@ -66,14 +66,14 @@ function statistic(params, updated) {
|
|
|
66
66
|
var statistic = options.statistic, percent = options.percent, meta = options.meta;
|
|
67
67
|
// 先清空标注,再重新渲染
|
|
68
68
|
chart.getController('annotation').clear(true);
|
|
69
|
-
var metaFormatter = util_1.get(meta, ['percent', 'formatter']) || (function (v) { return (v * 100).toFixed(2)
|
|
69
|
+
var metaFormatter = (0, util_1.get)(meta, ['percent', 'formatter']) || (function (v) { return "".concat((v * 100).toFixed(2), "%"); });
|
|
70
70
|
var contentOpt = statistic.content;
|
|
71
71
|
if (contentOpt) {
|
|
72
|
-
contentOpt = utils_1.deepAssign({}, contentOpt, {
|
|
73
|
-
content: !util_1.isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),
|
|
72
|
+
contentOpt = (0, utils_1.deepAssign)({}, contentOpt, {
|
|
73
|
+
content: !(0, util_1.isNil)(contentOpt.content) ? contentOpt.content : metaFormatter(percent),
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
utils_1.renderStatistic(chart, { statistic: tslib_1.__assign(tslib_1.__assign({}, statistic), { content: contentOpt }), plotType: 'liquid' }, { percent: percent });
|
|
76
|
+
(0, utils_1.renderStatistic)(chart, { statistic: tslib_1.__assign(tslib_1.__assign({}, statistic), { content: contentOpt }), plotType: 'liquid' }, { percent: percent });
|
|
77
77
|
if (updated) {
|
|
78
78
|
chart.render(true);
|
|
79
79
|
}
|
|
@@ -87,7 +87,7 @@ exports.statistic = statistic;
|
|
|
87
87
|
*/
|
|
88
88
|
function adaptor(params) {
|
|
89
89
|
// flow 的方式处理所有的配置到 G2 API (主题前置,会影响绘制的取色)
|
|
90
|
-
return utils_1.flow(common_1.theme, common_1.pattern('liquidStyle'), geometry, statistic, common_1.scale({}), common_1.animation, common_1.interaction)(params);
|
|
90
|
+
return (0, utils_1.flow)(common_1.theme, (0, common_1.pattern)('liquidStyle'), geometry, statistic, (0, common_1.scale)({}), common_1.animation, common_1.interaction)(params);
|
|
91
91
|
}
|
|
92
92
|
exports.adaptor = adaptor;
|
|
93
93
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/liquid/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAAwC;AACxC,+CAAqF;AACrF,uDAAoD;AAEpD,qCAAgE;AAEhE,iCAAwC;AAExC;;;GAGG;AACH,SAAS,QAAQ,CA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esContent":["import { Geometry } from '@antv/g2';\nimport { get, isNil } from '@antv/util';\nimport { animation, interaction, pattern, scale, theme } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, renderStatistic } from '../../utils';\nimport { CustomInfo, LiquidOptions } from './types';\nimport { getLiquidData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<LiquidOptions>): Params<LiquidOptions> {\n const { chart, options } = params;\n const { percent, liquidStyle, radius, outline, wave, shape, shapeStyle, animation } = options;\n\n chart.scale({\n percent: {\n min: 0,\n max: 1,\n },\n });\n\n chart.data(getLiquidData(percent));\n\n const color = options.color || chart.getTheme().defaultColor;\n\n const p = deepAssign({}, params, {\n options: {\n xField: 'type',\n yField: 'percent',\n // radius 放到 columnWidthRatio 中。\n // 保证横向的大小是根据 radius 生成的\n widthRatio: radius,\n interval: {\n color,\n style: liquidStyle,\n shape: 'liquid-fill-gauge',\n },\n },\n });\n const { ext } = interval(p);\n const geometry = ext.geometry as Geometry;\n const { background } = chart.getTheme();\n const customInfo: CustomInfo = {\n percent,\n radius,\n outline,\n wave,\n shape,\n shapeStyle,\n background,\n animation,\n };\n\n // 将 radius 传入到自定义 shape 中\n geometry.customInfo(customInfo);\n\n // 关闭组件\n chart.legend(false);\n chart.axis(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nexport function statistic(params: Params<LiquidOptions>, updated?: boolean): Params<LiquidOptions> {\n const { chart, options } = params;\n const { statistic, percent, meta } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n const metaFormatter = get(meta, ['percent', 'formatter']) || ((v) => `${(v * 100).toFixed(2)}%`);\n let contentOpt = statistic.content;\n if (contentOpt) {\n contentOpt = deepAssign({}, contentOpt, {\n content: !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(percent),\n });\n }\n\n renderStatistic(chart, { statistic: { ...statistic, content: contentOpt }, plotType: 'liquid' }, { percent });\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * 水波图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LiquidOptions>) {\n // flow 的方式处理所有的配置到 G2 API (主题前置,会影响绘制的取色)\n return flow(theme, pattern('liquidStyle'), geometry, statistic, scale({}), animation, interaction)(params);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Liquid = void 0;
|
|
3
|
+
exports.Liquid = exports.addWaterWave = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var g2_1 = require("@antv/g2");
|
|
6
6
|
var plot_1 = require("../../core/plot");
|
|
@@ -42,8 +42,8 @@ var Liquid = /** @class */ (function (_super) {
|
|
|
42
42
|
Liquid.prototype.changeData = function (percent) {
|
|
43
43
|
this.chart.emit(g2_1.VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, g2_1.Event.fromData(this.chart, g2_1.VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
|
|
44
44
|
this.updateOption({ percent: percent });
|
|
45
|
-
this.chart.data(utils_1.getLiquidData(percent));
|
|
46
|
-
adaptor_1.statistic({ chart: this.chart, options: this.options }, true);
|
|
45
|
+
this.chart.data((0, utils_1.getLiquidData)(percent));
|
|
46
|
+
(0, adaptor_1.statistic)({ chart: this.chart, options: this.options }, true);
|
|
47
47
|
this.chart.emit(g2_1.VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, g2_1.Event.fromData(this.chart, g2_1.VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plots/liquid/index.ts"],"names":[],"mappings":";;;;AAAA,+BAAmD;AAEnD,wCAAuC;AACvC,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ED;;;OAGG;IACI,2BAAU,GAAjB,UAAkB,OAAe;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,qBAAgB,CAAC,kBAAkB,EACnC,UAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CACtE,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC,CAAC;QACxC,IAAA,mBAAS,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;QAE9D,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,qBAAgB,CAAC,iBAAiB,EAClC,UAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAgB,CAAC,iBAAiB,EAAE,IAAI,CAAC,CACrE,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,iCAAgB,GAA1B;QACE,OAAO,iBAAO,CAAC;IACjB,CAAC;IACH,aAAC;AAAD,CAAC,AA7CD,CAA4B,WAAI,GA6C/B;AA7CY,wBAAM","sourcesContent":["import { Event, VIEW_LIFE_CIRCLE } from '@antv/g2';\nimport { Adaptor } from '../../core/adaptor';\nimport { Plot } from '../../core/plot';\nimport { adaptor, statistic } from './adaptor';\nimport { DEFAULT_OPTIONS } from './constants';\n// register liquid shape\nimport './shapes/liquid';\nimport { LiquidOptions } from './types';\nimport { getLiquidData } from './utils';\n\nexport { addWaterWave } from './shapes/liquid';\nexport type { LiquidOptions };\n\n/**\n * 传说中的水波图\n */\nexport class Liquid extends Plot<LiquidOptions> {\n /**\n * 获取 饼图 默认配置项\n * 供外部使用\n */\n static getDefaultOptions(): Partial<LiquidOptions> {\n return DEFAULT_OPTIONS;\n }\n\n /** 图表类型 */\n public type: string = 'liquid';\n\n /**\n * 获取 水波图 默认配置项, 供 base 获取\n */\n protected getDefaultOptions(): Partial<LiquidOptions> {\n return Liquid.getDefaultOptions();\n }\n\n /**\n * 更新数据\n * @param percent\n */\n public changeData(percent: number) {\n this.chart.emit(\n VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA,\n Event.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null)\n );\n this.updateOption({ percent });\n\n this.chart.data(getLiquidData(percent));\n statistic({ chart: this.chart, options: this.options }, true);\n\n this.chart.emit(\n VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA,\n Event.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null)\n );\n }\n\n /**\n * 获取适配器\n */\n protected getSchemaAdaptor(): Adaptor<LiquidOptions> {\n return adaptor;\n }\n}\n"]}
|