@visactor/vrender-components 0.20.1-alpha.4 → 0.20.1-alpha.6
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/axis/base.d.ts +1 -0
- package/cjs/axis/base.js +4 -3
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/constant.d.ts +1 -0
- package/cjs/axis/constant.js +1 -1
- package/cjs/axis/constant.js.map +1 -1
- package/cjs/axis/line.js +30 -23
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-rotate.js +3 -3
- package/cjs/axis/overlap/auto-rotate.js.map +1 -1
- package/cjs/axis/tick-data/continuous.js +6 -8
- package/cjs/axis/tick-data/continuous.js.map +1 -1
- package/cjs/axis/type.d.ts +1 -0
- package/cjs/axis/type.js.map +1 -1
- package/cjs/crosshair/polygon.js +1 -2
- package/cjs/data-zoom/config.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/indicator.js +4 -3
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/label/arc.js +15 -2
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +15 -2
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +14 -2
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/line.js +21 -3
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/polygon.js +14 -2
- package/cjs/label/polygon.js.map +1 -1
- package/cjs/label/rect.js +14 -1
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.js +14 -2
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/poptip/contribution.js +3 -3
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/util/align.js +31 -51
- package/cjs/util/align.js.map +1 -1
- package/dist/index.es.js +100 -95
- package/es/axis/base.d.ts +1 -0
- package/es/axis/base.js +4 -3
- package/es/axis/base.js.map +1 -1
- package/es/axis/constant.d.ts +1 -0
- package/es/axis/constant.js +1 -1
- package/es/axis/constant.js.map +1 -1
- package/es/axis/line.js +30 -22
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-rotate.js +3 -3
- package/es/axis/overlap/auto-rotate.js.map +1 -1
- package/es/axis/tick-data/continuous.js +6 -8
- package/es/axis/tick-data/continuous.js.map +1 -1
- package/es/axis/type.d.ts +1 -0
- package/es/axis/type.js.map +1 -1
- package/es/crosshair/polygon.js +1 -2
- package/es/data-zoom/config.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/indicator.js +4 -3
- package/es/indicator/indicator.js.map +1 -1
- package/es/label/arc.js +15 -2
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +15 -2
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +14 -2
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/line.js +21 -3
- package/es/label/line.js.map +1 -1
- package/es/label/polygon.js +14 -2
- package/es/label/polygon.js.map +1 -1
- package/es/label/rect.js +14 -1
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.js +14 -2
- package/es/label/symbol.js.map +1 -1
- package/es/poptip/contribution.js +3 -3
- package/es/poptip/contribution.js.map +1 -1
- package/es/util/align.js +31 -51
- package/es/util/align.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAQA,yDAAoD;AACpD,qCAAkC;AAClC,6CAAyC;AACzC,mCAAgC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,IAAA,cAAK,EAAC,MAAM,EAAE,aAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAA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CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAC5C,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC5C;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,MAAA,IAAI,CAAC,eAAe,CAAC,MAAM,0CAAE,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAChE;SACF;IACH,CAAC;CACF,CAAA;AAlEY,wBAAwB;IADpC,IAAA,yBAAU,GAAE;GACA,wBAAwB,CAkEpC;AAlEY,4DAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n if (this.poptipComponent) {\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n this.poptipComponent.parent?.removeChild(this.poptipComponent);\n }\n }\n }\n}\n"]}
|
package/cjs/util/align.js
CHANGED
|
@@ -1,57 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function alignAxisLabels(labels, start, containerSize, orient, align) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
textBaseline: "top"
|
|
36
|
-
});
|
|
37
|
-
}));
|
|
38
|
-
} else if ("bottom" === align) {
|
|
39
|
-
const flag = "bottom" === orient ? 1 : 0;
|
|
40
|
-
labels.forEach((label => {
|
|
41
|
-
label.setAttributes({
|
|
42
|
-
y: start + containerSize * flag,
|
|
43
|
-
textBaseline: "bottom"
|
|
44
|
-
});
|
|
45
|
-
}));
|
|
46
|
-
} else if ("middle" === align) {
|
|
47
|
-
const flag = "bottom" === orient ? 1 : -1;
|
|
48
|
-
labels.forEach((label => {
|
|
49
|
-
label.setAttributes({
|
|
50
|
-
y: start + .5 * containerSize * flag,
|
|
51
|
-
textBaseline: "middle"
|
|
52
|
-
});
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
4
|
+
"left" === orient || "right" === orient ? "left" === align ? labels.forEach((label => {
|
|
5
|
+
var _a;
|
|
6
|
+
label.setAttributes({
|
|
7
|
+
dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.x1
|
|
8
|
+
});
|
|
9
|
+
})) : "right" === align ? labels.forEach((label => {
|
|
10
|
+
var _a;
|
|
11
|
+
label.setAttributes({
|
|
12
|
+
dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.x2
|
|
13
|
+
});
|
|
14
|
+
})) : "center" === align && labels.forEach((label => {
|
|
15
|
+
var _a;
|
|
16
|
+
label.setAttributes({
|
|
17
|
+
dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2
|
|
18
|
+
});
|
|
19
|
+
})) : "bottom" !== orient && "top" !== orient || ("top" === align ? labels.forEach((label => {
|
|
20
|
+
var _a;
|
|
21
|
+
label.setAttributes({
|
|
22
|
+
dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.y1
|
|
23
|
+
});
|
|
24
|
+
})) : "bottom" === align ? labels.forEach((label => {
|
|
25
|
+
var _a;
|
|
26
|
+
label.setAttributes({
|
|
27
|
+
dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.y2
|
|
28
|
+
});
|
|
29
|
+
})) : "middle" === align && labels.forEach((label => {
|
|
30
|
+
var _a;
|
|
31
|
+
label.setAttributes({
|
|
32
|
+
dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2
|
|
33
|
+
});
|
|
34
|
+
})));
|
|
55
35
|
}
|
|
56
36
|
|
|
57
37
|
Object.defineProperty(exports, "__esModule", {
|
package/cjs/util/align.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/align.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,MAAe,EAAE,KAAa,EAAE,aAAqB,EAAE,MAAc,EAAE,KAAa;IAClH,IAAI,MAAM,KAAK,
|
|
1
|
+
{"version":3,"sources":["../src/util/align.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,MAAe,EAAE,KAAa,EAAE,aAAqB,EAAE,MAAc,EAAE,KAAa;IAClH,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE;QAC3C,IAAI,KAAK,KAAK,MAAM,EAAE;YACpB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,KAA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,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE;iBAC5E,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC;iBAC5G,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AA1CD,0CA0CC","file":"align.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\n\nexport function alignAxisLabels(labels: IText[], start: number, containerSize: number, orient: string, align: string) {\n if (orient === 'left' || orient === 'right') {\n if (align === 'left') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start - label.AABBBounds.x1\n });\n });\n } else if (align === 'right') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize - label.AABBBounds.x2\n });\n });\n } else if (align === 'center') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2\n });\n });\n }\n } else if (orient === 'bottom' || orient === 'top') {\n if (align === 'top') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start - label.AABBBounds.y1\n });\n });\n } else if (align === 'bottom') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize - label.AABBBounds.y2\n });\n });\n } else if (align === 'middle') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2\n });\n });\n }\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -15166,7 +15166,7 @@ function wrapPoptip(target, source) {
|
|
|
15166
15166
|
}
|
|
15167
15167
|
let PopTipRenderContribution = class PopTipRenderContribution {
|
|
15168
15168
|
render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
15169
|
-
var _a;
|
|
15169
|
+
var _a, _b;
|
|
15170
15170
|
if (graphic._showPoptip === 1) {
|
|
15171
15171
|
const { visible, visibleCb } = graphic.attribute.poptip || {};
|
|
15172
15172
|
if (visible === false || (visibleCb && visibleCb(graphic) === false)) {
|
|
@@ -15197,10 +15197,12 @@ let PopTipRenderContribution = class PopTipRenderContribution {
|
|
|
15197
15197
|
}
|
|
15198
15198
|
else if (graphic._showPoptip === 2) {
|
|
15199
15199
|
graphic._showPoptip = 0;
|
|
15200
|
-
this.poptipComponent
|
|
15200
|
+
if (this.poptipComponent) {
|
|
15201
15201
|
this.poptipComponent.setAttributes({
|
|
15202
15202
|
visibleAll: false
|
|
15203
15203
|
});
|
|
15204
|
+
(_b = this.poptipComponent.parent) === null || _b === void 0 ? void 0 : _b.removeChild(this.poptipComponent);
|
|
15205
|
+
}
|
|
15204
15206
|
}
|
|
15205
15207
|
}
|
|
15206
15208
|
};
|
|
@@ -16069,7 +16071,8 @@ class LabelBase extends AbstractComponent {
|
|
|
16069
16071
|
this._bmpTool = bmpTool;
|
|
16070
16072
|
}
|
|
16071
16073
|
constructor(attributes, options) {
|
|
16072
|
-
|
|
16074
|
+
const { data } = attributes, restAttributes = __rest(attributes, ["data"]);
|
|
16075
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ data }, merge({}, LabelBase.defaultAttributes, restAttributes)));
|
|
16073
16076
|
this.name = 'label';
|
|
16074
16077
|
this._onHover = (e) => {
|
|
16075
16078
|
const target = e.target;
|
|
@@ -16771,7 +16774,8 @@ const getLabelComponent = (type) => {
|
|
|
16771
16774
|
|
|
16772
16775
|
class SymbolLabel extends LabelBase {
|
|
16773
16776
|
constructor(attributes, options) {
|
|
16774
|
-
|
|
16777
|
+
const { data } = attributes, restAttributes = __rest(attributes, ["data"]);
|
|
16778
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ data }, merge({}, SymbolLabel.defaultAttributes, restAttributes)));
|
|
16775
16779
|
this.name = 'symbol-label';
|
|
16776
16780
|
}
|
|
16777
16781
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
@@ -16792,7 +16796,8 @@ const registerSymbolDataLabel = () => {
|
|
|
16792
16796
|
|
|
16793
16797
|
class RectLabel extends LabelBase {
|
|
16794
16798
|
constructor(attributes, options) {
|
|
16795
|
-
|
|
16799
|
+
const { data } = attributes, restAttributes = __rest(attributes, ["data"]);
|
|
16800
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ data }, merge({}, RectLabel.defaultAttributes, restAttributes)));
|
|
16796
16801
|
}
|
|
16797
16802
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
16798
16803
|
if (!textBounds || !graphicBounds) {
|
|
@@ -16846,14 +16851,25 @@ const registerRectDataLabel = () => {
|
|
|
16846
16851
|
|
|
16847
16852
|
class LineLabel extends LabelBase {
|
|
16848
16853
|
constructor(attributes, options) {
|
|
16849
|
-
|
|
16854
|
+
const { data } = attributes, restAttributes = __rest(attributes, ["data"]);
|
|
16855
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ data }, merge({}, LineLabel.defaultAttributes, restAttributes)));
|
|
16850
16856
|
this.name = 'line-label';
|
|
16851
16857
|
}
|
|
16852
16858
|
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
16853
16859
|
if (!graphic || (graphic.type !== 'line' && graphic.type !== 'area')) {
|
|
16854
16860
|
return super.getGraphicBounds(graphic, point);
|
|
16855
16861
|
}
|
|
16856
|
-
|
|
16862
|
+
let points = graphic.attribute.points;
|
|
16863
|
+
const segments = graphic.attribute.segments;
|
|
16864
|
+
if (!points && segments && segments.length) {
|
|
16865
|
+
points = segments.reduce((res, seg) => {
|
|
16866
|
+
var _a;
|
|
16867
|
+
return res.concat((_a = seg.points) !== null && _a !== void 0 ? _a : []);
|
|
16868
|
+
}, []);
|
|
16869
|
+
}
|
|
16870
|
+
if (!points || points.length === 0) {
|
|
16871
|
+
points = [point];
|
|
16872
|
+
}
|
|
16857
16873
|
const index = position === 'start' ? 0 : points.length - 1;
|
|
16858
16874
|
if (!points[index]) {
|
|
16859
16875
|
return;
|
|
@@ -16909,7 +16925,8 @@ class ArcInfo {
|
|
|
16909
16925
|
}
|
|
16910
16926
|
class ArcLabel extends LabelBase {
|
|
16911
16927
|
constructor(attributes, options) {
|
|
16912
|
-
|
|
16928
|
+
const { data } = attributes, restAttributes = __rest(attributes, ["data"]);
|
|
16929
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ data }, merge({}, ArcLabel.defaultAttributes, restAttributes)));
|
|
16913
16930
|
this.name = 'arc-label';
|
|
16914
16931
|
this._ellipsisWidth = 0;
|
|
16915
16932
|
this._arcLeft = new Map();
|
|
@@ -17630,7 +17647,8 @@ const registerArcDataLabel = () => {
|
|
|
17630
17647
|
|
|
17631
17648
|
class DataLabel extends AbstractComponent {
|
|
17632
17649
|
constructor(attributes, options) {
|
|
17633
|
-
|
|
17650
|
+
const { dataLabels } = attributes, restAttributes = __rest(attributes, ["dataLabels"]);
|
|
17651
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : Object.assign({ dataLabels }, merge({}, DataLabel.defaultAttributes, restAttributes)));
|
|
17634
17652
|
this.name = 'data-label';
|
|
17635
17653
|
}
|
|
17636
17654
|
render() {
|
|
@@ -18010,6 +18028,7 @@ var AXIS_ELEMENT_NAME;
|
|
|
18010
18028
|
AXIS_ELEMENT_NAME["line"] = "axis-line";
|
|
18011
18029
|
AXIS_ELEMENT_NAME["background"] = "axis-background";
|
|
18012
18030
|
AXIS_ELEMENT_NAME["axisLabelBackground"] = "axis-label-background";
|
|
18031
|
+
AXIS_ELEMENT_NAME["axisBreak"] = "axis-break";
|
|
18013
18032
|
AXIS_ELEMENT_NAME["axisBreakSymbol"] = "axis-break-symbol";
|
|
18014
18033
|
})(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
18015
18034
|
var AxisStateValue;
|
|
@@ -18366,7 +18385,8 @@ class AxisBase extends AbstractComponent {
|
|
|
18366
18385
|
let maxTextHeight = 0;
|
|
18367
18386
|
let textAlign = 'center';
|
|
18368
18387
|
let textBaseline = 'middle';
|
|
18369
|
-
|
|
18388
|
+
let labelPos = 0;
|
|
18389
|
+
labels.forEach((label, index) => {
|
|
18370
18390
|
var _a;
|
|
18371
18391
|
const labelStyle = label.attribute;
|
|
18372
18392
|
const angle = (_a = labelStyle.angle) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -18381,10 +18401,14 @@ class AxisBase extends AbstractComponent {
|
|
|
18381
18401
|
maxTextHeight = Math.max(maxTextHeight, textHeight);
|
|
18382
18402
|
textAlign = labelStyle.textAlign;
|
|
18383
18403
|
textBaseline = labelStyle.textBaseline;
|
|
18404
|
+
if (index === 0) {
|
|
18405
|
+
labelPos = labelStyle.x;
|
|
18406
|
+
}
|
|
18384
18407
|
});
|
|
18385
18408
|
this.axisLabelLayerSize[layer] = {
|
|
18386
18409
|
width: maxTextWidth,
|
|
18387
18410
|
height: maxTextHeight,
|
|
18411
|
+
labelPos,
|
|
18388
18412
|
textAlign,
|
|
18389
18413
|
textBaseline
|
|
18390
18414
|
};
|
|
@@ -18876,11 +18900,11 @@ function getXAxisLabelAlign(orient, angle = 0) {
|
|
|
18876
18900
|
};
|
|
18877
18901
|
}
|
|
18878
18902
|
function getYAxisLabelAlign(orient, angle = 0) {
|
|
18879
|
-
let align = ['right', 'right', 'center', 'left', '
|
|
18903
|
+
let align = ['right', 'right', 'center', 'left', 'left', 'left', 'center', 'right', 'right'];
|
|
18880
18904
|
let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle'];
|
|
18881
18905
|
if (orient === 'right') {
|
|
18882
|
-
align = ['left', '
|
|
18883
|
-
baseline = ['middle', '
|
|
18906
|
+
align = ['left', 'left', 'center', 'right', 'right', 'right', 'center', 'left', 'left'];
|
|
18907
|
+
baseline = ['middle', 'middle', 'bottom', 'bottom', 'middle', 'middle', 'top', 'middle', 'middle'];
|
|
18884
18908
|
}
|
|
18885
18909
|
angle = clampAngle(angle);
|
|
18886
18910
|
const step = angle / (Math.PI * 0.5);
|
|
@@ -18972,60 +18996,54 @@ function autoLimit(labels, config) {
|
|
|
18972
18996
|
}
|
|
18973
18997
|
|
|
18974
18998
|
function alignAxisLabels(labels, start, containerSize, orient, align) {
|
|
18975
|
-
if (orient === '
|
|
18999
|
+
if (orient === 'left' || orient === 'right') {
|
|
18976
19000
|
if (align === 'left') {
|
|
18977
|
-
const flag = orient === 'right' ? 0 : -1;
|
|
18978
19001
|
labels.forEach(label => {
|
|
19002
|
+
var _a;
|
|
18979
19003
|
label.setAttributes({
|
|
18980
|
-
|
|
18981
|
-
textAlign: 'left'
|
|
19004
|
+
dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start - label.AABBBounds.x1
|
|
18982
19005
|
});
|
|
18983
19006
|
});
|
|
18984
19007
|
}
|
|
18985
19008
|
else if (align === 'right') {
|
|
18986
|
-
const flag = orient === 'right' ? 1 : 0;
|
|
18987
19009
|
labels.forEach(label => {
|
|
19010
|
+
var _a;
|
|
18988
19011
|
label.setAttributes({
|
|
18989
|
-
|
|
18990
|
-
textAlign: 'right'
|
|
19012
|
+
dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start + containerSize - label.AABBBounds.x2
|
|
18991
19013
|
});
|
|
18992
19014
|
});
|
|
18993
19015
|
}
|
|
18994
19016
|
else if (align === 'center') {
|
|
18995
|
-
const flag = orient === 'right' ? 1 : -1;
|
|
18996
19017
|
labels.forEach(label => {
|
|
19018
|
+
var _a;
|
|
18997
19019
|
label.setAttributes({
|
|
18998
|
-
|
|
18999
|
-
textAlign: 'center'
|
|
19020
|
+
dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2
|
|
19000
19021
|
});
|
|
19001
19022
|
});
|
|
19002
19023
|
}
|
|
19003
19024
|
}
|
|
19004
19025
|
else if (orient === 'bottom' || orient === 'top') {
|
|
19005
19026
|
if (align === 'top') {
|
|
19006
|
-
const flag = orient === 'bottom' ? 0 : -1;
|
|
19007
19027
|
labels.forEach(label => {
|
|
19028
|
+
var _a;
|
|
19008
19029
|
label.setAttributes({
|
|
19009
|
-
|
|
19010
|
-
textBaseline: 'top'
|
|
19030
|
+
dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start - label.AABBBounds.y1
|
|
19011
19031
|
});
|
|
19012
19032
|
});
|
|
19013
19033
|
}
|
|
19014
19034
|
else if (align === 'bottom') {
|
|
19015
|
-
const flag = orient === 'bottom' ? 1 : 0;
|
|
19016
19035
|
labels.forEach(label => {
|
|
19036
|
+
var _a;
|
|
19017
19037
|
label.setAttributes({
|
|
19018
|
-
|
|
19019
|
-
textBaseline: 'bottom'
|
|
19038
|
+
dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start + containerSize - label.AABBBounds.y2
|
|
19020
19039
|
});
|
|
19021
19040
|
});
|
|
19022
19041
|
}
|
|
19023
19042
|
else if (align === 'middle') {
|
|
19024
|
-
const flag = orient === 'bottom' ? 1 : -1;
|
|
19025
19043
|
labels.forEach(label => {
|
|
19044
|
+
var _a;
|
|
19026
19045
|
label.setAttributes({
|
|
19027
|
-
|
|
19028
|
-
textBaseline: 'middle'
|
|
19046
|
+
dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2
|
|
19029
19047
|
});
|
|
19030
19048
|
});
|
|
19031
19049
|
}
|
|
@@ -19088,30 +19106,39 @@ class LineAxis extends AxisBase {
|
|
|
19088
19106
|
_renderInner(container) {
|
|
19089
19107
|
var _a;
|
|
19090
19108
|
if (this.attribute.breaks && this.attribute.breaks.length) {
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
const { range, breakSymbol } =
|
|
19095
|
-
|
|
19109
|
+
const transformedBreaks = [];
|
|
19110
|
+
for (let index = 0; index < this.attribute.breaks.length; index++) {
|
|
19111
|
+
const aBreak = this.attribute.breaks[index];
|
|
19112
|
+
const { range, breakSymbol, rawRange } = aBreak;
|
|
19113
|
+
transformedBreaks.push({
|
|
19096
19114
|
startPoint: this.getTickCoord(range[0]),
|
|
19097
19115
|
endPoint: this.getTickCoord(range[1]),
|
|
19098
19116
|
range,
|
|
19099
|
-
breakSymbol
|
|
19100
|
-
|
|
19101
|
-
|
|
19117
|
+
breakSymbol,
|
|
19118
|
+
rawRange
|
|
19119
|
+
});
|
|
19120
|
+
}
|
|
19121
|
+
this._breaks = transformedBreaks;
|
|
19102
19122
|
}
|
|
19103
19123
|
super._renderInner(container);
|
|
19104
19124
|
if (this._breaks && this._breaks.length) {
|
|
19105
|
-
this._breaks.forEach(b => {
|
|
19106
|
-
const { startPoint, endPoint, breakSymbol } = b;
|
|
19125
|
+
this._breaks.forEach((b, index) => {
|
|
19126
|
+
const { startPoint, endPoint, breakSymbol, rawRange } = b;
|
|
19107
19127
|
if ((breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.visible) !== false) {
|
|
19128
|
+
const axisBreakGroup = graphicCreator.group({
|
|
19129
|
+
zIndex: 99
|
|
19130
|
+
});
|
|
19131
|
+
axisBreakGroup.name = AXIS_ELEMENT_NAME.axisBreak;
|
|
19132
|
+
axisBreakGroup.id = this._getNodeId(`${AXIS_ELEMENT_NAME.axisBreak}-${index}`);
|
|
19133
|
+
axisBreakGroup.data = rawRange;
|
|
19108
19134
|
const symbolStyle = getAxisBreakSymbolAttrs(breakSymbol);
|
|
19109
19135
|
const shape1 = graphicCreator.symbol(Object.assign({ x: startPoint.x, y: startPoint.y }, symbolStyle));
|
|
19110
19136
|
shape1.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19111
19137
|
const shape2 = graphicCreator.symbol(Object.assign({ x: endPoint.x, y: endPoint.y }, symbolStyle));
|
|
19112
19138
|
shape2.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19113
|
-
|
|
19114
|
-
|
|
19139
|
+
axisBreakGroup.add(shape1);
|
|
19140
|
+
axisBreakGroup.add(shape2);
|
|
19141
|
+
container.add(axisBreakGroup);
|
|
19115
19142
|
}
|
|
19116
19143
|
});
|
|
19117
19144
|
}
|
|
@@ -19187,9 +19214,20 @@ class LineAxis extends AxisBase {
|
|
|
19187
19214
|
}
|
|
19188
19215
|
else {
|
|
19189
19216
|
if (axisVector[0] === 0) {
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19217
|
+
if (this.axisLabelsContainer &&
|
|
19218
|
+
this.axisLabelsContainer.AABBBounds &&
|
|
19219
|
+
!this.axisLabelsContainer.AABBBounds.empty()) {
|
|
19220
|
+
const baseX = this.axisLabelLayerSize[0].labelPos;
|
|
19221
|
+
const bounds = this.axisLabelsContainer.AABBBounds;
|
|
19222
|
+
labelLength +=
|
|
19223
|
+
(factor === 1
|
|
19224
|
+
? bounds.x2 > baseX
|
|
19225
|
+
? Math.min(bounds.x2 - baseX, bounds.width())
|
|
19226
|
+
: 0
|
|
19227
|
+
: bounds.x1 < baseX
|
|
19228
|
+
? Math.min(baseX - bounds.x1, bounds.width())
|
|
19229
|
+
: 0) +
|
|
19230
|
+
(layerCount - 1) * space;
|
|
19193
19231
|
}
|
|
19194
19232
|
else {
|
|
19195
19233
|
labelLength = 0;
|
|
@@ -19200,36 +19238,6 @@ class LineAxis extends AxisBase {
|
|
|
19200
19238
|
labelLength += this.axisLabelLayerSize[layer].width + (index > 0 ? space : 0);
|
|
19201
19239
|
});
|
|
19202
19240
|
}
|
|
19203
|
-
const textAlign = this.axisLabelLayerSize[0].textAlign;
|
|
19204
|
-
const isTextAlignStart = textAlign === 'start' || textAlign === 'left';
|
|
19205
|
-
const isTextCenter = textAlign === 'center';
|
|
19206
|
-
const isReverse = axisVector[1] > 0;
|
|
19207
|
-
if (factor === 1) {
|
|
19208
|
-
labelLength = isReverse
|
|
19209
|
-
? isTextAlignStart
|
|
19210
|
-
? labelLength
|
|
19211
|
-
: isTextCenter
|
|
19212
|
-
? labelLength / 2
|
|
19213
|
-
: space
|
|
19214
|
-
: isTextAlignStart
|
|
19215
|
-
? space
|
|
19216
|
-
: isTextCenter
|
|
19217
|
-
? labelLength / 2
|
|
19218
|
-
: labelLength;
|
|
19219
|
-
}
|
|
19220
|
-
else {
|
|
19221
|
-
labelLength = isReverse
|
|
19222
|
-
? isTextAlignStart
|
|
19223
|
-
? space
|
|
19224
|
-
: isTextCenter
|
|
19225
|
-
? labelLength / 2
|
|
19226
|
-
: labelLength
|
|
19227
|
-
: isTextAlignStart
|
|
19228
|
-
? labelLength
|
|
19229
|
-
: isTextCenter
|
|
19230
|
-
? labelLength / 2
|
|
19231
|
-
: space;
|
|
19232
|
-
}
|
|
19233
19241
|
}
|
|
19234
19242
|
}
|
|
19235
19243
|
let tickLength = 0;
|
|
@@ -19517,13 +19525,13 @@ class LineAxis extends AxisBase {
|
|
|
19517
19525
|
if (isValid(this.attribute.label.containerAlign)) {
|
|
19518
19526
|
let start;
|
|
19519
19527
|
if (orient === 'left') {
|
|
19520
|
-
start = axisLabelContainerBounds.x2;
|
|
19528
|
+
start = axisLabelContainerBounds.x2 - axisLabelContainerSize;
|
|
19521
19529
|
}
|
|
19522
19530
|
else if (orient === 'right') {
|
|
19523
19531
|
start = axisLabelContainerBounds.x1;
|
|
19524
19532
|
}
|
|
19525
19533
|
else if (orient === 'top') {
|
|
19526
|
-
start = axisLabelContainerBounds.y2;
|
|
19534
|
+
start = axisLabelContainerBounds.y2 - axisLabelContainerSize;
|
|
19527
19535
|
}
|
|
19528
19536
|
else if (orient === 'bottom') {
|
|
19529
19537
|
start = axisLabelContainerBounds.y1;
|
|
@@ -19923,22 +19931,18 @@ function getScaleTicks(op, scale, count, getTicks) {
|
|
|
19923
19931
|
let scaleTicks;
|
|
19924
19932
|
const { breakData } = op;
|
|
19925
19933
|
if (breakData) {
|
|
19926
|
-
const {
|
|
19934
|
+
const { range: breakRanges } = breakData();
|
|
19927
19935
|
const domain = scale.domain();
|
|
19928
19936
|
scaleTicks = [];
|
|
19929
19937
|
for (let i = 0; i < domain.length; i++) {
|
|
19930
19938
|
if (i < domain.length - 1) {
|
|
19931
19939
|
const range = [domain[i], domain[i + 1]];
|
|
19932
|
-
const
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
|
|
19938
|
-
scaleTicks.push(tick);
|
|
19939
|
-
}
|
|
19940
|
-
});
|
|
19941
|
-
}
|
|
19940
|
+
const ticks = getTicks(count, range);
|
|
19941
|
+
ticks.forEach(tick => {
|
|
19942
|
+
if (!breakRanges.some((breakRange) => tick >= breakRange[0] && tick <= breakRange[1])) {
|
|
19943
|
+
scaleTicks.push(tick);
|
|
19944
|
+
}
|
|
19945
|
+
});
|
|
19942
19946
|
}
|
|
19943
19947
|
}
|
|
19944
19948
|
scale.domain(domain);
|
|
@@ -19998,8 +20002,9 @@ const continuousTicks = (scale, op) => {
|
|
|
19998
20002
|
AABBBounds: bounds,
|
|
19999
20003
|
value: scaleTicks[i]
|
|
20000
20004
|
}));
|
|
20005
|
+
const samplingMethod = breakData ? methods.greedy : methods.parity;
|
|
20001
20006
|
while (items.length >= 3 && hasOverlap(items, labelGap)) {
|
|
20002
|
-
items =
|
|
20007
|
+
items = samplingMethod(items, labelGap);
|
|
20003
20008
|
}
|
|
20004
20009
|
const ticks = items.map(item => item.value);
|
|
20005
20010
|
if (ticks.length < 3 && labelFlush) {
|
|
@@ -26206,14 +26211,14 @@ class Indicator extends AbstractComponent {
|
|
|
26206
26211
|
return undefined;
|
|
26207
26212
|
}
|
|
26208
26213
|
render() {
|
|
26209
|
-
var _a;
|
|
26214
|
+
var _a, _b;
|
|
26210
26215
|
this.removeAllChild(true);
|
|
26211
26216
|
if (this.attribute.visible !== true) {
|
|
26212
26217
|
return;
|
|
26213
26218
|
}
|
|
26214
26219
|
const { title = {}, content, size, limitRatio = Infinity } = this.attribute;
|
|
26215
26220
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
26216
|
-
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
26221
|
+
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1, pickable: (_a = this.attribute.pickable) !== null && _a !== void 0 ? _a : true }, 'group');
|
|
26217
26222
|
if (isValid(title)) {
|
|
26218
26223
|
this._title = this._renderText(group, title, limit, limitRatio, 'title.style', 'indicator-title');
|
|
26219
26224
|
}
|
|
@@ -26229,7 +26234,7 @@ class Indicator extends AbstractComponent {
|
|
|
26229
26234
|
}
|
|
26230
26235
|
this._setGlobalAutoFit(limit);
|
|
26231
26236
|
this._setYPosition();
|
|
26232
|
-
const totalHeight = (
|
|
26237
|
+
const totalHeight = (_b = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _b !== void 0 ? _b : 0;
|
|
26233
26238
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
26234
26239
|
group.setAttribute('x', size.width / 2);
|
|
26235
26240
|
}
|
|
@@ -28618,6 +28623,6 @@ EmptyTip.defaultAttributes = {
|
|
|
28618
28623
|
}
|
|
28619
28624
|
};
|
|
28620
28625
|
|
|
28621
|
-
const version = "0.20.1-alpha.
|
|
28626
|
+
const version = "0.20.1-alpha.6";
|
|
28622
28627
|
|
|
28623
28628
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
package/es/axis/base.d.ts
CHANGED
package/es/axis/base.js
CHANGED
|
@@ -82,17 +82,18 @@ export class AxisBase extends AbstractComponent {
|
|
|
82
82
|
this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length),
|
|
83
83
|
this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length),
|
|
84
84
|
this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
|
|
85
|
-
let maxTextWidth = 0, maxTextHeight = 0, textAlign = "center", textBaseline = "middle";
|
|
86
|
-
labels.forEach((label => {
|
|
85
|
+
let maxTextWidth = 0, maxTextHeight = 0, textAlign = "center", textBaseline = "middle", labelPos = 0;
|
|
86
|
+
labels.forEach(((label, index) => {
|
|
87
87
|
var _a;
|
|
88
88
|
const labelStyle = label.attribute, angle = null !== (_a = labelStyle.angle) && void 0 !== _a ? _a : 0, textBounds = label.AABBBounds;
|
|
89
89
|
let textWidth = textBounds.width(), textHeight = textBounds.height();
|
|
90
90
|
angle && (textWidth = Math.abs(textWidth * Math.cos(angle)), textHeight = Math.abs(textHeight * Math.sin(angle))),
|
|
91
91
|
maxTextWidth = Math.max(maxTextWidth, textWidth), maxTextHeight = Math.max(maxTextHeight, textHeight),
|
|
92
|
-
textAlign = labelStyle.textAlign, textBaseline = labelStyle.textBaseline;
|
|
92
|
+
textAlign = labelStyle.textAlign, textBaseline = labelStyle.textBaseline, 0 === index && (labelPos = labelStyle.x);
|
|
93
93
|
})), this.axisLabelLayerSize[layer] = {
|
|
94
94
|
width: maxTextWidth,
|
|
95
95
|
height: maxTextHeight,
|
|
96
|
+
labelPos: labelPos,
|
|
96
97
|
textAlign: textAlign,
|
|
97
98
|
textBaseline: textBaseline
|
|
98
99
|
};
|