@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
package/src/api/mark/mark.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '../../spec';
|
|
29
29
|
import { NodePropertyDescriptor, defineProps } from '../props';
|
|
30
30
|
import { Concrete } from '../types';
|
|
31
|
-
import {
|
|
31
|
+
import { MarkNode } from './base';
|
|
32
32
|
import { API } from './types';
|
|
33
33
|
|
|
34
34
|
export interface Interval extends API<Concrete<IntervalGeometry>, Interval> {
|
|
@@ -149,185 +149,186 @@ export const props: NodePropertyDescriptor[] = [
|
|
|
149
149
|
{ name: 'slider', type: 'object' },
|
|
150
150
|
{ name: 'scrollbar', type: 'object' },
|
|
151
151
|
{ name: 'state', type: 'object' },
|
|
152
|
+
{ name: 'tooltip', type: 'mix' },
|
|
152
153
|
];
|
|
153
154
|
|
|
154
155
|
@defineProps(props)
|
|
155
|
-
export class Interval extends
|
|
156
|
+
export class Interval extends MarkNode<IntervalGeometry> {
|
|
156
157
|
constructor() {
|
|
157
158
|
super({}, 'interval');
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
@defineProps(props)
|
|
162
|
-
export class Rect extends
|
|
163
|
+
export class Rect extends MarkNode<RectGeometry> {
|
|
163
164
|
constructor() {
|
|
164
165
|
super({}, 'rect');
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
@defineProps(props)
|
|
169
|
-
export class Point extends
|
|
170
|
+
export class Point extends MarkNode<PointGeometry> {
|
|
170
171
|
constructor() {
|
|
171
172
|
super({}, 'point');
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
@defineProps(props)
|
|
176
|
-
export class Area extends
|
|
177
|
+
export class Area extends MarkNode<AreaGeometry> {
|
|
177
178
|
constructor() {
|
|
178
179
|
super({}, 'area');
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
@defineProps(props)
|
|
183
|
-
export class Line extends
|
|
184
|
+
export class Line extends MarkNode<LineGeometry> {
|
|
184
185
|
constructor() {
|
|
185
186
|
super({}, 'line');
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
@defineProps(props)
|
|
190
|
-
export class Cell extends
|
|
191
|
+
export class Cell extends MarkNode<CellGeometry> {
|
|
191
192
|
constructor() {
|
|
192
193
|
super({}, 'cell');
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
@defineProps(props)
|
|
197
|
-
export class Vector extends
|
|
198
|
+
export class Vector extends MarkNode<VectorGeometry> {
|
|
198
199
|
constructor() {
|
|
199
200
|
super({}, 'vector');
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
@defineProps(props)
|
|
204
|
-
export class Link extends
|
|
205
|
+
export class Link extends MarkNode<LinkGeometry> {
|
|
205
206
|
constructor() {
|
|
206
207
|
super({}, 'link');
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
@defineProps(props)
|
|
211
|
-
export class Polygon extends
|
|
212
|
+
export class Polygon extends MarkNode<PolygonGeometry> {
|
|
212
213
|
constructor() {
|
|
213
214
|
super({}, 'polygon');
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
@defineProps(props)
|
|
218
|
-
export class Image extends
|
|
219
|
+
export class Image extends MarkNode<ImageGeometry> {
|
|
219
220
|
constructor() {
|
|
220
221
|
super({}, 'image');
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
@defineProps(props)
|
|
225
|
-
export class Text extends
|
|
226
|
+
export class Text extends MarkNode<TextGeometry> {
|
|
226
227
|
constructor() {
|
|
227
228
|
super({}, 'text');
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
@defineProps(props)
|
|
232
|
-
export class Box extends
|
|
233
|
+
export class Box extends MarkNode<BoxGeometry> {
|
|
233
234
|
constructor() {
|
|
234
235
|
super({}, 'box');
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
@defineProps(props)
|
|
239
|
-
export class LineX extends
|
|
240
|
+
export class LineX extends MarkNode<LineXMark> {
|
|
240
241
|
constructor() {
|
|
241
242
|
super({}, 'lineX');
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
@defineProps(props)
|
|
246
|
-
export class LineY extends
|
|
247
|
+
export class LineY extends MarkNode<LineYMark> {
|
|
247
248
|
constructor() {
|
|
248
249
|
super({}, 'lineY');
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
@defineProps(props)
|
|
253
|
-
export class Range extends
|
|
254
|
+
export class Range extends MarkNode<RangeMark> {
|
|
254
255
|
constructor() {
|
|
255
256
|
super({}, 'range');
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
@defineProps(props)
|
|
260
|
-
export class RangeX extends
|
|
261
|
+
export class RangeX extends MarkNode<RangeXMark> {
|
|
261
262
|
constructor() {
|
|
262
263
|
super({}, 'rangeX');
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
@defineProps(props)
|
|
267
|
-
export class RangeY extends
|
|
268
|
+
export class RangeY extends MarkNode<RangeYMark> {
|
|
268
269
|
constructor() {
|
|
269
270
|
super({}, 'rangeY');
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
|
|
273
274
|
@defineProps(props)
|
|
274
|
-
export class Connector extends
|
|
275
|
+
export class Connector extends MarkNode<ConnectorMark> {
|
|
275
276
|
constructor() {
|
|
276
277
|
super({}, 'connector');
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
@defineProps(props)
|
|
281
|
-
export class Shape extends
|
|
282
|
+
export class Shape extends MarkNode<ShapeMark> {
|
|
282
283
|
constructor() {
|
|
283
284
|
super({}, 'shape');
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
@defineProps([...props, { name: 'layout', type: 'value' }])
|
|
288
|
-
export class Sankey extends
|
|
289
|
+
export class Sankey extends MarkNode<SankeyMark> {
|
|
289
290
|
constructor() {
|
|
290
291
|
super({}, 'sankey');
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
@defineProps([...props, { name: 'layout', type: 'value' }])
|
|
295
|
-
export class Treemap extends
|
|
296
|
+
export class Treemap extends MarkNode<ConnectorMark> {
|
|
296
297
|
constructor() {
|
|
297
298
|
super({}, 'treemap');
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
@defineProps(props)
|
|
302
|
-
export class Boxplot extends
|
|
303
|
+
export class Boxplot extends MarkNode<Boxplot> {
|
|
303
304
|
constructor() {
|
|
304
305
|
super({}, 'boxplot');
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
308
|
|
|
308
309
|
@defineProps([...props, { name: 'layout', type: 'value' }])
|
|
309
|
-
export class Pack extends
|
|
310
|
+
export class Pack extends MarkNode<Pack> {
|
|
310
311
|
constructor() {
|
|
311
312
|
super({}, 'pack');
|
|
312
313
|
}
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
@defineProps([...props, { name: 'layout', type: 'value' }])
|
|
316
|
-
export class ForceGraph extends
|
|
317
|
+
export class ForceGraph extends MarkNode<ForceGraph> {
|
|
317
318
|
constructor() {
|
|
318
319
|
super({}, 'forceGraph');
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
@defineProps([...props, { name: 'layout', type: 'value' }])
|
|
323
|
-
export class Tree extends
|
|
324
|
+
export class Tree extends MarkNode<Tree> {
|
|
324
325
|
constructor() {
|
|
325
326
|
super({}, 'tree');
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
@defineProps([...props, { name: 'layout', type: 'object' }])
|
|
330
|
-
export class WordCloud extends
|
|
331
|
+
export class WordCloud extends MarkNode<WordCloud> {
|
|
331
332
|
constructor() {
|
|
332
333
|
super({}, 'wordCloud');
|
|
333
334
|
}
|
package/src/api/mark/types.ts
CHANGED
package/src/api/node.ts
CHANGED
package/src/api/props.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { isStrictObject } from '../utils/helper';
|
|
2
|
+
|
|
1
3
|
export type NodePropertyDescriptor = {
|
|
2
|
-
type: 'object' | 'value' | 'array' | 'node' | 'container' | '
|
|
4
|
+
type: 'object' | 'value' | 'array' | 'node' | 'container' | 'mix';
|
|
3
5
|
name: string;
|
|
4
6
|
key?: string;
|
|
5
7
|
ctor?: new (...args: any[]) => any;
|
|
@@ -36,6 +38,24 @@ function defineObjectProp(
|
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
function defineMixProp(Node, { name }: NodePropertyDescriptor) {
|
|
42
|
+
Node.prototype[name] = function (key) {
|
|
43
|
+
if (arguments.length === 0) return this.attr(name);
|
|
44
|
+
if (Array.isArray(key)) return this.attr(name, { items: key });
|
|
45
|
+
if (
|
|
46
|
+
isStrictObject(key) &&
|
|
47
|
+
(key.title !== undefined || key.items !== undefined)
|
|
48
|
+
) {
|
|
49
|
+
return this.attr(name, key);
|
|
50
|
+
}
|
|
51
|
+
const obj = this.attr(name) || {};
|
|
52
|
+
const { items = [] } = obj;
|
|
53
|
+
items.push(key);
|
|
54
|
+
obj.items = items;
|
|
55
|
+
return this.attr(name, obj);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
function defineNodeProp(Node, { name, ctor }: NodePropertyDescriptor) {
|
|
40
60
|
Node.prototype[name] = function () {
|
|
41
61
|
return this.append(ctor);
|
|
@@ -62,6 +82,7 @@ export function defineProps(descriptors: NodePropertyDescriptor[]) {
|
|
|
62
82
|
else if (type === 'object') defineObjectProp(Node, descriptor);
|
|
63
83
|
else if (type === 'node') defineNodeProp(Node, descriptor);
|
|
64
84
|
else if (type === 'container') defineContainerProp(Node, descriptor);
|
|
85
|
+
else if (type === 'mix') defineMixProp(Node, descriptor);
|
|
65
86
|
}
|
|
66
87
|
return Node;
|
|
67
88
|
};
|
|
@@ -32,13 +32,19 @@ function setAnimation(node: G2ViewTree, duration: number, easing: string) {
|
|
|
32
32
|
const n = discovered.pop();
|
|
33
33
|
n.animate = deepMix(
|
|
34
34
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
enter: {
|
|
36
|
+
duration,
|
|
37
|
+
},
|
|
38
|
+
update: {
|
|
39
|
+
duration,
|
|
40
|
+
easing,
|
|
41
|
+
type: 'morphing',
|
|
42
|
+
fill: 'both',
|
|
43
|
+
},
|
|
44
|
+
exit: {
|
|
45
|
+
type: 'fadeOut',
|
|
46
|
+
duration,
|
|
47
|
+
},
|
|
42
48
|
},
|
|
43
49
|
n.animate || {},
|
|
44
50
|
);
|
package/src/composition/view.ts
CHANGED
|
@@ -19,7 +19,6 @@ export const View: CC<ViewOptions> = () => {
|
|
|
19
19
|
scale: viewScale = {},
|
|
20
20
|
axis: viewAxis = {},
|
|
21
21
|
legend: viewLegend = {},
|
|
22
|
-
coordinate: viewCoordinate = {},
|
|
23
22
|
encode: viewEncode = {},
|
|
24
23
|
transform: viewTransform = [],
|
|
25
24
|
...rest
|
|
@@ -43,14 +42,7 @@ export const View: CC<ViewOptions> = () => {
|
|
|
43
42
|
...rest,
|
|
44
43
|
}),
|
|
45
44
|
);
|
|
46
|
-
|
|
47
|
-
const newCoordinate = [...markCoordinates, viewCoordinate].reduceRight(
|
|
48
|
-
(prev, cur) => deepMix(prev, cur),
|
|
49
|
-
{},
|
|
50
|
-
);
|
|
51
|
-
return [
|
|
52
|
-
{ ...rest, marks, type: 'standardView', coordinate: newCoordinate },
|
|
53
|
-
];
|
|
45
|
+
return [{ ...rest, marks, type: 'standardView' }];
|
|
54
46
|
};
|
|
55
47
|
};
|
|
56
48
|
|
package/src/index.ts
CHANGED
package/src/interaction/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { BrushXFilter } from './native/brushXFilter';
|
|
|
20
20
|
export { BrushYFilter } from './native/brushYFilter';
|
|
21
21
|
export { SliderFilter } from './native/sliderFilter';
|
|
22
22
|
export { Poptip } from './native/poptip';
|
|
23
|
+
export { Event } from './native/event';
|
|
23
24
|
|
|
24
25
|
export { LEGEND_ITEMS_CLASS_NAME } from './native/legendFilter';
|
|
25
26
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function dataOf(element, view) {
|
|
2
|
+
const { __data__: datum } = element;
|
|
3
|
+
const { markKey, index, seriesIndex } = datum;
|
|
4
|
+
const { markState } = view;
|
|
5
|
+
const selectedMark: any = Array.from(markState.keys()).find(
|
|
6
|
+
(mark) => (mark as any).key === markKey,
|
|
7
|
+
);
|
|
8
|
+
if (!selectedMark) return;
|
|
9
|
+
if (seriesIndex) {
|
|
10
|
+
return seriesIndex.map((i) => selectedMark.data[i]);
|
|
11
|
+
}
|
|
12
|
+
return selectedMark.data[index];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function clickEvent(view, emitter) {
|
|
16
|
+
return (e) => {
|
|
17
|
+
const { target } = e;
|
|
18
|
+
const { classList } = target;
|
|
19
|
+
const [elementType, markType] = classList;
|
|
20
|
+
if (elementType === 'element') {
|
|
21
|
+
const { data = {} } = e;
|
|
22
|
+
data.data = dataOf(target, view);
|
|
23
|
+
e.data = data;
|
|
24
|
+
emitter.emit('element:click', e);
|
|
25
|
+
emitter.emit(`${markType}:click`, e);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// @todo Handle click axis and legend.
|
|
29
|
+
emitter.emit(`${elementType}:click`);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// @todo More events such as mouseenter, mouseleave.
|
|
34
|
+
// @todo Provide more info for event.dataset.
|
|
35
|
+
export function Event() {
|
|
36
|
+
return (context, _, emitter) => {
|
|
37
|
+
const { container, view } = context;
|
|
38
|
+
const click = clickEvent(view, emitter);
|
|
39
|
+
container.addEventListener('click', click);
|
|
40
|
+
return () => {
|
|
41
|
+
container.removeEventListener('click', click);
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|