@visactor/vrender-components 0.19.5 → 0.19.6-alpha.1
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/marker/common-line.js +1 -1
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/config.js +52 -4
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.js +5 -9
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +4 -3
- package/cjs/marker/point.js +34 -29
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +8 -2
- package/cjs/marker/type.js +7 -4
- package/cjs/marker/type.js.map +1 -1
- package/cjs/segment/arc-segment.js +4 -4
- package/cjs/segment/arc-segment.js.map +1 -1
- package/cjs/segment/segment.js +5 -5
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/util/common.d.ts +7 -2
- package/cjs/util/common.js +17 -7
- package/cjs/util/common.js.map +1 -1
- package/dist/index.es.js +154 -79
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/marker/common-line.js +1 -1
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/config.js +52 -4
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.js +4 -10
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +4 -3
- package/es/marker/point.js +31 -28
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +8 -2
- package/es/marker/type.js +7 -4
- package/es/marker/type.js.map +1 -1
- package/es/segment/arc-segment.js +4 -4
- package/es/segment/arc-segment.js.map +1 -1
- package/es/segment/segment.js +5 -5
- package/es/segment/segment.js.map +1 -1
- package/es/util/common.d.ts +7 -2
- package/es/util/common.js +14 -4
- package/es/util/common.js.map +1 -1
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -15541,14 +15541,33 @@ function removeRepeatPoint(points) {
|
|
|
15541
15541
|
}
|
|
15542
15542
|
return result;
|
|
15543
15543
|
}
|
|
15544
|
-
function
|
|
15545
|
-
return angle >
|
|
15544
|
+
function isPostiveXAxis(angle) {
|
|
15545
|
+
return (angle >= 0 && angle < Math.PI / 2) || (angle > (Math.PI * 3) / 2 && angle <= Math.PI * 2);
|
|
15546
15546
|
}
|
|
15547
|
-
function
|
|
15548
|
-
|
|
15549
|
-
|
|
15547
|
+
function fuzzyEqualNumber(a, b, delta) {
|
|
15548
|
+
return Math.abs(a - b) < delta;
|
|
15549
|
+
}
|
|
15550
|
+
function getTextAlignAttrOfVerticalDir(autoRotate, lineEndAngle, itemPosition) {
|
|
15551
|
+
if (autoRotate) {
|
|
15552
|
+
return {
|
|
15553
|
+
textAlign: 'right',
|
|
15554
|
+
textBaseline: 'middle'
|
|
15555
|
+
};
|
|
15550
15556
|
}
|
|
15551
|
-
return
|
|
15557
|
+
return {
|
|
15558
|
+
textAlign: (lineEndAngle < Math.PI && itemPosition.toLocaleLowerCase().includes('top')) ||
|
|
15559
|
+
(lineEndAngle > Math.PI && itemPosition.toLocaleLowerCase().includes('bottom'))
|
|
15560
|
+
? 'left'
|
|
15561
|
+
:
|
|
15562
|
+
(lineEndAngle < Math.PI && itemPosition.toLocaleLowerCase().includes('bottom')) ||
|
|
15563
|
+
(lineEndAngle > Math.PI && itemPosition.toLocaleLowerCase().includes('top'))
|
|
15564
|
+
? 'right'
|
|
15565
|
+
: 'center',
|
|
15566
|
+
textBaseline: (lineEndAngle < Math.PI && itemPosition.includes('inside')) ||
|
|
15567
|
+
(lineEndAngle > Math.PI && !itemPosition.includes('inside'))
|
|
15568
|
+
? 'bottom'
|
|
15569
|
+
: 'top'
|
|
15570
|
+
};
|
|
15552
15571
|
}
|
|
15553
15572
|
|
|
15554
15573
|
const defaultAlternativeColors = ['#ffffff', '#000000'];
|
|
@@ -18833,10 +18852,18 @@ function loadArcSegmentComponent() {
|
|
|
18833
18852
|
loadSegmentComponent();
|
|
18834
18853
|
class Segment extends AbstractComponent {
|
|
18835
18854
|
getStartAngle() {
|
|
18836
|
-
return this._startAngle
|
|
18855
|
+
return this._startAngle < 0
|
|
18856
|
+
? this._startAngle + Math.PI * 2
|
|
18857
|
+
: this._startAngle > Math.PI * 2
|
|
18858
|
+
? this._startAngle - Math.PI * 2
|
|
18859
|
+
: this._startAngle;
|
|
18837
18860
|
}
|
|
18838
18861
|
getEndAngle() {
|
|
18839
|
-
return this._endAngle
|
|
18862
|
+
return this._endAngle < 0
|
|
18863
|
+
? this._endAngle + Math.PI * 2
|
|
18864
|
+
: this._endAngle > Math.PI * 2
|
|
18865
|
+
? this._endAngle - Math.PI * 2
|
|
18866
|
+
: this._endAngle;
|
|
18840
18867
|
}
|
|
18841
18868
|
getMainSegmentPoints() {
|
|
18842
18869
|
return this._mainSegmentPoints;
|
|
@@ -18911,8 +18938,8 @@ class Segment extends AbstractComponent {
|
|
|
18911
18938
|
const { autoRotate = true } = attribute;
|
|
18912
18939
|
let symbol;
|
|
18913
18940
|
if (attribute && attribute.visible) {
|
|
18914
|
-
const startAngle = this.
|
|
18915
|
-
const endAngle = this.
|
|
18941
|
+
const startAngle = this.getStartAngle();
|
|
18942
|
+
const endAngle = this.getEndAngle();
|
|
18916
18943
|
const { state } = this.attribute;
|
|
18917
18944
|
const start = points[0];
|
|
18918
18945
|
const end = points[points.length - 1];
|
|
@@ -18926,14 +18953,14 @@ class Segment extends AbstractComponent {
|
|
|
18926
18953
|
y: start.y +
|
|
18927
18954
|
(isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
18928
18955
|
};
|
|
18929
|
-
rotate = this._computeStartRotate(
|
|
18956
|
+
rotate = this._computeStartRotate(this._startAngle);
|
|
18930
18957
|
}
|
|
18931
18958
|
else {
|
|
18932
18959
|
position = {
|
|
18933
18960
|
x: end.x + (isValidNumber(endAngle) ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
18934
18961
|
y: end.y + (isValidNumber(endAngle) ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
18935
18962
|
};
|
|
18936
|
-
rotate = this._computeEndRotate(
|
|
18963
|
+
rotate = this._computeEndRotate(this._endAngle);
|
|
18937
18964
|
}
|
|
18938
18965
|
symbol = graphicCreator.symbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
|
|
18939
18966
|
symbol.name = `${this.name}-${dim}-symbol`;
|
|
@@ -19063,12 +19090,12 @@ class ArcSegment extends Segment {
|
|
|
19063
19090
|
this.isReverseArc = false;
|
|
19064
19091
|
}
|
|
19065
19092
|
getStartAngle() {
|
|
19066
|
-
const
|
|
19067
|
-
return
|
|
19093
|
+
const tangAng = this.isReverseArc ? this._startAngle + Math.PI / 2 : this._startAngle - Math.PI / 2;
|
|
19094
|
+
return tangAng < 0 ? tangAng + Math.PI * 2 : tangAng > Math.PI * 2 ? tangAng - Math.PI * 2 : tangAng;
|
|
19068
19095
|
}
|
|
19069
19096
|
getEndAngle() {
|
|
19070
|
-
const
|
|
19071
|
-
return
|
|
19097
|
+
const tangAng = this.isReverseArc ? this._endAngle - Math.PI / 2 : this._endAngle + Math.PI / 2;
|
|
19098
|
+
return tangAng < 0 ? tangAng + Math.PI * 2 : tangAng > Math.PI * 2 ? tangAng - Math.PI * 2 : tangAng;
|
|
19072
19099
|
}
|
|
19073
19100
|
getMainSegmentPoints() {
|
|
19074
19101
|
return this._mainSegmentPoints;
|
|
@@ -22665,12 +22692,18 @@ DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
|
22665
22692
|
var IMarkLineLabelPosition;
|
|
22666
22693
|
(function (IMarkLineLabelPosition) {
|
|
22667
22694
|
IMarkLineLabelPosition["start"] = "start";
|
|
22668
|
-
IMarkLineLabelPosition["
|
|
22669
|
-
IMarkLineLabelPosition["
|
|
22695
|
+
IMarkLineLabelPosition["startTop"] = "startTop";
|
|
22696
|
+
IMarkLineLabelPosition["startBottom"] = "startBottom";
|
|
22697
|
+
IMarkLineLabelPosition["insideStart"] = "insideStart";
|
|
22670
22698
|
IMarkLineLabelPosition["insideStartTop"] = "insideStartTop";
|
|
22671
22699
|
IMarkLineLabelPosition["insideStartBottom"] = "insideStartBottom";
|
|
22700
|
+
IMarkLineLabelPosition["middle"] = "middle";
|
|
22672
22701
|
IMarkLineLabelPosition["insideMiddleTop"] = "insideMiddleTop";
|
|
22673
22702
|
IMarkLineLabelPosition["insideMiddleBottom"] = "insideMiddleBottom";
|
|
22703
|
+
IMarkLineLabelPosition["end"] = "end";
|
|
22704
|
+
IMarkLineLabelPosition["endTop"] = "endTop";
|
|
22705
|
+
IMarkLineLabelPosition["endBottom"] = "endBottom";
|
|
22706
|
+
IMarkLineLabelPosition["insideEnd"] = "insideEnd";
|
|
22674
22707
|
IMarkLineLabelPosition["insideEndTop"] = "insideEndTop";
|
|
22675
22708
|
IMarkLineLabelPosition["insideEndBottom"] = "insideEndBottom";
|
|
22676
22709
|
})(IMarkLineLabelPosition || (IMarkLineLabelPosition = {}));
|
|
@@ -23176,7 +23209,9 @@ class MarkCommonLine extends Marker {
|
|
|
23176
23209
|
const { label = {}, limitRect } = this.attribute;
|
|
23177
23210
|
const { position, confine, autoRotate } = label;
|
|
23178
23211
|
const labelPoint = this.getPointAttrByPosition(position);
|
|
23179
|
-
const labelAngle =
|
|
23212
|
+
const labelAngle = position.toString().toLocaleLowerCase().includes('start')
|
|
23213
|
+
? this._line.getStartAngle() || 0
|
|
23214
|
+
: this._line.getEndAngle() || 0;
|
|
23180
23215
|
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle) }));
|
|
23181
23216
|
if (limitRect && confine) {
|
|
23182
23217
|
const { x, y, width, height } = limitRect;
|
|
@@ -23262,15 +23297,27 @@ const DEFAULT_MARK_LINE_THEME = {
|
|
|
23262
23297
|
const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
23263
23298
|
postiveXAxis: {
|
|
23264
23299
|
start: {
|
|
23300
|
+
textAlign: 'left',
|
|
23301
|
+
textBaseline: 'middle'
|
|
23302
|
+
},
|
|
23303
|
+
startTop: {
|
|
23304
|
+
textAlign: 'left',
|
|
23305
|
+
textBaseline: 'bottom'
|
|
23306
|
+
},
|
|
23307
|
+
startBottom: {
|
|
23308
|
+
textAlign: 'left',
|
|
23309
|
+
textBaseline: 'top'
|
|
23310
|
+
},
|
|
23311
|
+
insideStart: {
|
|
23265
23312
|
textAlign: 'right',
|
|
23266
23313
|
textBaseline: 'middle'
|
|
23267
23314
|
},
|
|
23268
23315
|
insideStartTop: {
|
|
23269
|
-
textAlign: '
|
|
23316
|
+
textAlign: 'right',
|
|
23270
23317
|
textBaseline: 'bottom'
|
|
23271
23318
|
},
|
|
23272
23319
|
insideStartBottom: {
|
|
23273
|
-
textAlign: '
|
|
23320
|
+
textAlign: 'right',
|
|
23274
23321
|
textBaseline: 'top'
|
|
23275
23322
|
},
|
|
23276
23323
|
middle: {
|
|
@@ -23289,6 +23336,18 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23289
23336
|
textAlign: 'left',
|
|
23290
23337
|
textBaseline: 'middle'
|
|
23291
23338
|
},
|
|
23339
|
+
endTop: {
|
|
23340
|
+
textAlign: 'left',
|
|
23341
|
+
textBaseline: 'bottom'
|
|
23342
|
+
},
|
|
23343
|
+
endBottom: {
|
|
23344
|
+
textAlign: 'left',
|
|
23345
|
+
textBaseline: 'top'
|
|
23346
|
+
},
|
|
23347
|
+
insideEnd: {
|
|
23348
|
+
textAlign: 'right',
|
|
23349
|
+
textBaseline: 'middle'
|
|
23350
|
+
},
|
|
23292
23351
|
insideEndTop: {
|
|
23293
23352
|
textAlign: 'right',
|
|
23294
23353
|
textBaseline: 'bottom'
|
|
@@ -23300,15 +23359,27 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23300
23359
|
},
|
|
23301
23360
|
negativeXAxis: {
|
|
23302
23361
|
start: {
|
|
23362
|
+
textAlign: 'right',
|
|
23363
|
+
textBaseline: 'middle'
|
|
23364
|
+
},
|
|
23365
|
+
startTop: {
|
|
23366
|
+
textAlign: 'right',
|
|
23367
|
+
textBaseline: 'bottom'
|
|
23368
|
+
},
|
|
23369
|
+
startBottom: {
|
|
23370
|
+
textAlign: 'right',
|
|
23371
|
+
textBaseline: 'top'
|
|
23372
|
+
},
|
|
23373
|
+
insideStart: {
|
|
23303
23374
|
textAlign: 'left',
|
|
23304
23375
|
textBaseline: 'middle'
|
|
23305
23376
|
},
|
|
23306
23377
|
insideStartTop: {
|
|
23307
|
-
textAlign: '
|
|
23378
|
+
textAlign: 'left',
|
|
23308
23379
|
textBaseline: 'bottom'
|
|
23309
23380
|
},
|
|
23310
23381
|
insideStartBottom: {
|
|
23311
|
-
textAlign: '
|
|
23382
|
+
textAlign: 'left',
|
|
23312
23383
|
textBaseline: 'top'
|
|
23313
23384
|
},
|
|
23314
23385
|
middle: {
|
|
@@ -23327,6 +23398,18 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23327
23398
|
textAlign: 'right',
|
|
23328
23399
|
textBaseline: 'middle'
|
|
23329
23400
|
},
|
|
23401
|
+
endTop: {
|
|
23402
|
+
textAlign: 'right',
|
|
23403
|
+
textBaseline: 'bottom'
|
|
23404
|
+
},
|
|
23405
|
+
endBottom: {
|
|
23406
|
+
textAlign: 'right',
|
|
23407
|
+
textBaseline: 'top'
|
|
23408
|
+
},
|
|
23409
|
+
insideEnd: {
|
|
23410
|
+
textAlign: 'left',
|
|
23411
|
+
textBaseline: 'middle'
|
|
23412
|
+
},
|
|
23330
23413
|
insideEndTop: {
|
|
23331
23414
|
textAlign: 'left',
|
|
23332
23415
|
textBaseline: 'bottom'
|
|
@@ -23640,7 +23723,7 @@ class MarkLine extends MarkCommonLine {
|
|
|
23640
23723
|
const { refX = 0, refY = 0 } = label;
|
|
23641
23724
|
const points = this._line.getMainSegmentPoints();
|
|
23642
23725
|
const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
23643
|
-
const labelAngle =
|
|
23726
|
+
const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
|
|
23644
23727
|
const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);
|
|
23645
23728
|
const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
|
|
23646
23729
|
if (position.includes('start') || position.includes('Start')) {
|
|
@@ -23671,25 +23754,15 @@ class MarkLine extends MarkCommonLine {
|
|
|
23671
23754
|
}
|
|
23672
23755
|
getRotateByAngle(angle) {
|
|
23673
23756
|
var _a;
|
|
23674
|
-
const itemAngle =
|
|
23757
|
+
const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
|
|
23675
23758
|
return itemAngle + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
23676
23759
|
}
|
|
23677
23760
|
getTextStyle(position, labelAngle, autoRotate) {
|
|
23678
|
-
if (
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
textAlign: 'right',
|
|
23682
|
-
textBaseline: 'middle'
|
|
23683
|
-
};
|
|
23684
|
-
}
|
|
23685
|
-
return {
|
|
23686
|
-
textAlign: 'center',
|
|
23687
|
-
textBaseline: (labelAngle > 0 && position.includes('inside')) || (labelAngle < 0 && !position.includes('inside'))
|
|
23688
|
-
? 'bottom'
|
|
23689
|
-
: 'top'
|
|
23690
|
-
};
|
|
23761
|
+
if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, 0.0001) ||
|
|
23762
|
+
fuzzyEqualNumber(Math.abs(labelAngle), (Math.PI * 3) / 2, 0.0001)) {
|
|
23763
|
+
return getTextAlignAttrOfVerticalDir(autoRotate, labelAngle, position);
|
|
23691
23764
|
}
|
|
23692
|
-
if (
|
|
23765
|
+
if (isPostiveXAxis(labelAngle)) {
|
|
23693
23766
|
return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.postiveXAxis[position];
|
|
23694
23767
|
}
|
|
23695
23768
|
return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.negativeXAxis[position];
|
|
@@ -24108,6 +24181,7 @@ loadMarkPointComponent();
|
|
|
24108
24181
|
function registerMarkPointAnimate() {
|
|
24109
24182
|
MarkPoint._animate = markPointAnimate;
|
|
24110
24183
|
}
|
|
24184
|
+
const FUZZY_EQUAL_DELTA = 0.001;
|
|
24111
24185
|
class MarkPoint extends Marker {
|
|
24112
24186
|
markerAnimate(state) {
|
|
24113
24187
|
if (MarkPoint._animate && this._animationConfig) {
|
|
@@ -24120,18 +24194,16 @@ class MarkPoint extends Marker {
|
|
|
24120
24194
|
this.defaultUpdateAnimation = DefaultUpdateMarkPointAnimation;
|
|
24121
24195
|
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
24122
24196
|
this._isArcLine = false;
|
|
24197
|
+
this._isStraightLine = false;
|
|
24123
24198
|
}
|
|
24124
24199
|
setLabelPos() {
|
|
24125
24200
|
}
|
|
24126
24201
|
getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, itemPosition) {
|
|
24127
|
-
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
}
|
|
24131
|
-
else {
|
|
24132
|
-
isPostiveXAxis = isPostiveXAxisCartes(lineEndAngle);
|
|
24202
|
+
if (fuzzyEqualNumber(Math.abs(lineEndAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
|
|
24203
|
+
fuzzyEqualNumber(Math.abs(lineEndAngle), (Math.PI * 3) / 2, FUZZY_EQUAL_DELTA)) {
|
|
24204
|
+
return getTextAlignAttrOfVerticalDir(autoRotate, lineEndAngle, itemPosition);
|
|
24133
24205
|
}
|
|
24134
|
-
if (isPostiveXAxis) {
|
|
24206
|
+
if (isPostiveXAxis(lineEndAngle)) {
|
|
24135
24207
|
return DEFAULT_MARK_POINT_TEXT_STYLE_MAP.postiveXAxis[itemPosition];
|
|
24136
24208
|
}
|
|
24137
24209
|
return DEFAULT_MARK_POINT_TEXT_STYLE_MAP.negativeXAxis[itemPosition];
|
|
@@ -24144,8 +24216,8 @@ class MarkPoint extends Marker {
|
|
|
24144
24216
|
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle = {}, richTextStyle = {}, imageStyle = {}, position: positionType = IMarkPointItemPosition.middle } = itemContent;
|
|
24145
24217
|
const { state } = this.attribute;
|
|
24146
24218
|
const lineEndAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
24147
|
-
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle);
|
|
24148
|
-
const itemRefOffsetY = refX * Math.sin(lineEndAngle) + refY * Math.sin(lineEndAngle);
|
|
24219
|
+
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle - Math.PI / 2);
|
|
24220
|
+
const itemRefOffsetY = refX * Math.sin(lineEndAngle) + refY * Math.sin(lineEndAngle - Math.PI / 2);
|
|
24149
24221
|
if (itemType === 'text') {
|
|
24150
24222
|
const offsetX = newItemPosition.x - newPosition.x;
|
|
24151
24223
|
const offsetY = newItemPosition.y - newPosition.y;
|
|
@@ -24168,16 +24240,7 @@ class MarkPoint extends Marker {
|
|
|
24168
24240
|
});
|
|
24169
24241
|
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.image);
|
|
24170
24242
|
}
|
|
24171
|
-
|
|
24172
|
-
let itemAngle;
|
|
24173
|
-
if (this._isArcLine) {
|
|
24174
|
-
isPostiveXAxis = isPostiveXAxisPolar(lineEndAngle, this._line.isReverseArc);
|
|
24175
|
-
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI;
|
|
24176
|
-
}
|
|
24177
|
-
else {
|
|
24178
|
-
isPostiveXAxis = isPostiveXAxisCartes(lineEndAngle);
|
|
24179
|
-
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI;
|
|
24180
|
-
}
|
|
24243
|
+
const itemAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle - Math.PI;
|
|
24181
24244
|
item.setAttributes({
|
|
24182
24245
|
x: newItemPosition.x + (itemRefOffsetX || 0),
|
|
24183
24246
|
y: newItemPosition.y + (itemRefOffsetY || 0),
|
|
@@ -24243,6 +24306,10 @@ class MarkPoint extends Marker {
|
|
|
24243
24306
|
let startAngle = 0;
|
|
24244
24307
|
let endAngle = 0;
|
|
24245
24308
|
const { type = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24309
|
+
const itemOffsetX = newItemPosition.x - newPosition.x;
|
|
24310
|
+
const itemOffsetY = newItemPosition.y - newPosition.y;
|
|
24311
|
+
this._isStraightLine =
|
|
24312
|
+
fuzzyEqualNumber(itemOffsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(itemOffsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24246
24313
|
if (this._isArcLine) {
|
|
24247
24314
|
const { x: x1, y: y1 } = newPosition;
|
|
24248
24315
|
const { x: x2, y: y2 } = newItemPosition;
|
|
@@ -24254,12 +24321,22 @@ class MarkPoint extends Marker {
|
|
|
24254
24321
|
const deltaX = arcRatio * direction * x0;
|
|
24255
24322
|
const centerX = x0 + deltaX;
|
|
24256
24323
|
const centerY = line(centerX);
|
|
24257
|
-
center = { x: centerX, y: centerY };
|
|
24258
24324
|
startAngle = deltaXYToAngle(y1 - centerY, x1 - centerX);
|
|
24259
24325
|
endAngle = deltaXYToAngle(y2 - centerY, x2 - centerX);
|
|
24326
|
+
center = { x: centerX, y: centerY };
|
|
24327
|
+
if (arcRatio > 0) {
|
|
24328
|
+
if (endAngle < startAngle) {
|
|
24329
|
+
endAngle += Math.PI * 2;
|
|
24330
|
+
}
|
|
24331
|
+
}
|
|
24332
|
+
else {
|
|
24333
|
+
if (startAngle < endAngle) {
|
|
24334
|
+
startAngle += Math.PI * 2;
|
|
24335
|
+
}
|
|
24336
|
+
}
|
|
24260
24337
|
radius = Math.sqrt((centerX - x1) * (centerX - x1) + (centerY - y1) * (centerY - y1));
|
|
24261
24338
|
}
|
|
24262
|
-
else if (type === 'type-do') {
|
|
24339
|
+
else if (type === 'type-do' && !this._isStraightLine) {
|
|
24263
24340
|
points = [
|
|
24264
24341
|
newPosition,
|
|
24265
24342
|
{
|
|
@@ -24269,7 +24346,7 @@ class MarkPoint extends Marker {
|
|
|
24269
24346
|
newItemPosition
|
|
24270
24347
|
];
|
|
24271
24348
|
}
|
|
24272
|
-
else if (type === 'type-po') {
|
|
24349
|
+
else if (type === 'type-po' && !this._isStraightLine) {
|
|
24273
24350
|
points = [
|
|
24274
24351
|
newPosition,
|
|
24275
24352
|
{
|
|
@@ -24279,7 +24356,7 @@ class MarkPoint extends Marker {
|
|
|
24279
24356
|
newItemPosition
|
|
24280
24357
|
];
|
|
24281
24358
|
}
|
|
24282
|
-
else if (type === 'type-op') {
|
|
24359
|
+
else if (type === 'type-op' && !this._isStraightLine) {
|
|
24283
24360
|
points = [
|
|
24284
24361
|
newPosition,
|
|
24285
24362
|
{
|
|
@@ -24321,8 +24398,7 @@ class MarkPoint extends Marker {
|
|
|
24321
24398
|
const { startSymbol, endSymbol, lineStyle, type = 'type-s' } = itemLine;
|
|
24322
24399
|
const { state } = this.attribute;
|
|
24323
24400
|
const pointsAttr = this.getItemLineAttr(itemLine, newPosition, newItemPosition);
|
|
24324
|
-
if ((
|
|
24325
|
-
(type !== 'type-arc' && this._line.key === 'segment')) {
|
|
24401
|
+
if ((this._isArcLine && this._line.key === 'arc-segment') || (!this._isArcLine && this._line.key === 'segment')) {
|
|
24326
24402
|
this._line.setAttributes(Object.assign(Object.assign({}, pointsAttr), { startSymbol,
|
|
24327
24403
|
endSymbol,
|
|
24328
24404
|
lineStyle, visible: itemLine.visible, state: {
|
|
@@ -24404,24 +24480,23 @@ class MarkPoint extends Marker {
|
|
|
24404
24480
|
const targetSize = targetItemvisible ? targetSymbolSize || ((_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : 10) : 0;
|
|
24405
24481
|
const targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX);
|
|
24406
24482
|
const newPosition = {
|
|
24407
|
-
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
24408
|
-
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
24483
|
+
x: position.x + (targetSize / 2 + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
24484
|
+
y: position.y + (targetSize / 2 + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
24409
24485
|
};
|
|
24410
24486
|
const newItemPosition = {
|
|
24411
|
-
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle) + itemContentOffsetX,
|
|
24412
|
-
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle) + itemContentOffsetY
|
|
24487
|
+
x: position.x + (targetSize / 2 + targetSymbolOffset) * Math.cos(targetOffsetAngle) + itemContentOffsetX,
|
|
24488
|
+
y: position.y + (targetSize / 2 + targetSymbolOffset) * Math.sin(targetOffsetAngle) + itemContentOffsetY
|
|
24413
24489
|
};
|
|
24414
24490
|
return { newPosition, newItemPosition };
|
|
24415
24491
|
}
|
|
24416
24492
|
initMarker(container) {
|
|
24417
24493
|
const { position, itemContent = {}, itemLine } = this.attribute;
|
|
24418
24494
|
const { type: itemLineType = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24495
|
+
const { offsetX = 0, offsetY = 0 } = itemContent;
|
|
24496
|
+
this._isStraightLine =
|
|
24497
|
+
fuzzyEqualNumber(offsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(offsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24498
|
+
this._isArcLine = itemLineType === 'type-arc' && arcRatio !== 0 && !this._isStraightLine;
|
|
24419
24499
|
const { newPosition, newItemPosition } = this.computeNewPositionAfterTargetItem(position);
|
|
24420
|
-
this._isArcLine =
|
|
24421
|
-
itemLineType === 'type-arc' &&
|
|
24422
|
-
arcRatio !== 0 &&
|
|
24423
|
-
newPosition.x !== newItemPosition.x &&
|
|
24424
|
-
newPosition.y !== newItemPosition.y;
|
|
24425
24500
|
const lineConstructor = this._isArcLine ? ArcSegment : Segment;
|
|
24426
24501
|
const line = new lineConstructor({
|
|
24427
24502
|
points: [],
|
|
@@ -24453,11 +24528,11 @@ class MarkPoint extends Marker {
|
|
|
24453
24528
|
const { position, itemContent = {}, itemLine } = this.attribute;
|
|
24454
24529
|
const { type = 'text' } = itemContent;
|
|
24455
24530
|
const { type: itemLineType = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24531
|
+
const { offsetX = 0, offsetY = 0 } = itemContent;
|
|
24532
|
+
this._isStraightLine =
|
|
24533
|
+
fuzzyEqualNumber(offsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(offsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24534
|
+
const isArcLine = itemLineType === 'type-arc' && arcRatio !== 0 && !this._isStraightLine;
|
|
24456
24535
|
const { newPosition, newItemPosition } = this.computeNewPositionAfterTargetItem(position);
|
|
24457
|
-
const isArcLine = itemLineType === 'type-arc' &&
|
|
24458
|
-
arcRatio !== 0 &&
|
|
24459
|
-
newPosition.x !== newItemPosition.x &&
|
|
24460
|
-
newPosition.y !== newItemPosition.y;
|
|
24461
24536
|
if (isArcLine !== this._isArcLine) {
|
|
24462
24537
|
this._isArcLine = isArcLine;
|
|
24463
24538
|
this.reDrawLine(itemLine, {
|
|
@@ -29351,6 +29426,6 @@ Radio.defaultAttributes = {
|
|
|
29351
29426
|
}
|
|
29352
29427
|
};
|
|
29353
29428
|
|
|
29354
|
-
const version = "0.19.
|
|
29429
|
+
const version = "0.19.6-alpha.1";
|
|
29355
29430
|
|
|
29356
|
-
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, 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, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Title, Tooltip, VTag, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, getCircleLabelPosition, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getSizeHandlerPath, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange,
|
|
29431
|
+
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, 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, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Title, Tooltip, VTag, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, fuzzyEqualNumber, getCircleLabelPosition, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, loadPoptip, measureTextSize, normalize, reactAttributeTransform, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.6-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './util';\n"]}
|
package/es/marker/common-line.js
CHANGED
|
@@ -22,7 +22,7 @@ export class MarkCommonLine extends Marker {
|
|
|
22
22
|
return this._label;
|
|
23
23
|
}
|
|
24
24
|
setLabelPos() {
|
|
25
|
-
const {label: label = {}, limitRect: limitRect} = this.attribute, {position: position, confine: confine, autoRotate: autoRotate} = label, labelPoint = this.getPointAttrByPosition(position), labelAngle = this._line.getEndAngle() || 0;
|
|
25
|
+
const {label: label = {}, limitRect: limitRect} = this.attribute, {position: position, confine: confine, autoRotate: autoRotate} = label, labelPoint = this.getPointAttrByPosition(position), labelAngle = position.toString().toLocaleLowerCase().includes("start") ? this._line.getStartAngle() || 0 : this._line.getEndAngle() || 0;
|
|
26
26
|
if (this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), {
|
|
27
27
|
angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0,
|
|
28
28
|
textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAE/F,MAAM,OAAgB,cAAwC,SAAQ,MAGrE;IAHD;;QAIE,SAAI,GAAG,gBAAgB,CAAC;QAIxB,2BAAsB,GAAG,8BAA8B,CAAC;QACxD,yBAAoB,GAAG,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":"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","file":"common-line.js","sourcesContent":["import type { IGroup, INode } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { ArcSegment, Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport type { MarkCommonLineAnimationType, MarkCommonLineAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport { DEFAULT_STATES } from '../constant';\nimport { Marker } from './base';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkLineAnimation } from './animate/animate';\n\nexport abstract class MarkCommonLine<LineAttr, LabelPosition> extends Marker<\n MarkCommonLineAttrs<LineAttr, LabelPosition, MarkCommonLineAnimationType>,\n MarkCommonLineAnimationType\n> {\n name = 'markCommonLine';\n\n /** animate */\n static _animate?: (line: Segment | ArcSegment, label: Tag, animationConfig: any, state: MarkerAnimationState) => void;\n defaultUpdateAnimation = DefaultUpdateMarkLineAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n\n protected _line!: Segment | ArcSegment;\n protected abstract createSegment(): any;\n protected abstract setLineAttributes(): any;\n protected abstract getPointAttrByPosition(position: any): any;\n protected abstract getRotateByAngle(angle: number): number;\n protected abstract getTextStyle(position: any, labelAngle: number, autoRotate: boolean): any;\n protected abstract markerAnimate(state: MarkerAnimationState): void;\n\n getLine() {\n return this._line;\n }\n getLabel() {\n return this._label;\n }\n\n protected setLabelPos(): void {\n const { label = {}, limitRect } = this.attribute;\n const { position, confine, autoRotate } = label;\n const labelPoint = this.getPointAttrByPosition(position);\n const labelAngle = position.toString().toLocaleLowerCase().includes('start')\n ? this._line.getStartAngle() || 0\n : this._line.getEndAngle() || 0;\n this._label.setAttributes({\n ...labelPoint.position,\n angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0,\n textStyle: {\n ...this.getTextStyle(position, labelAngle, autoRotate),\n ...label.textStyle\n }\n });\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { label, state } = this.attribute as MarkCommonLineAttrs<\n LineAttr,\n LabelPosition,\n MarkCommonLineAnimationType\n >;\n const line = this.createSegment();\n line.name = 'mark-common-line-line';\n this._line = line;\n container.add(line as unknown as INode);\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-common-line-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { label, state } = this.attribute as MarkCommonLineAttrs<\n LineAttr,\n LabelPosition,\n MarkCommonLineAnimationType\n >;\n\n this.setLineAttributes();\n\n if (this._label) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n this.setLabelPos();\n }\n }\n}\n"]}
|
package/es/marker/config.js
CHANGED
|
@@ -47,15 +47,27 @@ export const DEFAULT_MARK_LINE_THEME = {
|
|
|
47
47
|
export const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
48
48
|
postiveXAxis: {
|
|
49
49
|
start: {
|
|
50
|
+
textAlign: "left",
|
|
51
|
+
textBaseline: "middle"
|
|
52
|
+
},
|
|
53
|
+
startTop: {
|
|
54
|
+
textAlign: "left",
|
|
55
|
+
textBaseline: "bottom"
|
|
56
|
+
},
|
|
57
|
+
startBottom: {
|
|
58
|
+
textAlign: "left",
|
|
59
|
+
textBaseline: "top"
|
|
60
|
+
},
|
|
61
|
+
insideStart: {
|
|
50
62
|
textAlign: "right",
|
|
51
63
|
textBaseline: "middle"
|
|
52
64
|
},
|
|
53
65
|
insideStartTop: {
|
|
54
|
-
textAlign: "
|
|
66
|
+
textAlign: "right",
|
|
55
67
|
textBaseline: "bottom"
|
|
56
68
|
},
|
|
57
69
|
insideStartBottom: {
|
|
58
|
-
textAlign: "
|
|
70
|
+
textAlign: "right",
|
|
59
71
|
textBaseline: "top"
|
|
60
72
|
},
|
|
61
73
|
middle: {
|
|
@@ -74,6 +86,18 @@ export const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
74
86
|
textAlign: "left",
|
|
75
87
|
textBaseline: "middle"
|
|
76
88
|
},
|
|
89
|
+
endTop: {
|
|
90
|
+
textAlign: "left",
|
|
91
|
+
textBaseline: "bottom"
|
|
92
|
+
},
|
|
93
|
+
endBottom: {
|
|
94
|
+
textAlign: "left",
|
|
95
|
+
textBaseline: "top"
|
|
96
|
+
},
|
|
97
|
+
insideEnd: {
|
|
98
|
+
textAlign: "right",
|
|
99
|
+
textBaseline: "middle"
|
|
100
|
+
},
|
|
77
101
|
insideEndTop: {
|
|
78
102
|
textAlign: "right",
|
|
79
103
|
textBaseline: "bottom"
|
|
@@ -85,15 +109,27 @@ export const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
85
109
|
},
|
|
86
110
|
negativeXAxis: {
|
|
87
111
|
start: {
|
|
112
|
+
textAlign: "right",
|
|
113
|
+
textBaseline: "middle"
|
|
114
|
+
},
|
|
115
|
+
startTop: {
|
|
116
|
+
textAlign: "right",
|
|
117
|
+
textBaseline: "bottom"
|
|
118
|
+
},
|
|
119
|
+
startBottom: {
|
|
120
|
+
textAlign: "right",
|
|
121
|
+
textBaseline: "top"
|
|
122
|
+
},
|
|
123
|
+
insideStart: {
|
|
88
124
|
textAlign: "left",
|
|
89
125
|
textBaseline: "middle"
|
|
90
126
|
},
|
|
91
127
|
insideStartTop: {
|
|
92
|
-
textAlign: "
|
|
128
|
+
textAlign: "left",
|
|
93
129
|
textBaseline: "bottom"
|
|
94
130
|
},
|
|
95
131
|
insideStartBottom: {
|
|
96
|
-
textAlign: "
|
|
132
|
+
textAlign: "left",
|
|
97
133
|
textBaseline: "top"
|
|
98
134
|
},
|
|
99
135
|
middle: {
|
|
@@ -112,6 +148,18 @@ export const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
112
148
|
textAlign: "right",
|
|
113
149
|
textBaseline: "middle"
|
|
114
150
|
},
|
|
151
|
+
endTop: {
|
|
152
|
+
textAlign: "right",
|
|
153
|
+
textBaseline: "bottom"
|
|
154
|
+
},
|
|
155
|
+
endBottom: {
|
|
156
|
+
textAlign: "right",
|
|
157
|
+
textBaseline: "top"
|
|
158
|
+
},
|
|
159
|
+
insideEnd: {
|
|
160
|
+
textAlign: "left",
|
|
161
|
+
textBaseline: "middle"
|
|
162
|
+
},
|
|
115
163
|
insideEndTop: {
|
|
116
164
|
textAlign: "left",
|
|
117
165
|
textBaseline: "bottom"
|