@antv/g2 5.0.0-beta.10 → 5.0.0-beta.12
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/g2-lite.min.js +3 -3
- package/dist/g2.min.js +4 -4
- package/esm/api/chart.d.ts +2 -1
- package/esm/api/chart.js +2 -2
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition/base.d.ts +1 -1
- package/esm/api/composition/base.js +6 -17
- package/esm/api/composition/base.js.map +1 -1
- package/esm/api/composition/facetCircle.d.ts +2 -2
- package/esm/api/composition/facetCircle.js +2 -2
- package/esm/api/composition/facetCircle.js.map +1 -1
- package/esm/api/composition/facetRect.d.ts +2 -2
- package/esm/api/composition/facetRect.js +2 -2
- package/esm/api/composition/facetRect.js.map +1 -1
- package/esm/api/composition/geoPath.d.ts +2 -2
- package/esm/api/composition/geoPath.js +2 -2
- package/esm/api/composition/geoPath.js.map +1 -1
- package/esm/api/composition/geoView.d.ts +2 -2
- package/esm/api/composition/geoView.js +2 -2
- package/esm/api/composition/geoView.js.map +1 -1
- package/esm/api/composition/index.d.ts +2 -2
- package/esm/api/composition/index.js +2 -2
- package/esm/api/composition/index.js.map +1 -1
- package/esm/api/composition/repeatMatrix.d.ts +2 -2
- package/esm/api/composition/repeatMatrix.js +2 -2
- package/esm/api/composition/repeatMatrix.js.map +1 -1
- package/esm/api/composition/spaceFlex.d.ts +2 -2
- package/esm/api/composition/spaceFlex.js +2 -2
- package/esm/api/composition/spaceFlex.js.map +1 -1
- package/esm/api/composition/spaceLayer.d.ts +2 -2
- package/esm/api/composition/spaceLayer.js +2 -2
- package/esm/api/composition/spaceLayer.js.map +1 -1
- package/esm/api/composition/timingKeyframe.d.ts +2 -2
- package/esm/api/composition/timingKeyframe.js +2 -2
- package/esm/api/composition/timingKeyframe.js.map +1 -1
- package/esm/api/composition/view.d.ts +2 -2
- package/esm/api/composition/view.js +2 -2
- package/esm/api/composition/view.js.map +1 -1
- package/esm/api/index.d.ts +2 -0
- package/esm/api/index.js +2 -0
- package/esm/api/index.js.map +1 -1
- package/esm/api/mark/base.d.ts +1 -1
- package/esm/api/mark/base.js +7 -7
- package/esm/api/mark/base.js.map +1 -1
- package/esm/api/mark/index.d.ts +1 -0
- package/esm/api/mark/index.js +1 -0
- package/esm/api/mark/index.js.map +1 -1
- package/esm/api/mark/mark.d.ts +27 -27
- package/esm/api/mark/mark.js +28 -27
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +1 -0
- package/esm/api/node.d.ts +1 -1
- package/esm/api/node.js +1 -1
- package/esm/api/node.js.map +1 -1
- package/esm/api/props.d.ts +1 -1
- package/esm/api/props.js +20 -0
- package/esm/api/props.js.map +1 -1
- package/esm/composition/timingKeyframe.js +13 -7
- package/esm/composition/timingKeyframe.js.map +1 -1
- package/esm/composition/view.js +2 -6
- package/esm/composition/view.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/interaction/builtin/tooltip.d.ts +10 -2
- package/esm/interaction/index.d.ts +1 -0
- package/esm/interaction/index.js +1 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/event.d.ts +1 -0
- package/esm/interaction/native/event.js +42 -0
- package/esm/interaction/native/event.js.map +1 -0
- package/esm/interaction/native/tooltip.d.ts +2 -3
- package/esm/interaction/native/tooltip.js +78 -76
- package/esm/interaction/native/tooltip.js.map +1 -1
- package/esm/mark/area.js +1 -0
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/box.js +1 -0
- package/esm/mark/box.js.map +1 -1
- package/esm/mark/boxplot.js +1 -3
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/mark/cell.js +1 -0
- package/esm/mark/cell.js.map +1 -1
- package/esm/mark/connector.js +1 -0
- package/esm/mark/connector.js.map +1 -1
- package/esm/mark/forceGraph.js +1 -1
- package/esm/mark/forceGraph.js.map +1 -1
- package/esm/mark/image.js +1 -0
- package/esm/mark/image.js.map +1 -1
- package/esm/mark/interval.js +1 -0
- package/esm/mark/interval.js.map +1 -1
- package/esm/mark/line.js +1 -0
- package/esm/mark/line.js.map +1 -1
- package/esm/mark/lineX.js +1 -0
- package/esm/mark/lineX.js.map +1 -1
- package/esm/mark/lineY.js +1 -0
- package/esm/mark/lineY.js.map +1 -1
- package/esm/mark/link.js +1 -0
- package/esm/mark/link.js.map +1 -1
- package/esm/mark/pack.js +1 -1
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/path.js +1 -0
- package/esm/mark/path.js.map +1 -1
- package/esm/mark/point.js +1 -0
- package/esm/mark/point.js.map +1 -1
- package/esm/mark/polygon.js +1 -0
- package/esm/mark/polygon.js.map +1 -1
- package/esm/mark/range.js +1 -0
- package/esm/mark/range.js.map +1 -1
- package/esm/mark/rangeX.js +1 -0
- package/esm/mark/rangeX.js.map +1 -1
- package/esm/mark/rangeY.js +1 -0
- package/esm/mark/rangeY.js.map +1 -1
- package/esm/mark/rect.js +1 -0
- package/esm/mark/rect.js.map +1 -1
- package/esm/mark/sankey.js +1 -1
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/shape.js +1 -0
- package/esm/mark/shape.js.map +1 -1
- package/esm/mark/text.js +1 -0
- package/esm/mark/text.js.map +1 -1
- package/esm/mark/tree.js +1 -1
- package/esm/mark/tree.js.map +1 -1
- package/esm/mark/treemap.js +1 -1
- package/esm/mark/treemap.js.map +1 -1
- package/esm/mark/utils.js +1 -5
- package/esm/mark/utils.js.map +1 -1
- package/esm/mark/vector.js +1 -0
- package/esm/mark/vector.js.map +1 -1
- package/esm/mark/wordCloud.js +1 -1
- package/esm/mark/wordCloud.js.map +1 -1
- package/esm/runtime/mark.js +12 -7
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +81 -39
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.js +2 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.d.ts +5 -0
- package/esm/runtime/transform.js +63 -6
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/common.d.ts +1 -0
- package/esm/runtime/types/component.d.ts +2 -1
- package/esm/runtime/types/mark.d.ts +3 -3
- package/esm/runtime/types/options.d.ts +8 -1
- package/esm/scale/constant.d.ts +4 -0
- package/esm/scale/constant.js +6 -0
- package/esm/scale/constant.js.map +1 -0
- package/esm/scale/index.d.ts +2 -0
- package/esm/scale/index.js +1 -0
- package/esm/scale/index.js.map +1 -1
- package/esm/shape/interval/color.js +6 -4
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/spec/geometry.d.ts +33 -17
- package/esm/spec/interaction.d.ts +6 -1
- package/esm/spec/scale.d.ts +4 -3
- package/esm/stdlib/index.js +3 -3
- package/esm/stdlib/index.js.map +1 -1
- package/esm/transform/groupN.js +2 -2
- package/esm/transform/groupN.js.map +1 -1
- package/esm/transform/maybeTitle.js +13 -3
- package/esm/transform/maybeTitle.js.map +1 -1
- package/esm/transform/maybeTooltip.js +20 -20
- package/esm/transform/maybeTooltip.js.map +1 -1
- package/esm/transform/maybeZeroX.js +2 -2
- package/esm/transform/maybeZeroX.js.map +1 -1
- package/esm/transform/maybeZeroY.js +2 -2
- package/esm/transform/maybeZeroY.js.map +1 -1
- package/esm/transform/maybeZeroY1.js +2 -2
- package/esm/transform/maybeZeroY1.js.map +1 -1
- package/esm/transform/utils/helper.d.ts +12 -0
- package/esm/transform/utils/helper.js +8 -0
- package/esm/transform/utils/helper.js.map +1 -1
- package/esm/utils/helper.js +4 -1
- package/esm/utils/helper.js.map +1 -1
- package/lib/api/chart.d.ts +2 -1
- package/lib/api/chart.js +2 -2
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition/base.d.ts +1 -1
- package/lib/api/composition/base.js +8 -18
- package/lib/api/composition/base.js.map +1 -1
- package/lib/api/composition/facetCircle.d.ts +2 -2
- package/lib/api/composition/facetCircle.js +1 -1
- package/lib/api/composition/facetCircle.js.map +1 -1
- package/lib/api/composition/facetRect.d.ts +2 -2
- package/lib/api/composition/facetRect.js +1 -1
- package/lib/api/composition/facetRect.js.map +1 -1
- package/lib/api/composition/geoPath.d.ts +2 -2
- package/lib/api/composition/geoPath.js +1 -1
- package/lib/api/composition/geoPath.js.map +1 -1
- package/lib/api/composition/geoView.d.ts +2 -2
- package/lib/api/composition/geoView.js +1 -1
- package/lib/api/composition/geoView.js.map +1 -1
- package/lib/api/composition/index.d.ts +2 -2
- package/lib/api/composition/index.js +2 -2
- package/lib/api/composition/index.js.map +1 -1
- package/lib/api/composition/repeatMatrix.d.ts +2 -2
- package/lib/api/composition/repeatMatrix.js +1 -1
- package/lib/api/composition/repeatMatrix.js.map +1 -1
- package/lib/api/composition/spaceFlex.d.ts +2 -2
- package/lib/api/composition/spaceFlex.js +1 -1
- package/lib/api/composition/spaceFlex.js.map +1 -1
- package/lib/api/composition/spaceLayer.d.ts +2 -2
- package/lib/api/composition/spaceLayer.js +1 -1
- package/lib/api/composition/spaceLayer.js.map +1 -1
- package/lib/api/composition/timingKeyframe.d.ts +2 -2
- package/lib/api/composition/timingKeyframe.js +1 -1
- package/lib/api/composition/timingKeyframe.js.map +1 -1
- package/lib/api/composition/view.d.ts +2 -2
- package/lib/api/composition/view.js +1 -1
- package/lib/api/composition/view.js.map +1 -1
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +5 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/mark/base.d.ts +1 -1
- package/lib/api/mark/base.js +9 -9
- package/lib/api/mark/base.js.map +1 -1
- package/lib/api/mark/index.d.ts +1 -0
- package/lib/api/mark/index.js +3 -1
- package/lib/api/mark/index.js.map +1 -1
- package/lib/api/mark/mark.d.ts +27 -27
- package/lib/api/mark/mark.js +27 -26
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +1 -0
- package/lib/api/node.d.ts +1 -1
- package/lib/api/node.js +1 -1
- package/lib/api/node.js.map +1 -1
- package/lib/api/props.d.ts +1 -1
- package/lib/api/props.js +20 -0
- package/lib/api/props.js.map +1 -1
- package/lib/composition/timingKeyframe.js +13 -7
- package/lib/composition/timingKeyframe.js.map +1 -1
- package/lib/composition/view.js +2 -6
- package/lib/composition/view.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/builtin/tooltip.d.ts +10 -2
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/index.js +3 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/event.d.ts +1 -0
- package/lib/interaction/native/event.js +46 -0
- package/lib/interaction/native/event.js.map +1 -0
- package/lib/interaction/native/tooltip.d.ts +2 -3
- package/lib/interaction/native/tooltip.js +76 -74
- package/lib/interaction/native/tooltip.js.map +1 -1
- package/lib/mark/area.js +1 -0
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/box.js +1 -0
- package/lib/mark/box.js.map +1 -1
- package/lib/mark/boxplot.js +1 -3
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/mark/cell.js +1 -0
- package/lib/mark/cell.js.map +1 -1
- package/lib/mark/connector.js +1 -0
- package/lib/mark/connector.js.map +1 -1
- package/lib/mark/forceGraph.js +1 -1
- package/lib/mark/forceGraph.js.map +1 -1
- package/lib/mark/image.js +1 -0
- package/lib/mark/image.js.map +1 -1
- package/lib/mark/interval.js +1 -0
- package/lib/mark/interval.js.map +1 -1
- package/lib/mark/line.js +1 -0
- package/lib/mark/line.js.map +1 -1
- package/lib/mark/lineX.js +1 -0
- package/lib/mark/lineX.js.map +1 -1
- package/lib/mark/lineY.js +1 -0
- package/lib/mark/lineY.js.map +1 -1
- package/lib/mark/link.js +1 -0
- package/lib/mark/link.js.map +1 -1
- package/lib/mark/pack.js +1 -1
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/path.js +1 -0
- package/lib/mark/path.js.map +1 -1
- package/lib/mark/point.js +1 -0
- package/lib/mark/point.js.map +1 -1
- package/lib/mark/polygon.js +1 -0
- package/lib/mark/polygon.js.map +1 -1
- package/lib/mark/range.js +1 -0
- package/lib/mark/range.js.map +1 -1
- package/lib/mark/rangeX.js +1 -0
- package/lib/mark/rangeX.js.map +1 -1
- package/lib/mark/rangeY.js +1 -0
- package/lib/mark/rangeY.js.map +1 -1
- package/lib/mark/rect.js +1 -0
- package/lib/mark/rect.js.map +1 -1
- package/lib/mark/sankey.js +1 -1
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/shape.js +1 -0
- package/lib/mark/shape.js.map +1 -1
- package/lib/mark/text.js +1 -0
- package/lib/mark/text.js.map +1 -1
- package/lib/mark/tree.js +1 -1
- package/lib/mark/tree.js.map +1 -1
- package/lib/mark/treemap.js +1 -1
- package/lib/mark/treemap.js.map +1 -1
- package/lib/mark/utils.js +1 -5
- package/lib/mark/utils.js.map +1 -1
- package/lib/mark/vector.js +1 -0
- package/lib/mark/vector.js.map +1 -1
- package/lib/mark/wordCloud.js +1 -1
- package/lib/mark/wordCloud.js.map +1 -1
- package/lib/runtime/mark.js +11 -6
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +81 -39
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.js +2 -0
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.d.ts +5 -0
- package/lib/runtime/transform.js +65 -6
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/common.d.ts +1 -0
- package/lib/runtime/types/component.d.ts +2 -1
- package/lib/runtime/types/mark.d.ts +3 -3
- package/lib/runtime/types/options.d.ts +8 -1
- package/lib/scale/constant.d.ts +4 -0
- package/lib/scale/constant.js +10 -0
- package/lib/scale/constant.js.map +1 -0
- package/lib/scale/index.d.ts +2 -0
- package/lib/scale/index.js +3 -1
- package/lib/scale/index.js.map +1 -1
- package/lib/shape/interval/color.js +6 -4
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/spec/geometry.d.ts +33 -17
- package/lib/spec/interaction.d.ts +6 -1
- package/lib/spec/scale.d.ts +4 -3
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/transform/groupN.js +1 -1
- package/lib/transform/groupN.js.map +1 -1
- package/lib/transform/maybeTitle.js +12 -2
- package/lib/transform/maybeTitle.js.map +1 -1
- package/lib/transform/maybeTooltip.js +20 -20
- package/lib/transform/maybeTooltip.js.map +1 -1
- package/lib/transform/maybeZeroX.js +1 -1
- package/lib/transform/maybeZeroX.js.map +1 -1
- package/lib/transform/maybeZeroY.js +1 -1
- package/lib/transform/maybeZeroY.js.map +1 -1
- package/lib/transform/maybeZeroY1.js +1 -1
- package/lib/transform/maybeZeroY1.js.map +1 -1
- package/lib/transform/utils/helper.d.ts +12 -0
- package/lib/transform/utils/helper.js +11 -1
- package/lib/transform/utils/helper.js.map +1 -1
- package/lib/utils/helper.js +4 -1
- package/lib/utils/helper.js.map +1 -1
- package/package.json +4 -4
- package/src/api/chart.ts +2 -2
- package/src/api/composition/base.ts +5 -7
- package/src/api/composition/facetCircle.ts +2 -2
- package/src/api/composition/facetRect.ts +2 -2
- package/src/api/composition/geoPath.ts +2 -2
- package/src/api/composition/geoView.ts +2 -2
- package/src/api/composition/index.ts +2 -2
- package/src/api/composition/repeatMatrix.ts +2 -2
- package/src/api/composition/spaceFlex.ts +2 -2
- package/src/api/composition/spaceLayer.ts +2 -2
- package/src/api/composition/timingKeyframe.ts +2 -2
- package/src/api/composition/view.ts +2 -2
- package/src/api/index.ts +2 -0
- package/src/api/mark/base.ts +7 -7
- package/src/api/mark/index.ts +2 -0
- package/src/api/mark/mark.ts +28 -27
- package/src/api/mark/types.ts +1 -0
- package/src/api/node.ts +1 -1
- package/src/api/props.ts +22 -1
- package/src/composition/timingKeyframe.ts +13 -7
- package/src/composition/view.ts +1 -9
- package/src/index.ts +1 -1
- package/src/interaction/index.ts +1 -0
- package/src/interaction/native/event.ts +44 -0
- package/src/interaction/native/tooltip.ts +78 -95
- package/src/mark/area.ts +1 -0
- package/src/mark/box.ts +1 -0
- package/src/mark/boxplot.ts +1 -3
- package/src/mark/cell.ts +1 -0
- package/src/mark/connector.ts +1 -0
- package/src/mark/forceGraph.ts +1 -1
- package/src/mark/image.ts +1 -0
- package/src/mark/interval.ts +1 -0
- package/src/mark/line.ts +1 -0
- package/src/mark/lineX.ts +1 -0
- package/src/mark/lineY.ts +1 -0
- package/src/mark/link.ts +1 -0
- package/src/mark/pack.ts +1 -1
- package/src/mark/path.ts +1 -0
- package/src/mark/point.ts +1 -0
- package/src/mark/polygon.ts +1 -0
- package/src/mark/range.ts +1 -0
- package/src/mark/rangeX.ts +1 -0
- package/src/mark/rangeY.ts +1 -0
- package/src/mark/rect.ts +1 -0
- package/src/mark/sankey.ts +1 -1
- package/src/mark/shape.ts +1 -0
- package/src/mark/text.ts +1 -0
- package/src/mark/tree.ts +1 -1
- package/src/mark/treemap.ts +1 -1
- package/src/mark/utils.ts +1 -5
- package/src/mark/vector.ts +1 -0
- package/src/mark/wordCloud.ts +1 -1
- package/src/runtime/mark.ts +13 -5
- package/src/runtime/plot.ts +117 -50
- package/src/runtime/scale.ts +2 -0
- package/src/runtime/transform.ts +72 -6
- package/src/runtime/types/common.ts +1 -0
- package/src/runtime/types/component.ts +2 -0
- package/src/runtime/types/mark.ts +3 -3
- package/src/runtime/types/options.ts +8 -1
- package/src/scale/constant.ts +11 -0
- package/src/scale/index.ts +2 -0
- package/src/shape/interval/color.ts +11 -7
- package/src/spec/geometry.ts +38 -30
- package/src/spec/interaction.ts +5 -1
- package/src/spec/scale.ts +6 -1
- package/src/stdlib/index.ts +4 -0
- package/src/transform/groupN.ts +2 -2
- package/src/transform/maybeTitle.ts +11 -3
- package/src/transform/maybeTooltip.ts +17 -21
- package/src/transform/maybeZeroX.ts +2 -2
- package/src/transform/maybeZeroY.ts +2 -2
- package/src/transform/maybeZeroY1.ts +2 -2
- package/src/transform/utils/helper.ts +10 -0
- package/src/utils/helper.ts +6 -1
|
@@ -2,34 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MaybeTooltip = void 0;
|
|
4
4
|
const util_1 = require("@antv/util");
|
|
5
|
-
const helper_1 = require("./utils/helper");
|
|
6
5
|
/**
|
|
7
6
|
* Infer tooltip channel from specified channel.
|
|
8
7
|
*/
|
|
9
8
|
const MaybeTooltip = (options) => {
|
|
10
9
|
const { channel } = options;
|
|
11
10
|
return (I, mark) => {
|
|
12
|
-
const { encode } = mark;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const { encode, tooltip } = mark;
|
|
12
|
+
if (tooltip === null)
|
|
13
|
+
return [I, mark];
|
|
14
|
+
const { items = [] } = tooltip;
|
|
15
|
+
if (items.length > 0)
|
|
15
16
|
return [I, mark];
|
|
16
17
|
const channels = Array.isArray(channel) ? channel : [channel];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
32
|
-
return [I, (0, util_1.deepMix)({}, mark, { encode: Object.fromEntries(entries) })];
|
|
18
|
+
const newItems = channels.flatMap((channel) => Object.keys(encode)
|
|
19
|
+
.filter((key) => key.startsWith(channel))
|
|
20
|
+
.map((key) => {
|
|
21
|
+
const { field, value, inferred = false } = encode[key];
|
|
22
|
+
// Do not show inferred column.
|
|
23
|
+
if (inferred)
|
|
24
|
+
return null;
|
|
25
|
+
if (field)
|
|
26
|
+
return { field };
|
|
27
|
+
if (value)
|
|
28
|
+
return { channel: key };
|
|
29
|
+
return null;
|
|
30
|
+
})
|
|
31
|
+
.filter((d) => d !== null));
|
|
32
|
+
return [I, (0, util_1.deepMix)({}, mark, { tooltip: { items: newItems } })];
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
exports.MaybeTooltip = MaybeTooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybeTooltip.js","sourceRoot":"src/","sources":["transform/maybeTooltip.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"maybeTooltip.js","sourceRoot":"src/","sources":["transform/maybeTooltip.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAOrC;;GAEG;AACI,MAAM,YAAY,GAA4B,CAAC,OAAO,EAAE,EAAE;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;aAChB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aACxC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACvD,+BAA+B;YAC/B,IAAI,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC1B,IAAI,KAAK;gBAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YAC5B,IAAI,KAAK;gBAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAC7B,CAAC;QACF,OAAO,CAAC,CAAC,EAAE,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,YAAY,gBAuBvB;AAEF,oBAAY,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -16,7 +16,7 @@ const MaybeZeroX = () => {
|
|
|
16
16
|
return [
|
|
17
17
|
I,
|
|
18
18
|
(0, util_1.deepMix)({}, mark, {
|
|
19
|
-
encode: { x: (0, helper_1.
|
|
19
|
+
encode: { x: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
|
|
20
20
|
scale: { x: { guide: null } },
|
|
21
21
|
}),
|
|
22
22
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybeZeroX.js","sourceRoot":"src/","sources":["transform/maybeZeroX.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,
|
|
1
|
+
{"version":3,"file":"maybeZeroX.js","sourceRoot":"src/","sources":["transform/maybeZeroX.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAA0D;AAI1D;;;GAGG;AACI,MAAM,UAAU,GAA0B,GAAG,EAAE;IACpD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACtC,OAAO;YACL,CAAC;YACD,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE;gBAChB,MAAM,EAAE,EAAE,CAAC,EAAE,IAAA,uBAAc,EAAC,IAAA,iBAAQ,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC7C,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;aAC9B,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB;AAEF,kBAAU,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -15,7 +15,7 @@ const MaybeZeroY = () => {
|
|
|
15
15
|
return [
|
|
16
16
|
I,
|
|
17
17
|
(0, util_1.deepMix)({}, mark, {
|
|
18
|
-
encode: { y: (0, helper_1.
|
|
18
|
+
encode: { y: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
|
|
19
19
|
scale: { y: { guide: null } },
|
|
20
20
|
}),
|
|
21
21
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybeZeroY.js","sourceRoot":"src/","sources":["transform/maybeZeroY.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,
|
|
1
|
+
{"version":3,"file":"maybeZeroY.js","sourceRoot":"src/","sources":["transform/maybeZeroY.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAA0D;AAI1D;;GAEG;AACI,MAAM,UAAU,GAA0B,GAAG,EAAE;IACpD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACtC,OAAO;YACL,CAAC;YACD,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE;gBAChB,MAAM,EAAE,EAAE,CAAC,EAAE,IAAA,uBAAc,EAAC,IAAA,iBAAQ,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC7C,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;aAC9B,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB;AAEF,kBAAU,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybeZeroY1.js","sourceRoot":"src/","sources":["transform/maybeZeroY1.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,
|
|
1
|
+
{"version":3,"file":"maybeZeroY1.js","sourceRoot":"src/","sources":["transform/maybeZeroY1.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAA0D;AAI1D;;GAEG;AACI,MAAM,WAAW,GAA2B,GAAG,EAAE;IACtD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO;YACL,CAAC;YACD,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE;gBAChB,MAAM,EAAE,EAAE,EAAE,EAAE,IAAA,uBAAc,EAAC,IAAA,iBAAQ,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;aAC/C,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,WAAW,eAYtB;AAEF,mBAAW,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -4,12 +4,24 @@ export declare function column(value: Primitive[], field?: string): {
|
|
|
4
4
|
value: Primitive[];
|
|
5
5
|
field: string;
|
|
6
6
|
};
|
|
7
|
+
export declare function inferredColumn(value: Primitive[], field?: string): {
|
|
8
|
+
inferred: boolean;
|
|
9
|
+
type: string;
|
|
10
|
+
value: Primitive[];
|
|
11
|
+
field: string;
|
|
12
|
+
};
|
|
7
13
|
export declare function visualColumn(value: Primitive[], field?: string): {
|
|
8
14
|
type: string;
|
|
9
15
|
value: Primitive[];
|
|
10
16
|
field: string;
|
|
11
17
|
visual: boolean;
|
|
12
18
|
};
|
|
19
|
+
export declare function nonConstantColumn(value: Primitive[], field?: string): {
|
|
20
|
+
constant: boolean;
|
|
21
|
+
type: string;
|
|
22
|
+
value: Primitive[];
|
|
23
|
+
field: string;
|
|
24
|
+
};
|
|
13
25
|
export declare function constant(I: number[], value: any): any[];
|
|
14
26
|
export declare function columnOf(encode: any, key: string): [Primitive[], string];
|
|
15
27
|
export declare function maybeColumnOf(encode: any, ...K: (string | Primitive[])[]): [Primitive[], string];
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObject = exports.maybeColumnOf = exports.columnOf = exports.constant = exports.visualColumn = exports.column = void 0;
|
|
3
|
+
exports.isObject = exports.maybeColumnOf = exports.columnOf = exports.constant = exports.nonConstantColumn = exports.visualColumn = exports.inferredColumn = exports.column = void 0;
|
|
4
4
|
function column(value, field) {
|
|
5
5
|
if (value === null)
|
|
6
6
|
return undefined;
|
|
7
7
|
return { type: 'column', value, field };
|
|
8
8
|
}
|
|
9
9
|
exports.column = column;
|
|
10
|
+
function inferredColumn(value, field) {
|
|
11
|
+
const c = column(value, field);
|
|
12
|
+
return Object.assign(Object.assign({}, c), { inferred: true });
|
|
13
|
+
}
|
|
14
|
+
exports.inferredColumn = inferredColumn;
|
|
10
15
|
function visualColumn(value, field) {
|
|
11
16
|
if (value === null)
|
|
12
17
|
return undefined;
|
|
13
18
|
return { type: 'column', value, field, visual: true };
|
|
14
19
|
}
|
|
15
20
|
exports.visualColumn = visualColumn;
|
|
21
|
+
function nonConstantColumn(value, field) {
|
|
22
|
+
const c = column(value, field);
|
|
23
|
+
return Object.assign(Object.assign({}, c), { constant: false });
|
|
24
|
+
}
|
|
25
|
+
exports.nonConstantColumn = nonConstantColumn;
|
|
16
26
|
function constant(I, value) {
|
|
17
27
|
const array = [];
|
|
18
28
|
for (const i of I)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"src/","sources":["transform/utils/helper.ts"],"names":[],"mappings":";;;AAEA,SAAgB,MAAM,CAAC,KAAkB,EAAE,KAAc;IACvD,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1C,CAAC;AAHD,wBAGC;AAED,SAAgB,YAAY,CAAC,KAAkB,EAAE,KAAc;IAC7D,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC;AAHD,oCAGC;AAED,SAAgB,QAAQ,CAAC,CAAW,EAAE,KAAU;IAC9C,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAJD,4BAIC;AAED,SAAgB,QAAQ,CAAC,MAAM,EAAE,GAAW;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,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IAAI,CAAC,CAAC;SACpB;KACF;IACD,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtB,CAAC;AAbD,sCAaC;AAED,SAAgB,QAAQ,CAAC,CAAC;IACxB,IAAI,CAAC,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAHD,4BAGC"}
|
package/lib/utils/helper.js
CHANGED
|
@@ -102,7 +102,10 @@ function maybePercentage(x, size) {
|
|
|
102
102
|
}
|
|
103
103
|
exports.maybePercentage = maybePercentage;
|
|
104
104
|
function isStrictObject(d) {
|
|
105
|
-
return typeof d === 'object' &&
|
|
105
|
+
return (typeof d === 'object' &&
|
|
106
|
+
!(d instanceof Date) &&
|
|
107
|
+
d !== null &&
|
|
108
|
+
!Array.isArray(d));
|
|
106
109
|
}
|
|
107
110
|
exports.isStrictObject = isStrictObject;
|
|
108
111
|
//# sourceMappingURL=helper.js.map
|
package/lib/utils/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"src/","sources":["utils/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAoD;AAEpD,SAAgB,QAAQ,CAAI,CAAI;IAC9B,OAAO,CAAC,CAAC;AACX,CAAC;AAFD,4BAEC;AAGD;;GAEG;AACH,SAAgB,OAAO,CAAI,GAAc;IACvC,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CACf,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,CACb,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EACrC,QAAQ,CACT,CAAC;AACJ,CAAC;AAPD,0BAOC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC1B,GAAiC;IAEjC,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,QAAQ,E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O,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;AACrD,CAAC;AALD,0CAKC;AAED,SAAgB,cAAc,CAAC,CAAM;IACnC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC;QACpB,CAAC,KAAK,IAAI;QACV,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,CAAC;AACJ,CAAC;AAPD,wCAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.12",
|
|
4
4
|
"description": "the Grammar of Graphics in Javascript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"size": "limit-size",
|
|
20
20
|
"lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
|
|
21
21
|
"fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
|
|
22
|
-
"test": "
|
|
23
|
-
"test:unit": "jest __tests__/unit/ --coverage -i",
|
|
24
|
-
"test:integration": "jest __tests__/integration/ --coverage -i",
|
|
22
|
+
"test": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
|
|
23
|
+
"test:unit": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
|
|
24
|
+
"test:integration": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
|
|
25
25
|
"test-live": "cross-env DEBUG_MODE=1 jest --watch",
|
|
26
26
|
"build:umd": "rimraf ./dist && rollup -c && npm run size",
|
|
27
27
|
"build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
|
package/src/api/chart.ts
CHANGED
|
@@ -213,11 +213,11 @@ export class Chart extends View<ChartOptions> {
|
|
|
213
213
|
return optionsOf(this);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
getContainer(): HTMLElement {
|
|
217
217
|
return this._container;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
getContext(): G2Context {
|
|
221
221
|
return this._context;
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
2
|
import { Coordinate } from '@antv/coord';
|
|
3
|
-
import { defineProps } from '../props';
|
|
4
3
|
import { Node } from '../node';
|
|
5
4
|
import { G2Theme, G2ViewDescriptor } from '../../runtime';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
export class Base<
|
|
6
|
+
export class CompositionNode<
|
|
9
7
|
Value extends Record<string, any> = Record<string, any>,
|
|
10
8
|
ParentValue extends Record<string, any> = Record<string, any>,
|
|
11
9
|
ChildValue extends Record<string, any> = Record<string, any>,
|
|
@@ -14,8 +12,8 @@ export class Base<
|
|
|
14
12
|
* Get view instance by key.
|
|
15
13
|
*/
|
|
16
14
|
getView(): G2ViewDescriptor {
|
|
17
|
-
const chart = this.
|
|
18
|
-
const { views } = chart.
|
|
15
|
+
const chart = this.getRoot();
|
|
16
|
+
const { views } = chart.getContext();
|
|
19
17
|
if (!views?.length) return undefined;
|
|
20
18
|
return views.find((view) => view.key === this.attr('key'));
|
|
21
19
|
}
|
|
@@ -31,8 +29,8 @@ export class Base<
|
|
|
31
29
|
getGroup(): DisplayObject {
|
|
32
30
|
const key = this.attr('key');
|
|
33
31
|
if (!key) return undefined;
|
|
34
|
-
const chart = this.
|
|
35
|
-
const chartGroup = chart.
|
|
32
|
+
const chart = this.getRoot();
|
|
33
|
+
const chartGroup = chart.getContext().canvas.getRoot();
|
|
36
34
|
return chartGroup.getElementById(key);
|
|
37
35
|
}
|
|
38
36
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ObjectAttribute,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import { Composition,
|
|
10
|
+
import { Composition, CompositionNode } from './index';
|
|
11
11
|
|
|
12
12
|
type FacetCircleSpec = Concrete<FacetCircleComposition>;
|
|
13
13
|
|
|
@@ -29,7 +29,7 @@ export interface FacetCircle extends Composition, Mark {
|
|
|
29
29
|
{ type: 'object', name: 'axis' },
|
|
30
30
|
...nodeProps(mark),
|
|
31
31
|
])
|
|
32
|
-
export class FacetCircle extends
|
|
32
|
+
export class FacetCircle extends CompositionNode<FacetCircleComposition> {
|
|
33
33
|
constructor() {
|
|
34
34
|
super({}, 'facetCircle');
|
|
35
35
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ObjectAttribute,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import { Composition,
|
|
10
|
+
import { Composition, CompositionNode } from './index';
|
|
11
11
|
|
|
12
12
|
type FacetRectSpec = Concrete<FacetRectComposition>;
|
|
13
13
|
|
|
@@ -29,7 +29,7 @@ export interface FacetRect extends Composition, Mark {
|
|
|
29
29
|
{ type: 'object', name: 'axis' },
|
|
30
30
|
...nodeProps(mark),
|
|
31
31
|
])
|
|
32
|
-
export class FacetRect extends
|
|
32
|
+
export class FacetRect extends CompositionNode<FacetRectComposition> {
|
|
33
33
|
constructor() {
|
|
34
34
|
super({}, 'facetRect');
|
|
35
35
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Concrete,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import { Composition,
|
|
10
|
+
import { Composition, CompositionNode } from './index';
|
|
11
11
|
|
|
12
12
|
type GeoPathSpec = Concrete<GeoPathComposition>;
|
|
13
13
|
|
|
@@ -33,7 +33,7 @@ export interface GeoPath extends Mark, Composition {
|
|
|
33
33
|
{ type: 'object', name: 'legend' },
|
|
34
34
|
...nodeProps(mark),
|
|
35
35
|
])
|
|
36
|
-
export class GeoPath extends
|
|
36
|
+
export class GeoPath extends CompositionNode<GeoPathComposition> {
|
|
37
37
|
constructor() {
|
|
38
38
|
super({}, 'geoPath');
|
|
39
39
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Concrete,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import { Composition,
|
|
10
|
+
import { Composition, CompositionNode } from './index';
|
|
11
11
|
|
|
12
12
|
type GeoViewSpec = Concrete<GeoViewComposition>;
|
|
13
13
|
|
|
@@ -32,7 +32,7 @@ export interface GeoView extends Mark, Composition {
|
|
|
32
32
|
{ type: 'object', name: 'legend' },
|
|
33
33
|
...nodeProps(mark),
|
|
34
34
|
])
|
|
35
|
-
export class GeoView extends
|
|
35
|
+
export class GeoView extends CompositionNode<GeoViewComposition> {
|
|
36
36
|
constructor() {
|
|
37
37
|
super({}, 'geoView');
|
|
38
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineProps, nodeProps } from '../props';
|
|
2
|
-
import {
|
|
2
|
+
import { CompositionNode } from './base';
|
|
3
3
|
import { View } from './view';
|
|
4
4
|
import { SpaceLayer } from './spaceLayer';
|
|
5
5
|
import { SpaceFlex } from './spaceFlex';
|
|
@@ -35,7 +35,7 @@ export interface Composition {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export {
|
|
38
|
-
|
|
38
|
+
CompositionNode,
|
|
39
39
|
View,
|
|
40
40
|
SpaceLayer,
|
|
41
41
|
SpaceFlex,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ObjectAttribute,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import { Composition,
|
|
10
|
+
import { Composition, CompositionNode } from './index';
|
|
11
11
|
|
|
12
12
|
type RepeatMatrixSpec = Concrete<RepeatMatrixComposition>;
|
|
13
13
|
|
|
@@ -29,7 +29,7 @@ export interface RepeatMatrix extends Composition, Mark {
|
|
|
29
29
|
{ type: 'object', name: 'legend' },
|
|
30
30
|
...nodeProps(mark),
|
|
31
31
|
])
|
|
32
|
-
export class RepeatMatrix extends
|
|
32
|
+
export class RepeatMatrix extends CompositionNode<RepeatMatrixComposition> {
|
|
33
33
|
constructor() {
|
|
34
34
|
super({}, 'repeatMatrix');
|
|
35
35
|
}
|
|
@@ -2,7 +2,7 @@ import { SpaceFlexComposition } from '../../spec';
|
|
|
2
2
|
import { defineProps, nodeProps } from '../props';
|
|
3
3
|
import { ValueAttribute, Concrete } from '../types';
|
|
4
4
|
import { mark, Mark } from '../mark';
|
|
5
|
-
import { Composition,
|
|
5
|
+
import { Composition, CompositionNode } from './index';
|
|
6
6
|
|
|
7
7
|
type SpaceFlexSpec = Concrete<SpaceFlexComposition>;
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export interface SpaceFlex extends Composition, Mark {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@defineProps([{ type: 'value', name: 'data' }, ...nodeProps(mark)])
|
|
14
|
-
export class SpaceFlex extends
|
|
14
|
+
export class SpaceFlex extends CompositionNode<SpaceFlexSpec> {
|
|
15
15
|
constructor() {
|
|
16
16
|
super({}, 'spaceFlex');
|
|
17
17
|
}
|
|
@@ -2,7 +2,7 @@ import { SpaceLayerComposition } from '../../spec';
|
|
|
2
2
|
import { defineProps, nodeProps } from '../props';
|
|
3
3
|
import { ValueAttribute, Concrete } from '../types';
|
|
4
4
|
import { mark, Mark } from '../mark';
|
|
5
|
-
import { Composition,
|
|
5
|
+
import { Composition, CompositionNode } from './index';
|
|
6
6
|
|
|
7
7
|
type SpaceLayerSpec = Concrete<SpaceLayerComposition>;
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export interface SpaceLayer extends Composition, Mark {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@defineProps([{ type: 'value', name: 'data' }, ...nodeProps(mark)])
|
|
14
|
-
export class SpaceLayer extends
|
|
14
|
+
export class SpaceLayer extends CompositionNode<SpaceLayerComposition> {
|
|
15
15
|
constructor() {
|
|
16
16
|
super({}, 'spaceLayer');
|
|
17
17
|
}
|
|
@@ -2,14 +2,14 @@ import { TimingKeyframeComposition } from '../../spec';
|
|
|
2
2
|
import { defineProps, nodeProps } from '../props';
|
|
3
3
|
import { Concrete } from '../types';
|
|
4
4
|
import { mark, Mark } from '../mark';
|
|
5
|
-
import { Composition,
|
|
5
|
+
import { Composition, CompositionNode } from './index';
|
|
6
6
|
|
|
7
7
|
type TimingKeyframeSpec = Concrete<TimingKeyframeComposition>;
|
|
8
8
|
|
|
9
9
|
export interface TimingKeyframe extends Composition, Mark {}
|
|
10
10
|
|
|
11
11
|
@defineProps([...nodeProps(mark)])
|
|
12
|
-
export class TimingKeyframe extends
|
|
12
|
+
export class TimingKeyframe extends CompositionNode<TimingKeyframeSpec> {
|
|
13
13
|
constructor() {
|
|
14
14
|
super({}, 'timingKeyframe');
|
|
15
15
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Concrete,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { mark, Mark } from '../mark';
|
|
10
|
-
import {
|
|
10
|
+
import { CompositionNode } from './base';
|
|
11
11
|
|
|
12
12
|
type ViewSpec = Concrete<ViewComposition>;
|
|
13
13
|
|
|
@@ -35,7 +35,7 @@ export interface View extends Mark {
|
|
|
35
35
|
])
|
|
36
36
|
export class View<
|
|
37
37
|
ViewProps extends ViewComposition = ViewComposition,
|
|
38
|
-
> extends
|
|
38
|
+
> extends CompositionNode<ViewProps> {
|
|
39
39
|
constructor(options = {}, type = 'view') {
|
|
40
40
|
super(options, type);
|
|
41
41
|
}
|
package/src/api/index.ts
CHANGED
package/src/api/mark/base.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { DisplayObject } from '@antv/g';
|
|
|
2
2
|
import { Node } from '../node';
|
|
3
3
|
import { G2MarkState, Scale } from '../../runtime';
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class MarkNode<
|
|
6
6
|
Value extends Record<string, any> = Record<string, any>,
|
|
7
7
|
ParentValue extends Record<string, any> = Record<string, any>,
|
|
8
8
|
ChildValue extends Record<string, any> = Record<string, any>,
|
|
9
9
|
> extends Node<Value, ParentValue, ChildValue> {
|
|
10
10
|
changeData(data: any) {
|
|
11
|
-
const chart = this.
|
|
11
|
+
const chart = this.getRoot();
|
|
12
12
|
if (!chart) return;
|
|
13
13
|
this.attr('data', data);
|
|
14
14
|
return chart?.render();
|
|
@@ -18,7 +18,7 @@ export class MarkBase<
|
|
|
18
18
|
* Get mark from chart views.
|
|
19
19
|
*/
|
|
20
20
|
getMark(): G2MarkState {
|
|
21
|
-
const chartView = this.
|
|
21
|
+
const chartView = this.getRoot()?.getView();
|
|
22
22
|
if (!chartView) return undefined;
|
|
23
23
|
const { markState } = chartView;
|
|
24
24
|
const markKey = Array.from(markState.keys()).find(
|
|
@@ -31,7 +31,7 @@ export class MarkBase<
|
|
|
31
31
|
* Get all scales instance.
|
|
32
32
|
*/
|
|
33
33
|
getScale(): Record<string, Scale> {
|
|
34
|
-
const chartView = this.
|
|
34
|
+
const chartView = this.getRoot()?.getView();
|
|
35
35
|
if (!chartView) return undefined;
|
|
36
36
|
return chartView?.scale;
|
|
37
37
|
}
|
|
@@ -40,7 +40,7 @@ export class MarkBase<
|
|
|
40
40
|
* Get the scale instance by channel.
|
|
41
41
|
*/
|
|
42
42
|
getScaleByChannel(channel: string): Scale {
|
|
43
|
-
const chartView = this.
|
|
43
|
+
const chartView = this.getRoot()?.getView();
|
|
44
44
|
if (!chartView) return undefined;
|
|
45
45
|
return chartView?.scale?.[channel];
|
|
46
46
|
}
|
|
@@ -51,8 +51,8 @@ export class MarkBase<
|
|
|
51
51
|
getGroup(): DisplayObject {
|
|
52
52
|
const key = this.attr('key');
|
|
53
53
|
if (!key) return undefined;
|
|
54
|
-
const chart = this.
|
|
55
|
-
const chartGroup = chart.
|
|
54
|
+
const chart = this.getRoot();
|
|
55
|
+
const chartGroup = chart.getContext().canvas.getRoot();
|
|
56
56
|
return chartGroup.getElementById(key);
|
|
57
57
|
}
|
|
58
58
|
}
|