tvcharts 0.5.82 → 0.5.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/echarts.js +72 -20
- package/dist/echarts.js.map +2 -2
- package/lib/component/axis/AxisView.js +62 -0
- package/lib/component/axisPointer/install.js +6 -1
- package/lib/component/graphic/GraphicView.js +4 -1
- package/lib/component/marker/MarkLabelView.js +8 -1
- package/lib/model/Global.js +3 -0
- package/lib/model/OptionManager.js +3 -0
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +3 -0
- package/types/dist/shared.d.ts +3 -0
- package/types/src/component/axis/AxisView.d.ts +5 -0
- package/types/src/coord/axisCommonTypes.d.ts +1 -0
- package/types/src/model/Global.d.ts +1 -0
- package/types/src/model/OptionManager.d.ts +1 -0
package/dist/echarts.js
CHANGED
|
@@ -38457,16 +38457,65 @@ var AxisView2 = class extends Component_default2 {
|
|
|
38457
38457
|
this.axisPointerClass && fixValue(axisModel);
|
|
38458
38458
|
super.render.apply(this, arguments);
|
|
38459
38459
|
this._doUpdateAxisPointerClass(axisModel, api2, true);
|
|
38460
|
+
this.updateAxisRange(axisModel, ecModel, api2, payload);
|
|
38460
38461
|
}
|
|
38461
38462
|
updateAxisPointer(axisModel, ecModel, api2, payload) {
|
|
38462
38463
|
this._doUpdateAxisPointerClass(axisModel, api2, false);
|
|
38463
38464
|
}
|
|
38465
|
+
updateAxisRange(axisModel, ecModel, api2, payload) {
|
|
38466
|
+
const {name, y, height, style, z, zlevel, status} = payload;
|
|
38467
|
+
if (status === "hide") {
|
|
38468
|
+
this.removeRangeRect(api2);
|
|
38469
|
+
return;
|
|
38470
|
+
}
|
|
38471
|
+
if (name !== axisModel.name) {
|
|
38472
|
+
return;
|
|
38473
|
+
}
|
|
38474
|
+
const layoutInfo = layout4(axisModel.axis.grid.model, axisModel);
|
|
38475
|
+
const width = axisModel.get("width") ?? 65;
|
|
38476
|
+
this._rangePayload = payload;
|
|
38477
|
+
const x = layoutInfo.labelDirection > 0 ? layoutInfo.position[0] : layoutInfo.position[0] + layoutInfo.labelDirection * width;
|
|
38478
|
+
if (this._rangeRect) {
|
|
38479
|
+
this._rangeRect.attr({
|
|
38480
|
+
shape: {
|
|
38481
|
+
x,
|
|
38482
|
+
y,
|
|
38483
|
+
width,
|
|
38484
|
+
height
|
|
38485
|
+
},
|
|
38486
|
+
style,
|
|
38487
|
+
z,
|
|
38488
|
+
zlevel
|
|
38489
|
+
});
|
|
38490
|
+
} else {
|
|
38491
|
+
this._rangeRect = new Rect_default({
|
|
38492
|
+
shape: {
|
|
38493
|
+
x: layoutInfo.position[0],
|
|
38494
|
+
y,
|
|
38495
|
+
width,
|
|
38496
|
+
height
|
|
38497
|
+
},
|
|
38498
|
+
style,
|
|
38499
|
+
z,
|
|
38500
|
+
zlevel
|
|
38501
|
+
});
|
|
38502
|
+
api2.getZr().add(this._rangeRect);
|
|
38503
|
+
}
|
|
38504
|
+
}
|
|
38505
|
+
removeRangeRect(api2) {
|
|
38506
|
+
if (this._rangeRect) {
|
|
38507
|
+
api2.getZr().remove(this._rangeRect);
|
|
38508
|
+
this._rangeRect = void 0;
|
|
38509
|
+
}
|
|
38510
|
+
;
|
|
38511
|
+
}
|
|
38464
38512
|
remove(ecModel, api2) {
|
|
38465
38513
|
const axisPointer = this._axisPointer;
|
|
38466
38514
|
axisPointer && axisPointer.remove(api2);
|
|
38467
38515
|
}
|
|
38468
38516
|
dispose(ecModel, api2) {
|
|
38469
38517
|
this._disposeAxisPointer(api2);
|
|
38518
|
+
this.removeRangeRect(api2);
|
|
38470
38519
|
super.dispose.apply(this, arguments);
|
|
38471
38520
|
}
|
|
38472
38521
|
_doUpdateAxisPointerClass(axisModel, api2, forceRender) {
|
|
@@ -57005,7 +57054,7 @@ var GraphicComponentModel2 = class extends Component_default {
|
|
|
57005
57054
|
newElOption.getElementLabels = resultItem.existing.getElementLabels;
|
|
57006
57055
|
}
|
|
57007
57056
|
elOptionsToUpdate.push(newElOption);
|
|
57008
|
-
if (newElOption.getElementLabels) {
|
|
57057
|
+
if (newElOption.getElementLabels && newElOption.labelVisible) {
|
|
57009
57058
|
includesLabelOptionsToUpdate.push(newElOption);
|
|
57010
57059
|
}
|
|
57011
57060
|
setKeyInfoToNewElOption(resultItem, newElOption);
|
|
@@ -58115,6 +58164,11 @@ function install29(registers) {
|
|
|
58115
58164
|
event: "updateAxisPointer",
|
|
58116
58165
|
update: ":updateAxisPointer"
|
|
58117
58166
|
}, axisTrigger);
|
|
58167
|
+
registers.registerAction({
|
|
58168
|
+
type: "updateAxisRange",
|
|
58169
|
+
event: "updateAxisRange",
|
|
58170
|
+
update: "yAxis:updateAxisRange"
|
|
58171
|
+
}, noop);
|
|
58118
58172
|
}
|
|
58119
58173
|
|
|
58120
58174
|
// src/component/grid/install.ts
|
|
@@ -66952,8 +67006,7 @@ var markerTypeCalculator2 = {
|
|
|
66952
67006
|
labelTextStyle: {
|
|
66953
67007
|
fill,
|
|
66954
67008
|
backgroundColor: backgroundColor2,
|
|
66955
|
-
borderColor: fill
|
|
66956
|
-
borderWidth: 1
|
|
67009
|
+
borderColor: fill
|
|
66957
67010
|
}
|
|
66958
67011
|
};
|
|
66959
67012
|
}
|
|
@@ -66975,16 +67028,13 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
66975
67028
|
if (type !== "updateComOption") {
|
|
66976
67029
|
this.updateMarkLabels(markerModel, ecModel);
|
|
66977
67030
|
}
|
|
67031
|
+
this.graphicLabelsResize(ecModel);
|
|
66978
67032
|
this.updateGraphicLabels(ecModel);
|
|
66979
|
-
if (["dataZoom", "resize"].includes(type)) {
|
|
66980
|
-
this.graphicLabelsResize(ecModel);
|
|
66981
|
-
}
|
|
66982
67033
|
this.avoidOverlap();
|
|
66983
67034
|
}
|
|
66984
67035
|
updateMarkLabels(markerModel, ecModel) {
|
|
66985
67036
|
const markerGroupMap = this.markerGroupMap;
|
|
66986
67037
|
const labelMap = markerModel.labelMap;
|
|
66987
|
-
console.log("%c [ labelMap ]-148", "font-size:13px; background:pink; color:#bf2c9f;", labelMap);
|
|
66988
67038
|
ecModel.eachSeries((seriesModel) => {
|
|
66989
67039
|
const seriesName = seriesModel.name;
|
|
66990
67040
|
const markLabelData = labelMap.get(seriesName);
|
|
@@ -67062,7 +67112,7 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67062
67112
|
const labelsBySeriesId = {};
|
|
67063
67113
|
each(labelOptions, (item) => {
|
|
67064
67114
|
const label = item.getElementLabels();
|
|
67065
|
-
if (item.$action === "remove" ||
|
|
67115
|
+
if (item.$action === "remove" || item.labelVisible === false) {
|
|
67066
67116
|
this.removeGraphicLabels(label);
|
|
67067
67117
|
return;
|
|
67068
67118
|
}
|
|
@@ -67184,7 +67234,7 @@ function labelAvoidOverlap(labels, marginTop = 0) {
|
|
|
67184
67234
|
const currentLabel = labels[i];
|
|
67185
67235
|
const prevHeight = 18 + marginTop;
|
|
67186
67236
|
let currentLabelY = inner21(currentLabel).y;
|
|
67187
|
-
if (Math.abs(currentLabelY - prevLabelY) < prevHeight) {
|
|
67237
|
+
if (prevLabelY > currentLabelY || Math.abs(currentLabelY - prevLabelY) < prevHeight) {
|
|
67188
67238
|
currentLabelY = prevLabelY + prevHeight;
|
|
67189
67239
|
}
|
|
67190
67240
|
sortYbyId[currentLabel.id] = currentLabelY;
|
|
@@ -67203,7 +67253,7 @@ function getLeftTextX(x, text, textStyle, ecModel) {
|
|
|
67203
67253
|
const font = getFont(textStyle, ecModel);
|
|
67204
67254
|
const textRect = getBoundingRect(text, font);
|
|
67205
67255
|
const paddings = normalizeCssArray2(textStyle.padding || 0);
|
|
67206
|
-
return x - textRect.width - paddings[1] - paddings[3] - 1;
|
|
67256
|
+
return x - textRect.width - paddings[1] - paddings[3] - (textStyle.borderWidth || 0) - 1;
|
|
67207
67257
|
}
|
|
67208
67258
|
function createText({option, gridRect, position: position2, ecModel, y, offset}) {
|
|
67209
67259
|
const isLeft = position2 === "left";
|
|
@@ -67232,11 +67282,13 @@ function updateText({option, gridRect, position: position2, ecModel, el, y, offs
|
|
|
67232
67282
|
}
|
|
67233
67283
|
function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle}) {
|
|
67234
67284
|
const {zlevel} = markerModel.option;
|
|
67235
|
-
const {textStyle, lineStyle, showLine, showName, showTitle} = labelData;
|
|
67285
|
+
const {textStyle, lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
67236
67286
|
const text = labelData.text;
|
|
67287
|
+
const labelTitle = title || labelData.name;
|
|
67237
67288
|
const isLeft = position2 === "left";
|
|
67238
67289
|
const group = new Group_default();
|
|
67239
67290
|
const labelY = y - 9;
|
|
67291
|
+
const borderWidth = textStyle.borderWidth ?? 0;
|
|
67240
67292
|
const textEl = new Text_default({
|
|
67241
67293
|
x: isLeft ? getLeftTextX(x, text, textStyle, markerModel.ecModel) : x,
|
|
67242
67294
|
y: labelY,
|
|
@@ -67246,9 +67298,9 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
67246
67298
|
ignore: !showName
|
|
67247
67299
|
});
|
|
67248
67300
|
const textNameEl = new Text_default({
|
|
67249
|
-
x: isLeft ? gridRect.x : getLeftTextX(gridRect.x + gridRect.width,
|
|
67301
|
+
x: isLeft ? gridRect.x - borderWidth : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel) + borderWidth,
|
|
67250
67302
|
y: labelY,
|
|
67251
|
-
style: Object.assign({text:
|
|
67303
|
+
style: Object.assign({text: labelTitle}, textStyle, labelTextStyle),
|
|
67252
67304
|
z: 101,
|
|
67253
67305
|
zlevel,
|
|
67254
67306
|
ignore: !showTitle
|
|
@@ -67274,7 +67326,8 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
67274
67326
|
return group;
|
|
67275
67327
|
}
|
|
67276
67328
|
function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle}) {
|
|
67277
|
-
const {textStyle = {}, lineStyle, showLine, showName, showTitle} = labelData;
|
|
67329
|
+
const {textStyle = {}, lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
67330
|
+
const borderWidth = textStyle.borderWidth ?? 0;
|
|
67278
67331
|
const isLeft = position2 === "left";
|
|
67279
67332
|
if (el.ignore) {
|
|
67280
67333
|
el.ignore = false;
|
|
@@ -67306,9 +67359,8 @@ function updateLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
67306
67359
|
return;
|
|
67307
67360
|
}
|
|
67308
67361
|
const textLabel = labelData.text;
|
|
67309
|
-
const labelX = isLeft ? getLeftTextX(x, textLabel, textStyle, markerModel.ecModel) : x;
|
|
67310
|
-
|
|
67311
|
-
element.x = labelX + (labelTextStyle?.borderWidth ? margin : 0);
|
|
67362
|
+
const labelX = isLeft ? getLeftTextX(x, textLabel, textStyle, markerModel.ecModel) - borderWidth : x + borderWidth;
|
|
67363
|
+
element.x = labelX;
|
|
67312
67364
|
element.y = labelY;
|
|
67313
67365
|
element.attr("style", Object.assign({text: textLabel}, textStyle, labelTextStyle));
|
|
67314
67366
|
element.ignore = false;
|
|
@@ -67318,11 +67370,11 @@ function updateLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
67318
67370
|
element.ignore = true;
|
|
67319
67371
|
return;
|
|
67320
67372
|
}
|
|
67321
|
-
const
|
|
67322
|
-
const nameX = isLeft ? gridRect.x : getLeftTextX(gridRect.x + gridRect.width,
|
|
67373
|
+
const labelTitle = title || labelData.name;
|
|
67374
|
+
const nameX = isLeft ? gridRect.x : getLeftTextX(gridRect.x + gridRect.width, labelTitle, textStyle, markerModel.ecModel);
|
|
67323
67375
|
element.x = nameX;
|
|
67324
67376
|
element.y = labelY;
|
|
67325
|
-
element.attr("style", Object.assign({text:
|
|
67377
|
+
element.attr("style", Object.assign({text: labelTitle}, textStyle, labelTextStyle));
|
|
67326
67378
|
element.ignore = false;
|
|
67327
67379
|
break;
|
|
67328
67380
|
}
|