@visactor/vrender-components 0.18.10-alpha.1 → 0.18.10-alpha.2
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -2
- package/cjs/label/base.d.ts +2 -2
- package/cjs/marker/base-line.d.ts +2 -2
- package/cjs/marker/base-line.js +4 -18
- package/cjs/marker/base-line.js.map +1 -1
- package/cjs/marker/cartesian/area.d.ts +6 -1
- package/cjs/marker/cartesian/area.js +9 -10
- package/cjs/marker/cartesian/area.js.map +1 -1
- package/cjs/marker/cartesian/line.d.ts +14 -1
- package/cjs/marker/cartesian/line.js +98 -2
- package/cjs/marker/cartesian/line.js.map +1 -1
- package/cjs/marker/config.d.ts +52 -9
- package/cjs/marker/config.js +51 -40
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/polar/arc-line.d.ts +13 -2
- package/cjs/marker/polar/arc-line.js +57 -4
- package/cjs/marker/polar/arc-line.js.map +1 -1
- package/cjs/marker/polar/area.d.ts +10 -4
- package/cjs/marker/polar/area.js +39 -33
- package/cjs/marker/polar/area.js.map +1 -1
- package/cjs/marker/type.d.ts +15 -13
- package/cjs/marker/type.js +15 -14
- package/cjs/marker/type.js.map +1 -1
- package/cjs/tag/tag.d.ts +5 -0
- package/cjs/tag/tag.js +11 -2
- package/cjs/tag/tag.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +2 -2
- package/es/label/base.d.ts +2 -2
- package/es/marker/base-line.d.ts +2 -2
- package/es/marker/base-line.js +2 -20
- package/es/marker/base-line.js.map +1 -1
- package/es/marker/cartesian/area.d.ts +6 -1
- package/es/marker/cartesian/area.js +10 -11
- package/es/marker/cartesian/area.js.map +1 -1
- package/es/marker/cartesian/line.d.ts +14 -1
- package/es/marker/cartesian/line.js +100 -2
- package/es/marker/cartesian/line.js.map +1 -1
- package/es/marker/config.d.ts +52 -9
- package/es/marker/config.js +51 -40
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/polar/arc-line.d.ts +13 -2
- package/es/marker/polar/arc-line.js +60 -5
- package/es/marker/polar/arc-line.js.map +1 -1
- package/es/marker/polar/area.d.ts +10 -4
- package/es/marker/polar/area.js +44 -38
- package/es/marker/polar/area.js.map +1 -1
- package/es/marker/type.d.ts +15 -13
- package/es/marker/type.js +15 -14
- package/es/marker/type.js.map +1 -1
- package/es/tag/tag.d.ts +5 -0
- package/es/tag/tag.js +11 -2
- package/es/tag/tag.js.map +1 -1
- package/package.json +5 -5
package/cjs/marker/config.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.DEFAULT_MARK_POINT_TEXT_STYLE_MAP = exports.DEFAULT_MARK_POINT_THEME = exports.DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP = exports.DEFAULT_POLAR_MARK_AREA_THEME = exports.DEFAULT_CARTESIAN_MARK_AREA_THEME = exports.
|
|
5
|
+
}), exports.DEFAULT_MARK_POINT_TEXT_STYLE_MAP = exports.DEFAULT_MARK_POINT_THEME = exports.DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP = exports.DEFAULT_POLAR_MARK_AREA_THEME = exports.DEFAULT_CARTESIAN_MARK_AREA_THEME = exports.DEFAULT_POLAR_MARK_LINE_THEME = exports.DEFAULT_CARTESIAN_MARK_LINE_THEME = void 0;
|
|
6
6
|
|
|
7
7
|
const type_1 = require("./type");
|
|
8
8
|
|
|
9
|
-
exports.
|
|
9
|
+
exports.DEFAULT_CARTESIAN_MARK_LINE_THEME = {
|
|
10
10
|
interactive: !0,
|
|
11
11
|
startSymbol: {
|
|
12
12
|
visible: !1,
|
|
@@ -23,7 +23,7 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
23
23
|
lineWidth: 0
|
|
24
24
|
},
|
|
25
25
|
label: {
|
|
26
|
-
position: type_1.
|
|
26
|
+
position: type_1.ICartesianMarkLineLabelPosition.end,
|
|
27
27
|
refX: 0,
|
|
28
28
|
refY: 0,
|
|
29
29
|
refAngle: 0,
|
|
@@ -33,7 +33,9 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
33
33
|
lineWidth: 0,
|
|
34
34
|
fontSize: 10,
|
|
35
35
|
fontWeight: "normal",
|
|
36
|
-
fontStyle: "normal"
|
|
36
|
+
fontStyle: "normal",
|
|
37
|
+
textAlign: "center",
|
|
38
|
+
textBaseline: "middle"
|
|
37
39
|
},
|
|
38
40
|
padding: [ 2, 2, 4, 4 ],
|
|
39
41
|
panel: {
|
|
@@ -48,42 +50,49 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
48
50
|
lineWidth: 1,
|
|
49
51
|
lineDash: [ 2 ]
|
|
50
52
|
}
|
|
51
|
-
}, exports.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
insideStartBottom: {
|
|
61
|
-
textAlign: "left",
|
|
62
|
-
textBaseline: "top"
|
|
63
|
-
},
|
|
64
|
-
middle: {
|
|
65
|
-
textAlign: "center",
|
|
66
|
-
textBaseline: "middle"
|
|
67
|
-
},
|
|
68
|
-
insideMiddleTop: {
|
|
69
|
-
textAlign: "center",
|
|
70
|
-
textBaseline: "bottom"
|
|
71
|
-
},
|
|
72
|
-
insideMiddleBottom: {
|
|
73
|
-
textAlign: "center",
|
|
74
|
-
textBaseline: "top"
|
|
53
|
+
}, exports.DEFAULT_POLAR_MARK_LINE_THEME = {
|
|
54
|
+
interactive: !0,
|
|
55
|
+
startSymbol: {
|
|
56
|
+
visible: !1,
|
|
57
|
+
symbolType: "triangle",
|
|
58
|
+
size: 12,
|
|
59
|
+
fill: "rgba(46, 47, 50)",
|
|
60
|
+
lineWidth: 0
|
|
75
61
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
endSymbol: {
|
|
63
|
+
visible: !0,
|
|
64
|
+
symbolType: "triangle",
|
|
65
|
+
size: 12,
|
|
66
|
+
fill: "rgba(46, 47, 50)",
|
|
67
|
+
lineWidth: 0
|
|
79
68
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
label: {
|
|
70
|
+
position: type_1.IPolarMarkLabelPosition.arcOuterMiddle,
|
|
71
|
+
refX: 0,
|
|
72
|
+
refY: 0,
|
|
73
|
+
refAngle: 0,
|
|
74
|
+
textStyle: {
|
|
75
|
+
fill: "#fff",
|
|
76
|
+
stroke: "#fff",
|
|
77
|
+
lineWidth: 0,
|
|
78
|
+
fontSize: 10,
|
|
79
|
+
fontWeight: "normal",
|
|
80
|
+
fontStyle: "normal",
|
|
81
|
+
textAlign: "center",
|
|
82
|
+
textBaseline: "middle"
|
|
83
|
+
},
|
|
84
|
+
padding: [ 2, 2, 4, 4 ],
|
|
85
|
+
panel: {
|
|
86
|
+
visible: !0,
|
|
87
|
+
cornerRadius: 0,
|
|
88
|
+
fill: "rgb(48, 115, 242)",
|
|
89
|
+
fillOpacity: .8
|
|
90
|
+
}
|
|
83
91
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
lineStyle: {
|
|
93
|
+
stroke: "#b2bacf",
|
|
94
|
+
lineWidth: 1,
|
|
95
|
+
lineDash: [ 2 ]
|
|
87
96
|
}
|
|
88
97
|
}, exports.DEFAULT_CARTESIAN_MARK_AREA_THEME = {
|
|
89
98
|
interactive: !0,
|
|
@@ -95,7 +104,9 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
95
104
|
lineWidth: 0,
|
|
96
105
|
fontSize: 10,
|
|
97
106
|
fontWeight: "normal",
|
|
98
|
-
fontStyle: "normal"
|
|
107
|
+
fontStyle: "normal",
|
|
108
|
+
textAlign: "center",
|
|
109
|
+
textBaseline: "middle"
|
|
99
110
|
},
|
|
100
111
|
padding: [ 2, 2, 4, 4 ],
|
|
101
112
|
panel: {
|
|
@@ -112,7 +123,7 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
112
123
|
}, exports.DEFAULT_POLAR_MARK_AREA_THEME = {
|
|
113
124
|
interactive: !0,
|
|
114
125
|
label: {
|
|
115
|
-
position: type_1.
|
|
126
|
+
position: type_1.IPolarMarkLabelPosition.arcOuterMiddle,
|
|
116
127
|
textStyle: {
|
|
117
128
|
fill: "#fff",
|
|
118
129
|
stroke: "#fff",
|
|
@@ -121,7 +132,7 @@ exports.DEFAULT_COMMON_MARK_LINE_THEME = {
|
|
|
121
132
|
fontWeight: "normal",
|
|
122
133
|
fontStyle: "normal",
|
|
123
134
|
textAlign: "center",
|
|
124
|
-
|
|
135
|
+
textBaseline: "middle"
|
|
125
136
|
},
|
|
126
137
|
padding: [ 2, 2, 4, 4 ],
|
|
127
138
|
panel: {
|
package/cjs/marker/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/config.ts"],"names":[],"mappings":";;;AACA,iCAAoH;AAEvG,QAAA,8BAA8B,GAAG;IAC5C,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACX,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,UAAU;QACtB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,CAAC;KACb;IACD,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,UAAU;QACtB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,CAAC;KACb;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,mCAA4B,CAAC,GAAG;QAC1C,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E;QACX,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,EAAE;QACR,WAAW,EAAE;YACX,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE,GAAG;YAChB,IAAI,EAAE,EAAE;SACT;QACD,SAAS,EAAE;YACT,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;SACN;QACD,UAAU,EAAE;YACV,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;QACD,aAAa,EAAE;YACb,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ;KACF;CACF,CAAC;AAEW,QAAA,iCAAiC,GAK1C;IACF,GAAG,EAAE;QACH,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE;QACN,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,MAAM,EAAE;QACN,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,QAAQ;KACvB;IACD,SAAS,EAAE;QACT,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACvB;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACvB;CACF,CAAC","file":"config.js","sourcesContent":["import type { TextAlignType, TextBaselineType } from '@visactor/vrender-core';\nimport { ICartesianMarkAreaLabelPosition, ICommonMarkLineLabelPosition, IPolarMarkAreaLabelPosition } from './type';\n\nexport const DEFAULT_COMMON_MARK_LINE_THEME = {\n interactive: true,\n startSymbol: {\n visible: false,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n endSymbol: {\n visible: true,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n label: {\n position: ICommonMarkLineLabelPosition.end,\n refX: 0,\n refY: 0,\n refAngle: 0,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n lineStyle: {\n stroke: '#b2bacf',\n lineWidth: 1,\n lineDash: [2]\n }\n};\n\nexport const DEFAULT_COMMON_MARK_LINE_TEXT_STYLE_MAP: {\n [K: string]: {\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n };\n} = {\n start: {\n textAlign: 'right',\n textBaseline: 'middle'\n },\n insideStartTop: {\n textAlign: 'left',\n textBaseline: 'bottom'\n },\n insideStartBottom: {\n textAlign: 'left',\n textBaseline: 'top'\n },\n\n middle: {\n textAlign: 'center',\n textBaseline: 'middle'\n },\n insideMiddleTop: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n insideMiddleBottom: {\n textAlign: 'center',\n textBaseline: 'top'\n },\n\n end: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n insideEndTop: {\n textAlign: 'right',\n textBaseline: 'bottom'\n },\n insideEndBottom: {\n textAlign: 'right',\n textBaseline: 'top'\n }\n};\n\nexport const DEFAULT_CARTESIAN_MARK_AREA_THEME = {\n interactive: true,\n label: {\n position: ICartesianMarkAreaLabelPosition.right,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n areaStyle: {\n fill: '#b2bacf',\n visible: true\n }\n};\n\nexport const DEFAULT_POLAR_MARK_AREA_THEME = {\n interactive: true,\n label: {\n position: IPolarMarkAreaLabelPosition.arcInner,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAlign: 'center',\n textBaseLine: 'middle'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n areaStyle: {\n fill: '#b2bacf',\n visible: true\n }\n};\n\nexport const DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP: {\n [K: string]: {\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n };\n} = {\n left: {\n textAlign: 'right',\n textBaseline: 'middle'\n },\n insideLeft: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n\n right: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n insideRight: {\n textAlign: 'right',\n textBaseline: 'middle'\n },\n\n top: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n insideTop: {\n textAlign: 'center',\n textBaseline: 'top'\n },\n\n bottom: {\n textAlign: 'center',\n textBaseline: 'top'\n },\n insideBottom: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n\n middle: {\n textAlign: 'center',\n textBaseline: 'middle'\n }\n};\n\nexport const DEFAULT_MARK_POINT_THEME = {\n interactive: true,\n itemLine: {\n visible: true,\n decorativeLine: {\n visible: false,\n length: 30\n },\n startSymbol: {\n visible: true,\n clip: true,\n symbolType: 'circle',\n size: 20,\n style: {\n fill: false,\n stroke: 'rgba(46, 47, 50)'\n }\n },\n endSymbol: {\n visible: false,\n clip: true,\n symbolType: 'triangle',\n size: 12,\n style: {\n fill: false,\n stroke: 'rgba(46, 47, 50)'\n }\n },\n lineStyle: {\n stroke: '#000',\n lineWidth: 1\n }\n },\n itemContent: {\n type: 'text',\n position: 'middle',\n refX: 10,\n symbolStyle: {\n symbolType: 'star',\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8,\n size: 20\n },\n textStyle: {\n dx: 0,\n dy: 0\n },\n imageStyle: {\n width: 80,\n height: 80\n },\n richTextStyle: {\n width: 100,\n height: 100\n }\n }\n};\n\nexport const DEFAULT_MARK_POINT_TEXT_STYLE_MAP: {\n [K: string]: {\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n };\n} = {\n top: {\n textAlign: 'left',\n textBaseline: 'bottom'\n },\n bottom: {\n textAlign: 'left',\n textBaseline: 'top'\n },\n middle: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n insideTop: {\n textAlign: 'right',\n textBaseline: 'bottom'\n },\n insideBottom: {\n textAlign: 'right',\n textBaseline: 'top'\n },\n insideMiddle: {\n textAlign: 'right',\n textBaseline: 'middle'\n }\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/config.ts"],"names":[],"mappings":";;;AACA,iCAAmH;AAEtG,QAAA,iCAAiC,GAAG;IAC/C,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACX,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,UAAU;QACtB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,CAAC;KACb;IACD,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,UAAU;QACtB,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,CAAC;KACb;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,sCAA+B,CAAC,GAAG;QAC7C,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,QAAQ;YACpB,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,QAAQ;SACvB;QACD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,C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,MAAM;YACd,SAAS,EAAE,CAAC;SACb;KACF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,EAAE;QACR,WAAW,EAAE;YACX,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE,GAAG;YAChB,IAAI,EAAE,EAAE;SACT;QACD,SAAS,EAAE;YACT,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;SACN;QACD,UAAU,EAAE;YACV,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;QACD,aAAa,EAAE;YACb,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ;KACF;CACF,CAAC;AAEW,QAAA,iCAAiC,GAK1C;IACF,GAAG,EAAE;QACH,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE;QACN,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,MAAM,EAAE;QACN,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,QAAQ;KACvB;IACD,SAAS,EAAE;QACT,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACvB;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACvB;CACF,CAAC","file":"config.js","sourcesContent":["import type { TextAlignType, TextBaselineType } from '@visactor/vrender-core';\nimport { ICartesianMarkAreaLabelPosition, ICartesianMarkLineLabelPosition, IPolarMarkLabelPosition } from './type';\n\nexport const DEFAULT_CARTESIAN_MARK_LINE_THEME = {\n interactive: true,\n startSymbol: {\n visible: false,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n endSymbol: {\n visible: true,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n label: {\n position: ICartesianMarkLineLabelPosition.end,\n refX: 0,\n refY: 0,\n refAngle: 0,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAlign: 'center',\n textBaseline: 'middle'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n lineStyle: {\n stroke: '#b2bacf',\n lineWidth: 1,\n lineDash: [2]\n }\n};\n\nexport const DEFAULT_POLAR_MARK_LINE_THEME = {\n interactive: true,\n startSymbol: {\n visible: false,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n endSymbol: {\n visible: true,\n symbolType: 'triangle',\n size: 12,\n fill: 'rgba(46, 47, 50)',\n lineWidth: 0\n },\n label: {\n position: IPolarMarkLabelPosition.arcOuterMiddle,\n refX: 0,\n refY: 0,\n refAngle: 0,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAlign: 'center',\n textBaseline: 'middle'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n lineStyle: {\n stroke: '#b2bacf',\n lineWidth: 1,\n lineDash: [2]\n }\n};\n\nexport const DEFAULT_CARTESIAN_MARK_AREA_THEME = {\n interactive: true,\n label: {\n position: ICartesianMarkAreaLabelPosition.right,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAlign: 'center',\n textBaseline: 'middle'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n areaStyle: {\n fill: '#b2bacf',\n visible: true\n }\n};\n\nexport const DEFAULT_POLAR_MARK_AREA_THEME = {\n interactive: true,\n label: {\n position: IPolarMarkLabelPosition.arcOuterMiddle,\n textStyle: {\n fill: '#fff',\n stroke: '#fff',\n lineWidth: 0,\n fontSize: 10,\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAlign: 'center',\n textBaseline: 'middle'\n },\n padding: [2, 2, 4, 4],\n panel: {\n visible: true,\n cornerRadius: 0,\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8\n }\n },\n areaStyle: {\n fill: '#b2bacf',\n visible: true\n }\n};\n\nexport const DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP: {\n [K: string]: {\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n };\n} = {\n left: {\n textAlign: 'right',\n textBaseline: 'middle'\n },\n insideLeft: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n\n right: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n insideRight: {\n textAlign: 'right',\n textBaseline: 'middle'\n },\n\n top: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n insideTop: {\n textAlign: 'center',\n textBaseline: 'top'\n },\n\n bottom: {\n textAlign: 'center',\n textBaseline: 'top'\n },\n insideBottom: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n\n middle: {\n textAlign: 'center',\n textBaseline: 'middle'\n }\n};\n\nexport const DEFAULT_MARK_POINT_THEME = {\n interactive: true,\n itemLine: {\n visible: true,\n decorativeLine: {\n visible: false,\n length: 30\n },\n startSymbol: {\n visible: true,\n clip: true,\n symbolType: 'circle',\n size: 20,\n style: {\n fill: false,\n stroke: 'rgba(46, 47, 50)'\n }\n },\n endSymbol: {\n visible: false,\n clip: true,\n symbolType: 'triangle',\n size: 12,\n style: {\n fill: false,\n stroke: 'rgba(46, 47, 50)'\n }\n },\n lineStyle: {\n stroke: '#000',\n lineWidth: 1\n }\n },\n itemContent: {\n type: 'text',\n position: 'middle',\n refX: 10,\n symbolStyle: {\n symbolType: 'star',\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8,\n size: 20\n },\n textStyle: {\n dx: 0,\n dy: 0\n },\n imageStyle: {\n width: 80,\n height: 80\n },\n richTextStyle: {\n width: 100,\n height: 100\n }\n }\n};\n\nexport const DEFAULT_MARK_POINT_TEXT_STYLE_MAP: {\n [K: string]: {\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n };\n} = {\n top: {\n textAlign: 'left',\n textBaseline: 'bottom'\n },\n bottom: {\n textAlign: 'left',\n textBaseline: 'top'\n },\n middle: {\n textAlign: 'left',\n textBaseline: 'middle'\n },\n insideTop: {\n textAlign: 'right',\n textBaseline: 'bottom'\n },\n insideBottom: {\n textAlign: 'right',\n textBaseline: 'top'\n },\n insideMiddle: {\n textAlign: 'right',\n textBaseline: 'middle'\n }\n};\n"]}
|
package/cjs/marker/point.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export declare class MarkPoint extends Marker<MarkPointAttrs> {
|
|
|
72
72
|
protected setItemAttributes(item: ISymbol | Tag | IImage | IRichText, itemContent: IItemContent, itemPosition: Point, itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'): void;
|
|
73
73
|
protected getItemDx(item: ISymbol | Tag | IImage | IRichText, position: keyof typeof IMarkPointItemPosition, style?: IImageGraphicAttribute | IRichTextGraphicAttribute): number;
|
|
74
74
|
protected getItemDy(item: ISymbol | Tag | IImage | IRichText, position: keyof typeof IMarkPointItemPosition, style?: IImageGraphicAttribute | IRichTextGraphicAttribute): number;
|
|
75
|
-
protected initItem(itemContent: IItemContent, itemPosition: Point): IGroup | Tag |
|
|
75
|
+
protected initItem(itemContent: IItemContent, itemPosition: Point): IGroup | Tag | IRichText | ISymbol | IImage;
|
|
76
76
|
protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point): Point[];
|
|
77
77
|
protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean): void;
|
|
78
78
|
protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point): {
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { ArcSegment } from '../../segment';
|
|
2
|
-
import type { PolarMarkArcLineAttrs } from '../type';
|
|
3
2
|
import { BaseMarkLine } from '../base-line';
|
|
4
|
-
|
|
3
|
+
import { IPolarMarkLabelPosition } from '../type';
|
|
4
|
+
import type { PolarMarkArcLineAttrs } from '../type';
|
|
5
|
+
import type { ComponentOptions } from '../../interface';
|
|
6
|
+
export declare class PolarMarkArcLine extends BaseMarkLine<IPolarMarkLabelPosition> {
|
|
5
7
|
name: string;
|
|
6
8
|
static defaultAttributes: Partial<PolarMarkArcLineAttrs>;
|
|
7
9
|
protected _line: ArcSegment;
|
|
10
|
+
constructor(attributes: PolarMarkArcLineAttrs, options?: ComponentOptions);
|
|
8
11
|
protected isValidPoints(): boolean;
|
|
12
|
+
protected getPositionByDirection(direction: IPolarMarkLabelPosition): {
|
|
13
|
+
position: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
angle: number;
|
|
18
|
+
};
|
|
19
|
+
protected setLabelPos(): void;
|
|
9
20
|
protected createSegment(): ArcSegment;
|
|
10
21
|
protected setLineAttributes(): void;
|
|
11
22
|
}
|
|
@@ -4,17 +4,70 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.PolarMarkArcLine = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), segment_1 = require("../../segment"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), segment_1 = require("../../segment"), register_1 = require("../register"), constant_1 = require("../../constant"), base_line_1 = require("../base-line"), type_1 = require("../type"), config_1 = require("../config");
|
|
8
8
|
|
|
9
9
|
(0, register_1.loadPolarMarkArcLineComponent)();
|
|
10
10
|
|
|
11
11
|
class PolarMarkArcLine extends base_line_1.BaseMarkLine {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(
|
|
12
|
+
constructor(attributes, options) {
|
|
13
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, PolarMarkArcLine.defaultAttributes, attributes)),
|
|
14
|
+
this.name = "polarMarkArcLine";
|
|
14
15
|
}
|
|
15
16
|
isValidPoints() {
|
|
16
17
|
return !0;
|
|
17
18
|
}
|
|
19
|
+
getPositionByDirection(direction) {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21
|
+
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelRectHeight = Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)), labelTextHeight = Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)), labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
22
|
+
let angle, orthogonalOffsetDirection;
|
|
23
|
+
switch (direction) {
|
|
24
|
+
case type_1.IPolarMarkLabelPosition.center:
|
|
25
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 0;
|
|
26
|
+
break;
|
|
27
|
+
|
|
28
|
+
case type_1.IPolarMarkLabelPosition.arcInnerStart:
|
|
29
|
+
angle = startAngle, orthogonalOffsetDirection = -1;
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case type_1.IPolarMarkLabelPosition.arcOuterStart:
|
|
33
|
+
angle = startAngle, orthogonalOffsetDirection = 1;
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case type_1.IPolarMarkLabelPosition.arcInnerEnd:
|
|
37
|
+
angle = endAngle, orthogonalOffsetDirection = -1;
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case type_1.IPolarMarkLabelPosition.arcOuterEnd:
|
|
41
|
+
angle = endAngle, orthogonalOffsetDirection = 1;
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
case type_1.IPolarMarkLabelPosition.arcInnerMiddle:
|
|
45
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case type_1.IPolarMarkLabelPosition.arcOuterMiddle:
|
|
49
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 1;
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
default:
|
|
53
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
position: {
|
|
57
|
+
x: center.x + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.cos(angle) + refX * Math.cos(angle - Math.PI / 2),
|
|
58
|
+
y: center.y + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.sin(angle) + refX * Math.sin(angle - Math.PI / 2)
|
|
59
|
+
},
|
|
60
|
+
angle: angle
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
setLabelPos() {
|
|
64
|
+
var _a;
|
|
65
|
+
super.setLabelPos();
|
|
66
|
+
const {label: label = {}} = this.attribute, {position: position = "arcInnerMiddle", autoRotate: autoRotate = !0} = label, labelAttr = this.getPositionByDirection(position);
|
|
67
|
+
this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), {
|
|
68
|
+
angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (null !== (_a = label.refAngle) && void 0 !== _a ? _a : 0) : 0
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
18
71
|
createSegment() {
|
|
19
72
|
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, state: state} = this.attribute;
|
|
20
73
|
return new segment_1.ArcSegment({
|
|
@@ -46,5 +99,5 @@ class PolarMarkArcLine extends base_line_1.BaseMarkLine {
|
|
|
46
99
|
}
|
|
47
100
|
}
|
|
48
101
|
|
|
49
|
-
exports.PolarMarkArcLine = PolarMarkArcLine, PolarMarkArcLine.defaultAttributes = config_1.
|
|
102
|
+
exports.PolarMarkArcLine = PolarMarkArcLine, PolarMarkArcLine.defaultAttributes = config_1.DEFAULT_POLAR_MARK_LINE_THEME;
|
|
50
103
|
//# sourceMappingURL=arc-line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/polar/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,2CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"sources":["../src/marker/polar/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,2CAA2C;AAC3C,0CAA4D;AAC5D,6CAAgD;AAChD,4CAA4C;AAC5C,kCAAkD;AAGlD,sCAA0D;AAG1D,IAAA,wCAA6B,GAAE,CAAC;AAChC,MAAa,gBAAiB,SAAQ,wBAAqC;IAOzE,YAAY,UAAiC,EAAE,OAA0B;QACvE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAPvG,SAAI,GAAG,kBAAkB,CAAC;IAQ1B,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,sBAAsB,CAAC,SAAkC;;QACjE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAA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,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;aACrF,SAAkC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,EAAE;YACb,IAAI,CAAC,KAAa,CAAC,aAAa,CAAC;gBAChC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,QAAQ;gBACR,WAAW;gBACX,SAAS;gBACT,SAAS;aACV,CAAC,CAAC;SACJ;IACH,CAAC;;AA9HH,4CA+HC;AA5HQ,kCAAiB,GACtB,sCAAiE,CAAC","file":"arc-line.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { ArcSegment } from '../../segment';\nimport { loadPolarMarkArcLineComponent } from '../register';\nimport { DEFAULT_STATES } from '../../constant';\nimport { BaseMarkLine } from '../base-line';\nimport { IPolarMarkLabelPosition } from '../type';\n// eslint-disable-next-line no-duplicate-imports\nimport type { PolarMarkArcLineAttrs } from '../type';\nimport { DEFAULT_POLAR_MARK_LINE_THEME } from '../config';\nimport type { ComponentOptions } from '../../interface';\n\nloadPolarMarkArcLineComponent();\nexport class PolarMarkArcLine extends BaseMarkLine<IPolarMarkLabelPosition> {\n name = 'polarMarkArcLine';\n // eslint-disable-next-line max-len\n static defaultAttributes: Partial<PolarMarkArcLineAttrs> =\n DEFAULT_POLAR_MARK_LINE_THEME as unknown as PolarMarkArcLineAttrs;\n protected _line!: ArcSegment;\n\n constructor(attributes: PolarMarkArcLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PolarMarkArcLine.defaultAttributes, attributes));\n }\n\n protected isValidPoints() {\n return true;\n }\n\n protected getPositionByDirection(direction: IPolarMarkLabelPosition) {\n const { center, radius, startAngle, endAngle, label } = this.attribute as PolarMarkArcLineAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n // eslint-disable-next-line max-len\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (direction) {\n case IPolarMarkLabelPosition.center:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IPolarMarkLabelPosition.arcInnerStart:\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterStart:\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerEnd:\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterEnd:\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos(): void {\n super.setLabelPos();\n const { label = {} } = this.attribute as PolarMarkArcLineAttrs;\n const { position = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPositionByDirection(position as any);\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\n });\n }\n\n protected createSegment() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this\n .attribute as PolarMarkArcLineAttrs;\n return new ArcSegment({\n center,\n radius,\n startAngle,\n endAngle,\n startSymbol,\n endSymbol,\n lineStyle,\n state: {\n line: merge({}, DEFAULT_STATES, state?.line),\n startSymbol: merge({}, DEFAULT_STATES, state?.lineStartSymbol),\n endSymbol: merge({}, DEFAULT_STATES, state?.lineEndSymbol)\n }\n });\n }\n\n protected setLineAttributes() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle } = this\n .attribute as PolarMarkArcLineAttrs;\n if (this._line) {\n (this._line as any).setAttributes({\n center,\n radius,\n startAngle,\n endAngle,\n startSymbol,\n endSymbol,\n lineStyle\n });\n }\n }\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IArc, IGroup } from '@visactor/vrender-core';
|
|
2
2
|
import { Tag } from '../../tag';
|
|
3
3
|
import { Marker } from '../base';
|
|
4
|
-
import {
|
|
4
|
+
import { IPolarMarkLabelPosition, type PolarMarkAreaAttrs } from '../type';
|
|
5
5
|
import type { ComponentOptions } from '../../interface';
|
|
6
6
|
export declare class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {
|
|
7
7
|
name: string;
|
|
8
8
|
static defaultAttributes: {
|
|
9
9
|
interactive: boolean;
|
|
10
10
|
label: {
|
|
11
|
-
position:
|
|
11
|
+
position: IPolarMarkLabelPosition;
|
|
12
12
|
textStyle: {
|
|
13
13
|
fill: string;
|
|
14
14
|
stroke: string;
|
|
@@ -17,7 +17,7 @@ export declare class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {
|
|
|
17
17
|
fontWeight: string;
|
|
18
18
|
fontStyle: string;
|
|
19
19
|
textAlign: string;
|
|
20
|
-
|
|
20
|
+
textBaseline: string;
|
|
21
21
|
};
|
|
22
22
|
padding: number[];
|
|
23
23
|
panel: {
|
|
@@ -36,7 +36,13 @@ export declare class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {
|
|
|
36
36
|
getArea(): IArc;
|
|
37
37
|
getLabel(): Tag;
|
|
38
38
|
constructor(attributes: PolarMarkAreaAttrs, options?: ComponentOptions);
|
|
39
|
-
|
|
39
|
+
protected getPositionByDirection(direction: string): {
|
|
40
|
+
position: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
angle: number;
|
|
45
|
+
};
|
|
40
46
|
protected setLabelPos(): void;
|
|
41
47
|
protected initMarker(container: IGroup): void;
|
|
42
48
|
protected updateMarker(): void;
|
package/cjs/marker/polar/area.js
CHANGED
|
@@ -19,51 +19,57 @@ class PolarMarkArea extends base_1.Marker {
|
|
|
19
19
|
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, PolarMarkArea.defaultAttributes, attributes)),
|
|
20
20
|
this.name = "polarMarkArea";
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
getPositionByDirection(direction) {
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
24
|
+
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelRectHeight = Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)), labelTextHeight = Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)), labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
25
|
+
let radius, angle, orthogonalOffsetDirection;
|
|
24
26
|
switch (direction) {
|
|
25
|
-
case type_1.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin((startAngle + endAngle) / 2)
|
|
29
|
-
};
|
|
27
|
+
case type_1.IPolarMarkLabelPosition.center:
|
|
28
|
+
radius = (innerRadius + outerRadius) / 2, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 0;
|
|
29
|
+
break;
|
|
30
30
|
|
|
31
|
-
case type_1.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(startAngle)
|
|
35
|
-
};
|
|
31
|
+
case type_1.IPolarMarkLabelPosition.arcInnerStart:
|
|
32
|
+
radius = innerRadius, angle = startAngle, orthogonalOffsetDirection = -1;
|
|
33
|
+
break;
|
|
36
34
|
|
|
37
|
-
case type_1.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(endAngle)
|
|
41
|
-
};
|
|
35
|
+
case type_1.IPolarMarkLabelPosition.arcOuterStart:
|
|
36
|
+
radius = outerRadius, angle = startAngle, orthogonalOffsetDirection = 1;
|
|
37
|
+
break;
|
|
42
38
|
|
|
43
|
-
case type_1.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
|
|
47
|
-
};
|
|
39
|
+
case type_1.IPolarMarkLabelPosition.arcInnerEnd:
|
|
40
|
+
radius = innerRadius, angle = endAngle, orthogonalOffsetDirection = -1;
|
|
41
|
+
break;
|
|
48
42
|
|
|
49
|
-
case type_1.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
case type_1.IPolarMarkLabelPosition.arcOuterEnd:
|
|
44
|
+
radius = outerRadius, angle = endAngle, orthogonalOffsetDirection = 1;
|
|
45
|
+
break;
|
|
46
|
+
|
|
47
|
+
case type_1.IPolarMarkLabelPosition.arcInnerMiddle:
|
|
48
|
+
radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case type_1.IPolarMarkLabelPosition.arcOuterMiddle:
|
|
52
|
+
radius = outerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 1;
|
|
53
|
+
break;
|
|
54
54
|
|
|
55
55
|
default:
|
|
56
|
-
|
|
57
|
-
x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),
|
|
58
|
-
y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
|
|
59
|
-
};
|
|
56
|
+
radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
60
57
|
}
|
|
58
|
+
return {
|
|
59
|
+
position: {
|
|
60
|
+
x: center.x + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.cos(angle) + refX * Math.cos(angle - Math.PI / 2),
|
|
61
|
+
y: center.y + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.sin(angle) + refX * Math.sin(angle - Math.PI / 2)
|
|
62
|
+
},
|
|
63
|
+
angle: angle
|
|
64
|
+
};
|
|
61
65
|
}
|
|
62
66
|
setLabelPos() {
|
|
63
67
|
var _a;
|
|
64
68
|
if (this._label && this._area) {
|
|
65
|
-
const {label: label = {}} = this.attribute, labelPosition =
|
|
66
|
-
if (this._label.setAttributes(Object.assign({},
|
|
69
|
+
const {label: label = {}} = this.attribute, {position: labelPosition = "arcInnerMiddle", autoRotate: autoRotate = !0} = label, labelAttr = this.getPositionByDirection(labelPosition);
|
|
70
|
+
if (this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), {
|
|
71
|
+
angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (null !== (_a = label.refAngle) && void 0 !== _a ? _a : 0) : 0
|
|
72
|
+
})), this.attribute.limitRect && label.confine) {
|
|
67
73
|
const {x: x, y: y, width: width, height: height} =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EAAE,KAAK,EAAE,GAAG,IAAI;aACtF,SAA+B,CAAC;QACnC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,iBACtB,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,WAAW;gBACX,WAAW;gBACX,UAAU;gBACV,QAAQ,IACL,SAAS,EACZ,CAAC;SACJ;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AAnIH,sCAoIC;AAlIQ,+BAAiB,GAAG,sCAA6B,CAAC","file":"area.js","sourcesContent":["import type { IArc, IGroup, INode } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../../tag';\nimport { Marker } from '../base';\nimport { DEFAULT_POLAR_MARK_AREA_THEME } from '../config';\nimport { IPolarMarkAreaLabelPosition, type PolarMarkAreaAttrs } from '../type';\nimport { limitShapeInBounds } from '../../util/limit-shape';\nimport type { ComponentOptions } from '../../interface';\nimport { loadPolarMarkAreaComponent } from '../register';\nimport { DEFAULT_STATES } from '../../constant';\n\nloadPolarMarkAreaComponent();\nexport class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {\n name = 'polarMarkArea';\n static defaultAttributes = DEFAULT_POLAR_MARK_AREA_THEME;\n private _area!: IArc;\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: PolarMarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PolarMarkArea.defaultAttributes, attributes));\n }\n\n private _getPositionByDirection(area: IArc, direction: string) {\n const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute as PolarMarkAreaAttrs;\n\n switch (direction) {\n case IPolarMarkAreaLabelPosition.center:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos((startAngle + endAngle) / 2),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin((startAngle + endAngle) / 2)\n };\n case IPolarMarkAreaLabelPosition.arcStart:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos(startAngle),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin(startAngle)\n };\n case IPolarMarkAreaLabelPosition.arcEnd:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos(endAngle),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin(endAngle)\n };\n case IPolarMarkAreaLabelPosition.arcInner:\n return {\n x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n case IPolarMarkAreaLabelPosition.arcOuter:\n return {\n x: center.x + outerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + outerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n default: // default arcOuter\n return {\n x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n }\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as PolarMarkAreaAttrs;\n const labelPosition = label.position ?? 'middle';\n const labelPoint = this._getPositionByDirection(this._area, labelPosition);\n this._label.setAttributes({\n ...labelPoint\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as PolarMarkAreaAttrs;\n const area = graphicCreator.arc({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'polar-mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label } = this\n .attribute as PolarMarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/polar/area.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AACxD,6CAAyC;AAGzC,mCAAgC;AAChC,kCAAiC;AACjC,sCAA0D;AAC1D,kCAA2E;AAC3E,wDAA4D;AAE5D,0CAAyD;AACzD,6CAAgD;AAEhD,IAAA,qCAA0B,GAAE,CAAC;AAC7B,MAAa,aAAc,SAAQ,aAA0B;IAK3D,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CA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I,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,SAAS,CAAC,GAAG,CAAC,SAA6B,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,YAAY;QACpB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;aACtF,SAA+B,CAAC;QACnC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,iBACtB,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,WAAW;gBACX,WAAW;gBACX,UAAU;gBACV,QAAQ,IACL,SAAS,EACZ,CAAC;SACJ;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA5KH,sCA6KC;AA3KQ,+BAAiB,GAAG,sCAA6B,CAAC","file":"area.js","sourcesContent":["import type { IArc, IGroup, INode } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../../tag';\nimport { Marker } from '../base';\nimport { DEFAULT_POLAR_MARK_AREA_THEME } from '../config';\nimport { IPolarMarkLabelPosition, type PolarMarkAreaAttrs } from '../type';\nimport { limitShapeInBounds } from '../../util/limit-shape';\nimport type { ComponentOptions } from '../../interface';\nimport { loadPolarMarkAreaComponent } from '../register';\nimport { DEFAULT_STATES } from '../../constant';\n\nloadPolarMarkAreaComponent();\nexport class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {\n name = 'polarMarkArea';\n static defaultAttributes = DEFAULT_POLAR_MARK_AREA_THEME;\n private _area!: IArc;\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: PolarMarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PolarMarkArea.defaultAttributes, attributes));\n }\n\n protected getPositionByDirection(direction: string) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute as PolarMarkAreaAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n // eslint-disable-next-line max-len\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let radius;\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (direction) {\n case IPolarMarkLabelPosition.center:\n radius = (innerRadius + outerRadius) / 2;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IPolarMarkLabelPosition.arcInnerStart:\n radius = innerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterStart:\n radius = outerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerEnd:\n radius = innerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterEnd:\n radius = outerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerMiddle:\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterMiddle:\n radius = outerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as PolarMarkAreaAttrs;\n const { position: labelPosition = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPositionByDirection(labelPosition);\n\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as PolarMarkAreaAttrs;\n const area = graphicCreator.arc({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'polar-mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label } = this\n .attribute as PolarMarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
package/cjs/marker/type.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { EasingType, IArcGraphicAttribute, IGroup, IGroupGraphicAttribute,
|
|
|
2
2
|
import type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes } from '../segment';
|
|
3
3
|
import type { TagAttributes } from '../tag';
|
|
4
4
|
import type { Point, State } from '../core/type';
|
|
5
|
-
export declare enum
|
|
5
|
+
export declare enum ICartesianMarkLineLabelPosition {
|
|
6
6
|
start = "start",
|
|
7
7
|
middle = "middle",
|
|
8
8
|
end = "end",
|
|
@@ -24,11 +24,13 @@ export declare enum ICartesianMarkAreaLabelPosition {
|
|
|
24
24
|
insideTop = "insideTop",
|
|
25
25
|
insideBottom = "insideBottom"
|
|
26
26
|
}
|
|
27
|
-
export declare enum
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
export declare enum IPolarMarkLabelPosition {
|
|
28
|
+
arcInnerStart = "arcInnerStart",
|
|
29
|
+
arcInnerEnd = "arcInnerEnd",
|
|
30
|
+
arcInnerMiddle = "arcInnerMiddle",
|
|
31
|
+
arcOuterStart = "arcOuterStart",
|
|
32
|
+
arcOuterEnd = "arcOuterEnd",
|
|
33
|
+
arcOuterMiddle = "arcOuterMiddle",
|
|
32
34
|
center = "center"
|
|
33
35
|
}
|
|
34
36
|
export declare enum IMarkPointItemPosition {
|
|
@@ -113,26 +115,26 @@ export type MarkPointState = {
|
|
|
113
115
|
richText?: State<Partial<IRichTextGraphicAttribute>>;
|
|
114
116
|
customMark?: State<Partial<IGroupGraphicAttribute>>;
|
|
115
117
|
};
|
|
116
|
-
export type CommonMarkLineAttrs = MarkerAttrs & Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {
|
|
118
|
+
export type CommonMarkLineAttrs<T> = MarkerAttrs & Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {
|
|
117
119
|
label?: {
|
|
118
|
-
position?:
|
|
120
|
+
position?: T;
|
|
119
121
|
confine?: boolean;
|
|
120
122
|
} & IMarkRef & IMarkLabel;
|
|
121
123
|
state?: CommonMarkLineState;
|
|
122
124
|
} & BaseMarkerAnimation<CommonMarkLineAnimationType>;
|
|
123
|
-
export type CartesianMarkLineAttrs = CommonMarkLineAttrs & {
|
|
125
|
+
export type CartesianMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {
|
|
124
126
|
type?: 'cartesian-line';
|
|
125
127
|
multiSegment?: boolean;
|
|
126
128
|
mainSegmentIndex?: number;
|
|
127
129
|
points: Point[] | Point[][];
|
|
128
130
|
lineStyle?: ILineGraphicAttribute;
|
|
129
131
|
};
|
|
130
|
-
export type PolarMarkLineAttrs = CommonMarkLineAttrs & {
|
|
132
|
+
export type PolarMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {
|
|
131
133
|
type?: 'polar-line';
|
|
132
134
|
points: Point[] | Point[][];
|
|
133
135
|
lineStyle?: ILineGraphicAttribute;
|
|
134
136
|
};
|
|
135
|
-
export type PolarMarkArcLineAttrs = CommonMarkLineAttrs & {
|
|
137
|
+
export type PolarMarkArcLineAttrs = CommonMarkLineAttrs<keyof typeof IPolarMarkLabelPosition> & {
|
|
136
138
|
type?: 'polar-arc-line';
|
|
137
139
|
center: {
|
|
138
140
|
x: number;
|
|
@@ -164,9 +166,9 @@ export type PolarMarkAreaAttrs = MarkerAttrs & {
|
|
|
164
166
|
startAngle: number;
|
|
165
167
|
endAngle: number;
|
|
166
168
|
label?: {
|
|
167
|
-
position?: keyof typeof
|
|
169
|
+
position?: keyof typeof IPolarMarkLabelPosition;
|
|
168
170
|
confine?: boolean;
|
|
169
|
-
} & IMarkLabel;
|
|
171
|
+
} & IMarkRef & IMarkLabel;
|
|
170
172
|
areaStyle?: IArcGraphicAttribute;
|
|
171
173
|
state?: PolarMarkAreaState;
|
|
172
174
|
} & BaseMarkerAnimation<CommonMarkAreaAnimationType>;
|