@antv/g2 5.0.0-beta.4 → 5.0.0-beta.5
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 +5 -2
- package/dist/g2.min.js +5 -2
- package/esm/api/mark/mark.js +0 -2
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +0 -2
- package/esm/component/axis.js +5 -4
- package/esm/component/axis.js.map +1 -1
- package/esm/component/slider.js +2 -4
- package/esm/component/slider.js.map +1 -1
- package/esm/composition/mark.js +2 -1
- package/esm/composition/mark.js.map +1 -1
- package/esm/interaction/builtin/brushHighlight.d.ts +1 -1
- package/esm/interaction/index.d.ts +3 -0
- package/esm/interaction/index.js +3 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/brushHighlight.d.ts +15 -0
- package/esm/interaction/native/brushHighlight.js +283 -0
- package/esm/interaction/native/brushHighlight.js.map +1 -0
- package/esm/interaction/native/brushXHighlight.d.ts +1 -0
- package/esm/interaction/native/brushXHighlight.js +8 -0
- package/esm/interaction/native/brushXHighlight.js.map +1 -0
- package/esm/interaction/native/brushYHighlight.d.ts +1 -0
- package/esm/interaction/native/brushYHighlight.js +8 -0
- package/esm/interaction/native/brushYHighlight.js.map +1 -0
- package/esm/interaction/native/legendFilter.js +3 -12
- package/esm/interaction/native/legendFilter.js.map +1 -1
- package/esm/interaction/native/tooltip.js +96 -28
- package/esm/interaction/native/tooltip.js.map +1 -1
- package/esm/interaction/native/utils.d.ts +4 -0
- package/esm/interaction/native/utils.js +23 -0
- package/esm/interaction/native/utils.js.map +1 -1
- package/esm/label-transform/contrastReverse.d.ts +9 -0
- package/esm/label-transform/contrastReverse.js +48 -0
- package/esm/label-transform/contrastReverse.js.map +1 -0
- package/esm/label-transform/index.d.ts +8 -8
- package/esm/label-transform/index.js +4 -4
- package/esm/label-transform/index.js.map +1 -1
- package/esm/label-transform/overflowHide.d.ts +7 -0
- package/esm/label-transform/overflowHide.js +18 -0
- package/esm/label-transform/overflowHide.js.map +1 -0
- package/esm/label-transform/overlapDodgeY.d.ts +7 -0
- package/esm/label-transform/{dodgeY.js → overlapDodgeY.js} +4 -4
- package/esm/label-transform/overlapDodgeY.js.map +1 -0
- package/esm/label-transform/overlapHide.d.ts +7 -0
- package/esm/label-transform/overlapHide.js +24 -0
- package/esm/label-transform/overlapHide.js.map +1 -0
- package/esm/runtime/plot.js +24 -6
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.js +17 -5
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +10 -4
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/common.d.ts +1 -0
- package/esm/runtime/types/options.d.ts +1 -0
- package/esm/shape/label/label.js +3 -3
- package/esm/shape/label/label.js.map +1 -1
- package/esm/shape/label/position/area.d.ts +13 -0
- package/esm/shape/label/position/area.js +28 -0
- package/esm/shape/label/position/area.js.map +1 -0
- package/esm/shape/label/position/bottom.d.ts +1 -0
- package/esm/shape/label/position/bottom.js +2 -0
- package/esm/shape/label/position/bottom.js.map +1 -0
- package/esm/shape/label/position/bottomLeft.d.ts +1 -0
- package/esm/shape/label/position/bottomLeft.js +2 -0
- package/esm/shape/label/position/bottomLeft.js.map +1 -0
- package/esm/shape/label/position/bottomRight.d.ts +1 -0
- package/esm/shape/label/position/bottomRight.js +2 -0
- package/esm/shape/label/position/bottomRight.js.map +1 -0
- package/esm/shape/label/position/default.d.ts +20 -0
- package/esm/shape/label/{position.js → position/default.js} +9 -45
- package/esm/shape/label/position/default.js.map +1 -0
- package/esm/shape/label/position/index.d.ts +13 -0
- package/esm/shape/label/position/index.js +14 -0
- package/esm/shape/label/position/index.js.map +1 -0
- package/esm/shape/label/position/inside.d.ts +1 -0
- package/esm/shape/label/position/inside.js +2 -0
- package/esm/shape/label/position/inside.js.map +1 -0
- package/esm/shape/label/position/left.d.ts +1 -0
- package/esm/shape/label/position/left.js +2 -0
- package/esm/shape/label/position/left.js.map +1 -0
- package/esm/shape/label/position/outside.d.ts +1 -0
- package/esm/shape/label/position/outside.js +2 -0
- package/esm/shape/label/position/outside.js.map +1 -0
- package/esm/shape/label/position/right.d.ts +1 -0
- package/esm/shape/label/position/right.js +2 -0
- package/esm/shape/label/position/right.js.map +1 -0
- package/esm/shape/label/position/spider.d.ts +7 -0
- package/esm/shape/label/position/spider.js +40 -0
- package/esm/shape/label/position/spider.js.map +1 -0
- package/esm/shape/label/position/surround.d.ts +7 -0
- package/esm/shape/label/position/surround.js +37 -0
- package/esm/shape/label/position/surround.js.map +1 -0
- package/esm/shape/label/position/top.d.ts +1 -0
- package/esm/shape/label/position/top.js +2 -0
- package/esm/shape/label/position/top.js.map +1 -0
- package/esm/shape/label/position/topLeft.d.ts +1 -0
- package/esm/shape/label/position/topLeft.js +2 -0
- package/esm/shape/label/position/topLeft.js.map +1 -0
- package/esm/shape/label/position/topRight.d.ts +1 -0
- package/esm/shape/label/position/topRight.js +2 -0
- package/esm/shape/label/position/topRight.js.map +1 -0
- package/esm/spec/composition.d.ts +2 -0
- package/esm/spec/geometry.d.ts +1 -1
- package/esm/spec/interaction.d.ts +21 -5
- package/esm/spec/labelTransform.d.ts +24 -11
- package/esm/spec/theme.d.ts +5 -2
- package/esm/stdlib/index.js +5 -6
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.d.ts +3 -0
- package/esm/theme/academy.js +402 -0
- package/esm/theme/academy.js.map +1 -0
- package/esm/theme/dark.js +3 -2
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/index.d.ts +1 -0
- package/esm/theme/index.js +1 -0
- package/esm/theme/index.js.map +1 -1
- package/esm/theme/light.js +4 -3
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/maybeTooltip.js +3 -1
- package/esm/transform/maybeTooltip.js.map +1 -1
- package/esm/utils/bounds.d.ts +26 -0
- package/esm/utils/bounds.js +41 -0
- package/esm/utils/bounds.js.map +1 -0
- package/esm/utils/color.d.ts +6 -0
- package/esm/utils/color.js +7 -0
- package/esm/utils/color.js.map +1 -0
- package/esm/utils/coordinate.d.ts +1 -0
- package/esm/utils/coordinate.js +12 -0
- package/esm/utils/coordinate.js.map +1 -1
- package/esm/utils/helper.d.ts +1 -0
- package/esm/utils/helper.js +3 -0
- package/esm/utils/helper.js.map +1 -1
- package/lib/api/mark/mark.js +0 -2
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +0 -2
- package/lib/component/axis.js +5 -4
- package/lib/component/axis.js.map +1 -1
- package/lib/component/slider.js +2 -4
- package/lib/component/slider.js.map +1 -1
- package/lib/composition/mark.js +2 -1
- package/lib/composition/mark.js.map +1 -1
- package/lib/interaction/builtin/brushHighlight.d.ts +1 -1
- package/lib/interaction/index.d.ts +3 -0
- package/lib/interaction/index.js +7 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/brushHighlight.d.ts +15 -0
- package/lib/interaction/native/brushHighlight.js +289 -0
- package/lib/interaction/native/brushHighlight.js.map +1 -0
- package/lib/interaction/native/brushXHighlight.d.ts +1 -0
- package/lib/interaction/native/brushXHighlight.js +12 -0
- package/lib/interaction/native/brushXHighlight.js.map +1 -0
- package/lib/interaction/native/brushYHighlight.d.ts +1 -0
- package/lib/interaction/native/brushYHighlight.js +12 -0
- package/lib/interaction/native/brushYHighlight.js.map +1 -0
- package/lib/interaction/native/legendFilter.js +4 -13
- package/lib/interaction/native/legendFilter.js.map +1 -1
- package/lib/interaction/native/tooltip.js +93 -25
- package/lib/interaction/native/tooltip.js.map +1 -1
- package/lib/interaction/native/utils.d.ts +4 -0
- package/lib/interaction/native/utils.js +28 -1
- package/lib/interaction/native/utils.js.map +1 -1
- package/lib/label-transform/contrastReverse.d.ts +9 -0
- package/lib/label-transform/contrastReverse.js +52 -0
- package/lib/label-transform/contrastReverse.js.map +1 -0
- package/lib/label-transform/index.d.ts +8 -8
- package/lib/label-transform/index.js +9 -9
- package/lib/label-transform/index.js.map +1 -1
- package/lib/label-transform/overflowHide.d.ts +7 -0
- package/lib/label-transform/overflowHide.js +22 -0
- package/lib/label-transform/overflowHide.js.map +1 -0
- package/lib/label-transform/overlapDodgeY.d.ts +7 -0
- package/lib/label-transform/{dodgeY.js → overlapDodgeY.js} +6 -6
- package/lib/label-transform/overlapDodgeY.js.map +1 -0
- package/lib/label-transform/overlapHide.d.ts +7 -0
- package/lib/label-transform/overlapHide.js +28 -0
- package/lib/label-transform/overlapHide.js.map +1 -0
- package/lib/runtime/plot.js +24 -6
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.js +16 -4
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +10 -4
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/common.d.ts +1 -0
- package/lib/runtime/types/options.d.ts +1 -0
- package/lib/shape/label/label.js +3 -3
- package/lib/shape/label/label.js.map +1 -1
- package/lib/shape/label/position/area.d.ts +13 -0
- package/lib/shape/label/position/area.js +32 -0
- package/lib/shape/label/position/area.js.map +1 -0
- package/lib/shape/label/position/bottom.d.ts +1 -0
- package/lib/shape/label/position/bottom.js +6 -0
- package/lib/shape/label/position/bottom.js.map +1 -0
- package/lib/shape/label/position/bottomLeft.d.ts +1 -0
- package/lib/shape/label/position/bottomLeft.js +6 -0
- package/lib/shape/label/position/bottomLeft.js.map +1 -0
- package/lib/shape/label/position/bottomRight.d.ts +1 -0
- package/lib/shape/label/position/bottomRight.js +6 -0
- package/lib/shape/label/position/bottomRight.js.map +1 -0
- package/lib/shape/label/position/default.d.ts +20 -0
- package/lib/shape/label/{position.js → position/default.js} +10 -43
- package/lib/shape/label/position/default.js.map +1 -0
- package/lib/shape/label/position/index.d.ts +13 -0
- package/lib/shape/label/position/index.js +30 -0
- package/lib/shape/label/position/index.js.map +1 -0
- package/lib/shape/label/position/inside.d.ts +1 -0
- package/lib/shape/label/position/inside.js +6 -0
- package/lib/shape/label/position/inside.js.map +1 -0
- package/lib/shape/label/position/left.d.ts +1 -0
- package/lib/shape/label/position/left.js +6 -0
- package/lib/shape/label/position/left.js.map +1 -0
- package/lib/shape/label/position/outside.d.ts +1 -0
- package/lib/shape/label/position/outside.js +6 -0
- package/lib/shape/label/position/outside.js.map +1 -0
- package/lib/shape/label/position/right.d.ts +1 -0
- package/lib/shape/label/position/right.js +6 -0
- package/lib/shape/label/position/right.js.map +1 -0
- package/lib/shape/label/position/spider.d.ts +7 -0
- package/lib/shape/label/position/spider.js +44 -0
- package/lib/shape/label/position/spider.js.map +1 -0
- package/lib/shape/label/position/surround.d.ts +7 -0
- package/lib/shape/label/position/surround.js +41 -0
- package/lib/shape/label/position/surround.js.map +1 -0
- package/lib/shape/label/position/top.d.ts +1 -0
- package/lib/shape/label/position/top.js +6 -0
- package/lib/shape/label/position/top.js.map +1 -0
- package/lib/shape/label/position/topLeft.d.ts +1 -0
- package/lib/shape/label/position/topLeft.js +6 -0
- package/lib/shape/label/position/topLeft.js.map +1 -0
- package/lib/shape/label/position/topRight.d.ts +1 -0
- package/lib/shape/label/position/topRight.js +6 -0
- package/lib/shape/label/position/topRight.js.map +1 -0
- package/lib/spec/composition.d.ts +2 -0
- package/lib/spec/geometry.d.ts +1 -1
- package/lib/spec/interaction.d.ts +21 -5
- package/lib/spec/labelTransform.d.ts +24 -11
- package/lib/spec/theme.d.ts +5 -2
- package/lib/stdlib/index.js +2 -3
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.d.ts +3 -0
- package/lib/theme/academy.js +406 -0
- package/lib/theme/academy.js.map +1 -0
- package/lib/theme/dark.js +3 -2
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +3 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/light.js +4 -3
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/maybeTooltip.js +3 -1
- package/lib/transform/maybeTooltip.js.map +1 -1
- package/lib/utils/bounds.d.ts +26 -0
- package/lib/utils/bounds.js +48 -0
- package/lib/utils/bounds.js.map +1 -0
- package/lib/utils/color.d.ts +6 -0
- package/lib/utils/color.js +11 -0
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/coordinate.d.ts +1 -0
- package/lib/utils/coordinate.js +14 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/lib/utils/helper.d.ts +1 -0
- package/lib/utils/helper.js +5 -1
- package/lib/utils/helper.js.map +1 -1
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/api/mark/mark.ts +0 -2
- package/src/api/mark/types.ts +0 -2
- package/src/component/axis.ts +16 -11
- package/src/component/slider.ts +1 -3
- package/src/composition/mark.ts +2 -0
- package/src/data/.DS_Store +0 -0
- package/src/interaction/index.ts +3 -0
- package/src/interaction/native/brushHighlight.ts +346 -0
- package/src/interaction/native/brushXHighlight.ts +11 -0
- package/src/interaction/native/brushYHighlight.ts +11 -0
- package/src/interaction/native/legendFilter.ts +3 -14
- package/src/interaction/native/tooltip.ts +119 -32
- package/src/interaction/native/utils.ts +31 -0
- package/src/label-transform/contrastReverse.ts +56 -0
- package/src/label-transform/index.ts +8 -8
- package/src/label-transform/overflowHide.ts +23 -0
- package/src/label-transform/{dodgeY.ts → overlapDodgeY.ts} +6 -6
- package/src/label-transform/overlapHide.ts +32 -0
- package/src/runtime/plot.ts +35 -6
- package/src/runtime/scale.ts +15 -7
- package/src/runtime/transform.ts +13 -4
- package/src/runtime/types/common.ts +1 -0
- package/src/runtime/types/options.ts +1 -0
- package/src/shape/.DS_Store +0 -0
- package/src/shape/label/label.ts +4 -3
- package/src/shape/label/position/area.ts +39 -0
- package/src/shape/label/position/bottom.ts +1 -0
- package/src/shape/label/position/bottomLeft.ts +1 -0
- package/src/shape/label/position/bottomRight.ts +1 -0
- package/src/shape/label/{position.ts → position/default.ts} +12 -56
- package/src/shape/label/position/index.ts +13 -0
- package/src/shape/label/position/inside.ts +1 -0
- package/src/shape/label/position/left.ts +1 -0
- package/src/shape/label/position/outside.ts +1 -0
- package/src/shape/label/position/right.ts +1 -0
- package/src/shape/label/position/spider.ts +46 -0
- package/src/shape/label/position/surround.ts +42 -0
- package/src/shape/label/position/top.ts +1 -0
- package/src/shape/label/position/topLeft.ts +1 -0
- package/src/shape/label/position/topRight.ts +1 -0
- package/src/spec/composition.ts +2 -0
- package/src/spec/geometry.ts +2 -1
- package/src/spec/interaction.ts +28 -4
- package/src/spec/labelTransform.ts +29 -11
- package/src/spec/theme.ts +6 -2
- package/src/stdlib/index.ts +19 -7
- package/src/theme/academy.ts +408 -0
- package/src/theme/dark.ts +3 -2
- package/src/theme/index.ts +1 -0
- package/src/theme/light.ts +4 -3
- package/src/transform/maybeTooltip.ts +3 -1
- package/src/utils/bounds.ts +52 -0
- package/src/utils/color.ts +12 -0
- package/src/utils/coordinate.ts +12 -0
- package/src/utils/helper.ts +4 -0
- package/esm/label-transform/dodgeY.d.ts +0 -7
- package/esm/label-transform/dodgeY.js.map +0 -1
- package/esm/label-transform/hideOverlap.d.ts +0 -4
- package/esm/label-transform/hideOverlap.js +0 -48
- package/esm/label-transform/hideOverlap.js.map +0 -1
- package/esm/label-transform/spider.d.ts +0 -7
- package/esm/label-transform/spider.js +0 -30
- package/esm/label-transform/spider.js.map +0 -1
- package/esm/label-transform/surround.d.ts +0 -7
- package/esm/label-transform/surround.js +0 -30
- package/esm/label-transform/surround.js.map +0 -1
- package/esm/shape/label/position.d.ts +0 -25
- package/esm/shape/label/position.js.map +0 -1
- package/lib/label-transform/dodgeY.d.ts +0 -7
- package/lib/label-transform/dodgeY.js.map +0 -1
- package/lib/label-transform/hideOverlap.d.ts +0 -4
- package/lib/label-transform/hideOverlap.js +0 -52
- package/lib/label-transform/hideOverlap.js.map +0 -1
- package/lib/label-transform/spider.d.ts +0 -7
- package/lib/label-transform/spider.js +0 -34
- package/lib/label-transform/spider.js.map +0 -1
- package/lib/label-transform/surround.d.ts +0 -7
- package/lib/label-transform/surround.js +0 -34
- package/lib/label-transform/surround.js.map +0 -1
- package/lib/shape/label/position.d.ts +0 -25
- package/lib/shape/label/position.js.map +0 -1
- package/src/label-transform/hideOverlap.ts +0 -62
- package/src/label-transform/spider.ts +0 -37
- package/src/label-transform/surround.ts +0 -37
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { ThemeComponent as TC, Theme } from '../runtime';
|
|
2
|
+
|
|
3
|
+
export type AcademyOptions = Theme;
|
|
4
|
+
|
|
5
|
+
const COLORS = {
|
|
6
|
+
BLACK: '#000',
|
|
7
|
+
WHITE: '#fff',
|
|
8
|
+
STROKE: '#888',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const BACKGROUND_COLOR = 'transparent';
|
|
12
|
+
|
|
13
|
+
export const Academy: TC<AcademyOptions> = (options) => {
|
|
14
|
+
const DEFAULT_COLOR = '#4e79a7';
|
|
15
|
+
const defaultOptions: Theme = {
|
|
16
|
+
defaultColor: DEFAULT_COLOR,
|
|
17
|
+
defaultCategory10: 'tableau10',
|
|
18
|
+
defaultCategory20: 'tableau10',
|
|
19
|
+
defaultSize: 1,
|
|
20
|
+
elementActiveStroke: COLORS.BLACK,
|
|
21
|
+
enter: {
|
|
22
|
+
duration: 300,
|
|
23
|
+
fill: 'both',
|
|
24
|
+
delay: 0,
|
|
25
|
+
},
|
|
26
|
+
update: {
|
|
27
|
+
duration: 300,
|
|
28
|
+
fill: 'both',
|
|
29
|
+
delay: 0,
|
|
30
|
+
},
|
|
31
|
+
exit: {
|
|
32
|
+
duration: 300,
|
|
33
|
+
fill: 'both',
|
|
34
|
+
delay: 0,
|
|
35
|
+
},
|
|
36
|
+
// --- Theme of area style
|
|
37
|
+
viewFill: BACKGROUND_COLOR,
|
|
38
|
+
plotFill: 'transparent',
|
|
39
|
+
mainFill: 'transparent',
|
|
40
|
+
contentFill: 'transparent',
|
|
41
|
+
// --- Theme of mark shape
|
|
42
|
+
line: {
|
|
43
|
+
line: {
|
|
44
|
+
fill: '',
|
|
45
|
+
strokeOpacity: 1,
|
|
46
|
+
lineWidth: 1,
|
|
47
|
+
connectStroke: '#aaa',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
point: {
|
|
51
|
+
point: {
|
|
52
|
+
r: 3,
|
|
53
|
+
fillOpacity: 0.95,
|
|
54
|
+
lineWidth: 0,
|
|
55
|
+
},
|
|
56
|
+
hollow: {
|
|
57
|
+
r: 3,
|
|
58
|
+
fill: '',
|
|
59
|
+
strokeOpacity: 0.95,
|
|
60
|
+
lineWidth: 1,
|
|
61
|
+
},
|
|
62
|
+
plus: {
|
|
63
|
+
r: 3,
|
|
64
|
+
fill: '',
|
|
65
|
+
strokeOpacity: 0.95,
|
|
66
|
+
lineWidth: 3,
|
|
67
|
+
},
|
|
68
|
+
diamond: {
|
|
69
|
+
r: 3,
|
|
70
|
+
fill: '',
|
|
71
|
+
strokeOpacity: 0.95,
|
|
72
|
+
lineWidth: 1,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
interval: {
|
|
76
|
+
rect: {
|
|
77
|
+
fillOpacity: 0.95,
|
|
78
|
+
},
|
|
79
|
+
hollow: {
|
|
80
|
+
fill: '',
|
|
81
|
+
strokeOpacity: 1,
|
|
82
|
+
lineWidth: 2,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
area: {
|
|
86
|
+
area: {
|
|
87
|
+
fillOpacity: 0.85,
|
|
88
|
+
lineWidth: 0,
|
|
89
|
+
connectFill: COLORS.BLACK,
|
|
90
|
+
connectFillOpacity: 0.1,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
polygon: {
|
|
94
|
+
polygon: {
|
|
95
|
+
fillOpacity: 0.95,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
cell: {
|
|
99
|
+
cell: {
|
|
100
|
+
fillOpacity: 0.95,
|
|
101
|
+
},
|
|
102
|
+
hollow: {
|
|
103
|
+
fill: '',
|
|
104
|
+
strokeOpacity: 1,
|
|
105
|
+
lineWidth: 2,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
rect: {
|
|
109
|
+
rect: {
|
|
110
|
+
fillOpacity: 0.95,
|
|
111
|
+
},
|
|
112
|
+
hollow: {
|
|
113
|
+
fill: '',
|
|
114
|
+
strokeOpacity: 1,
|
|
115
|
+
lineWidth: 2,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
link: {
|
|
119
|
+
link: {
|
|
120
|
+
fill: '',
|
|
121
|
+
strokeOpacity: 1,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
vector: {
|
|
125
|
+
vector: {
|
|
126
|
+
fillOpacity: 1,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
box: {
|
|
130
|
+
box: {
|
|
131
|
+
fillOpacity: 0.95,
|
|
132
|
+
stroke: '#1D2129',
|
|
133
|
+
lineWidth: 1,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
text: {
|
|
137
|
+
text: {
|
|
138
|
+
fill: '#1D2129',
|
|
139
|
+
fontSize: 10,
|
|
140
|
+
strokeWidth: 0,
|
|
141
|
+
connectorStroke: COLORS.STROKE,
|
|
142
|
+
connectorStrokeOpacity: 0.45,
|
|
143
|
+
connectorLineWidth: 1,
|
|
144
|
+
backgroundFill: COLORS.STROKE,
|
|
145
|
+
backgroundFillOpacity: 0.15,
|
|
146
|
+
backgroundPadding: [2, 4],
|
|
147
|
+
startMarkerSymbol: 'circle',
|
|
148
|
+
startMarkerSize: 4,
|
|
149
|
+
endMarkerSymbol: 'circle',
|
|
150
|
+
endMarkerSize: 4,
|
|
151
|
+
},
|
|
152
|
+
badge: {
|
|
153
|
+
fill: '#1D2129',
|
|
154
|
+
fillOpacity: 0.65,
|
|
155
|
+
strokeWidth: 0,
|
|
156
|
+
fontSize: 10,
|
|
157
|
+
textAlign: 'center',
|
|
158
|
+
textBaseline: 'middle',
|
|
159
|
+
markerFill: COLORS.STROKE,
|
|
160
|
+
markerFillOpacity: 0.25,
|
|
161
|
+
markerStrokeOpacity: 0,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
lineX: {
|
|
165
|
+
line: {
|
|
166
|
+
stroke: COLORS.STROKE,
|
|
167
|
+
strokeOpacity: 0.45,
|
|
168
|
+
lineWidth: 1,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
lineY: {
|
|
172
|
+
line: {
|
|
173
|
+
stroke: COLORS.STROKE,
|
|
174
|
+
strokeOpacity: 0.45,
|
|
175
|
+
lineWidth: 1,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
rangeX: {
|
|
179
|
+
range: {
|
|
180
|
+
fill: COLORS.STROKE,
|
|
181
|
+
fillOpacity: 0.15,
|
|
182
|
+
lineWidth: 0,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
rangeY: {
|
|
186
|
+
range: {
|
|
187
|
+
fill: COLORS.STROKE,
|
|
188
|
+
fillOpacity: 0.15,
|
|
189
|
+
lineWidth: 0,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
connector: {
|
|
193
|
+
connector: {
|
|
194
|
+
stroke: COLORS.STROKE,
|
|
195
|
+
strokeOpacity: 0.45,
|
|
196
|
+
lineWidth: 1,
|
|
197
|
+
connectLength1: 12,
|
|
198
|
+
endMarker: true,
|
|
199
|
+
endMarkerSize: 6,
|
|
200
|
+
endMarkerFill: COLORS.STROKE,
|
|
201
|
+
endMarkerFillOpacity: 0.95,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
interaction: {
|
|
205
|
+
active: {
|
|
206
|
+
line: {
|
|
207
|
+
line: { lineWidth: 3 },
|
|
208
|
+
},
|
|
209
|
+
interval: {
|
|
210
|
+
rect: { stroke: COLORS.BLACK },
|
|
211
|
+
},
|
|
212
|
+
area: {
|
|
213
|
+
area: { fillOpacity: 0.5 },
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
inactive: {
|
|
217
|
+
area: {
|
|
218
|
+
area: { fillOpacity: 0.3 },
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
selected: {},
|
|
222
|
+
disabled: {},
|
|
223
|
+
},
|
|
224
|
+
axis: {
|
|
225
|
+
titleFill: COLORS.BLACK,
|
|
226
|
+
titleFillOpacity: 1,
|
|
227
|
+
titleFontSize: 11,
|
|
228
|
+
titleFontWeight: 'bold',
|
|
229
|
+
titleSpacing: 12,
|
|
230
|
+
line: true,
|
|
231
|
+
lineStroke: '#888',
|
|
232
|
+
lineStrokeOpacity: 1,
|
|
233
|
+
lineLineWidth: 1,
|
|
234
|
+
lineArrow: null,
|
|
235
|
+
tickStroke: COLORS.STROKE,
|
|
236
|
+
tickStrokeOpacity: 1,
|
|
237
|
+
tickLineWidth: 1,
|
|
238
|
+
tickLength: 5,
|
|
239
|
+
labelFill: COLORS.BLACK,
|
|
240
|
+
labelFillOpacity: 1,
|
|
241
|
+
labelFontSize: 10,
|
|
242
|
+
labelAutoRotate: false,
|
|
243
|
+
labelFontWeight: 'normal',
|
|
244
|
+
labelSpacing: 4,
|
|
245
|
+
labelAlign: 'horizontal',
|
|
246
|
+
gridStroke: '#ddd',
|
|
247
|
+
gridStrokeOpacity: 1,
|
|
248
|
+
gridLineWidth: 1,
|
|
249
|
+
gridLineDash: [0, 0],
|
|
250
|
+
titleTransformOrigin: 'center',
|
|
251
|
+
},
|
|
252
|
+
axisTop: {
|
|
253
|
+
titlePosition: 'top',
|
|
254
|
+
titleSpacing: 0,
|
|
255
|
+
titleTextBaseline: 'middle',
|
|
256
|
+
labelDirection: 'negative',
|
|
257
|
+
tickDirection: 'negative',
|
|
258
|
+
gridDirection: 'positive',
|
|
259
|
+
},
|
|
260
|
+
axisBottom: {
|
|
261
|
+
titleSpacing: 4,
|
|
262
|
+
titleTextBaseline: 'bottom',
|
|
263
|
+
labelSpacing: 8,
|
|
264
|
+
labelDirection: 'positive',
|
|
265
|
+
tickDirection: 'positive',
|
|
266
|
+
gridDirection: 'negative',
|
|
267
|
+
},
|
|
268
|
+
axisLeft: {
|
|
269
|
+
titleTextBaseline: 'middle',
|
|
270
|
+
titleSpacing: 4,
|
|
271
|
+
titlePosition: 'left',
|
|
272
|
+
titleTransformOrigin: 'center',
|
|
273
|
+
titleTransform: `translate(50%, 0) rotate(-90) translate(0, -50%)`,
|
|
274
|
+
labelSpacing: 4,
|
|
275
|
+
labelDirection: 'positive',
|
|
276
|
+
tickDirection: 'positive',
|
|
277
|
+
gridDirection: 'negative',
|
|
278
|
+
},
|
|
279
|
+
axisRight: {
|
|
280
|
+
titleTextBaseline: 'top',
|
|
281
|
+
titleSpacing: 0,
|
|
282
|
+
titlePosition: 'right',
|
|
283
|
+
titleTransformOrigin: 'center',
|
|
284
|
+
titleTransform: `translate(-50%, 0) rotate(-90)`,
|
|
285
|
+
labelSpacing: 4,
|
|
286
|
+
labelDirection: 'negative',
|
|
287
|
+
tickDirection: 'negative',
|
|
288
|
+
gridDirection: 'positive',
|
|
289
|
+
},
|
|
290
|
+
axisArcY: {
|
|
291
|
+
titlePosition: 'top',
|
|
292
|
+
titleSpacing: 0,
|
|
293
|
+
titleTextBaseline: 'bottom',
|
|
294
|
+
gridDirection: 'negative',
|
|
295
|
+
gridConnect: 'arc',
|
|
296
|
+
gridControlAngles: [90, 180, 360],
|
|
297
|
+
gridType: 'surround',
|
|
298
|
+
girdClosed: true,
|
|
299
|
+
},
|
|
300
|
+
legend: {
|
|
301
|
+
padding: 8,
|
|
302
|
+
showTitle: false,
|
|
303
|
+
titleFill: COLORS.BLACK,
|
|
304
|
+
titleFillOpacity: 1,
|
|
305
|
+
titleFontSize: 11,
|
|
306
|
+
titleFontWeight: 'bold',
|
|
307
|
+
titleSpacing: 4,
|
|
308
|
+
// legend marker
|
|
309
|
+
itemMarkerFill: DEFAULT_COLOR,
|
|
310
|
+
itemMarkerFillOpacity: 1,
|
|
311
|
+
itemMarkerSize: 8,
|
|
312
|
+
itemSpacing: [5, 4],
|
|
313
|
+
itemLabelFill: COLORS.BLACK,
|
|
314
|
+
itemLabelFillOpacity: 1,
|
|
315
|
+
itemLabelFontSize: 10,
|
|
316
|
+
itemLabelFontWeight: 'normal',
|
|
317
|
+
itemValueFill: COLORS.BLACK,
|
|
318
|
+
itemValueFillOpacity: 1,
|
|
319
|
+
itemValueFontSize: 10,
|
|
320
|
+
itemValueFontWeight: 'normal',
|
|
321
|
+
itemBackgroundFill: 'transparent',
|
|
322
|
+
// [todo] rename legend navigator
|
|
323
|
+
navButtonFill: COLORS.BLACK,
|
|
324
|
+
navButtonFillOpacity: 0.45,
|
|
325
|
+
navButtonSize: 6,
|
|
326
|
+
navPageNumFill: COLORS.BLACK,
|
|
327
|
+
navPageNumFillOpacity: 0.45,
|
|
328
|
+
navPageNumFontSize: 10,
|
|
329
|
+
// others
|
|
330
|
+
backgroundFill: 'transparent',
|
|
331
|
+
},
|
|
332
|
+
continuousLegend: {
|
|
333
|
+
showTitle: false,
|
|
334
|
+
labelFill: COLORS.BLACK,
|
|
335
|
+
labelFillOpacity: 0.45,
|
|
336
|
+
labelFontSize: 10,
|
|
337
|
+
labelFontWeight: 'normal',
|
|
338
|
+
handleWidth: 10,
|
|
339
|
+
handleHeight: 12,
|
|
340
|
+
handleMarkerFill: COLORS.BLACK,
|
|
341
|
+
handleMarkerFillOpacity: 0.6,
|
|
342
|
+
handleMarkerStroke: COLORS.BLACK,
|
|
343
|
+
handleMarkerStrokeOpacity: 0.25,
|
|
344
|
+
handleMarkerLineWidth: 1,
|
|
345
|
+
handleLabelFill: COLORS.BLACK,
|
|
346
|
+
handleLabelFillOpacity: 0.45,
|
|
347
|
+
handleLabelFontSize: 10,
|
|
348
|
+
handleLabelFontWeight: 'normal',
|
|
349
|
+
},
|
|
350
|
+
label: {
|
|
351
|
+
fill: COLORS.BLACK,
|
|
352
|
+
fillOpacity: 0.65,
|
|
353
|
+
fontSize: 10,
|
|
354
|
+
fontWeight: 'normal',
|
|
355
|
+
stroke: null,
|
|
356
|
+
offset: 12,
|
|
357
|
+
connectorStroke: COLORS.BLACK,
|
|
358
|
+
connectorStrokeOpacity: 0.45,
|
|
359
|
+
connectorLineWidth: 1,
|
|
360
|
+
connectorLength2: 8,
|
|
361
|
+
connectorDistance: 4,
|
|
362
|
+
},
|
|
363
|
+
innerLabel: {
|
|
364
|
+
fill: COLORS.WHITE,
|
|
365
|
+
fontSize: 10,
|
|
366
|
+
fillOpacity: 0.85,
|
|
367
|
+
fontWeight: 'normal',
|
|
368
|
+
stroke: null,
|
|
369
|
+
offset: 0,
|
|
370
|
+
},
|
|
371
|
+
slider: {
|
|
372
|
+
trackSize: 16,
|
|
373
|
+
backgroundFill: COLORS.STROKE,
|
|
374
|
+
backgroundFillOpacity: 0.05,
|
|
375
|
+
selectionFill: DEFAULT_COLOR,
|
|
376
|
+
selectionFillOpacity: 0.15,
|
|
377
|
+
handleIconSize: 10,
|
|
378
|
+
handleIconFill: '#f7f7f7',
|
|
379
|
+
handleIconFillOpacity: 1,
|
|
380
|
+
handleIconStroke: COLORS.BLACK,
|
|
381
|
+
handleIconStrokeOpacity: 0.25,
|
|
382
|
+
handleIconLineWidth: 1,
|
|
383
|
+
handleIconRadius: 2,
|
|
384
|
+
handleLabelFill: COLORS.BLACK,
|
|
385
|
+
handleLabelFillOpacity: 0.45,
|
|
386
|
+
handleLabelFontSize: 10,
|
|
387
|
+
handleLabelFontWeight: 'normal',
|
|
388
|
+
},
|
|
389
|
+
scrollbar: {},
|
|
390
|
+
title: {
|
|
391
|
+
fill: COLORS.BLACK,
|
|
392
|
+
fillOpacity: 0.85,
|
|
393
|
+
fontSize: 24,
|
|
394
|
+
fontWeight: 'bold',
|
|
395
|
+
textBaseline: 'top',
|
|
396
|
+
},
|
|
397
|
+
subtitle: {
|
|
398
|
+
fill: COLORS.BLACK,
|
|
399
|
+
fillOpacity: 0.65,
|
|
400
|
+
fontSize: 10,
|
|
401
|
+
fontWeight: 'normal',
|
|
402
|
+
textBaseline: 'top',
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
return Object.assign({}, defaultOptions, options);
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
Academy.props = {};
|
package/src/theme/dark.ts
CHANGED
|
@@ -132,7 +132,7 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
132
132
|
box: {
|
|
133
133
|
box: {
|
|
134
134
|
fillOpacity: 0.95,
|
|
135
|
-
stroke:
|
|
135
|
+
stroke: COLORS.BLACK,
|
|
136
136
|
lineWidth: 1,
|
|
137
137
|
},
|
|
138
138
|
},
|
|
@@ -281,6 +281,7 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
281
281
|
titleTransform: `translate(50%, 0) rotate(-90)`,
|
|
282
282
|
labelSpacing: 4,
|
|
283
283
|
labelDirection: 'positive',
|
|
284
|
+
labelAutoRotate: false,
|
|
284
285
|
tickDirection: 'positive',
|
|
285
286
|
gridDirection: 'negative',
|
|
286
287
|
},
|
|
@@ -375,7 +376,7 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
375
376
|
offset: 0,
|
|
376
377
|
},
|
|
377
378
|
slider: {
|
|
378
|
-
|
|
379
|
+
trackSize: 16,
|
|
379
380
|
backgroundFill: COLORS.STROKE,
|
|
380
381
|
backgroundFillOpacity: 1,
|
|
381
382
|
selectionFill: DEFAULT_COLOR,
|
package/src/theme/index.ts
CHANGED
package/src/theme/light.ts
CHANGED
|
@@ -132,7 +132,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
132
132
|
box: {
|
|
133
133
|
box: {
|
|
134
134
|
fillOpacity: 0.95,
|
|
135
|
-
stroke:
|
|
135
|
+
stroke: COLORS.BLACK,
|
|
136
136
|
lineWidth: 1,
|
|
137
137
|
},
|
|
138
138
|
},
|
|
@@ -281,6 +281,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
281
281
|
titleTransform: `translate(50%, 0) rotate(-90)`,
|
|
282
282
|
labelSpacing: 4,
|
|
283
283
|
labelDirection: 'positive',
|
|
284
|
+
labelAutoRotate: false,
|
|
284
285
|
tickDirection: 'positive',
|
|
285
286
|
gridDirection: 'negative',
|
|
286
287
|
},
|
|
@@ -329,7 +330,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
329
330
|
itemBackgroundFill: 'transparent',
|
|
330
331
|
// [todo] rename legend navigator
|
|
331
332
|
navButtonFill: COLORS.BLACK,
|
|
332
|
-
navButtonFillOpacity: 0.
|
|
333
|
+
navButtonFillOpacity: 0.65,
|
|
333
334
|
navPageNumFill: COLORS.BLACK,
|
|
334
335
|
navPageNumFillOpacity: 0.45,
|
|
335
336
|
navPageNumFontSize: 12,
|
|
@@ -376,7 +377,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
376
377
|
offset: 0,
|
|
377
378
|
},
|
|
378
379
|
slider: {
|
|
379
|
-
|
|
380
|
+
trackSize: 16,
|
|
380
381
|
backgroundFill: COLORS.STROKE,
|
|
381
382
|
backgroundFillOpacity: 1,
|
|
382
383
|
selectionFill: DEFAULT_COLOR,
|
|
@@ -25,7 +25,9 @@ export const MaybeTooltip: TC<MaybeTooltipOptions> = (options) => {
|
|
|
25
25
|
const E = [[key, column(V)]];
|
|
26
26
|
// Only show channel with field.
|
|
27
27
|
if (V && fv !== null) {
|
|
28
|
-
|
|
28
|
+
const T = V.map((v) => ({ value: v, field: fv }));
|
|
29
|
+
//@ts-ignore
|
|
30
|
+
E.push([`tooltip${index === 0 ? '' : index}`, column(T, fv)]);
|
|
29
31
|
index++;
|
|
30
32
|
}
|
|
31
33
|
return E;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AABB } from '@antv/g';
|
|
2
|
+
import { Vector2 } from './vector';
|
|
3
|
+
|
|
4
|
+
type Min = Vector2;
|
|
5
|
+
type Max = Vector2;
|
|
6
|
+
export type Bounds = [Min, Max];
|
|
7
|
+
|
|
8
|
+
export function parseAABB(min2: AABB): Bounds {
|
|
9
|
+
const { min, max } = min2;
|
|
10
|
+
return [
|
|
11
|
+
[min[0], min[1]],
|
|
12
|
+
[max[0], max[1]],
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether the `point` in `bounds`.
|
|
18
|
+
* @param point
|
|
19
|
+
* @param bounds
|
|
20
|
+
*/
|
|
21
|
+
export function isInBounds(point: Vector2, bounds: Bounds): boolean {
|
|
22
|
+
const [x, y] = point;
|
|
23
|
+
const [min, max] = bounds;
|
|
24
|
+
return x >= min[0] && x <= max[0] && y >= min[1] && y <= max[1];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether `b1` is overflow from `b2`.
|
|
29
|
+
* @param b1
|
|
30
|
+
* @param b2
|
|
31
|
+
*/
|
|
32
|
+
export function isOverflow(b1: Bounds, b2: Bounds): boolean {
|
|
33
|
+
const [min, max] = b1;
|
|
34
|
+
return !(isInBounds(min, b2) && isInBounds(max, b2));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether `b1` is overlap with `b2`.
|
|
39
|
+
* @param b1
|
|
40
|
+
* @param b2
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export function isOverlap(b1: Bounds, b2: Bounds): boolean {
|
|
44
|
+
const [min1, max1] = b1;
|
|
45
|
+
const [min2, max2] = b2;
|
|
46
|
+
return (
|
|
47
|
+
min1[0] < max2[0] &&
|
|
48
|
+
max1[0] > min2[0] &&
|
|
49
|
+
min1[1] < max2[1] &&
|
|
50
|
+
max1[1] > min2[1]
|
|
51
|
+
);
|
|
52
|
+
}
|
package/src/utils/coordinate.ts
CHANGED
|
@@ -44,3 +44,15 @@ export function isCircular(coordinate: Coordinate): boolean {
|
|
|
44
44
|
export function isTheta(coordinate: Coordinate): boolean {
|
|
45
45
|
return isPolar(coordinate) && isTranspose(coordinate);
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
export function getRadius(coordinate: Coordinate): number {
|
|
49
|
+
if (isCircular(coordinate)) {
|
|
50
|
+
const [width, height] = coordinate.getSize();
|
|
51
|
+
const polar = coordinate
|
|
52
|
+
.getOptions()
|
|
53
|
+
.transformations.find((t) => t[0] === 'polar');
|
|
54
|
+
// coordinate.size * outerRadius.
|
|
55
|
+
if (polar) return (Math.max(width, height) / 2) * polar[4];
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
package/src/utils/helper.ts
CHANGED
|
@@ -99,3 +99,7 @@ export function maybePercentage(x: number | string, size: number) {
|
|
|
99
99
|
const px = +x.replace('%', '');
|
|
100
100
|
return Number.isNaN(px) ? null : (px / 100) * size;
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
export function isStrictObject(d: any): boolean {
|
|
104
|
+
return typeof d === 'object' && !(d instanceof Date) && d !== null;
|
|
105
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DodgeYLabelTransform } from 'spec';
|
|
2
|
-
import { LabelTransformComponent as LLC } from '../runtime';
|
|
3
|
-
export type DodgeYOptions = Omit<DodgeYLabelTransform, 'type'>;
|
|
4
|
-
/**
|
|
5
|
-
* An iterative dodge method avoids label overlap. (n * log(n))
|
|
6
|
-
*/
|
|
7
|
-
export declare const DodgeY: LLC<DodgeYOptions>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dodgeY.js","sourceRoot":"src/","sources":["label-transform/dodgeY.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,MAAM;IACb,MAAM,GAAG,GAAG,IAAI,GAAG,EAAQ,CAAC;IAC5B,MAAM,GAAG,GAAG,CAAC,GAAM,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,CAAC,GAAM,EAAE,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AC,CAAC;oBACjB,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;oBACjB,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;oBAC7B,IAAI,KAAK,GAAG,OAAO,EAAE;wBACnB,MAAM,QAAQ,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;wBACvC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;wBAClC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;wBACxB,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;qBACzB;iBACF;aACF;YACD,IAAI,KAAK,GAAG,QAAQ;gBAAE,MAAM;SAC7B;QAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;SACvC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { isPolygonsIntersect } from '@antv/path-util';
|
|
2
|
-
import { ascending } from 'd3-array';
|
|
3
|
-
function getPoints(element) {
|
|
4
|
-
const { min, max } = element.getRenderBounds();
|
|
5
|
-
const [x0, y0] = min;
|
|
6
|
-
const [x1, y1] = max;
|
|
7
|
-
return [
|
|
8
|
-
[x0, y0],
|
|
9
|
-
[x0, y1],
|
|
10
|
-
[x1, y1],
|
|
11
|
-
[x1, y0],
|
|
12
|
-
];
|
|
13
|
-
}
|
|
14
|
-
function priority(shape) {
|
|
15
|
-
return shape.style.priority || 0;
|
|
16
|
-
}
|
|
17
|
-
function show(shape) {
|
|
18
|
-
shape.style.visibility = 'visible';
|
|
19
|
-
}
|
|
20
|
-
function hide(shape) {
|
|
21
|
-
shape.style.visibility = 'hidden';
|
|
22
|
-
}
|
|
23
|
-
// @todo Support label shape with priority attribute.
|
|
24
|
-
export const HideOverlap = () => {
|
|
25
|
-
return (labels, coordinate) => {
|
|
26
|
-
const displayLabels = [];
|
|
27
|
-
// Label with lower priority will be hidden when overlapped.
|
|
28
|
-
labels.sort((a, b) => ascending(priority(a), priority(b)));
|
|
29
|
-
for (let i = 0; i < labels.length; i++) {
|
|
30
|
-
const label = labels[i];
|
|
31
|
-
show(label);
|
|
32
|
-
let overlapping = false;
|
|
33
|
-
for (let j = 0; j < displayLabels.length; j++) {
|
|
34
|
-
const existedLabel = displayLabels[j];
|
|
35
|
-
if (isPolygonsIntersect(getPoints(label), getPoints(existedLabel))) {
|
|
36
|
-
hide(label);
|
|
37
|
-
overlapping = true;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (!overlapping) {
|
|
42
|
-
displayLabels.push(label);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return labels;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=hideOverlap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hideOverlap.js","sourceRoot":"src/","sources":["label-transform/hideOverlap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,SAAS,SAAS,CAAC,OAAsB;IACvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAC/C,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACrB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACrB,OAAO;QACL,CAAC,EAAE,EAAE,EAAE,CAAC;QACR,CAAC,EAAE,EAAE,EAAE,CAAC;QACR,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,GAAG,IAAI,CAAC;oBACnB,MAAM;iBACP;aACF;YAED,IAAI,CAAC,WAAW,EAAE;gBAChB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SpiderLabelTransform } from '../spec';
|
|
2
|
-
import { LabelTransformComponent as LLC } from '../runtime';
|
|
3
|
-
export type SpiderOptions = Omit<SpiderLabelTransform, 'type'>;
|
|
4
|
-
/**
|
|
5
|
-
* Spider label transform only suitable for the labels in polar coordinate, labels should distinguish coordinate type.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Spider: LLC<SpiderOptions>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { isCircular } from '../utils/coordinate';
|
|
2
|
-
import { maybePercentage } from '../utils/helper';
|
|
3
|
-
import { sub } from '../utils/vector';
|
|
4
|
-
/**
|
|
5
|
-
* Spider label transform only suitable for the labels in polar coordinate, labels should distinguish coordinate type.
|
|
6
|
-
*/
|
|
7
|
-
export const Spider = (options) => {
|
|
8
|
-
const { edgeDistance = 0 } = options;
|
|
9
|
-
return (labels, coordinate) => {
|
|
10
|
-
if (!isCircular(coordinate))
|
|
11
|
-
return labels;
|
|
12
|
-
const { x: coordX, width } = coordinate.getOptions();
|
|
13
|
-
const center = coordinate.getCenter();
|
|
14
|
-
const margin = maybePercentage(edgeDistance, width);
|
|
15
|
-
const edgeX = coordX + margin;
|
|
16
|
-
const edgeX1 = coordX + width - margin;
|
|
17
|
-
labels.forEach((label) => {
|
|
18
|
-
const { x: originX, x0, y0 } = label.style;
|
|
19
|
-
const dx = originX <= center[0] ? edgeX - originX : edgeX1 - originX;
|
|
20
|
-
label.style.x += dx;
|
|
21
|
-
const { x, y } = label.style;
|
|
22
|
-
const p0 = sub([x0, y0], center);
|
|
23
|
-
const p1 = sub([0, y], center);
|
|
24
|
-
const p1x = p0[1] ? (p0[0] * p1[1]) / p0[1] + center[0] : x;
|
|
25
|
-
label.style.connectorPoints = [[p1x - x, 0]];
|
|
26
|
-
});
|
|
27
|
-
return labels;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=spider.js.map
|