tvcharts 0.5.91 → 0.5.93
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 +50 -71
- package/dist/echarts.js.map +2 -2
- package/lib/component/graphic/GraphicView.js +1 -162
- package/lib/component/marker/MarkLabelModal.js +1 -1
- package/lib/component/marker/MarkLabelView.js +96 -40
- package/lib/component/title/install.js +21 -17
- package/lib/coord/axisHelper.js +5 -3
- package/lib/coord/axisTickLabelBuilder.js +3 -1
- package/lib/core/echarts.js +0 -12
- package/lib/data/OrdinalMeta.js +1 -6
- package/lib/data/scale-time/default-tick-mark-formatter.js +11 -5
- package/lib/data/scale-time/time-scale-point-weight-generator.js +13 -4
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +1 -1
- package/types/dist/shared.d.ts +1 -1
- package/types/src/coord/axisCommonTypes.d.ts +1 -1
package/dist/echarts.js
CHANGED
|
@@ -16266,11 +16266,6 @@ echarts.use([${seriesImportName}]);`);
|
|
|
16266
16266
|
delete option[OPTION_INNER_KEY];
|
|
16267
16267
|
return option;
|
|
16268
16268
|
}
|
|
16269
|
-
setTheme(theme2) {
|
|
16270
|
-
this._theme = new Model_default(theme2);
|
|
16271
|
-
mergeTheme(this.option, this._theme.option);
|
|
16272
|
-
this._mergeOption(this.option, null);
|
|
16273
|
-
}
|
|
16274
16269
|
getTheme() {
|
|
16275
16270
|
return this._theme;
|
|
16276
16271
|
}
|
|
@@ -16467,7 +16462,6 @@ GlobalModel.internalField = function() {
|
|
|
16467
16462
|
mergeTheme(baseOption, ecModel._theme.option);
|
|
16468
16463
|
merge(baseOption, globalDefault_default, false);
|
|
16469
16464
|
ecModel._mergeOption(baseOption, null);
|
|
16470
|
-
console.log("%c [ baseOption ]-970", "font-size:13px; background:pink; color:#bf2c9f;", baseOption, ecModel._optionManager);
|
|
16471
16465
|
};
|
|
16472
16466
|
}();
|
|
16473
16467
|
function isNotTargetSeries(seriesModel, payload) {
|
|
@@ -23522,16 +23516,6 @@ var ECharts = class extends Eventful_default {
|
|
|
23522
23516
|
};
|
|
23523
23517
|
doDispatchAction.call(this, payload, true);
|
|
23524
23518
|
}
|
|
23525
|
-
changeTheme(theme2) {
|
|
23526
|
-
if (isString(theme2)) {
|
|
23527
|
-
theme2 = themeStorage[theme2];
|
|
23528
|
-
}
|
|
23529
|
-
theme2 = clone(theme2);
|
|
23530
|
-
theme2 && globalBackwardCompat(theme2, true);
|
|
23531
|
-
this._theme = theme2;
|
|
23532
|
-
this._model.setTheme(theme2);
|
|
23533
|
-
updateMethods.update.call(this);
|
|
23534
|
-
}
|
|
23535
23519
|
};
|
|
23536
23520
|
PENDING_UPDATE, IN_MAIN_PROCESS_KEY, CONNECT_STATUS_KEY, STATUS_NEEDS_UPDATE_KEY;
|
|
23537
23521
|
ECharts.internalField = function() {
|
|
@@ -26275,11 +26259,11 @@ var intradayWeightDivisors = [
|
|
|
26275
26259
|
{divisor: hours(12), weight: TickMarkWeight.Hour12}
|
|
26276
26260
|
];
|
|
26277
26261
|
function weightByTime(currentDate, prevDate) {
|
|
26278
|
-
if (currentDate.
|
|
26262
|
+
if (currentDate.getFullYear() !== prevDate.getFullYear()) {
|
|
26279
26263
|
return TickMarkWeight.Year;
|
|
26280
|
-
} else if (currentDate.
|
|
26264
|
+
} else if (currentDate.getMonth() !== prevDate.getMonth()) {
|
|
26281
26265
|
return TickMarkWeight.Month;
|
|
26282
|
-
} else if (currentDate.
|
|
26266
|
+
} else if (currentDate.getDate() !== prevDate.getDate()) {
|
|
26283
26267
|
return TickMarkWeight.Day;
|
|
26284
26268
|
}
|
|
26285
26269
|
for (let i = intradayWeightDivisors.length - 1; i >= 0; --i) {
|
|
@@ -26337,12 +26321,7 @@ var OrdinalMeta = class {
|
|
|
26337
26321
|
timePoints.push({
|
|
26338
26322
|
originalTime: value,
|
|
26339
26323
|
index,
|
|
26340
|
-
timestamp: d.getTime() / 1e3
|
|
26341
|
-
businessDay: {
|
|
26342
|
-
day: d.getUTCDate(),
|
|
26343
|
-
month: d.getUTCMonth() + 1,
|
|
26344
|
-
year: d.getUTCFullYear()
|
|
26345
|
-
}
|
|
26324
|
+
timestamp: d.getTime() / 1e3
|
|
26346
26325
|
});
|
|
26347
26326
|
};
|
|
26348
26327
|
const categories = data && map(data, (val, index) => {
|
|
@@ -27901,18 +27880,19 @@ function niceScaleExtent(scale4, inModel) {
|
|
|
27901
27880
|
const extentInfo = getScaleExtent(scale4, model);
|
|
27902
27881
|
const extent3 = extentInfo.extent;
|
|
27903
27882
|
let splitNumber = model.get("splitNumber");
|
|
27904
|
-
const
|
|
27883
|
+
const splitIntervalByFontSize = model.get("splitIntervalByFontSize");
|
|
27905
27884
|
if (scale4 instanceof Log_default) {
|
|
27906
27885
|
scale4.base = model.get("logBase");
|
|
27907
27886
|
}
|
|
27908
27887
|
const scaleType = scale4.type;
|
|
27909
27888
|
const interval = model.get("interval");
|
|
27910
27889
|
const isIntervalOrTime = scaleType === "interval" || scaleType === "time";
|
|
27911
|
-
if (
|
|
27890
|
+
if (splitIntervalByFontSize) {
|
|
27891
|
+
const fontSize = model.get("axisLabel").fontSize ?? 12;
|
|
27912
27892
|
const axis = model.axis;
|
|
27913
27893
|
const rect = axis.grid.getRect();
|
|
27914
27894
|
const length2 = axis.dim === "y" ? rect.height : rect.width;
|
|
27915
|
-
splitNumber = Math.ceil(length2 /
|
|
27895
|
+
splitNumber = Math.ceil(length2 / (fontSize * 4));
|
|
27916
27896
|
}
|
|
27917
27897
|
scale4.setExtent(extent3[0], extent3[1]);
|
|
27918
27898
|
scale4.calcNiceExtent({
|
|
@@ -28550,7 +28530,7 @@ function weightToTickMarkType(weight, timeVisible, secondsVisible) {
|
|
|
28550
28530
|
}
|
|
28551
28531
|
}
|
|
28552
28532
|
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
|
28553
|
-
const formatOptions = {};
|
|
28533
|
+
const formatOptions = {timeZone: "Asia/Shanghai"};
|
|
28554
28534
|
switch (tickMarkType) {
|
|
28555
28535
|
case TickMarkType.Year:
|
|
28556
28536
|
formatOptions.year = "numeric";
|
|
@@ -28575,7 +28555,7 @@ function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
|
|
28575
28555
|
default:
|
|
28576
28556
|
return "";
|
|
28577
28557
|
}
|
|
28578
|
-
const date =
|
|
28558
|
+
const date = new Date(timePoint.timestamp * 1e3);
|
|
28579
28559
|
return date.toLocaleString(locale, formatOptions);
|
|
28580
28560
|
}
|
|
28581
28561
|
|
|
@@ -28679,7 +28659,9 @@ function calculateCategoryInterval(axis) {
|
|
|
28679
28659
|
const axisExtent = axis.getExtent();
|
|
28680
28660
|
const ordinalExtent = ordinalScale.getExtent();
|
|
28681
28661
|
if (axis.model.get("segmentedByTime")) {
|
|
28682
|
-
|
|
28662
|
+
const labelModel = axis.getLabelModel();
|
|
28663
|
+
const fontSize = typeof labelModel.get("fontSize") === "number" ? +labelModel.get("fontSize") : 12;
|
|
28664
|
+
return Math.round((fontSize + 4) * 5 / ordinalScale.barSpace);
|
|
28683
28665
|
}
|
|
28684
28666
|
const params = fetchAutoCategoryIntervalCalculationParams(axis);
|
|
28685
28667
|
const labelFormatter = makeLabelFormatter(axis);
|
|
@@ -38037,7 +38019,9 @@ var builders = {
|
|
|
38037
38019
|
applyTransform(pt12, pt12, matrix13);
|
|
38038
38020
|
applyTransform(pt22, pt22, matrix13);
|
|
38039
38021
|
}
|
|
38040
|
-
const style =
|
|
38022
|
+
const style = {
|
|
38023
|
+
fill: axisModel.ecModel.get("backgroundColor")
|
|
38024
|
+
};
|
|
38041
38025
|
const position2 = axisModel.axis.position;
|
|
38042
38026
|
const api2 = axisModel.ecModel.scheduler.api;
|
|
38043
38027
|
const pt = inverse ? pt22 : pt12;
|
|
@@ -60592,8 +60576,6 @@ var GraphicComponentView2 = class extends Component_default2 {
|
|
|
60592
60576
|
}
|
|
60593
60577
|
const elMap = this._elMap;
|
|
60594
60578
|
const rootGroup = this.group;
|
|
60595
|
-
const that = this;
|
|
60596
|
-
const elLabelMap = that._elLabelMap;
|
|
60597
60579
|
const globalZ = graphicModel.get("z");
|
|
60598
60580
|
const globalZLevel = graphicModel.get("zlevel");
|
|
60599
60581
|
each(elOptionsToUpdate, function(elOption) {
|
|
@@ -65090,23 +65072,6 @@ var TitleView2 = class extends Component_default2 {
|
|
|
65090
65072
|
};
|
|
65091
65073
|
textEl.setStyle(alignStyle);
|
|
65092
65074
|
subTextEl.setStyle(alignStyle);
|
|
65093
|
-
groupRect = group.getBoundingRect();
|
|
65094
|
-
const padding = layoutRect.margin;
|
|
65095
|
-
const style = titleModel.getItemStyle(["color", "opacity"]);
|
|
65096
|
-
style.fill = titleModel.get("backgroundColor");
|
|
65097
|
-
const rect = new Rect_default({
|
|
65098
|
-
shape: {
|
|
65099
|
-
x: groupRect.x - padding[3],
|
|
65100
|
-
y: groupRect.y - padding[0],
|
|
65101
|
-
width: groupRect.width + padding[1] + padding[3],
|
|
65102
|
-
height: groupRect.height + padding[0] + padding[2],
|
|
65103
|
-
r: titleModel.get("borderRadius")
|
|
65104
|
-
},
|
|
65105
|
-
style,
|
|
65106
|
-
subPixelOptimize: true,
|
|
65107
|
-
silent: true
|
|
65108
|
-
});
|
|
65109
|
-
group.add(rect);
|
|
65110
65075
|
}
|
|
65111
65076
|
};
|
|
65112
65077
|
var TitleView = TitleView2;
|
|
@@ -67051,7 +67016,6 @@ function install43(registers) {
|
|
|
67051
67016
|
// src/component/marker/MarkLabelModal.ts
|
|
67052
67017
|
var defaultDataOption = {
|
|
67053
67018
|
textStyle: {
|
|
67054
|
-
padding: [4, 6, 2, 8],
|
|
67055
67019
|
fill: "#fff",
|
|
67056
67020
|
backgroundColor: "#26A69A"
|
|
67057
67021
|
},
|
|
@@ -67248,6 +67212,7 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67248
67212
|
}
|
|
67249
67213
|
item.text = ["last"].includes(item.type) ? yAxisModel.scale.getLabel({value}, {precision: item.precision}) : value.toFixed(item.precision);
|
|
67250
67214
|
const y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(value));
|
|
67215
|
+
const fontSize = yAxisModel.getLabelModel().option.fontSize;
|
|
67251
67216
|
if (el) {
|
|
67252
67217
|
updateLabel({
|
|
67253
67218
|
el,
|
|
@@ -67257,7 +67222,8 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67257
67222
|
labelData: item,
|
|
67258
67223
|
markerModel,
|
|
67259
67224
|
position: yAxisModel.position,
|
|
67260
|
-
labelTextStyle
|
|
67225
|
+
labelTextStyle,
|
|
67226
|
+
fontSize
|
|
67261
67227
|
});
|
|
67262
67228
|
} else {
|
|
67263
67229
|
el = createLabel({
|
|
@@ -67267,7 +67233,8 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67267
67233
|
labelData: item,
|
|
67268
67234
|
markerModel,
|
|
67269
67235
|
position: yAxisModel.position,
|
|
67270
|
-
labelTextStyle
|
|
67236
|
+
labelTextStyle,
|
|
67237
|
+
fontSize
|
|
67271
67238
|
});
|
|
67272
67239
|
markerGroupMap.set(item.name, el);
|
|
67273
67240
|
this.group.add(el);
|
|
@@ -67324,16 +67291,17 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67324
67291
|
each(label.children, (item) => {
|
|
67325
67292
|
const option = item;
|
|
67326
67293
|
let el = graphicLabelElMap.get(option.id);
|
|
67327
|
-
const y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(option.y))
|
|
67294
|
+
const y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(option.y));
|
|
67328
67295
|
const style = option.style;
|
|
67329
67296
|
if (yAxisModel.scale.type === "percentage") {
|
|
67330
67297
|
const formatLabel2 = yAxisModel.scale.getLabel({value: +option.style.text});
|
|
67331
67298
|
option.style = Object.assign({}, option.style, {text: formatLabel2});
|
|
67332
67299
|
}
|
|
67300
|
+
const fontSize = yAxisModel.getLabelModel().option.fontSize;
|
|
67333
67301
|
if (el) {
|
|
67334
|
-
updateText({el, gridRect, position: position2, option, ecModel, y, offset});
|
|
67302
|
+
updateText({el, gridRect, position: position2, option, ecModel, y, offset, fontSize});
|
|
67335
67303
|
} else {
|
|
67336
|
-
el = createText({gridRect, position: position2, option, ecModel, y, offset});
|
|
67304
|
+
el = createText({gridRect, position: position2, option, ecModel, y, offset, fontSize});
|
|
67337
67305
|
graphLabelGroup.add(el);
|
|
67338
67306
|
graphicLabelElMap.set(option.id, el);
|
|
67339
67307
|
inner21(el).yAxisIndex = yAxisModel.index;
|
|
@@ -67355,7 +67323,7 @@ var MarkLabelView2 = class extends Component_default2 {
|
|
|
67355
67323
|
}
|
|
67356
67324
|
const gridRect = yAxisModel.grid.getRect();
|
|
67357
67325
|
const position2 = yAxisModel.position;
|
|
67358
|
-
const y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(inner21(el).originalValue))
|
|
67326
|
+
const y = yAxisModel.toGlobalCoord(yAxisModel.dataToCoord(inner21(el).originalValue));
|
|
67359
67327
|
const offset = yAxisModel.model.get("offset") || 0;
|
|
67360
67328
|
let style = inner21(el).style;
|
|
67361
67329
|
if (yAxisModel.scale.type === "percentage") {
|
|
@@ -67408,23 +67376,25 @@ var MarkLabelView = MarkLabelView2;
|
|
|
67408
67376
|
MarkLabelView.type = "markLabel";
|
|
67409
67377
|
function labelAvoidOverlap(labels, marginTop = 0) {
|
|
67410
67378
|
labels.sort((a, b) => inner21(a).y - inner21(b).y);
|
|
67379
|
+
const height = labels[0].isGroup ? labels[0].children().find((item) => item.type === "text").getBoundingRect().height : labels[0].getBoundingRect().height;
|
|
67411
67380
|
const sortYbyId = {};
|
|
67381
|
+
const offestY = height / 2;
|
|
67412
67382
|
for (let i = 1; i < labels.length; i++) {
|
|
67413
67383
|
const prevLabel = labels[i - 1];
|
|
67414
67384
|
const prevLabelY = sortYbyId[prevLabel.id] ?? inner21(prevLabel).y;
|
|
67415
67385
|
const currentLabel = labels[i];
|
|
67416
|
-
const prevHeight =
|
|
67386
|
+
const prevHeight = height + marginTop;
|
|
67417
67387
|
let currentLabelY = inner21(currentLabel).y;
|
|
67418
67388
|
if (prevLabelY > currentLabelY || Math.abs(currentLabelY - prevLabelY) < prevHeight) {
|
|
67419
67389
|
currentLabelY = prevLabelY + prevHeight;
|
|
67420
67390
|
}
|
|
67421
67391
|
sortYbyId[currentLabel.id] = currentLabelY;
|
|
67422
67392
|
if (currentLabel.type === "text") {
|
|
67423
|
-
currentLabel.y = Math.floor(currentLabelY);
|
|
67393
|
+
currentLabel.y = Math.floor(currentLabelY) - offestY;
|
|
67424
67394
|
} else {
|
|
67425
67395
|
each(currentLabel.children(), (item) => {
|
|
67426
67396
|
if (item.type === "text") {
|
|
67427
|
-
item.y = Math.floor(currentLabelY);
|
|
67397
|
+
item.y = Math.floor(currentLabelY) - offestY;
|
|
67428
67398
|
}
|
|
67429
67399
|
});
|
|
67430
67400
|
}
|
|
@@ -67436,7 +67406,14 @@ function getLeftTextX(x, text, textStyle, ecModel) {
|
|
|
67436
67406
|
const paddings = normalizeCssArray2(textStyle.padding || 0);
|
|
67437
67407
|
return x - textRect.width - paddings[1] - paddings[3] - (textStyle.borderWidth || 0) - 1;
|
|
67438
67408
|
}
|
|
67439
|
-
function
|
|
67409
|
+
function getPaddingByStyle(fontsize, borderWidth = 0) {
|
|
67410
|
+
const [top, right, bottom, left] = [4, 6, 2, 8];
|
|
67411
|
+
const diff = fontsize - 12;
|
|
67412
|
+
const xLength = diff - borderWidth;
|
|
67413
|
+
const yLength = diff * 0.25;
|
|
67414
|
+
return [top + yLength, right + xLength, bottom + yLength, left + xLength];
|
|
67415
|
+
}
|
|
67416
|
+
function createText({option, gridRect, position: position2, ecModel, y, offset, fontSize}) {
|
|
67440
67417
|
const isLeft = position2 === "left";
|
|
67441
67418
|
const {style, zlevel} = option;
|
|
67442
67419
|
const startX = isLeft ? gridRect.x - offset : gridRect.x + gridRect.width + offset;
|
|
@@ -67444,31 +67421,32 @@ function createText({option, gridRect, position: position2, ecModel, y, offset})
|
|
|
67444
67421
|
const textEl = new Text_default({
|
|
67445
67422
|
x,
|
|
67446
67423
|
y,
|
|
67447
|
-
style,
|
|
67424
|
+
style: Object.assign(style, {fontSize, padding: getPaddingByStyle(fontSize, style.borderWidth)}),
|
|
67448
67425
|
z: 101,
|
|
67449
67426
|
zlevel
|
|
67450
67427
|
});
|
|
67451
67428
|
inner21(textEl).y = y;
|
|
67452
67429
|
return textEl;
|
|
67453
67430
|
}
|
|
67454
|
-
function updateText({option, gridRect, position: position2, ecModel, el, y, offset}) {
|
|
67431
|
+
function updateText({option, gridRect, position: position2, ecModel, el, y, offset, fontSize}) {
|
|
67455
67432
|
const isLeft = position2 === "left";
|
|
67456
67433
|
const startX = isLeft ? gridRect.x - offset : gridRect.x + gridRect.width + offset;
|
|
67457
67434
|
const {style} = option;
|
|
67458
67435
|
const x = isLeft ? getLeftTextX(startX, style.text, style, ecModel) : startX;
|
|
67459
67436
|
el.x = x;
|
|
67460
67437
|
el.y = y;
|
|
67461
|
-
el.attr("style", style);
|
|
67438
|
+
el.attr("style", fontSize ? Object.assign(style, {fontSize, padding: getPaddingByStyle(fontSize, style.borderWidth)}) : style);
|
|
67462
67439
|
inner21(el).y = y;
|
|
67463
67440
|
}
|
|
67464
|
-
function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle}) {
|
|
67441
|
+
function createLabel({x, y, labelData, markerModel, gridRect, position: position2, labelTextStyle, fontSize}) {
|
|
67465
67442
|
const {zlevel} = markerModel.option;
|
|
67466
|
-
const {
|
|
67443
|
+
const {lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
67444
|
+
const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelData.textStyle.borderWidth)});
|
|
67467
67445
|
const text = labelData.text;
|
|
67468
67446
|
const labelTitle = title || labelData.name;
|
|
67469
67447
|
const isLeft = position2 === "left";
|
|
67470
67448
|
const group = new Group_default();
|
|
67471
|
-
const labelY = y
|
|
67449
|
+
const labelY = y;
|
|
67472
67450
|
const borderWidth = textStyle.borderWidth ?? 0;
|
|
67473
67451
|
const textEl = new Text_default({
|
|
67474
67452
|
x: isLeft ? getLeftTextX(x, text, textStyle, markerModel.ecModel) : x,
|
|
@@ -67506,14 +67484,15 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
|
|
|
67506
67484
|
group.add(textNameEl);
|
|
67507
67485
|
return group;
|
|
67508
67486
|
}
|
|
67509
|
-
function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle}) {
|
|
67510
|
-
const {
|
|
67487
|
+
function updateLabel({x, y, labelData, markerModel, gridRect, position: position2, el, labelTextStyle, fontSize}) {
|
|
67488
|
+
const {lineStyle, showLine, showName, showTitle, title} = labelData;
|
|
67489
|
+
const textStyle = Object.assign(labelData.textStyle ?? {}, {fontSize, padding: getPaddingByStyle(fontSize, labelData.textStyle.borderWidth)});
|
|
67511
67490
|
const borderWidth = textStyle.borderWidth ?? 0;
|
|
67512
67491
|
const isLeft = position2 === "left";
|
|
67513
67492
|
if (el.ignore) {
|
|
67514
67493
|
el.ignore = false;
|
|
67515
67494
|
}
|
|
67516
|
-
const labelY = y
|
|
67495
|
+
const labelY = y;
|
|
67517
67496
|
inner21(el).y = labelY;
|
|
67518
67497
|
each(el.children(), (element) => {
|
|
67519
67498
|
const labelType = inner21(element).labelType;
|