You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2025/07/23 06:37:30 UTC
(echarts) branch release-dev created (now 64f8d9c4e)
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a change to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git
at 64f8d9c4e chore: release 6.0.0-rc.1
This branch includes the following new commits:
new 65efa6645 test: add mark as expected
new 64f8d9c4e chore: release 6.0.0-rc.1
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
(echarts) 01/02: test: add mark as expected
Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 65efa6645e1a3dd5a5626deda3a550efae02bf3e
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jul 23 14:36:10 2025 +0800
test: add mark as expected
---
test/runTest/marks/calendar-other-coord-sys.json | 8 ++++++++
test/runTest/marks/dataset-guess.json | 10 ++++++++++
test/runTest/marks/gauge.json | 8 ++++++++
test/runTest/marks/legend-borderColor.json | 10 ++++++++++
test/runTest/marks/legend.json | 8 ++++++++
test/runTest/marks/logScale.json | 8 ++++++++
test/runTest/marks/marker-z-z2.json | 8 ++++++++
test/runTest/marks/pie-label-alignTo-adjust.json | 10 ++++++++++
test/runTest/marks/pie-label-alignTo.json | 8 ++++++++
test/runTest/marks/pie-label-extreme.json | 10 ++++++++++
test/runTest/marks/sankey-labelValue.json | 8 ++++++++
test/runTest/marks/scale-extreme-number.json | 10 ++++++++++
test/runTest/marks/theme.json | 8 ++++++++
test/runTest/marks/tooltip.json | 10 ++++++++++
test/runTest/marks/violin.json | 8 ++++++++
test/runTest/marks/visualMap-on-data.json | 10 ++++++++++
16 files changed, 142 insertions(+)
diff --git a/test/runTest/marks/calendar-other-coord-sys.json b/test/runTest/marks/calendar-other-coord-sys.json
index 25f259b7d..b0bcb7269 100644
--- a/test/runTest/marks/calendar-other-coord-sys.json
+++ b/test/runTest/marks/calendar-other-coord-sys.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that the hideOverlap effect is changed, but both acceptable. Or indiscernible to the naked eye.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174329313
+ },
{
"link": "https://github.com/apache/echarts/pull/21005",
"comment": "",
diff --git a/test/runTest/marks/dataset-guess.json b/test/runTest/marks/dataset-guess.json
new file mode 100644
index 000000000..4f4bb6413
--- /dev/null
+++ b/test/runTest/marks/dataset-guess.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that some `hideOverlap` is avoided.",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753239026718
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/gauge.json b/test/runTest/marks/gauge.json
index c6046c410..2cd5a7fb1 100644
--- a/test/runTest/marks/gauge.json
+++ b/test/runTest/marks/gauge.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21097",
+ "comment": "Dark theme changed to improve accessibility.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174883804
+ },
{
"link": "",
"comment": "When dark theme is used, v6 dark theme is used instead of v5.",
diff --git a/test/runTest/marks/legend-borderColor.json b/test/runTest/marks/legend-borderColor.json
new file mode 100644
index 000000000..ac48d8c41
--- /dev/null
+++ b/test/runTest/marks/legend-borderColor.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that the hideOverlap effect is changed, but both acceptable. Or indiscernible to the naked eye.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174350529
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/legend.json b/test/runTest/marks/legend.json
index 8c6fac82b..7c18b06f3 100644
--- a/test/runTest/marks/legend.json
+++ b/test/runTest/marks/legend.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21097",
+ "comment": "Dark theme changed to improve accessibility.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174863513
+ },
{
"link": "",
"comment": "When dark theme is used, v6 dark theme is used instead of v5.",
diff --git a/test/runTest/marks/logScale.json b/test/runTest/marks/logScale.json
index b8c18742d..af9430de6 100644
--- a/test/runTest/marks/logScale.json
+++ b/test/runTest/marks/logScale.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21120",
+ "comment": "fix(logScale): Fix incorrect rounding usage, and support data with big negative exponent.",
+ "type": "Bug Fixing",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174993092
+ },
{
"link": "https://github.com/apache/echarts/pull/21059",
"comment": "Introduced by the `outerBounds` feature, which avoids axis name overflowing the canvas by default.",
diff --git a/test/runTest/marks/marker-z-z2.json b/test/runTest/marks/marker-z-z2.json
index de243a292..a5884fa5c 100644
--- a/test/runTest/marks/marker-z-z2.json
+++ b/test/runTest/marks/marker-z-z2.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21117",
+ "comment": "feat(marker): markPoint markLine markArea support z option",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753175046918
+ },
{
"link": "https://github.com/apache/echarts/pull/20782",
"comment": "markPoint markLine markArea add z2 option to support change level",
diff --git a/test/runTest/marks/pie-label-alignTo-adjust.json b/test/runTest/marks/pie-label-alignTo-adjust.json
new file mode 100644
index 000000000..c9fb1e04a
--- /dev/null
+++ b/test/runTest/marks/pie-label-alignTo-adjust.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that some `hideOverlap` is avoided.",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753239034897
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/pie-label-alignTo.json b/test/runTest/marks/pie-label-alignTo.json
index 9036a26dc..516c15d19 100644
--- a/test/runTest/marks/pie-label-alignTo.json
+++ b/test/runTest/marks/pie-label-alignTo.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that the hideOverlap effect is changed, but both acceptable. Or indiscernible to the naked eye.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174655356
+ },
{
"link": "https://github.com/ecomfe/zrender/pull/1122",
"comment": "Text wrapping enhanced",
diff --git a/test/runTest/marks/pie-label-extreme.json b/test/runTest/marks/pie-label-extreme.json
new file mode 100644
index 000000000..9a3e04b18
--- /dev/null
+++ b/test/runTest/marks/pie-label-extreme.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that the hideOverlap effect is changed, but both acceptable. Or indiscernible to the naked eye.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174687616
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/sankey-labelValue.json b/test/runTest/marks/sankey-labelValue.json
index 10d0313ef..019299115 100644
--- a/test/runTest/marks/sankey-labelValue.json
+++ b/test/runTest/marks/sankey-labelValue.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21097",
+ "comment": "Dark theme changed to improve accessibility.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174898247
+ },
{
"link": "",
"comment": "Expected to have diff because explict theme is used in this case so v5.js is not merged with the explict theme so legend position is changed.",
diff --git a/test/runTest/marks/scale-extreme-number.json b/test/runTest/marks/scale-extreme-number.json
new file mode 100644
index 000000000..947bcf5ad
--- /dev/null
+++ b/test/runTest/marks/scale-extreme-number.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "https://github.com/apache/echarts/pull/21126",
+ "comment": "Fix that extreme small numbers can not be displayed in Cartesian due to the inappropriate rounding precision.",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753238664192
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/theme.json b/test/runTest/marks/theme.json
index dbdcc215d..95e2ddcc6 100644
--- a/test/runTest/marks/theme.json
+++ b/test/runTest/marks/theme.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21097",
+ "comment": "Dark theme changed to improve accessibility.",
+ "type": "Others",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753174887243
+ },
{
"link": "",
"comment": "Expected to have diff because explict theme is used in this case so v5.js is not merged with the explict theme so legend position is changed.",
diff --git a/test/runTest/marks/tooltip.json b/test/runTest/marks/tooltip.json
new file mode 100644
index 000000000..b7d0d7f04
--- /dev/null
+++ b/test/runTest/marks/tooltip.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that some `hideOverlap` is avoided.",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753239094513
+ }
+]
\ No newline at end of file
diff --git a/test/runTest/marks/violin.json b/test/runTest/marks/violin.json
index d9a44fdd3..040ff5d1d 100644
--- a/test/runTest/marks/violin.json
+++ b/test/runTest/marks/violin.json
@@ -1,4 +1,12 @@
[
+ {
+ "link": "https://github.com/apache/echarts/pull/21067",
+ "comment": "fix(jitter): fix overlap when there is enough space to avoid",
+ "type": "Bug Fixing",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753175130600
+ },
{
"link": "https://github.com/apache/echarts/pull/19941",
"comment": "",
diff --git a/test/runTest/marks/visualMap-on-data.json b/test/runTest/marks/visualMap-on-data.json
new file mode 100644
index 000000000..19f260a7f
--- /dev/null
+++ b/test/runTest/marks/visualMap-on-data.json
@@ -0,0 +1,10 @@
+[
+ {
+ "link": "",
+ "comment": "The label diff results from the fix of the margin. Indiscernible to naked eye. More compact so that some `hideOverlap` is avoided.",
+ "type": "New Feature",
+ "markedBy": "Ovilia",
+ "lastVersion": "6.0.0-beta.1",
+ "markTime": 1753239018907
+ }
+]
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
(echarts) 02/02: chore: release 6.0.0-rc.1
Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 64f8d9c4efea43a6086b4c2dd0414f8b6238dfd8
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jul 23 14:36:49 2025 +0800
chore: release 6.0.0-rc.1
---
dist/echarts.common.js | 748 +++++++++++++++++++++---------------
dist/echarts.common.js.map | 2 +-
dist/echarts.common.min.js | 2 +-
dist/echarts.esm.js | 930 +++++++++++++++++++++++++--------------------
dist/echarts.esm.js.map | 2 +-
dist/echarts.esm.min.js | 4 +-
dist/echarts.esm.min.mjs | 4 +-
dist/echarts.esm.mjs | 930 +++++++++++++++++++++++++--------------------
dist/echarts.esm.mjs.map | 2 +-
dist/echarts.js | 930 +++++++++++++++++++++++++--------------------
dist/echarts.js.map | 2 +-
dist/echarts.min.js | 2 +-
dist/echarts.simple.js | 698 +++++++++++++++++++---------------
dist/echarts.simple.js.map | 2 +-
dist/echarts.simple.min.js | 2 +-
i18n/langEL-obj.js | 175 +++++++++
i18n/langEL.js | 171 +++++++++
package-lock.json | 18 +-
package.json | 4 +-
src/core/echarts.ts | 4 +-
20 files changed, 2773 insertions(+), 1859 deletions(-)
diff --git a/dist/echarts.common.js b/dist/echarts.common.js
index e0b416037..709ec4491 100644
--- a/dist/echarts.common.js
+++ b/dist/echarts.common.js
@@ -7564,7 +7564,7 @@
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
- var version = '6.0.0-rc.1';
+ var version = '6.0.0';
var zrender = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -7678,6 +7678,8 @@
}
function round(x, precision, returnStr) {
if (precision == null) {
+ // FIXME: the default precision should not be provided, since there is no universally adaptable
+ // precision. The caller need to input a precision according to the scenarios.
precision = 10;
}
// Avoid range error
@@ -8656,7 +8658,7 @@
var others = {};
var mainTypeSpecified = false;
each(finder, function (value, key) {
- // Exclude 'dataIndex' and other illgal keys.
+ // Exclude 'dataIndex' and other illegal keys.
if (key === 'dataIndex' || key === 'dataIndexInside') {
others[key] = value;
return;
@@ -9238,8 +9240,8 @@
}
return i;
}
- function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
- text != null && (text += '');
+ function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
+ var text = formatText(rawText);
var overflow = style.overflow;
var padding = style.padding;
var paddingH = padding ? padding[1] + padding[3] : 0;
@@ -9339,9 +9341,9 @@
}
return RichTextContentBlock;
}());
- function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
+ function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
var contentBlock = new RichTextContentBlock();
- text != null && (text += '');
+ var text = formatText(rawText);
if (!text) {
return contentBlock;
}
@@ -9667,6 +9669,33 @@
}
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
+ function formatText(text) {
+ return text != null ? (text += '') : (text = '');
+ }
+ function tSpanCreateBoundingRect(style) {
+ var text = formatText(style.text);
+ var font = style.font;
+ var contentWidth = measureWidth(ensureFontMeasureInfo(font), text);
+ var contentHeight = getLineHeight(font);
+ return tSpanCreateBoundingRect2(style, contentWidth, contentHeight, null);
+ }
+ function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
+ var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY$1(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
+ var lineWidth = forceLineWidth != null
+ ? forceLineWidth
+ : (tSpanHasStroke(style) ? style.lineWidth : 0);
+ if (lineWidth > 0) {
+ rect.x -= lineWidth / 2;
+ rect.y -= lineWidth / 2;
+ rect.width += lineWidth;
+ rect.height += lineWidth;
+ }
+ return rect;
+ }
+ function tSpanHasStroke(style) {
+ var stroke = style.stroke;
+ return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ }
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
@@ -11616,9 +11645,7 @@
return _super !== null && _super.apply(this, arguments) || this;
}
TSpan.prototype.hasStroke = function () {
- var style = this.style;
- var stroke = style.stroke;
- return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ return tSpanHasStroke(this.style);
};
TSpan.prototype.hasFill = function () {
var style = this.style;
@@ -11632,21 +11659,8 @@
this._rect = rect;
};
TSpan.prototype.getBoundingRect = function () {
- var style = this.style;
if (!this._rect) {
- var text = style.text;
- text != null ? (text += '') : (text = '');
- var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
- rect.x += style.x || 0;
- rect.y += style.y || 0;
- if (this.hasStroke()) {
- var w = style.lineWidth;
- rect.x -= w / 2;
- rect.y -= w / 2;
- rect.width += w;
- rect.height += w;
- }
- this._rect = rect;
+ this._rect = tSpanCreateBoundingRect(this.style);
}
return this._rect;
};
@@ -12104,7 +12118,6 @@
var bgColorDrawn = !!(style.backgroundColor);
var outerHeight = contentBlock.outerHeight;
var outerWidth = contentBlock.outerWidth;
- var contentWidth = contentBlock.contentWidth;
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
this.isTruncated = !!contentBlock.isTruncated;
@@ -12126,6 +12139,7 @@
}
}
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var useDefaultFill = false;
var textFill = getFill('fill' in style
? style.fill
@@ -12134,12 +12148,9 @@
? style.stroke
: (!bgColorDrawn
&& (!defaultStyle.autoStroke || useDefaultFill))
- ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = style.textShadowBlur > 0;
- var fixedBoundingRect = style.width != null
- && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
- var calculatedLineHeight = contentBlock.calculatedLineHeight;
for (var i = 0; i < textLines.length; i++) {
var el = this._getOrCreateChild(TSpan);
var subElStyle = el.createStyle();
@@ -12169,9 +12180,7 @@
subElStyle.font = textFont;
setSeparateFont(subElStyle, style);
textY += lineHeight;
- if (fixedBoundingRect) {
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
- }
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, contentBlock.contentWidth, contentBlock.calculatedLineHeight, usingDefaultStroke ? 0 : null));
}
};
ZRText.prototype._updateRichTexts = function () {
@@ -12268,6 +12277,7 @@
var defaultStyle = this._defaultStyle;
var useDefaultFill = false;
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill
: 'fill' in style ? style.fill
: (useDefaultFill = true, defaultStyle.fill));
@@ -12275,7 +12285,7 @@
: 'stroke' in style ? style.stroke
: (!bgColorDrawn
&& !parentBgColorDrawn
- && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = tokenStyle.textShadowBlur > 0
|| style.textShadowBlur > 0;
@@ -12302,9 +12312,7 @@
if (textFill) {
subElStyle.fill = textFill;
}
- var textWidth = token.contentWidth;
- var textHeight = token.contentHeight;
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, token.contentWidth, token.contentHeight, usingDefaultStroke ? 0 : null));
};
ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
var textBackgroundColor = style.backgroundColor;
@@ -12460,25 +12468,6 @@
|| (style.borderWidth && style.borderColor));
}
- var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
- var SOURCE_FORMAT_ORIGINAL = 'original';
- var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
- var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
- var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
- var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
- var SOURCE_FORMAT_UNKNOWN = 'unknown';
- var SERIES_LAYOUT_BY_COLUMN = 'column';
- var SERIES_LAYOUT_BY_ROW = 'row';
- /**
- * PENDING: Temporary impl. unify them?
- * @see {LabelCommonOption['textMargin']}
- * @see {LabelCommonOption['minMargin']}
- */
- var LabelMarginType = {
- minMargin: 0,
- textMargin: 1
- };
-
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
if (el) {
@@ -15171,7 +15160,7 @@
* `false` - expand if `delta[i]` is positive, commmonly used in `margin` case. (default)
* @param noNegative
* `true` - negative `delta[i]` will be clampped to 0.
- * `false` - No clamp to `delta`. (defualt).
+ * `false` - No clamp to `delta`. (default).
* @return The input `rect`.
*/
function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize // by default [0, 0].
@@ -15181,6 +15170,9 @@
} else if (isNumber(delta)) {
_tmpExpandRectDelta[0] = _tmpExpandRectDelta[1] = _tmpExpandRectDelta[2] = _tmpExpandRectDelta[3] = delta;
} else {
+ if ("development" !== 'production') {
+ assert(delta.length === 4);
+ }
_tmpExpandRectDelta[0] = delta[0];
_tmpExpandRectDelta[1] = delta[1];
_tmpExpandRectDelta[2] = delta[2];
@@ -15281,6 +15273,27 @@
return !transform || mathAbs$1(transform[1]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[2]) < AXIS_ALIGN_EPSILON || mathAbs$1(transform[0]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[3]) < AXIS_ALIGN_EPSILON;
}
var AXIS_ALIGN_EPSILON = 1e-5;
+ /**
+ * Create or copy to the existing bounding rect to avoid modifying `source`.
+ *
+ * @usage
+ * out.rect = ensureCopyRect(out.rect, sourceRect);
+ */
+ function ensureCopyRect(target, source) {
+ return target ? BoundingRect.copy(target, source) : source.clone();
+ }
+ /**
+ * Create or copy to the existing transform to avoid modifying `source`.
+ *
+ * [CAUTION]: transform is `NullUndefined` if no transform, following convention of zrender,
+ * and enable to bypass some unnecessary calculation, since in most cases there is no transform.
+ *
+ * @usage
+ * out.transform = ensureCopyTransform(out.transform, sourceTransform);
+ */
+ function ensureCopyTransform(target, source) {
+ return source ? copy$1(target || create$1(), source) : undefined;
+ }
function retrieveZInfo(model) {
return {
z: model.get('z') || 0,
@@ -15334,9 +15347,9 @@
doUpdateZ(el, z, zlevel, -Infinity);
}
function doUpdateZ(el, z, zlevel,
- // FIXME: ideally all the labels shold be above all the glyphs by default,
+ // FIXME: Ideally all the labels should be above all the glyphs by default,
// e.g. in graph, edge labels should be above node elements.
- // currenly impl does not garaentee that.
+ // Currently impl does not guarantee that.
maxZ2) {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
@@ -15421,6 +15434,8 @@
setTooltipConfig: setTooltipConfig,
traverseElements: traverseElements,
isBoundingRectAxisAligned: isBoundingRectAxisAligned,
+ ensureCopyRect: ensureCopyRect,
+ ensureCopyTransform: ensureCopyTransform,
retrieveZInfo: retrieveZInfo,
calcZ2Range: calcZ2Range,
traverseUpdateZ: traverseUpdateZ,
@@ -15680,23 +15695,26 @@
if (overflow) {
textStyle.overflow = overflow;
}
- var minMargin = textStyleModel.get('minMargin');
- if (minMargin != null) {
- textStyle.margin = minMargin;
- textStyle.__marginType = LabelMarginType.minMargin;
- }
- var textMargin = textStyleModel.get('textMargin');
- if (textMargin != null) {
- textStyle.margin = clone(textMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- } else if (opt.defaultTextMargin != null) {
- textStyle.margin = clone(opt.defaultTextMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- }
var lineOverflow = textStyleModel.get('lineOverflow');
if (lineOverflow) {
textStyle.lineOverflow = lineOverflow;
}
+ var labelTextStyle = textStyle;
+ // `minMargin` has a higher precedence than `textMargin`, because `textMargin` is allowed
+ // to be set in `defaultOption`.
+ var minMargin = textStyleModel.get('minMargin');
+ if (minMargin != null) {
+ // `minMargin` only support number value.
+ minMargin = !isNumber(minMargin) ? 0 : minMargin / 2;
+ labelTextStyle.margin = [minMargin, minMargin, minMargin, minMargin];
+ labelTextStyle.__marginType = LabelMarginType.minMargin;
+ } else {
+ var textMargin = textStyleModel.get('textMargin');
+ if (textMargin != null) {
+ labelTextStyle.margin = normalizeCssArray(textMargin);
+ labelTextStyle.__marginType = LabelMarginType.textMargin;
+ }
+ }
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, null, null, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
@@ -15887,6 +15905,15 @@
obj.statesModels = labelStatesModels;
}
}
+ /**
+ * PENDING: Temporary impl. unify them?
+ * @see {LabelCommonOption['textMargin']}
+ * @see {LabelCommonOption['minMargin']}
+ */
+ var LabelMarginType = {
+ minMargin: 1,
+ textMargin: 2
+ };
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
@@ -17558,7 +17585,7 @@
// Commonly used in option `legend.padding`, `timeline.padding`, `title.padding`,
// `visualMap.padding`, ...
// [NOTICE]:
- // It's named `margin`, becuase it's the space that outside the bounding rect. But from
+ // It's named `margin`, because it's the space that outside the bounding rect. But from
// the perspective of the the caller, it's commonly used as the `padding` of a component,
// because conventionally background color covers this space.
// [BEHAVIOR]:
@@ -18179,7 +18206,7 @@
tokens.darkColor[key] = modifyHSL(hex, null, function (s) {
return s * 0.9;
}, function (l) {
- return 1 - l;
+ return 1 - Math.pow(l, 1.5);
});
}
}
@@ -18286,6 +18313,16 @@
useUTC: false
};
+ var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
+ var SOURCE_FORMAT_ORIGINAL = 'original';
+ var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
+ var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
+ var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
+ var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
+ var SOURCE_FORMAT_UNKNOWN = 'unknown';
+ var SERIES_LAYOUT_BY_COLUMN = 'column';
+ var SERIES_LAYOUT_BY_ROW = 'row';
+
// The result of `guessOrdinal`.
var BE_ORDINAL = {
Must: 1,
@@ -25153,7 +25190,10 @@
color: color$2.secondary
},
itemStyle: {
- borderColor: color$2.neutral20
+ borderColor: color$2.borderTint
+ },
+ dividerLineStyle: {
+ color: color$2.border
}
};
var theme = {
@@ -25243,9 +25283,6 @@
textStyle: {
color: color$2.secondary
},
- inRange: {
- color: [color$2.neutral10, color$2.theme[0]]
- },
handleStyle: {
borderColor: color$2.neutral30
}
@@ -25281,10 +25318,12 @@
x: matrixAxis,
y: matrixAxis,
backgroundColor: {
- borderColor: '#817f91'
+ borderColor: color$2.axisLine
},
- innerBackgroundStyle: {
- borderColor: '#484753'
+ body: {
+ itemStyle: {
+ borderColor: color$2.borderTint
+ }
}
},
timeAxis: axisCommon(),
@@ -27161,9 +27200,9 @@
return implsStore[name];
}
- var version$1 = '6.0.0-beta.1';
+ var version$1 = '6.0.0';
var dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
@@ -28328,15 +28367,16 @@
coordSysMgr.update(ecModel, api);
clearColorPalette(ecModel);
scheduler.performVisualTasks(ecModel, payload);
- render(this, ecModel, api, payload, updateParams);
- // Set background
+ // Set background and dark mode before rendering, because they affect auto-color-determination
+ // in zrender Text, and consequently affect the bounding rect if stroke is added.
var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
- var darkMode = ecModel.get('darkMode');
zr.setBackgroundColor(backgroundColor);
// Force set dark mode.
+ var darkMode = ecModel.get('darkMode');
if (darkMode != null && darkMode !== 'auto') {
zr.setDarkMode(darkMode);
}
+ render(this, ecModel, api, payload, updateParams);
lifecycle.trigger('afterupdate', ecModel, api);
},
updateTransform: function (payload) {
@@ -32321,8 +32361,9 @@
var minorTicksGroup = [];
var interval = nextTick.value - prevTick.value;
var minorInterval = interval / splitNumber;
+ var minorIntervalPrecision = getIntervalPrecision(minorInterval);
while (count < splitNumber - 1) {
- var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
+ var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval, minorIntervalPrecision);
// For the first and last interval. The count may be less than splitNumber.
if (minorTick > extent[0] && minorTick < extent[1]) {
minorTicksGroup.push(minorTick);
@@ -32361,6 +32402,12 @@
return addCommas(dataNum);
};
/**
+ * FIXME: refactor - disallow override, use composition instead.
+ *
+ * The override of `calcNiceTicks` should ensure these members are provided:
+ * this._intervalPrecision
+ * this._interval
+ *
* @param splitNumber By default `5`.
*/
IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
@@ -32416,11 +32463,12 @@
extent = this._extent.slice();
this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
var interval = this._interval;
+ var intervalPrecition = this._intervalPrecision;
if (!opt.fixMin) {
- extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
+ extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval, intervalPrecition);
}
if (!opt.fixMax) {
- extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
+ extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval, intervalPrecition);
}
this._innerSetExtent(extent[0], extent[1]);
};
@@ -32985,6 +33033,7 @@
var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
// Interval that can be used to calculate ticks
this._interval = scaleIntervals[idx][1];
+ this._intervalPrecision = getIntervalPrecision(this._interval);
// Min level used when picking ticks from top down.
// We check one more level to avoid the ticks are to sparse in some case.
this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
@@ -33375,8 +33424,8 @@
var scaleBreakHelper = getScaleBreakHelper();
return map(ticks, function (tick) {
var val = tick.value;
- var powVal = fixRound(mathPow$1(base, val));
var roundingCriterion = null;
+ var powVal = mathPow$1(base, val);
// Fix #4158
if (val === extent[0] && this._fixMin) {
roundingCriterion = originalExtent[0];
@@ -33450,6 +33499,7 @@
}
var niceExtent = [fixRound(mathCeil(extent[0] / interval) * interval), fixRound(mathFloor(extent[1] / interval) * interval)];
this._interval = interval;
+ this._intervalPrecision = getIntervalPrecision(interval);
this._niceExtent = niceExtent;
};
LogScale.prototype.calcNiceExtent = function (opt) {
@@ -35459,128 +35509,192 @@
return statesModels;
}
- // Also prevent duck typing.
- var LABEL_LAYOUT_INFO_KIND_RAW = 1;
- var LABEL_LAYOUT_INFO_KIND_COMPUTED = 2;
+ var LABEL_LAYOUT_BASE_PROPS = ['label', 'labelLine', 'layoutOption', 'priority', 'defaultAttr', 'marginForce', 'minMarginForce', 'marginDefault', 'suggestIgnore'];
+ var LABEL_LAYOUT_DIRTY_BIT_OTHERS = 1;
+ var LABEL_LAYOUT_DIRTY_BIT_OBB = 2;
+ var LABEL_LAYOUT_DIRTY_ALL = LABEL_LAYOUT_DIRTY_BIT_OTHERS | LABEL_LAYOUT_DIRTY_BIT_OBB;
+ function setLabelLayoutDirty(labelGeometry, dirtyOrClear, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ dirtyOrClear ? labelGeometry.dirty |= dirtyBits : labelGeometry.dirty &= ~dirtyBits;
+ }
+ function isLabelLayoutDirty(labelGeometry, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ return labelGeometry.dirty == null || !!(labelGeometry.dirty & dirtyBits);
+ }
/**
- * If `defaultAttr.ignore: true`, return `NullUndefined`.
- * (the caller is reponsible for ensuring the label is always `ignore: true`.)
- * Otherwise the `layoutInfo` will be modified and returned.
- * `label.ignore` is not necessarily falsy, since it might be modified by some overlap resolving handling.
+ * [CAUTION]
+ * - No auto dirty propagation mechanism yet. If the transform of the raw label or any of its ancestors is
+ * changed, must sync the changes to the props of `LabelGeometry` by:
+ * either explicitly call:
+ * `setLabelLayoutDirty(labelLayout, true); ensureLabelLayoutWithGeometry(labelLayout);`
+ * or call (if only translation is performed):
+ * `labelLayoutApplyTranslation(labelLayout);`
+ * - `label.ignore` is not necessarily falsy, and not considered in computing `LabelGeometry`,
+ * since it might be modified by some overlap resolving handling.
+ * - To duplicate or make a variation:
+ * use `newLabelLayoutWithGeometry`.
*
* The result can also be the input of this method.
- *
- * @see ensureLabelLayoutInfoComputed
+ * @return `NullUndefined` if and only if `labelLayout` is `NullUndefined`.
*/
- function prepareLabelLayoutInfo(layoutInfo) {
- if (!layoutInfo || layoutInfo.defaultAttr.ignore) {
+ function ensureLabelLayoutWithGeometry(labelLayout) {
+ if (!labelLayout) {
return;
}
- var label = layoutInfo.label;
- var ignoreMargin = layoutInfo.ignoreMargin;
- var transform = label.getComputedTransform();
- // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
- var localRect = label.getBoundingRect();
- var axisAligned = isBoundingRectAxisAligned(transform);
- if (!ignoreMargin) {
- localRect = applyTextMarginToLocalRect(label, localRect);
- }
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- if (!ignoreMargin && label.style.__marginType === LabelMarginType.minMargin) {
- // `minMargin` only support number value.
- var halfMinMargin = (label.style.margin || 0) / 2;
- expandOrShrinkRect(globalRect, halfMinMargin, false, false);
- }
- var computed = layoutInfo;
- computed.kind = LABEL_LAYOUT_INFO_KIND_COMPUTED,
- // --- computed properties ---
- computed.rect = globalRect;
- computed.localRect = localRect;
- computed.obb = null,
- // will be created by `ensureOBB` when using.
- computed.axisAligned = axisAligned;
- computed.transform = transform;
- return computed;
- }
- /**
- * The reverse operation of `ensureLabelLayoutInfoComputedv`.
- */
- function rollbackToLabelLayoutInfoRaw(labelLayoutInfo) {
- if (labelLayoutInfo == null) {
+ if (isLabelLayoutDirty(labelLayout)) {
+ computeLabelGeometry(labelLayout, labelLayout.label, labelLayout);
+ }
+ return labelLayout;
+ }
+ /**
+ * The props in `out` will be filled if existing, or created.
+ */
+ function computeLabelGeometry(out, label, opt) {
+ // [CAUTION] These props may be modified directly for performance consideration,
+ // therefore, do not output the internal data structure of zrender Element.
+ var rawTransform = label.getComputedTransform();
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ // NOTE: should call `getBoundingRect` after `getComputedTransform`, or may get an inaccurate bounding rect.
+ // The reason is that `getComputedTransform` calls `__host.updateInnerText()` internally, which updates the label
+ // by `textConfig` mounted on the host.
+ // PENDING: add a dirty bit for that in zrender?
+ var outLocalRect = out.localRect = ensureCopyRect(out.localRect, label.getBoundingRect());
+ var labelStyleExt = label.style;
+ var margin = labelStyleExt.margin;
+ var marginForce = opt && opt.marginForce;
+ var minMarginForce = opt && opt.minMarginForce;
+ var marginDefault = opt && opt.marginDefault;
+ var marginType = labelStyleExt.__marginType;
+ if (marginType == null && marginDefault) {
+ margin = marginDefault;
+ marginType = LabelMarginType.textMargin;
+ }
+ // `textMargin` and `minMargin` can not exist both.
+ for (var i = 0; i < 4; i++) {
+ _tmpLabelMargin[i] = marginType === LabelMarginType.minMargin && minMarginForce && minMarginForce[i] != null ? minMarginForce[i] : marginForce && marginForce[i] != null ? marginForce[i] : margin ? margin[i] : 0;
+ }
+ if (marginType === LabelMarginType.textMargin) {
+ expandOrShrinkRect(outLocalRect, _tmpLabelMargin, false, false);
+ }
+ var outGlobalRect = out.rect = ensureCopyRect(out.rect, outLocalRect);
+ if (rawTransform) {
+ outGlobalRect.applyTransform(rawTransform);
+ }
+ // Notice: label.style.margin is actually `minMargin / 2`, handled by `setTextStyleCommon`.
+ if (marginType === LabelMarginType.minMargin) {
+ expandOrShrinkRect(outGlobalRect, _tmpLabelMargin, false, false);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ (out.label = out.label || {}).ignore = label.ignore;
+ setLabelLayoutDirty(out, false);
+ setLabelLayoutDirty(out, true, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ // Do not remove `obb` (if existing) for reuse, just reset the dirty bit.
+ return out;
+ }
+ var _tmpLabelMargin = [0, 0, 0, 0];
+ /**
+ * The props in `out` will be filled if existing, or created.
+ */
+ function computeLabelGeometry2(out, rawLocalRect, rawTransform) {
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ out.localRect = ensureCopyRect(out.localRect, rawLocalRect);
+ out.rect = ensureCopyRect(out.rect, rawLocalRect);
+ if (rawTransform) {
+ out.rect.applyTransform(rawTransform);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ out.obb = undefined; // Reset to undefined, will be created by `ensureOBB` when using.
+ (out.label = out.label || {}).ignore = false;
+ return out;
+ }
+ /**
+ * This is a shortcut of
+ * ```js
+ * labelLayout.label.x = newX;
+ * labelLayout.label.y = newY;
+ * setLabelLayoutDirty(labelLayout, true);
+ * ensureLabelLayoutWithGeometry(labelLayout);
+ * ```
+ * and provide better performance in this common case.
+ */
+ function labelLayoutApplyTranslation(labelLayout, offset) {
+ if (!labelLayout) {
return;
}
- var raw = labelLayoutInfo;
- raw.kind = LABEL_LAYOUT_INFO_KIND_RAW;
- return raw;
- }
- /**
- * This method supports that the label layout info is not computed until needed,
- * for performance consideration.
- *
- * [CAUTION]
- * - If the raw label is changed, must call
- * `ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(layoutInfo))`
- * to recreate the layout info.
- * - Null checking is needed for the result. @see prepareLabelLayoutInfo
- *
- * Usage:
- * To make a copy of labelLayoutInfo, simply:
- * const layoutInfoCopy = rollbackToLabelLayoutInfoRaw(extends({}, someLabelLayoutInfo));
- */
- function ensureLabelLayoutInfoComputed(labelLayoutInfo) {
- if (!labelLayoutInfo) {
- return;
+ labelLayout.label.x += offset.x;
+ labelLayout.label.y += offset.y;
+ labelLayout.label.markRedraw();
+ var transform = labelLayout.transform;
+ if (transform) {
+ transform[4] += offset.x;
+ transform[5] += offset.y;
}
- if (labelLayoutInfo.kind !== LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- labelLayoutInfo = prepareLabelLayoutInfo(labelLayoutInfo);
+ var globalRect = labelLayout.rect;
+ if (globalRect) {
+ globalRect.x += offset.x;
+ globalRect.y += offset.y;
+ }
+ var obb = labelLayout.obb;
+ if (obb) {
+ obb.fromBoundingRect(labelLayout.localRect, transform);
}
- return labelLayoutInfo;
- }
- function prepareIntersectionCheckInfo(localRect, transform) {
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- return {
- obb: null,
- rect: globalRect,
- localRect: localRect,
- axisAligned: isBoundingRectAxisAligned(transform),
- transform: transform
- };
- }
- function createSingleLayoutInfoComputed(el) {
- return ensureLabelLayoutInfoComputed({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
- label: el,
- priority: el.z2,
- defaultAttr: {
- ignore: el.ignore
- }
- });
}
/**
- * Create obb if no one, can cache it.
+ * To duplicate or make a variation of a label layout.
+ * Copy the only relevant properties to avoid the conflict or wrongly reuse of the props of `LabelLayoutWithGeometry`.
*/
- function ensureOBB(layoutInfo) {
- return layoutInfo.obb || (layoutInfo.obb = new OrientedBoundingRect(layoutInfo.localRect, layoutInfo.transform));
+ function newLabelLayoutWithGeometry(newBaseWithDefaults, source) {
+ for (var i = 0; i < LABEL_LAYOUT_BASE_PROPS.length; i++) {
+ var prop = LABEL_LAYOUT_BASE_PROPS[i];
+ if (newBaseWithDefaults[prop] == null) {
+ newBaseWithDefaults[prop] = source[prop];
+ }
+ }
+ return ensureLabelLayoutWithGeometry(newBaseWithDefaults);
}
/**
- * The input localRect is never modified.
- * The returned localRect maybe the input localRect.
+ * Create obb if no one, can cache it.
*/
- function applyTextMarginToLocalRect(label, localRect) {
- if (label.style.__marginType !== LabelMarginType.textMargin) {
- return localRect;
+ function ensureOBB(labelGeometry) {
+ var obb = labelGeometry.obb;
+ if (!obb || isLabelLayoutDirty(labelGeometry, LABEL_LAYOUT_DIRTY_BIT_OBB)) {
+ labelGeometry.obb = obb = obb || new OrientedBoundingRect();
+ obb.fromBoundingRect(labelGeometry.localRect, labelGeometry.transform);
+ setLabelLayoutDirty(labelGeometry, false, LABEL_LAYOUT_DIRTY_BIT_OBB);
}
- var textMargin = normalizeCssArray$1(retrieve2(label.style.margin, [0, 0]));
- localRect = localRect.clone();
- expandOrShrinkRect(localRect, textMargin, false, false);
- return localRect;
+ return obb;
}
- function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
+ /**
+ * Adjust labels on x/y direction to avoid overlap.
+ *
+ * PENDING: the current implementation is based on the global bounding rect rather than the local rect,
+ * which may be not preferable in some edge cases when the label has rotation, but works for most cases,
+ * since rotation is unnecessary when there is sufficient space, while squeezing is applied regardless
+ * of overlapping when there is no enough space.
+ *
+ * NOTICE:
+ * - The input `list` and its content will be modified (sort, label.x/y, rect).
+ * - The caller should sync the modifications to the other parts by
+ * `setLabelLayoutDirty` and `ensureLabelLayoutWithGeometry` if needed.
+ *
+ * @return adjusted
+ */
+ function shiftLayoutOnXY(list, xyDimIdx,
+ // 0 for x, 1 for y
+ minBound,
+ // for x, leftBound; for y, topBound
+ maxBound,
+ // for x, rightBound; for y, bottomBound
+ // If average the shifts on all labels and add them to 0
+ // TODO: Not sure if should enable it.
+ // Pros: The angle of lines will distribute more equally
+ // Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
+ balanceShift) {
var len = list.length;
+ var xyDim = XY$1[xyDimIdx];
+ var sizeDim = WH$1[xyDimIdx];
if (len < 2) {
- return;
+ return false;
}
list.sort(function (a, b) {
return a.rect[xyDim] - b.rect[xyDim];
@@ -35588,6 +35702,7 @@
var lastPos = 0;
var delta;
var adjusted = false;
+ // const shifts = [];
var totalShifts = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
@@ -35600,6 +35715,7 @@
adjusted = true;
}
var shift = Math.max(-delta, 0);
+ // shifts.push(shift);
totalShifts += shift;
lastPos = rect[xyDim] + rect[sizeDim];
}
@@ -35712,22 +35828,16 @@
return adjusted;
}
/**
- * Adjust labels on y direction to avoid overlap.
- */
- function shiftLayoutOnY(list, topBound, bottomBound,
- // If average the shifts on all labels and add them to 0
- balanceShift) {
- return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
- }
- /**
- * [CAUTION]: the `label.ignore` in the input is not necessarily falsy.
- * this method checks intersection regardless of current `ignore`,
- * if no intersection, restore the `ignore` to `defaultAttr.ignore`.
- * And `labelList` will be modified.
- * Therefore, if some other overlap resolving strategy has ignored some elements,
- * do not input them to this method.
- * PENDING: review the diff between the requirements from LabelManager and AxisBuilder,
- * and uniform the behavior?
+ * [NOTICE - restore]:
+ * 'series:layoutlabels' may be triggered during some shortcut passes, such as zooming in series.graph/geo
+ * (`updateLabelLayout`), where the modified `Element` props should be restorable from `defaultAttr`.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * `restoreIgnore` can be called to perform the restore, if needed.
+ *
+ * [NOTICE - state]:
+ * Regarding Element's states, this method is only designed for the normal state.
+ * PENDING: although currently this method is effectively called in other states in `updateLabelLayout` case,
+ * the bad case is not noticeable in the zooming scenario.
*/
function hideOverlap(labelList) {
var displayedLabels = [];
@@ -35746,8 +35856,10 @@
el.ignore = true;
}
for (var i = 0; i < labelList.length; i++) {
- var labelItem = ensureLabelLayoutInfoComputed(labelList[i]);
- if (!labelItem || labelItem.label.ignore) {
+ var labelItem = ensureLabelLayoutWithGeometry(labelList[i]);
+ // The current `el.ignore` is involved, since some previous overlap
+ // resolving strategies may have set `el.ignore` to true.
+ if (labelItem.label.ignore) {
continue;
}
var label = labelItem.label;
@@ -35770,24 +35882,24 @@
hideEl(label);
labelLine && hideEl(labelLine);
} else {
- label.attr('ignore', labelItem.defaultAttr.ignore);
- labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
displayedLabels.push(labelItem);
}
}
}
/**
- * [NOTICE]:
- * - `label.ignore` is not considered - no requirement so far.
- * - `baseLayoutInfo` and `targetLayoutInfo` may be modified - obb may be created and saved.
- *
* Enable fast check for performance; use obb if inevitable.
* If `mtv` is used, `targetLayoutInfo` can be moved based on the values filled into `mtv`.
+ *
+ * This method is based only on the current `Element` states (regardless of other states).
+ * Typically this method (and the entire layout process) is performed in normal state.
*/
function labelIntersect(baseLayoutInfo, targetLayoutInfo, mtv, intersectOpt) {
if (!baseLayoutInfo || !targetLayoutInfo) {
return false;
}
+ if (baseLayoutInfo.label && baseLayoutInfo.label.ignore || targetLayoutInfo.label && targetLayoutInfo.label.ignore) {
+ return false;
+ }
// Fast rejection.
if (!baseLayoutInfo.rect.intersect(targetLayoutInfo.rect, mtv, intersectOpt)) {
return false;
@@ -42366,7 +42478,7 @@
list[i].label.x = farthestX;
}
}
- if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
+ if (shiftLayoutOnXY(list, 1, viewTop, viewTop + viewHeight)) {
recalculateX(list);
}
}
@@ -42417,7 +42529,7 @@
}
}
layout.targetTextWidth = targetTextWidth;
- constrainTextWidth(layout, targetTextWidth);
+ constrainTextWidth(layout, targetTextWidth, false);
}
}
adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
@@ -42463,9 +42575,6 @@
* which case, previous wrapping should be redo.
*/
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
- if (forceRecalculate === void 0) {
- forceRecalculate = false;
- }
if (layout.labelStyleWidth != null) {
// User-defined style.width has the highest priority.
return;
@@ -42480,7 +42589,6 @@
// textRect.width already contains paddingH if bgColor is set
var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
if (availableWidth < oldOuterWidth || forceRecalculate) {
- var oldHeight = textRect.height;
if (overflow && overflow.match('break')) {
// Temporarily set background to be null to calculate
// the bounding box without background.
@@ -42512,13 +42620,18 @@
: null;
label.setStyle('width', newWidth);
}
- var newRect = label.getBoundingRect();
- textRect.width = newRect.width;
- var margin = (label.style.margin || 0) + 2.1;
- textRect.height = newRect.height + margin;
- textRect.y -= (textRect.height - oldHeight) / 2;
+ computeLabelGlobalRect(textRect, label);
}
}
+ function computeLabelGlobalRect(out, label) {
+ _tmpLabelGeometry.rect = out;
+ computeLabelGeometry(_tmpLabelGeometry, label, _computeLabelGeometryOpt);
+ }
+ var _computeLabelGeometryOpt = {
+ minMarginForce: [null, 0, null, 0],
+ marginDefault: [1, 0, 1, 0]
+ };
+ var _tmpLabelGeometry = {};
function isPositionCenter(sectorShape) {
// Not change x for center label
return sectorShape.position === 'center';
@@ -42650,12 +42763,8 @@
});
// Not sectorShape the inside label
if (!isLabelInside) {
- var textRect = label.getBoundingRect().clone();
- textRect.applyTransform(label.getComputedTransform());
- // Text has a default 1px stroke. Exclude this.
- var margin = (label.style.margin || 0) + 2.1;
- textRect.y -= margin / 2;
- textRect.height += margin;
+ var textRect = new BoundingRect(0, 0, 0, 0);
+ computeLabelGlobalRect(textRect, label);
labelLayoutList.push({
label: label,
labelLine: labelLine,
@@ -44370,17 +44479,15 @@
}
var PI$5 = Math.PI;
- // This tune is also for backward compat, since nameMoveOverlap is set as default,
- // in compact layout (multiple charts in one canvas), name should be more close to the axis line and labels.
- var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2], [5, 3], [8, 3]];
- var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1], [0, 3], [0, 3]];
+ var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]];
+ var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]];
var getLabelInner = makeInner();
var getTickInner = makeInner();
/**
* A context shared by difference axisBuilder instances.
* For cross-axes overlap resolving.
*
- * Lifecycle constrait: should not over a pass of ec main process.
+ * Lifecycle constraint: should not over a pass of ec main process.
* If model is changed, the context must be disposed.
*
* @see AxisBuilderLocalContext
@@ -44410,14 +44517,14 @@
* (such as `hideOverlap`, `fixMinMaxLabelShow`) and after transform calculating.
* 2. Can be called multiple times and should be idempotent.
*/
- function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutInfoList) {
+ function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) {
var axis = axisModel.axis;
var record = shared.ensureRecord(axisModel);
var labelInfoList = [];
var stOccupiedRect;
var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation);
- each(labelLayoutInfoList, function (layout) {
- var layoutInfo = ensureLabelLayoutInfoComputed(layout);
+ each(labelLayoutList, function (layout) {
+ var layoutInfo = ensureLabelLayoutWithGeometry(layout);
if (!layoutInfo || layoutInfo.label.ignore) {
return;
}
@@ -44461,7 +44568,7 @@
if (isNameLocationCenter(cfg.nameLocation)) {
var stOccupiedRect = thisRecord.stOccupiedRect;
if (stOccupiedRect) {
- moveIfOverlap(prepareIntersectionCheckInfo(stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
+ moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
}
} else {
moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec);
@@ -44475,8 +44582,7 @@
bidirectional: false,
touchThreshold: 0.05
})) {
- Point.add(movableLayoutInfo.label, movableLayoutInfo.label, mtv);
- ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(movableLayoutInfo));
+ labelLayoutApplyTranslation(movableLayoutInfo, mtv);
}
}
function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) {
@@ -44755,7 +44861,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
}
},
/**
@@ -44769,7 +44875,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
}
var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel);
syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls);
@@ -44854,14 +44960,6 @@
fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
align: textStyleModel.get('align') || labelLayout.textAlign,
verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
- }, {
- defaultTextMargin: isNameLocationCenter(nameLocation)
- // Make axis name visually far from axis labels.
- // (but not too aggressive, consider multiple small charts)
- ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
- // top/button margin is set to `0` to inserted the xAxis name into the indention
- // above the axis labels to save space. (see example below.)
- : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
}),
z2: 1
});
@@ -44882,7 +44980,20 @@
transformGroup.add(textEl);
textEl.updateTransform();
local.nameEl = textEl;
- var nameLayout = sharedRecord.nameLayout = createSingleLayoutInfoComputed(textEl);
+ var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({
+ label: textEl,
+ priority: textEl.z2,
+ defaultAttr: {
+ ignore: textEl.ignore
+ },
+ marginDefault: isNameLocationCenter(nameLocation)
+ // Make axis name visually far from axis labels.
+ // (but not too aggressive, consider multiple small charts)
+ ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
+ // top/button margin is set to `0` to inserted the xAxis name into the indention
+ // above the axis labels to save space. (see example below.)
+ : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
+ });
sharedRecord.nameLocation = nameLocation;
group.add(textEl);
textEl.decomposeTransform();
@@ -44895,7 +45006,7 @@
}
}
};
- function axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
+ function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
if (!axisLabelBuildResultExists(local)) {
buildAxisLabel(cfg, local, group, kind, axisModel, api);
}
@@ -44955,53 +45066,47 @@
// Have not consider onBand yet, where tick els is more than label els.
// Assert no ignore in labels.
function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) {
- var outmostLabelLayout = labelLayoutList[outmostLabelIdx];
- var innerLabelLayout = labelLayoutList[innerLabelIdx];
+ var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]);
+ var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]);
if (!outmostLabelLayout || !innerLabelLayout) {
return;
}
- if (showMinMaxLabel === false) {
+ if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) {
ignoreEl(outmostLabelLayout.label);
+ return;
+ }
+ if (innerLabelLayout.suggestIgnore) {
+ ignoreEl(innerLabelLayout.label);
+ return;
}
- // PENDING: Originally we thougth `optionHideOverlap === false` means do not hide anything,
+ // PENDING: Originally we thought `optionHideOverlap === false` means do not hide anything,
// since currently the bounding rect of text might not accurate enough and might slightly bigger,
// which causes false positive. But `optionHideOverlap: null/undfined` is falsy and likely
// be treated as false.
- else {
- // In most fonts the glyph does not reach the boundary of the bouding rect.
- // This is needed to avoid too aggressive to hide two elements that meet at the edge
- // due to compact layout by the same bounding rect or OBB.
- var touchThreshold = 0.1;
- // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
- // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
- // should be conservative, since the space might be sufficient in this case.
- var ignoreMargin = !optionHideOverlap;
- if (ignoreMargin) {
- // Make a copy to apply `ignoreMargin`.
- outmostLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, outmostLabelLayout));
- innerLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, innerLabelLayout));
- }
- var anyIgnored = false;
- if (outmostLabelLayout.suggestIgnore) {
- ignoreEl(outmostLabelLayout.label);
- anyIgnored = true;
- }
- if (innerLabelLayout.suggestIgnore) {
+ // In most fonts the glyph does not reach the boundary of the bounding rect.
+ // This is needed to avoid too aggressive to hide two elements that meet at the edge
+ // due to compact layout by the same bounding rect or OBB.
+ var touchThreshold = 0.1;
+ // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
+ // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
+ // should be conservative, since the space might be sufficient in this case.
+ if (!optionHideOverlap) {
+ var marginForce = [0, 0, 0, 0];
+ // Make a copy to apply `ignoreMargin`.
+ outmostLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, outmostLabelLayout);
+ innerLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, innerLabelLayout);
+ }
+ if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, {
+ touchThreshold: touchThreshold
+ })) {
+ if (showMinMaxLabel) {
ignoreEl(innerLabelLayout.label);
- anyIgnored = true;
- }
- if (!anyIgnored && labelIntersect(ensureLabelLayoutInfoComputed(outmostLabelLayout), ensureLabelLayoutInfoComputed(innerLabelLayout), null, {
- touchThreshold: touchThreshold
- })) {
- if (showMinMaxLabel) {
- ignoreEl(innerLabelLayout.label);
- } else {
- ignoreEl(outmostLabelLayout.label);
- }
+ } else {
+ ignoreEl(outmostLabelLayout.label);
}
}
}
@@ -45014,7 +45119,7 @@
deal(showMinLabel, 0, 1);
deal(showMaxLabel, labelsLen - 1, labelsLen - 2);
}
- // PENDING: is it necessary to display a tick while the cooresponding label is ignored?
+ // PENDING: Is it necessary to display a tick while the corresponding label is ignored?
function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) {
if (cfg.showMinorTicks) {
// It probably unreaasonable to hide major ticks when show minor ticks.
@@ -45121,7 +45226,7 @@
}
}
}
- // Return whether need to call `axisTickLabelLayout` again.
+ // Return whether need to call `layOutAxisTickLabel` again.
function dealLastTickLabelResultReusable(local, group, extraParams) {
if (axisLabelBuildResultExists(local)) {
var axisLabelsCreationContext = local.axisLabelsCreationContext;
@@ -45257,7 +45362,6 @@
});
var labelLayoutList = map(labelEls, function (label) {
return {
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) // Make break labels be highest priority.
: label.z2,
@@ -45268,7 +45372,7 @@
});
axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx);
}
- // Indicate that `axisTickLabelLayout` has been called.
+ // Indicate that `layOutAxisTickLabel` has been called.
function axisLabelBuildResultExists(local) {
return !!local.labelLayoutList;
}
@@ -45280,14 +45384,15 @@
}
function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) {
var labelMargin = axisModel.get(['axisLabel', 'margin']);
- each(labelLayoutList, function (layoutInfo, idx) {
- if (!layoutInfo) {
+ each(labelLayoutList, function (layout, idx) {
+ var geometry = ensureLabelLayoutWithGeometry(layout);
+ if (!geometry) {
return;
}
- var labelEl = layoutInfo.label;
+ var labelEl = geometry.label;
var inner = getLabelInner(labelEl);
// See the comment in `suggestIgnore`.
- layoutInfo.suggestIgnore = labelEl.ignore;
+ geometry.suggestIgnore = labelEl.ignore;
// Currently no `ignore:true` is set in `buildAxisLabel`
// But `ignore:true` may be set subsequently for overlap handling, thus reset it here.
labelEl.ignore = false;
@@ -45301,9 +45406,8 @@
_tmpLayoutEl.decomposeTransform();
copyTransform(labelEl, _tmpLayoutEl);
labelEl.markRedraw();
- if (layoutInfo.kind === LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- rollbackToLabelLayoutInfoRaw(layoutInfo);
- }
+ setLabelLayoutDirty(geometry, true);
+ ensureLabelLayoutWithGeometry(geometry);
});
}
var _tmpLayoutEl = new Rect();
@@ -45335,7 +45439,7 @@
var moveOverlap = axisModel.get(['breakLabelLayout', 'moveOverlap'], true);
if (moveOverlap === true || moveOverlap === 'auto') {
each(breakLabelIndexPairs, function (idxPair) {
- getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[0]]), ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[1]])]);
+ getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[0]]), ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[1]])]);
});
}
}
@@ -46022,7 +46126,7 @@
// Assume `updateAllAxisExtentTransByGridRect` has been performed once before this call.
// [NOTE]:
// - The bounding rect of the axis elements might be sensitve to variations in `axis.extent` due to strategies
- // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutInfoBase['suggestIgnore']`.
+ // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutBase['suggestIgnore']`.
// - The final `gridRect` might be slightly smaller than the ideally expected result if labels are giant and
// get hidden due to overlapping. More iterations could improve precision, but not performant. We consider
// the current result acceptable, since no alignment among charts can be guaranteed when using this feature.
@@ -48239,7 +48343,7 @@
// `legacy: false`, force do not compat.
// `legacy` not set: auto detect whether legacy.
// But in this case we do not compat (difficult to detect and rare case):
- // Becuse custom series and graphic component support "merge", users may firstly
+ // Because custom series and graphic component support "merge", users may firstly
// only set `textStrokeWidth` style or secondly only set `text`.
return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
// Difficult to detect whether legacy for a "text" el.
@@ -53175,9 +53279,11 @@
clearTimeout(this._longHideTimeout);
var zr = this._zr;
transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
- if (this.el) {
- var parentNode = this.el.parentNode;
- parentNode && parentNode.removeChild(this.el);
+ var el = this.el;
+ if (el) {
+ el.onmouseenter = el.onmousemove = el.onmouseleave = null;
+ var parentNode = el.parentNode;
+ parentNode && parentNode.removeChild(el);
}
this.el = this._container = null;
};
@@ -54363,6 +54469,7 @@
* If marker model is created by self from series
*/
_this.createdBySelf = false;
+ _this.preventAutoZ = true;
return _this;
}
/**
@@ -54686,6 +54793,7 @@
markerGroupMap.each(function (item) {
!inner$d(item).keep && _this.group.remove(item.group);
});
+ updateZ$1(ecModel, markerGroupMap, this.type);
};
MarkerView.prototype.markKeep = function (drawGroup) {
inner$d(drawGroup).keep = true;
@@ -54707,6 +54815,18 @@
MarkerView.type = 'marker';
return MarkerView;
}(ComponentView);
+ function updateZ$1(ecModel, markerGroupMap, type) {
+ ecModel.eachSeries(function (seriesModel) {
+ var markerModel = MarkerModel.getMarkerModelFromSeries(seriesModel, type);
+ var markerDraw = markerGroupMap.get(seriesModel.id);
+ if (markerModel && markerDraw && markerDraw.group) {
+ var _a = retrieveZInfo(markerModel),
+ z = _a.z,
+ zlevel = _a.zlevel;
+ traverseUpdateZ(markerDraw.group, z, zlevel);
+ }
+ });
+ }
function updateMarkerLayout(mpData, seriesModel, api) {
var coordSys = seriesModel.coordinateSystem;
@@ -60309,7 +60429,7 @@
return layout.transform ? mul$1(create$1(), axisStTrans, layout.transform) : axisStTrans;
});
function isParallelToAxis(whIdx) {
- // Assert label[0] and lable[1] has the same rotation, so only use [0].
+ // Assert label[0] and label[1] has the same rotation, so only use [0].
var localRect = layoutPair[0].localRect;
var labelVec0 = new Point(localRect[WH$1[whIdx]] * labelPairStTrans[0][0], localRect[WH$1[whIdx]] * labelPairStTrans[0][1]);
return Math.abs(labelVec0.y) < 1e-5;
@@ -60350,8 +60470,12 @@
var uval = uvalMax < 0 ? uvalMax : uvalMin > 0 ? uvalMin : 0;
k = (qval - uval) / mtvSt.x;
}
- Point.scaleAndAdd(layoutPair[0].label, layoutPair[0].label, mtv, -k);
- Point.scaleAndAdd(layoutPair[1].label, layoutPair[1].label, mtv, 1 - k);
+ var delta0 = new Point();
+ var delta1 = new Point();
+ Point.scale(delta0, mtv, -k);
+ Point.scale(delta1, mtv, 1 - k);
+ labelLayoutApplyTranslation(layoutPair[0], delta0);
+ labelLayoutApplyTranslation(layoutPair[1], delta1);
}
function updateModelAxisBreak(model, payload) {
var result = {
diff --git a/dist/echarts.common.js.map b/dist/echarts.common.js.map
index dec14057f..d6b47c836 100644
--- a/dist/echarts.common.js.map
+++ b/dist/echarts.common.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.common.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/co [...]
\ No newline at end of file
+{"version":3,"file":"echarts.common.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/co [...]
\ No newline at end of file
diff --git a/dist/echarts.common.min.js b/dist/echarts.common.min.js
index 5bfad59f7..9b4dacd22 100644
--- a/dist/echarts.common.min.js
+++ b/dist/echarts.common.min.js
@@ -42,4 +42,4 @@
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
-var qr={},Kr={};var $r,Qr=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new hn,a=n.renderer||"canvas";qr[a]||(a=H(qr)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new qr[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=r.node||r.worker||l?null:new ur(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
+var qr={},Kr={};var $r,Qr=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new hn,a=n.renderer||"canvas";qr[a]||(a=H(qr)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new qr[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=r.node||r.worker||l?null:new ur(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
diff --git a/dist/echarts.esm.js b/dist/echarts.esm.js
index 05814ae15..8130586bd 100644
--- a/dist/echarts.esm.js
+++ b/dist/echarts.esm.js
@@ -7558,7 +7558,7 @@ function getElementSSRData(el) {
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
-var version = '6.0.0-rc.1';
+var version = '6.0.0';
var zrender = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -7672,6 +7672,8 @@ function parsePositionSizeOption(option, percentBase, percentOffset) {
}
function round(x, precision, returnStr) {
if (precision == null) {
+ // FIXME: the default precision should not be provided, since there is no universally adaptable
+ // precision. The caller need to input a precision according to the scenarios.
precision = 10;
}
// Avoid range error
@@ -8700,7 +8702,7 @@ function preParseFinder(finderInput, opt) {
var others = {};
var mainTypeSpecified = false;
each(finder, function (value, key) {
- // Exclude 'dataIndex' and other illgal keys.
+ // Exclude 'dataIndex' and other illegal keys.
if (key === 'dataIndex' || key === 'dataIndexInside') {
others[key] = value;
return;
@@ -8898,6 +8900,10 @@ var ListIterator = /** @class */function () {
};
return ListIterator;
}();
+function clearTmpModel(model) {
+ // Clear to avoid memory leak.
+ model.option = model.parentModel = model.ecModel = null;
+}
var TYPE_DELIMITER = '.';
var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';
@@ -9342,8 +9348,8 @@ function estimateLength(text, contentWidth, fontMeasureInfo) {
}
return i;
}
-function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
- text != null && (text += '');
+function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
+ var text = formatText(rawText);
var overflow = style.overflow;
var padding = style.padding;
var paddingH = padding ? padding[1] + padding[3] : 0;
@@ -9443,9 +9449,9 @@ var RichTextContentBlock = (function () {
}
return RichTextContentBlock;
}());
-function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
+function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
var contentBlock = new RichTextContentBlock();
- text != null && (text += '');
+ var text = formatText(rawText);
if (!text) {
return contentBlock;
}
@@ -9771,6 +9777,33 @@ function calcInnerTextOverflowArea(out, overflowRect, baseX, baseY, textAlign, t
}
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
+function formatText(text) {
+ return text != null ? (text += '') : (text = '');
+}
+function tSpanCreateBoundingRect(style) {
+ var text = formatText(style.text);
+ var font = style.font;
+ var contentWidth = measureWidth(ensureFontMeasureInfo(font), text);
+ var contentHeight = getLineHeight(font);
+ return tSpanCreateBoundingRect2(style, contentWidth, contentHeight, null);
+}
+function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
+ var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY$1(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
+ var lineWidth = forceLineWidth != null
+ ? forceLineWidth
+ : (tSpanHasStroke(style) ? style.lineWidth : 0);
+ if (lineWidth > 0) {
+ rect.x -= lineWidth / 2;
+ rect.y -= lineWidth / 2;
+ rect.width += lineWidth;
+ rect.height += lineWidth;
+ }
+ return rect;
+}
+function tSpanHasStroke(style) {
+ var stroke = style.stroke;
+ return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+}
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
@@ -11741,9 +11774,7 @@ var TSpan = (function (_super) {
return _super !== null && _super.apply(this, arguments) || this;
}
TSpan.prototype.hasStroke = function () {
- var style = this.style;
- var stroke = style.stroke;
- return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ return tSpanHasStroke(this.style);
};
TSpan.prototype.hasFill = function () {
var style = this.style;
@@ -11757,21 +11788,8 @@ var TSpan = (function (_super) {
this._rect = rect;
};
TSpan.prototype.getBoundingRect = function () {
- var style = this.style;
if (!this._rect) {
- var text = style.text;
- text != null ? (text += '') : (text = '');
- var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
- rect.x += style.x || 0;
- rect.y += style.y || 0;
- if (this.hasStroke()) {
- var w = style.lineWidth;
- rect.x -= w / 2;
- rect.y -= w / 2;
- rect.width += w;
- rect.height += w;
- }
- this._rect = rect;
+ this._rect = tSpanCreateBoundingRect(this.style);
}
return this._rect;
};
@@ -12229,7 +12247,6 @@ var ZRText = (function (_super) {
var bgColorDrawn = !!(style.backgroundColor);
var outerHeight = contentBlock.outerHeight;
var outerWidth = contentBlock.outerWidth;
- var contentWidth = contentBlock.contentWidth;
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
this.isTruncated = !!contentBlock.isTruncated;
@@ -12251,6 +12268,7 @@ var ZRText = (function (_super) {
}
}
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var useDefaultFill = false;
var textFill = getFill('fill' in style
? style.fill
@@ -12259,12 +12277,9 @@ var ZRText = (function (_super) {
? style.stroke
: (!bgColorDrawn
&& (!defaultStyle.autoStroke || useDefaultFill))
- ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = style.textShadowBlur > 0;
- var fixedBoundingRect = style.width != null
- && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
- var calculatedLineHeight = contentBlock.calculatedLineHeight;
for (var i = 0; i < textLines.length; i++) {
var el = this._getOrCreateChild(TSpan);
var subElStyle = el.createStyle();
@@ -12294,9 +12309,7 @@ var ZRText = (function (_super) {
subElStyle.font = textFont;
setSeparateFont(subElStyle, style);
textY += lineHeight;
- if (fixedBoundingRect) {
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
- }
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, contentBlock.contentWidth, contentBlock.calculatedLineHeight, usingDefaultStroke ? 0 : null));
}
};
ZRText.prototype._updateRichTexts = function () {
@@ -12393,6 +12406,7 @@ var ZRText = (function (_super) {
var defaultStyle = this._defaultStyle;
var useDefaultFill = false;
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill
: 'fill' in style ? style.fill
: (useDefaultFill = true, defaultStyle.fill));
@@ -12400,7 +12414,7 @@ var ZRText = (function (_super) {
: 'stroke' in style ? style.stroke
: (!bgColorDrawn
&& !parentBgColorDrawn
- && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = tokenStyle.textShadowBlur > 0
|| style.textShadowBlur > 0;
@@ -12427,9 +12441,7 @@ var ZRText = (function (_super) {
if (textFill) {
subElStyle.fill = textFill;
}
- var textWidth = token.contentWidth;
- var textHeight = token.contentHeight;
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, token.contentWidth, token.contentHeight, usingDefaultStroke ? 0 : null));
};
ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
var textBackgroundColor = style.backgroundColor;
@@ -12585,25 +12597,6 @@ function needDrawBackground(style) {
|| (style.borderWidth && style.borderColor));
}
-var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
-var SOURCE_FORMAT_ORIGINAL = 'original';
-var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
-var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
-var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
-var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
-var SOURCE_FORMAT_UNKNOWN = 'unknown';
-var SERIES_LAYOUT_BY_COLUMN = 'column';
-var SERIES_LAYOUT_BY_ROW = 'row';
-/**
- * PENDING: Temporary impl. unify them?
- * @see {LabelCommonOption['textMargin']}
- * @see {LabelCommonOption['minMargin']}
- */
-var LabelMarginType = {
- minMargin: 0,
- textMargin: 1
-};
-
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
if (el) {
@@ -15335,7 +15328,7 @@ function nearZero(val) {
* `false` - expand if `delta[i]` is positive, commmonly used in `margin` case. (default)
* @param noNegative
* `true` - negative `delta[i]` will be clampped to 0.
- * `false` - No clamp to `delta`. (defualt).
+ * `false` - No clamp to `delta`. (default).
* @return The input `rect`.
*/
function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize // by default [0, 0].
@@ -15345,6 +15338,9 @@ function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize //
} else if (isNumber(delta)) {
_tmpExpandRectDelta[0] = _tmpExpandRectDelta[1] = _tmpExpandRectDelta[2] = _tmpExpandRectDelta[3] = delta;
} else {
+ if ("development" !== 'production') {
+ assert(delta.length === 4);
+ }
_tmpExpandRectDelta[0] = delta[0];
_tmpExpandRectDelta[1] = delta[1];
_tmpExpandRectDelta[2] = delta[2];
@@ -15445,6 +15441,27 @@ function isBoundingRectAxisAligned(transform) {
return !transform || mathAbs$1(transform[1]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[2]) < AXIS_ALIGN_EPSILON || mathAbs$1(transform[0]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[3]) < AXIS_ALIGN_EPSILON;
}
var AXIS_ALIGN_EPSILON = 1e-5;
+/**
+ * Create or copy to the existing bounding rect to avoid modifying `source`.
+ *
+ * @usage
+ * out.rect = ensureCopyRect(out.rect, sourceRect);
+ */
+function ensureCopyRect(target, source) {
+ return target ? BoundingRect.copy(target, source) : source.clone();
+}
+/**
+ * Create or copy to the existing transform to avoid modifying `source`.
+ *
+ * [CAUTION]: transform is `NullUndefined` if no transform, following convention of zrender,
+ * and enable to bypass some unnecessary calculation, since in most cases there is no transform.
+ *
+ * @usage
+ * out.transform = ensureCopyTransform(out.transform, sourceTransform);
+ */
+function ensureCopyTransform(target, source) {
+ return source ? copy$1(target || create$1(), source) : undefined;
+}
function retrieveZInfo(model) {
return {
z: model.get('z') || 0,
@@ -15498,9 +15515,9 @@ function traverseUpdateZ(el, z, zlevel) {
doUpdateZ(el, z, zlevel, -Infinity);
}
function doUpdateZ(el, z, zlevel,
-// FIXME: ideally all the labels shold be above all the glyphs by default,
+// FIXME: Ideally all the labels should be above all the glyphs by default,
// e.g. in graph, edge labels should be above node elements.
-// currenly impl does not garaentee that.
+// Currently impl does not guarantee that.
maxZ2) {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
@@ -15585,6 +15602,8 @@ var graphic = /*#__PURE__*/Object.freeze({
setTooltipConfig: setTooltipConfig,
traverseElements: traverseElements,
isBoundingRectAxisAligned: isBoundingRectAxisAligned,
+ ensureCopyRect: ensureCopyRect,
+ ensureCopyTransform: ensureCopyTransform,
retrieveZInfo: retrieveZInfo,
calcZ2Range: calcZ2Range,
traverseUpdateZ: traverseUpdateZ,
@@ -15844,23 +15863,26 @@ function setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttac
if (overflow) {
textStyle.overflow = overflow;
}
- var minMargin = textStyleModel.get('minMargin');
- if (minMargin != null) {
- textStyle.margin = minMargin;
- textStyle.__marginType = LabelMarginType.minMargin;
- }
- var textMargin = textStyleModel.get('textMargin');
- if (textMargin != null) {
- textStyle.margin = clone(textMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- } else if (opt.defaultTextMargin != null) {
- textStyle.margin = clone(opt.defaultTextMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- }
var lineOverflow = textStyleModel.get('lineOverflow');
if (lineOverflow) {
textStyle.lineOverflow = lineOverflow;
}
+ var labelTextStyle = textStyle;
+ // `minMargin` has a higher precedence than `textMargin`, because `textMargin` is allowed
+ // to be set in `defaultOption`.
+ var minMargin = textStyleModel.get('minMargin');
+ if (minMargin != null) {
+ // `minMargin` only support number value.
+ minMargin = !isNumber(minMargin) ? 0 : minMargin / 2;
+ labelTextStyle.margin = [minMargin, minMargin, minMargin, minMargin];
+ labelTextStyle.__marginType = LabelMarginType.minMargin;
+ } else {
+ var textMargin = textStyleModel.get('textMargin');
+ if (textMargin != null) {
+ labelTextStyle.margin = normalizeCssArray(textMargin);
+ labelTextStyle.__marginType = LabelMarginType.textMargin;
+ }
+ }
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, null, null, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
@@ -16078,6 +16100,15 @@ function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetche
percent: 1
}, animatableModel, dataIndex, null, during);
}
+/**
+ * PENDING: Temporary impl. unify them?
+ * @see {LabelCommonOption['textMargin']}
+ * @see {LabelCommonOption['minMargin']}
+ */
+var LabelMarginType = {
+ minMargin: 1,
+ textMargin: 2
+};
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
@@ -17762,7 +17793,7 @@ function getLayoutRect(positionInfo, containerRect,
// Commonly used in option `legend.padding`, `timeline.padding`, `title.padding`,
// `visualMap.padding`, ...
// [NOTICE]:
-// It's named `margin`, becuase it's the space that outside the bounding rect. But from
+// It's named `margin`, because it's the space that outside the bounding rect. But from
// the perspective of the the caller, it's commonly used as the `padding` of a component,
// because conventionally background color covers this space.
// [BEHAVIOR]:
@@ -18425,7 +18456,7 @@ for (var key in color$1) {
tokens.darkColor[key] = modifyHSL(hex, null, function (s) {
return s * 0.9;
}, function (l) {
- return 1 - l;
+ return 1 - Math.pow(l, 1.5);
});
}
}
@@ -18532,6 +18563,16 @@ var globalDefault = {
useUTC: false
};
+var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
+var SOURCE_FORMAT_ORIGINAL = 'original';
+var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
+var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
+var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
+var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
+var SOURCE_FORMAT_UNKNOWN = 'unknown';
+var SERIES_LAYOUT_BY_COLUMN = 'column';
+var SERIES_LAYOUT_BY_ROW = 'row';
+
// The result of `guessOrdinal`.
var BE_ORDINAL = {
Must: 1,
@@ -25499,7 +25540,10 @@ var matrixAxis = {
color: color$2.secondary
},
itemStyle: {
- borderColor: color$2.neutral20
+ borderColor: color$2.borderTint
+ },
+ dividerLineStyle: {
+ color: color$2.border
}
};
var theme = {
@@ -25589,9 +25633,6 @@ var theme = {
textStyle: {
color: color$2.secondary
},
- inRange: {
- color: [color$2.neutral10, color$2.theme[0]]
- },
handleStyle: {
borderColor: color$2.neutral30
}
@@ -25627,10 +25668,12 @@ var theme = {
x: matrixAxis,
y: matrixAxis,
backgroundColor: {
- borderColor: '#817f91'
+ borderColor: color$2.axisLine
},
- innerBackgroundStyle: {
- borderColor: '#484753'
+ body: {
+ itemStyle: {
+ borderColor: color$2.borderTint
+ }
}
},
timeAxis: axisCommon(),
@@ -27562,9 +27605,9 @@ function getCustomSeries(type) {
return customRenderers[type];
}
-var version$1 = '6.0.0-beta.1';
+var version$1 = '6.0.0';
var dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
@@ -28729,15 +28772,16 @@ var ECharts = /** @class */function (_super) {
coordSysMgr.update(ecModel, api);
clearColorPalette(ecModel);
scheduler.performVisualTasks(ecModel, payload);
- render(this, ecModel, api, payload, updateParams);
- // Set background
+ // Set background and dark mode before rendering, because they affect auto-color-determination
+ // in zrender Text, and consequently affect the bounding rect if stroke is added.
var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
- var darkMode = ecModel.get('darkMode');
zr.setBackgroundColor(backgroundColor);
// Force set dark mode.
+ var darkMode = ecModel.get('darkMode');
if (darkMode != null && darkMode !== 'auto') {
zr.setDarkMode(darkMode);
}
+ render(this, ecModel, api, payload, updateParams);
lifecycle.trigger('afterupdate', ecModel, api);
},
updateTransform: function (payload) {
@@ -32724,8 +32768,9 @@ var IntervalScale = /** @class */function (_super) {
var minorTicksGroup = [];
var interval = nextTick.value - prevTick.value;
var minorInterval = interval / splitNumber;
+ var minorIntervalPrecision = getIntervalPrecision(minorInterval);
while (count < splitNumber - 1) {
- var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
+ var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval, minorIntervalPrecision);
// For the first and last interval. The count may be less than splitNumber.
if (minorTick > extent[0] && minorTick < extent[1]) {
minorTicksGroup.push(minorTick);
@@ -32764,6 +32809,12 @@ var IntervalScale = /** @class */function (_super) {
return addCommas(dataNum);
};
/**
+ * FIXME: refactor - disallow override, use composition instead.
+ *
+ * The override of `calcNiceTicks` should ensure these members are provided:
+ * this._intervalPrecision
+ * this._interval
+ *
* @param splitNumber By default `5`.
*/
IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
@@ -32819,11 +32870,12 @@ var IntervalScale = /** @class */function (_super) {
extent = this._extent.slice();
this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
var interval = this._interval;
+ var intervalPrecition = this._intervalPrecision;
if (!opt.fixMin) {
- extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
+ extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval, intervalPrecition);
}
if (!opt.fixMax) {
- extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
+ extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval, intervalPrecition);
}
this._innerSetExtent(extent[0], extent[1]);
};
@@ -33415,6 +33467,7 @@ var TimeScale = /** @class */function (_super) {
var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
// Interval that can be used to calculate ticks
this._interval = scaleIntervals[idx][1];
+ this._intervalPrecision = getIntervalPrecision(this._interval);
// Min level used when picking ticks from top down.
// We check one more level to avoid the ticks are to sparse in some case.
this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
@@ -33805,8 +33858,8 @@ var LogScale = /** @class */function (_super) {
var scaleBreakHelper = getScaleBreakHelper();
return map(ticks, function (tick) {
var val = tick.value;
- var powVal = fixRound(mathPow$1(base, val));
var roundingCriterion = null;
+ var powVal = mathPow$1(base, val);
// Fix #4158
if (val === extent[0] && this._fixMin) {
roundingCriterion = originalExtent[0];
@@ -33880,6 +33933,7 @@ var LogScale = /** @class */function (_super) {
}
var niceExtent = [fixRound(mathCeil(extent[0] / interval) * interval), fixRound(mathFloor(extent[1] / interval) * interval)];
this._interval = interval;
+ this._intervalPrecision = getIntervalPrecision(interval);
this._niceExtent = niceExtent;
};
LogScale.prototype.calcNiceExtent = function (opt) {
@@ -36135,140 +36189,192 @@ function getLabelLineStatesModels(itemModel, labelLineName) {
return statesModels;
}
-// Also prevent duck typing.
-var LABEL_LAYOUT_INFO_KIND_RAW = 1;
-var LABEL_LAYOUT_INFO_KIND_COMPUTED = 2;
-function createLabelLayoutList(rawList) {
- var resultList = [];
- each(rawList, function (raw) {
- // PENDING: necessary?
- raw = extend({}, raw);
- var layoutInfo = prepareLabelLayoutInfo(raw);
- if (layoutInfo) {
- resultList.push(layoutInfo);
- }
- });
- return resultList;
+var LABEL_LAYOUT_BASE_PROPS = ['label', 'labelLine', 'layoutOption', 'priority', 'defaultAttr', 'marginForce', 'minMarginForce', 'marginDefault', 'suggestIgnore'];
+var LABEL_LAYOUT_DIRTY_BIT_OTHERS = 1;
+var LABEL_LAYOUT_DIRTY_BIT_OBB = 2;
+var LABEL_LAYOUT_DIRTY_ALL = LABEL_LAYOUT_DIRTY_BIT_OTHERS | LABEL_LAYOUT_DIRTY_BIT_OBB;
+function setLabelLayoutDirty(labelGeometry, dirtyOrClear, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ dirtyOrClear ? labelGeometry.dirty |= dirtyBits : labelGeometry.dirty &= ~dirtyBits;
+}
+function isLabelLayoutDirty(labelGeometry, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ return labelGeometry.dirty == null || !!(labelGeometry.dirty & dirtyBits);
}
/**
- * If `defaultAttr.ignore: true`, return `NullUndefined`.
- * (the caller is reponsible for ensuring the label is always `ignore: true`.)
- * Otherwise the `layoutInfo` will be modified and returned.
- * `label.ignore` is not necessarily falsy, since it might be modified by some overlap resolving handling.
+ * [CAUTION]
+ * - No auto dirty propagation mechanism yet. If the transform of the raw label or any of its ancestors is
+ * changed, must sync the changes to the props of `LabelGeometry` by:
+ * either explicitly call:
+ * `setLabelLayoutDirty(labelLayout, true); ensureLabelLayoutWithGeometry(labelLayout);`
+ * or call (if only translation is performed):
+ * `labelLayoutApplyTranslation(labelLayout);`
+ * - `label.ignore` is not necessarily falsy, and not considered in computing `LabelGeometry`,
+ * since it might be modified by some overlap resolving handling.
+ * - To duplicate or make a variation:
+ * use `newLabelLayoutWithGeometry`.
*
* The result can also be the input of this method.
- *
- * @see ensureLabelLayoutInfoComputed
+ * @return `NullUndefined` if and only if `labelLayout` is `NullUndefined`.
*/
-function prepareLabelLayoutInfo(layoutInfo) {
- if (!layoutInfo || layoutInfo.defaultAttr.ignore) {
+function ensureLabelLayoutWithGeometry(labelLayout) {
+ if (!labelLayout) {
return;
}
- var label = layoutInfo.label;
- var ignoreMargin = layoutInfo.ignoreMargin;
- var transform = label.getComputedTransform();
- // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
- var localRect = label.getBoundingRect();
- var axisAligned = isBoundingRectAxisAligned(transform);
- if (!ignoreMargin) {
- localRect = applyTextMarginToLocalRect(label, localRect);
- }
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- if (!ignoreMargin && label.style.__marginType === LabelMarginType.minMargin) {
- // `minMargin` only support number value.
- var halfMinMargin = (label.style.margin || 0) / 2;
- expandOrShrinkRect(globalRect, halfMinMargin, false, false);
- }
- var computed = layoutInfo;
- computed.kind = LABEL_LAYOUT_INFO_KIND_COMPUTED,
- // --- computed properties ---
- computed.rect = globalRect;
- computed.localRect = localRect;
- computed.obb = null,
- // will be created by `ensureOBB` when using.
- computed.axisAligned = axisAligned;
- computed.transform = transform;
- return computed;
+ if (isLabelLayoutDirty(labelLayout)) {
+ computeLabelGeometry(labelLayout, labelLayout.label, labelLayout);
+ }
+ return labelLayout;
}
/**
- * The reverse operation of `ensureLabelLayoutInfoComputedv`.
+ * The props in `out` will be filled if existing, or created.
*/
-function rollbackToLabelLayoutInfoRaw(labelLayoutInfo) {
- if (labelLayoutInfo == null) {
- return;
- }
- var raw = labelLayoutInfo;
- raw.kind = LABEL_LAYOUT_INFO_KIND_RAW;
- return raw;
+function computeLabelGeometry(out, label, opt) {
+ // [CAUTION] These props may be modified directly for performance consideration,
+ // therefore, do not output the internal data structure of zrender Element.
+ var rawTransform = label.getComputedTransform();
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ // NOTE: should call `getBoundingRect` after `getComputedTransform`, or may get an inaccurate bounding rect.
+ // The reason is that `getComputedTransform` calls `__host.updateInnerText()` internally, which updates the label
+ // by `textConfig` mounted on the host.
+ // PENDING: add a dirty bit for that in zrender?
+ var outLocalRect = out.localRect = ensureCopyRect(out.localRect, label.getBoundingRect());
+ var labelStyleExt = label.style;
+ var margin = labelStyleExt.margin;
+ var marginForce = opt && opt.marginForce;
+ var minMarginForce = opt && opt.minMarginForce;
+ var marginDefault = opt && opt.marginDefault;
+ var marginType = labelStyleExt.__marginType;
+ if (marginType == null && marginDefault) {
+ margin = marginDefault;
+ marginType = LabelMarginType.textMargin;
+ }
+ // `textMargin` and `minMargin` can not exist both.
+ for (var i = 0; i < 4; i++) {
+ _tmpLabelMargin[i] = marginType === LabelMarginType.minMargin && minMarginForce && minMarginForce[i] != null ? minMarginForce[i] : marginForce && marginForce[i] != null ? marginForce[i] : margin ? margin[i] : 0;
+ }
+ if (marginType === LabelMarginType.textMargin) {
+ expandOrShrinkRect(outLocalRect, _tmpLabelMargin, false, false);
+ }
+ var outGlobalRect = out.rect = ensureCopyRect(out.rect, outLocalRect);
+ if (rawTransform) {
+ outGlobalRect.applyTransform(rawTransform);
+ }
+ // Notice: label.style.margin is actually `minMargin / 2`, handled by `setTextStyleCommon`.
+ if (marginType === LabelMarginType.minMargin) {
+ expandOrShrinkRect(outGlobalRect, _tmpLabelMargin, false, false);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ (out.label = out.label || {}).ignore = label.ignore;
+ setLabelLayoutDirty(out, false);
+ setLabelLayoutDirty(out, true, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ // Do not remove `obb` (if existing) for reuse, just reset the dirty bit.
+ return out;
}
+var _tmpLabelMargin = [0, 0, 0, 0];
/**
- * This method supports that the label layout info is not computed until needed,
- * for performance consideration.
- *
- * [CAUTION]
- * - If the raw label is changed, must call
- * `ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(layoutInfo))`
- * to recreate the layout info.
- * - Null checking is needed for the result. @see prepareLabelLayoutInfo
- *
- * Usage:
- * To make a copy of labelLayoutInfo, simply:
- * const layoutInfoCopy = rollbackToLabelLayoutInfoRaw(extends({}, someLabelLayoutInfo));
+ * The props in `out` will be filled if existing, or created.
+ */
+function computeLabelGeometry2(out, rawLocalRect, rawTransform) {
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ out.localRect = ensureCopyRect(out.localRect, rawLocalRect);
+ out.rect = ensureCopyRect(out.rect, rawLocalRect);
+ if (rawTransform) {
+ out.rect.applyTransform(rawTransform);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ out.obb = undefined; // Reset to undefined, will be created by `ensureOBB` when using.
+ (out.label = out.label || {}).ignore = false;
+ return out;
+}
+/**
+ * This is a shortcut of
+ * ```js
+ * labelLayout.label.x = newX;
+ * labelLayout.label.y = newY;
+ * setLabelLayoutDirty(labelLayout, true);
+ * ensureLabelLayoutWithGeometry(labelLayout);
+ * ```
+ * and provide better performance in this common case.
*/
-function ensureLabelLayoutInfoComputed(labelLayoutInfo) {
- if (!labelLayoutInfo) {
+function labelLayoutApplyTranslation(labelLayout, offset) {
+ if (!labelLayout) {
return;
}
- if (labelLayoutInfo.kind !== LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- labelLayoutInfo = prepareLabelLayoutInfo(labelLayoutInfo);
+ labelLayout.label.x += offset.x;
+ labelLayout.label.y += offset.y;
+ labelLayout.label.markRedraw();
+ var transform = labelLayout.transform;
+ if (transform) {
+ transform[4] += offset.x;
+ transform[5] += offset.y;
+ }
+ var globalRect = labelLayout.rect;
+ if (globalRect) {
+ globalRect.x += offset.x;
+ globalRect.y += offset.y;
+ }
+ var obb = labelLayout.obb;
+ if (obb) {
+ obb.fromBoundingRect(labelLayout.localRect, transform);
}
- return labelLayoutInfo;
-}
-function prepareIntersectionCheckInfo(localRect, transform) {
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- return {
- obb: null,
- rect: globalRect,
- localRect: localRect,
- axisAligned: isBoundingRectAxisAligned(transform),
- transform: transform
- };
}
-function createSingleLayoutInfoComputed(el) {
- return ensureLabelLayoutInfoComputed({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
- label: el,
- priority: el.z2,
- defaultAttr: {
- ignore: el.ignore
+/**
+ * To duplicate or make a variation of a label layout.
+ * Copy the only relevant properties to avoid the conflict or wrongly reuse of the props of `LabelLayoutWithGeometry`.
+ */
+function newLabelLayoutWithGeometry(newBaseWithDefaults, source) {
+ for (var i = 0; i < LABEL_LAYOUT_BASE_PROPS.length; i++) {
+ var prop = LABEL_LAYOUT_BASE_PROPS[i];
+ if (newBaseWithDefaults[prop] == null) {
+ newBaseWithDefaults[prop] = source[prop];
}
- });
+ }
+ return ensureLabelLayoutWithGeometry(newBaseWithDefaults);
}
/**
* Create obb if no one, can cache it.
*/
-function ensureOBB(layoutInfo) {
- return layoutInfo.obb || (layoutInfo.obb = new OrientedBoundingRect(layoutInfo.localRect, layoutInfo.transform));
+function ensureOBB(labelGeometry) {
+ var obb = labelGeometry.obb;
+ if (!obb || isLabelLayoutDirty(labelGeometry, LABEL_LAYOUT_DIRTY_BIT_OBB)) {
+ labelGeometry.obb = obb = obb || new OrientedBoundingRect();
+ obb.fromBoundingRect(labelGeometry.localRect, labelGeometry.transform);
+ setLabelLayoutDirty(labelGeometry, false, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ }
+ return obb;
}
/**
- * The input localRect is never modified.
- * The returned localRect maybe the input localRect.
+ * Adjust labels on x/y direction to avoid overlap.
+ *
+ * PENDING: the current implementation is based on the global bounding rect rather than the local rect,
+ * which may be not preferable in some edge cases when the label has rotation, but works for most cases,
+ * since rotation is unnecessary when there is sufficient space, while squeezing is applied regardless
+ * of overlapping when there is no enough space.
+ *
+ * NOTICE:
+ * - The input `list` and its content will be modified (sort, label.x/y, rect).
+ * - The caller should sync the modifications to the other parts by
+ * `setLabelLayoutDirty` and `ensureLabelLayoutWithGeometry` if needed.
+ *
+ * @return adjusted
*/
-function applyTextMarginToLocalRect(label, localRect) {
- if (label.style.__marginType !== LabelMarginType.textMargin) {
- return localRect;
- }
- var textMargin = normalizeCssArray$1(retrieve2(label.style.margin, [0, 0]));
- localRect = localRect.clone();
- expandOrShrinkRect(localRect, textMargin, false, false);
- return localRect;
-}
-function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
+function shiftLayoutOnXY(list, xyDimIdx,
+// 0 for x, 1 for y
+minBound,
+// for x, leftBound; for y, topBound
+maxBound,
+// for x, rightBound; for y, bottomBound
+// If average the shifts on all labels and add them to 0
+// TODO: Not sure if should enable it.
+// Pros: The angle of lines will distribute more equally
+// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
+balanceShift) {
var len = list.length;
+ var xyDim = XY$1[xyDimIdx];
+ var sizeDim = WH$1[xyDimIdx];
if (len < 2) {
- return;
+ return false;
}
list.sort(function (a, b) {
return a.rect[xyDim] - b.rect[xyDim];
@@ -36276,6 +36382,7 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
var lastPos = 0;
var delta;
var adjusted = false;
+ // const shifts = [];
var totalShifts = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
@@ -36288,6 +36395,7 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
adjusted = true;
}
var shift = Math.max(-delta, 0);
+ // shifts.push(shift);
totalShifts += shift;
lastPos = rect[xyDim] + rect[sizeDim];
}
@@ -36400,33 +36508,29 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
return adjusted;
}
/**
- * Adjust labels on x direction to avoid overlap.
- */
-function shiftLayoutOnX(list, leftBound, rightBound,
-// If average the shifts on all labels and add them to 0
-// TODO: Not sure if should enable it.
-// Pros: The angle of lines will distribute more equally
-// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
-balanceShift) {
- return shiftLayout(list, 'x', 'width', leftBound, rightBound, balanceShift);
-}
-/**
- * Adjust labels on y direction to avoid overlap.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * @see `hideOverlap`
*/
-function shiftLayoutOnY(list, topBound, bottomBound,
-// If average the shifts on all labels and add them to 0
-balanceShift) {
- return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
+function restoreIgnore(labelList) {
+ for (var i = 0; i < labelList.length; i++) {
+ var labelItem = labelList[i];
+ var defaultAttr = labelItem.defaultAttr;
+ var labelLine = labelItem.labelLine;
+ labelItem.label.attr('ignore', defaultAttr.ignore);
+ labelLine && labelLine.attr('ignore', defaultAttr.labelGuideIgnore);
+ }
}
/**
- * [CAUTION]: the `label.ignore` in the input is not necessarily falsy.
- * this method checks intersection regardless of current `ignore`,
- * if no intersection, restore the `ignore` to `defaultAttr.ignore`.
- * And `labelList` will be modified.
- * Therefore, if some other overlap resolving strategy has ignored some elements,
- * do not input them to this method.
- * PENDING: review the diff between the requirements from LabelManager and AxisBuilder,
- * and uniform the behavior?
+ * [NOTICE - restore]:
+ * 'series:layoutlabels' may be triggered during some shortcut passes, such as zooming in series.graph/geo
+ * (`updateLabelLayout`), where the modified `Element` props should be restorable from `defaultAttr`.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * `restoreIgnore` can be called to perform the restore, if needed.
+ *
+ * [NOTICE - state]:
+ * Regarding Element's states, this method is only designed for the normal state.
+ * PENDING: although currently this method is effectively called in other states in `updateLabelLayout` case,
+ * the bad case is not noticeable in the zooming scenario.
*/
function hideOverlap(labelList) {
var displayedLabels = [];
@@ -36445,8 +36549,10 @@ function hideOverlap(labelList) {
el.ignore = true;
}
for (var i = 0; i < labelList.length; i++) {
- var labelItem = ensureLabelLayoutInfoComputed(labelList[i]);
- if (!labelItem || labelItem.label.ignore) {
+ var labelItem = ensureLabelLayoutWithGeometry(labelList[i]);
+ // The current `el.ignore` is involved, since some previous overlap
+ // resolving strategies may have set `el.ignore` to true.
+ if (labelItem.label.ignore) {
continue;
}
var label = labelItem.label;
@@ -36469,24 +36575,24 @@ function hideOverlap(labelList) {
hideEl(label);
labelLine && hideEl(labelLine);
} else {
- label.attr('ignore', labelItem.defaultAttr.ignore);
- labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
displayedLabels.push(labelItem);
}
}
}
/**
- * [NOTICE]:
- * - `label.ignore` is not considered - no requirement so far.
- * - `baseLayoutInfo` and `targetLayoutInfo` may be modified - obb may be created and saved.
- *
* Enable fast check for performance; use obb if inevitable.
* If `mtv` is used, `targetLayoutInfo` can be moved based on the values filled into `mtv`.
+ *
+ * This method is based only on the current `Element` states (regardless of other states).
+ * Typically this method (and the entire layout process) is performed in normal state.
*/
function labelIntersect(baseLayoutInfo, targetLayoutInfo, mtv, intersectOpt) {
if (!baseLayoutInfo || !targetLayoutInfo) {
return false;
}
+ if (baseLayoutInfo.label && baseLayoutInfo.label.ignore || targetLayoutInfo.label && targetLayoutInfo.label.ignore) {
+ return false;
+ }
// Fast rejection.
if (!baseLayoutInfo.rect.intersect(targetLayoutInfo.rect, mtv, intersectOpt)) {
return false;
@@ -36573,7 +36679,6 @@ var LabelManager = /** @class */function () {
}
var labelGuide = hostRect && host.getTextGuideLine();
this._labelList.push({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
labelLine: labelGuide,
seriesModel: seriesModel,
@@ -36730,18 +36835,24 @@ var LabelManager = /** @class */function () {
LabelManager.prototype.layout = function (api) {
var width = api.getWidth();
var height = api.getHeight();
- var labelList = createLabelLayoutList(this._labelList);
+ var labelList = [];
+ each(this._labelList, function (inputItem) {
+ if (!inputItem.defaultAttr.ignore) {
+ labelList.push(newLabelLayoutWithGeometry({}, inputItem));
+ }
+ });
var labelsNeedsAdjustOnX = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftX';
});
var labelsNeedsAdjustOnY = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftY';
});
- shiftLayoutOnX(labelsNeedsAdjustOnX, 0, width);
- shiftLayoutOnY(labelsNeedsAdjustOnY, 0, height);
+ shiftLayoutOnXY(labelsNeedsAdjustOnX, 0, 0, width);
+ shiftLayoutOnXY(labelsNeedsAdjustOnY, 1, 0, height);
var labelsNeedsHideOverlap = filter(labelList, function (item) {
return item.layoutOption.hideOverlap;
});
+ restoreIgnore(labelsNeedsHideOverlap);
hideOverlap(labelsNeedsHideOverlap);
};
/**
@@ -43467,7 +43578,7 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft,
list[i].label.x = farthestX;
}
}
- if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
+ if (shiftLayoutOnXY(list, 1, viewTop, viewTop + viewHeight)) {
recalculateX(list);
}
}
@@ -43518,7 +43629,7 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLef
}
}
layout.targetTextWidth = targetTextWidth;
- constrainTextWidth(layout, targetTextWidth);
+ constrainTextWidth(layout, targetTextWidth, false);
}
}
adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
@@ -43564,9 +43675,6 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLef
* which case, previous wrapping should be redo.
*/
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
- if (forceRecalculate === void 0) {
- forceRecalculate = false;
- }
if (layout.labelStyleWidth != null) {
// User-defined style.width has the highest priority.
return;
@@ -43581,7 +43689,6 @@ function constrainTextWidth(layout, availableWidth, forceRecalculate) {
// textRect.width already contains paddingH if bgColor is set
var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
if (availableWidth < oldOuterWidth || forceRecalculate) {
- var oldHeight = textRect.height;
if (overflow && overflow.match('break')) {
// Temporarily set background to be null to calculate
// the bounding box without background.
@@ -43613,13 +43720,18 @@ function constrainTextWidth(layout, availableWidth, forceRecalculate) {
: null;
label.setStyle('width', newWidth);
}
- var newRect = label.getBoundingRect();
- textRect.width = newRect.width;
- var margin = (label.style.margin || 0) + 2.1;
- textRect.height = newRect.height + margin;
- textRect.y -= (textRect.height - oldHeight) / 2;
+ computeLabelGlobalRect(textRect, label);
}
}
+function computeLabelGlobalRect(out, label) {
+ _tmpLabelGeometry.rect = out;
+ computeLabelGeometry(_tmpLabelGeometry, label, _computeLabelGeometryOpt);
+}
+var _computeLabelGeometryOpt = {
+ minMarginForce: [null, 0, null, 0],
+ marginDefault: [1, 0, 1, 0]
+};
+var _tmpLabelGeometry = {};
function isPositionCenter(sectorShape) {
// Not change x for center label
return sectorShape.position === 'center';
@@ -43751,12 +43863,8 @@ function pieLabelLayout(seriesModel) {
});
// Not sectorShape the inside label
if (!isLabelInside) {
- var textRect = label.getBoundingRect().clone();
- textRect.applyTransform(label.getComputedTransform());
- // Text has a default 1px stroke. Exclude this.
- var margin = (label.style.margin || 0) + 2.1;
- textRect.y -= margin / 2;
- textRect.height += margin;
+ var textRect = new BoundingRect(0, 0, 0, 0);
+ computeLabelGlobalRect(textRect, label);
labelLayoutList.push({
label: label,
labelLine: labelLine,
@@ -45471,17 +45579,15 @@ function registerAction$1(registers) {
}
var PI$5 = Math.PI;
-// This tune is also for backward compat, since nameMoveOverlap is set as default,
-// in compact layout (multiple charts in one canvas), name should be more close to the axis line and labels.
-var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2], [5, 3], [8, 3]];
-var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1], [0, 3], [0, 3]];
+var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]];
+var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]];
var getLabelInner = makeInner();
var getTickInner = makeInner();
/**
* A context shared by difference axisBuilder instances.
* For cross-axes overlap resolving.
*
- * Lifecycle constrait: should not over a pass of ec main process.
+ * Lifecycle constraint: should not over a pass of ec main process.
* If model is changed, the context must be disposed.
*
* @see AxisBuilderLocalContext
@@ -45511,14 +45617,14 @@ var AxisBuilderSharedContext = /** @class */function () {
* (such as `hideOverlap`, `fixMinMaxLabelShow`) and after transform calculating.
* 2. Can be called multiple times and should be idempotent.
*/
-function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutInfoList) {
+function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) {
var axis = axisModel.axis;
var record = shared.ensureRecord(axisModel);
var labelInfoList = [];
var stOccupiedRect;
var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation);
- each(labelLayoutInfoList, function (layout) {
- var layoutInfo = ensureLabelLayoutInfoComputed(layout);
+ each(labelLayoutList, function (layout) {
+ var layoutInfo = ensureLabelLayoutWithGeometry(layout);
if (!layoutInfo || layoutInfo.label.ignore) {
return;
}
@@ -45562,7 +45668,7 @@ var resolveAxisNameOverlapDefault = function (cfg, ctx, axisModel, nameLayoutInf
if (isNameLocationCenter(cfg.nameLocation)) {
var stOccupiedRect = thisRecord.stOccupiedRect;
if (stOccupiedRect) {
- moveIfOverlap(prepareIntersectionCheckInfo(stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
+ moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
}
} else {
moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec);
@@ -45576,8 +45682,7 @@ function moveIfOverlap(basedLayoutInfo, movableLayoutInfo, moveDirVec) {
bidirectional: false,
touchThreshold: 0.05
})) {
- Point.add(movableLayoutInfo.label, movableLayoutInfo.label, mtv);
- ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(movableLayoutInfo));
+ labelLayoutApplyTranslation(movableLayoutInfo, mtv);
}
}
function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) {
@@ -45856,7 +45961,7 @@ var builders = {
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
}
},
/**
@@ -45870,7 +45975,7 @@ var builders = {
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
}
var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel);
syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls);
@@ -45955,14 +46060,6 @@ var builders = {
fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
align: textStyleModel.get('align') || labelLayout.textAlign,
verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
- }, {
- defaultTextMargin: isNameLocationCenter(nameLocation)
- // Make axis name visually far from axis labels.
- // (but not too aggressive, consider multiple small charts)
- ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
- // top/button margin is set to `0` to inserted the xAxis name into the indention
- // above the axis labels to save space. (see example below.)
- : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
}),
z2: 1
});
@@ -45983,7 +46080,20 @@ var builders = {
transformGroup.add(textEl);
textEl.updateTransform();
local.nameEl = textEl;
- var nameLayout = sharedRecord.nameLayout = createSingleLayoutInfoComputed(textEl);
+ var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({
+ label: textEl,
+ priority: textEl.z2,
+ defaultAttr: {
+ ignore: textEl.ignore
+ },
+ marginDefault: isNameLocationCenter(nameLocation)
+ // Make axis name visually far from axis labels.
+ // (but not too aggressive, consider multiple small charts)
+ ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
+ // top/button margin is set to `0` to inserted the xAxis name into the indention
+ // above the axis labels to save space. (see example below.)
+ : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
+ });
sharedRecord.nameLocation = nameLocation;
group.add(textEl);
textEl.decomposeTransform();
@@ -45996,7 +46106,7 @@ var builders = {
}
}
};
-function axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
+function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
if (!axisLabelBuildResultExists(local)) {
buildAxisLabel(cfg, local, group, kind, axisModel, api);
}
@@ -46056,53 +46166,47 @@ function fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap) {
// Have not consider onBand yet, where tick els is more than label els.
// Assert no ignore in labels.
function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) {
- var outmostLabelLayout = labelLayoutList[outmostLabelIdx];
- var innerLabelLayout = labelLayoutList[innerLabelIdx];
+ var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]);
+ var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]);
if (!outmostLabelLayout || !innerLabelLayout) {
return;
}
- if (showMinMaxLabel === false) {
+ if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) {
ignoreEl(outmostLabelLayout.label);
+ return;
}
- // PENDING: Originally we thougth `optionHideOverlap === false` means do not hide anything,
+ if (innerLabelLayout.suggestIgnore) {
+ ignoreEl(innerLabelLayout.label);
+ return;
+ }
+ // PENDING: Originally we thought `optionHideOverlap === false` means do not hide anything,
// since currently the bounding rect of text might not accurate enough and might slightly bigger,
// which causes false positive. But `optionHideOverlap: null/undfined` is falsy and likely
// be treated as false.
- else {
- // In most fonts the glyph does not reach the boundary of the bouding rect.
- // This is needed to avoid too aggressive to hide two elements that meet at the edge
- // due to compact layout by the same bounding rect or OBB.
- var touchThreshold = 0.1;
- // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
- // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
- // should be conservative, since the space might be sufficient in this case.
- var ignoreMargin = !optionHideOverlap;
- if (ignoreMargin) {
- // Make a copy to apply `ignoreMargin`.
- outmostLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, outmostLabelLayout));
- innerLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, innerLabelLayout));
- }
- var anyIgnored = false;
- if (outmostLabelLayout.suggestIgnore) {
- ignoreEl(outmostLabelLayout.label);
- anyIgnored = true;
- }
- if (innerLabelLayout.suggestIgnore) {
+ // In most fonts the glyph does not reach the boundary of the bounding rect.
+ // This is needed to avoid too aggressive to hide two elements that meet at the edge
+ // due to compact layout by the same bounding rect or OBB.
+ var touchThreshold = 0.1;
+ // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
+ // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
+ // should be conservative, since the space might be sufficient in this case.
+ if (!optionHideOverlap) {
+ var marginForce = [0, 0, 0, 0];
+ // Make a copy to apply `ignoreMargin`.
+ outmostLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, outmostLabelLayout);
+ innerLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, innerLabelLayout);
+ }
+ if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, {
+ touchThreshold: touchThreshold
+ })) {
+ if (showMinMaxLabel) {
ignoreEl(innerLabelLayout.label);
- anyIgnored = true;
- }
- if (!anyIgnored && labelIntersect(ensureLabelLayoutInfoComputed(outmostLabelLayout), ensureLabelLayoutInfoComputed(innerLabelLayout), null, {
- touchThreshold: touchThreshold
- })) {
- if (showMinMaxLabel) {
- ignoreEl(innerLabelLayout.label);
- } else {
- ignoreEl(outmostLabelLayout.label);
- }
+ } else {
+ ignoreEl(outmostLabelLayout.label);
}
}
}
@@ -46115,7 +46219,7 @@ function fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap) {
deal(showMinLabel, 0, 1);
deal(showMaxLabel, labelsLen - 1, labelsLen - 2);
}
-// PENDING: is it necessary to display a tick while the cooresponding label is ignored?
+// PENDING: Is it necessary to display a tick while the corresponding label is ignored?
function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) {
if (cfg.showMinorTicks) {
// It probably unreaasonable to hide major ticks when show minor ticks.
@@ -46222,7 +46326,7 @@ function buildAxisMinorTicks(cfg, group, transformGroup, axisModel, tickDirectio
}
}
}
-// Return whether need to call `axisTickLabelLayout` again.
+// Return whether need to call `layOutAxisTickLabel` again.
function dealLastTickLabelResultReusable(local, group, extraParams) {
if (axisLabelBuildResultExists(local)) {
var axisLabelsCreationContext = local.axisLabelsCreationContext;
@@ -46358,7 +46462,6 @@ function buildAxisLabel(cfg, local, group, kind, axisModel, api) {
});
var labelLayoutList = map(labelEls, function (label) {
return {
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) // Make break labels be highest priority.
: label.z2,
@@ -46369,7 +46472,7 @@ function buildAxisLabel(cfg, local, group, kind, axisModel, api) {
});
axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx);
}
-// Indicate that `axisTickLabelLayout` has been called.
+// Indicate that `layOutAxisTickLabel` has been called.
function axisLabelBuildResultExists(local) {
return !!local.labelLayoutList;
}
@@ -46381,14 +46484,15 @@ function axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelsC
}
function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) {
var labelMargin = axisModel.get(['axisLabel', 'margin']);
- each(labelLayoutList, function (layoutInfo, idx) {
- if (!layoutInfo) {
+ each(labelLayoutList, function (layout, idx) {
+ var geometry = ensureLabelLayoutWithGeometry(layout);
+ if (!geometry) {
return;
}
- var labelEl = layoutInfo.label;
+ var labelEl = geometry.label;
var inner = getLabelInner(labelEl);
// See the comment in `suggestIgnore`.
- layoutInfo.suggestIgnore = labelEl.ignore;
+ geometry.suggestIgnore = labelEl.ignore;
// Currently no `ignore:true` is set in `buildAxisLabel`
// But `ignore:true` may be set subsequently for overlap handling, thus reset it here.
labelEl.ignore = false;
@@ -46402,9 +46506,8 @@ function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transfor
_tmpLayoutEl.decomposeTransform();
copyTransform(labelEl, _tmpLayoutEl);
labelEl.markRedraw();
- if (layoutInfo.kind === LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- rollbackToLabelLayoutInfoRaw(layoutInfo);
- }
+ setLabelLayoutDirty(geometry, true);
+ ensureLabelLayoutWithGeometry(geometry);
});
}
var _tmpLayoutEl = new Rect();
@@ -46436,7 +46539,7 @@ function adjustBreakLabels(axisModel, axisRotation, labelLayoutList) {
var moveOverlap = axisModel.get(['breakLabelLayout', 'moveOverlap'], true);
if (moveOverlap === true || moveOverlap === 'auto') {
each(breakLabelIndexPairs, function (idxPair) {
- getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[0]]), ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[1]])]);
+ getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[0]]), ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[1]])]);
});
}
}
@@ -47132,7 +47235,7 @@ function layOutGridByOuterBounds(outerBoundsRect, outerBoundsContain, outerBound
// Assume `updateAllAxisExtentTransByGridRect` has been performed once before this call.
// [NOTE]:
// - The bounding rect of the axis elements might be sensitve to variations in `axis.extent` due to strategies
- // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutInfoBase['suggestIgnore']`.
+ // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutBase['suggestIgnore']`.
// - The final `gridRect` might be slightly smaller than the ideally expected result if labels are giant and
// get hidden due to overlapping. More iterations could improve precision, but not performant. We consider
// the current result acceptable, since no alignment among charts can be guaranteed when using this feature.
@@ -47998,79 +48101,55 @@ function fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius) {
function fixJitterAvoidOverlaps(fixedAxis, fixedCoord, floatCoord, radius, jitter, margin) {
var store = inner$6(fixedAxis);
if (!store.items) {
- store.items = {
- fixedCoord: -1,
- floatCoord: -1,
- r: -1,
- next: null,
- prev: null
- };
- store.items.next = store.items;
- store.items.prev = store.items;
+ store.items = [];
}
var items = store.items;
+ // Try both positive and negative directions, choose the one with smaller movement
var overlapA = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, 1);
var overlapB = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, -1);
- var overlapResult = Math.abs(overlapA.resultCoord - floatCoord) < Math.abs(overlapB.resultCoord - floatCoord) ? overlapA : overlapB;
- var minFloat = overlapResult.resultCoord;
+ var minFloat = Math.abs(overlapA - floatCoord) < Math.abs(overlapB - floatCoord) ? overlapA : overlapB;
// Clamp only category axis
var bandWidth = fixedAxis.scale.type === 'ordinal' ? fixedAxis.getBandWidth() : null;
var distance = Math.abs(minFloat - floatCoord);
if (distance > jitter / 2 || bandWidth && distance > bandWidth / 2 - radius) {
// If the new item is moved too far, then give up.
// Fall back to random jitter.
- minFloat = fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
- }
- // Insert to store
- var insertBy = overlapResult.insertBy;
- var resultDirection = overlapResult.direction;
- var pointer1 = resultDirection > 0 ? 'next' : 'prev';
- var pointer2 = resultDirection > 0 ? 'prev' : 'next';
- var newItem = {
+ return fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
+ }
+ // Add new point to array
+ items.push({
fixedCoord: fixedCoord,
- floatCoord: overlapResult.resultCoord,
- r: radius,
- next: null,
- prev: null
- };
- newItem[pointer1] = insertBy[pointer1];
- newItem[pointer2] = insertBy;
- insertBy[pointer1][pointer2] = newItem;
- insertBy[pointer1] = newItem;
+ floatCoord: minFloat,
+ r: radius
+ });
return minFloat;
}
function placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, direction) {
- // Check for overlap with previous items.
var y = floatCoord;
- var pointer1 = direction > 0 ? 'next' : 'prev';
- var insertBy = items;
- var item = items[pointer1];
- while (item !== items) {
+ // Check all existing items for overlap and find the maximum adjustment needed
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
var dx = fixedCoord - item.fixedCoord;
var dy = y - item.floatCoord;
var d2 = dx * dx + dy * dy;
var r = radius + item.r + margin;
if (d2 < r * r) {
- // Overlap. Try to move the new item along otherCoord direction.
- y = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
- insertBy = item;
- if (Math.abs(y - floatCoord) > jitter / 2) {
- // If the new item is moved too far, then give up.
- // Fall back to random jitter.
- return {
- resultCoord: Number.MAX_VALUE,
- insertBy: insertBy,
- direction: direction
- };
+ // Has overlap, calculate required adjustment
+ var requiredY = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
+ // Check if this adjustment would move too far
+ if (Math.abs(requiredY - floatCoord) > jitter / 2) {
+ return Number.MAX_VALUE; // Give up
+ }
+ // Update y only when it's larger to the center
+ if (direction === 1 && requiredY > y || direction === -1 && requiredY < y) {
+ y = requiredY;
+ // Loop from the start again
+ i = -1; // Reset index to recheck all items
+ continue; // Recalculate with the new y position
}
}
- item = item[pointer1];
}
- return {
- resultCoord: y,
- insertBy: insertBy,
- direction: direction
- };
+ return y;
}
function jitterLayout(ecModel) {
@@ -48307,14 +48386,21 @@ var RadarView = /** @class */function (_super) {
var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty();
// Won't be ignore if normal state is not ignore.
polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;
+ var lineStyle = itemModel.getModel([stateName, 'lineStyle']).getLineStyle();
+ polyline.ensureState(stateName).style = lineStyle;
+ var areaStyle = stateModel.getAreaStyle();
+ polygon.ensureState(stateName).style = areaStyle;
+ var itemStateStyle = itemModel.getModel([stateName, 'itemStyle']).getItemStyle();
+ symbolGroup.eachChild(function (symbolPath) {
+ symbolPath.ensureState(stateName).style = clone(itemStateStyle);
+ });
});
- polygon.useStyle(defaults(areaStyleModel.getAreaStyle(), {
+ polygon.useStyle(defaults(itemModel.getModel('areaStyle').getAreaStyle(), {
fill: color,
opacity: 0.7,
decal: itemStyle.decal
}));
var emphasisModel = itemModel.getModel('emphasis');
- var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();
symbolGroup.eachChild(function (symbolPath) {
if (symbolPath instanceof ZRImage) {
var pathStyle = symbolPath.style;
@@ -48331,8 +48417,6 @@ var RadarView = /** @class */function (_super) {
symbolPath.setColor(color);
symbolPath.style.strokeNoScale = true;
}
- var pathEmphasisState = symbolPath.ensureState('emphasis');
- pathEmphasisState.style = clone(itemHoverStyle);
var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
@@ -69450,7 +69534,7 @@ function isEC4CompatibleStyle(style, elType, hasOwnTextContentOption, hasOwnText
// `legacy: false`, force do not compat.
// `legacy` not set: auto detect whether legacy.
// But in this case we do not compat (difficult to detect and rare case):
- // Becuse custom series and graphic component support "merge", users may firstly
+ // Because custom series and graphic component support "merge", users may firstly
// only set `textStrokeWidth` style or secondly only set `text`.
return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
// Difficult to detect whether legacy for a "text" el.
@@ -74858,7 +74942,7 @@ function resetXYLocatorRange(out) {
return rg;
}
/**
- * If illegal or out of boundary, set NaN to `locOut`. (See `isLocatorRangeInvalidOnDim`)
+ * If illegal or out of boundary, set NaN to `locOut`. See `isXYLocatorRangeInvalidOnDim`.
* x dimension and y dimension are calculated separately.
*/
function parseCoordRangeOption(locOut,
@@ -74877,14 +74961,18 @@ function parseCoordRangeOptionOnOneDim(locDimOut, reasonOut, clamp, data, dims,
var coordValArr = isArray(dataOnDim) ? dataOnDim : [dataOnDim];
var len = coordValArr.length;
var hasClamp = !!clamp;
- if (len === 1 || len === 2) {
+ if (len >= 1) {
parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 0);
if (len > 1) {
- parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 1);
+ // Users may intuitively input the coords like `[[x1, x2, x3], ...]`;
+ // consider the range as `[x1, x3]` in this case.
+ parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, len - 1);
}
} else {
- if (reasonOut) {
- reasonOut.push("Can only contain 1 or 2 coords, rather than " + len + ".");
+ if ("development" !== 'production') {
+ if (reasonOut) {
+ reasonOut.push('Should be like [["x1", "x2"], ["y1", "y2"]], or ["x1", "y1"], rather than empty.');
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
}
@@ -74916,8 +75004,10 @@ function parseCoordRangeOptionOnOneDim(locDimOut, reasonOut, clamp, data, dims,
function parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, partIdx) {
var layout = coordDataToAllCellLevelLayout(coordValArr[partIdx], dims, dimIdx);
if (!layout) {
- if (!hasClamp && reasonOut) {
- reasonOut.push("Can not find layout by coord[" + dimIdx + "][" + partIdx + "].");
+ if ("development" !== 'production') {
+ if (!hasClamp && reasonOut) {
+ reasonOut.push("Can not find cell by coord[" + dimIdx + "][" + partIdx + "].");
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
return;
@@ -75407,7 +75497,7 @@ var MatrixBodyCorner = /** @class */function () {
if ("development" !== 'production') {
reasonArr = [];
}
- parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, MatrixClampOption[self._kind]);
+ parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, option.coordClamp ? MatrixClampOption[self._kind] : MatrixClampOption.none);
if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) || isXYLocatorRangeInvalidOnDim(locatorRange, 1)) {
if ("development" !== 'production') {
error("Can not determine cells by option matrix." + self._kind + ".data[" + idx + "]: " + ("" + reasonArr.join(' ')));
@@ -75522,13 +75612,13 @@ var MatrixBodyCorner = /** @class */function () {
* @param locatorRange Must be the return of `parseCoordRangeOption`.
*/
MatrixBodyCorner.prototype.expandRangeByCellMerge = function (locatorRange) {
- if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) && isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
+ if (!isXYLocatorRangeInvalidOnDim(locatorRange, 0) && !isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
// If it locates to a single cell, use this quick path to avoid travelling.
// It is based on the fact that any cell is not contained by more than one cell merging rect.
_tmpERBCMLocator[0] = locatorRange[0][0];
_tmpERBCMLocator[1] = locatorRange[1][0];
var cell = this.getCell(_tmpERBCMLocator);
- var inSpanOf = cell.inSpanOf;
+ var inSpanOf = cell && cell.inSpanOf;
if (inSpanOf) {
cloneXYLocatorRange(locatorRange, inSpanOf.locatorRange);
return;
@@ -75666,7 +75756,7 @@ var MatrixView = /** @class */function (_super) {
_this.type = MatrixView.type;
return _this;
}
- MatrixView.prototype.render = function (matrixModel) {
+ MatrixView.prototype.render = function (matrixModel, ecModel) {
this.group.removeAll();
var group = this.group;
var coordSys = matrixModel.coordinateSystem;
@@ -75677,8 +75767,8 @@ var MatrixView = /** @class */function (_super) {
var yDim = yDimModel.dim;
// PENDING:
// reuse the existing text and rect elements for performance?
- renderDimensionCells(group, matrixModel);
- createBodyAndCorner(group, matrixModel, xDim, yDim);
+ renderDimensionCells(group, matrixModel, ecModel);
+ createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel);
var borderZ2Option = matrixModel.getShallow('borderZ2', true);
var outerBorderZ2 = retrieve2(borderZ2Option, Z2_OUTER_BORDER);
var dividerLineZ2 = outerBorderZ2 - 1;
@@ -75722,7 +75812,7 @@ var MatrixView = /** @class */function (_super) {
MatrixView.type = 'matrix';
return MatrixView;
}(ComponentView);
-function renderDimensionCells(group, matrixModel) {
+function renderDimensionCells(group, matrixModel, ecModel) {
renderOnDimension(0);
renderOnDimension(1);
function renderOnDimension(dimIdx) {
@@ -75740,11 +75830,11 @@ function renderDimensionCells(group, matrixModel) {
var shape = {};
BoundingRect.copy(shape, dimCell.rect);
set(xyLocator, dimCell.id.x, dimCell.id.y);
- createMatrixCell(xyLocator, matrixModel, group, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
}
}
}
-function createBodyAndCorner(group, matrixModel, xDim, yDim) {
+function createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel) {
createBodyOrCornerCells('body', matrixModel.getBody(), xDim, yDim);
if (xDim.shouldShow() && yDim.shouldShow()) {
createBodyOrCornerCells('corner', matrixModel.getCorner(), yDim, xDim);
@@ -75778,19 +75868,19 @@ function createBodyAndCorner(group, matrixModel, xDim, yDim) {
yLayout.dim.getLayout(shape, 1, xyLocator[1]);
}
var bodyCornerCellOption = bodyCornerCell ? bodyCornerCell.option : null;
- createMatrixCell(xyLocator, matrixModel, group, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
}
}
} // End of createBodyOrCornerCells
}
-function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
+function createMatrixCell(xyLocator, matrixModel, group, ecModel, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
var _a;
// Do not use getModel for handy performance optimization.
_tmpCellItemStyleModel.option = cellOption ? cellOption.itemStyle : null;
_tmpCellItemStyleModel.parentModel = parentItemStyleModel;
_tmpCellModel.option = cellOption;
_tmpCellModel.parentModel = parentCellModel;
- // Use different z2 becuase special border may be defined in itemStyle.
+ // Use different z2 because special border may be defined in itemStyle.
var z2 = retrieve2(_tmpCellModel.getShallow('z2'), cellOption && cellOption.itemStyle ? zrCellDefault.special : zrCellDefault.normal);
var tooltipOptionShow = tooltipOption && tooltipOption.show;
var cellRect = createMatrixRect(shape, _tmpCellItemStyleModel.getItemStyle(), z2);
@@ -75804,6 +75894,8 @@ function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemS
var text = textValue + '';
_tmpCellLabelModel.option = cellOption ? cellOption.label : null;
_tmpCellLabelModel.parentModel = parentLabelModel;
+ // This is to accept `option.textStyle` as the default.
+ _tmpCellLabelModel.ecModel = ecModel;
setLabelStyle(cellRect,
// Currently do not support other states (`emphasis`, `select`, `blur`)
{
@@ -75864,6 +75956,9 @@ function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemS
!cellRect.style || cellRect.style.fill === 'none' || !cellRect.style.fill;
}
cellRect.silent = rectSilent;
+ clearTmpModel(_tmpCellModel);
+ clearTmpModel(_tmpCellItemStyleModel);
+ clearTmpModel(_tmpCellLabelModel);
}
var _tmpCellModel = new Model();
var _tmpCellItemStyleModel = new Model();
@@ -79928,9 +80023,11 @@ var TooltipHTMLContent = /** @class */function () {
clearTimeout(this._longHideTimeout);
var zr = this._zr;
transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
- if (this.el) {
- var parentNode = this.el.parentNode;
- parentNode && parentNode.removeChild(this.el);
+ var el = this.el;
+ if (el) {
+ el.onmouseenter = el.onmousemove = el.onmouseleave = null;
+ var parentNode = el.parentNode;
+ parentNode && parentNode.removeChild(el);
}
this.el = this._container = null;
};
@@ -82867,6 +82964,7 @@ var MarkerModel = /** @class */function (_super) {
* If marker model is created by self from series
*/
_this.createdBySelf = false;
+ _this.preventAutoZ = true;
return _this;
}
/**
@@ -83190,6 +83288,7 @@ var MarkerView = /** @class */function (_super) {
markerGroupMap.each(function (item) {
!inner$j(item).keep && _this.group.remove(item.group);
});
+ updateZ$2(ecModel, markerGroupMap, this.type);
};
MarkerView.prototype.markKeep = function (drawGroup) {
inner$j(drawGroup).keep = true;
@@ -83211,6 +83310,18 @@ var MarkerView = /** @class */function (_super) {
MarkerView.type = 'marker';
return MarkerView;
}(ComponentView);
+function updateZ$2(ecModel, markerGroupMap, type) {
+ ecModel.eachSeries(function (seriesModel) {
+ var markerModel = MarkerModel.getMarkerModelFromSeries(seriesModel, type);
+ var markerDraw = markerGroupMap.get(seriesModel.id);
+ if (markerModel && markerDraw && markerDraw.group) {
+ var _a = retrieveZInfo(markerModel),
+ z = _a.z,
+ zlevel = _a.zlevel;
+ traverseUpdateZ(markerDraw.group, z, zlevel);
+ }
+ });
+}
function updateMarkerLayout(mpData, seriesModel, api) {
var coordSys = seriesModel.coordinateSystem;
@@ -87217,9 +87328,8 @@ var ContinuousModel = /** @class */function (_super) {
ContinuousModel.prototype.getValueState = function (value) {
var range = this.option.range;
var dataExtent = this.getExtent();
- // When range[0] === dataExtent[0], any value larger than dataExtent[0] maps to 'inRange'.
- // range[1] is processed likewise.
- return (range[0] <= dataExtent[0] || range[0] <= value) && (range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
+ var unboundedRange = retrieve2(this.option.unboundedRange, true);
+ return (unboundedRange && range[0] <= dataExtent[0] || range[0] <= value) && (unboundedRange && range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
};
ContinuousModel.prototype.findTargetDataIndices = function (range) {
var result = [];
@@ -89042,7 +89152,7 @@ var ThumbnailView = /** @class */function (_super) {
}));
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(thumbnailModel, this);
+ updateZ$3(thumbnailModel, this);
};
/**
* Can be called asynchronously directly.
@@ -89053,7 +89163,7 @@ var ThumbnailView = /** @class */function (_super) {
if (this._isEnabled()) {
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(this._model, this);
+ updateZ$3(this._model, this);
}
};
ThumbnailView.prototype._dealRenderContent = function () {
@@ -89208,7 +89318,7 @@ function makeRoamPayload(baseMapProvider, params) {
extend(payload, params);
return payload;
}
-function updateZ$2(thumbnailModel, thumbnailView) {
+function updateZ$3(thumbnailModel, thumbnailView) {
var zInfo = retrieveZInfo(thumbnailModel);
traverseUpdateZ(thumbnailView.group, zInfo.z, zInfo.zlevel);
}
@@ -92603,7 +92713,7 @@ function adjustBreakLabelPair(axisInverse, axisRotation, layoutPair) {
return layout.transform ? mul$1(create$1(), axisStTrans, layout.transform) : axisStTrans;
});
function isParallelToAxis(whIdx) {
- // Assert label[0] and lable[1] has the same rotation, so only use [0].
+ // Assert label[0] and label[1] has the same rotation, so only use [0].
var localRect = layoutPair[0].localRect;
var labelVec0 = new Point(localRect[WH$1[whIdx]] * labelPairStTrans[0][0], localRect[WH$1[whIdx]] * labelPairStTrans[0][1]);
return Math.abs(labelVec0.y) < 1e-5;
@@ -92644,8 +92754,12 @@ function adjustBreakLabelPair(axisInverse, axisRotation, layoutPair) {
var uval = uvalMax < 0 ? uvalMax : uvalMin > 0 ? uvalMin : 0;
k = (qval - uval) / mtvSt.x;
}
- Point.scaleAndAdd(layoutPair[0].label, layoutPair[0].label, mtv, -k);
- Point.scaleAndAdd(layoutPair[1].label, layoutPair[1].label, mtv, 1 - k);
+ var delta0 = new Point();
+ var delta1 = new Point();
+ Point.scale(delta0, mtv, -k);
+ Point.scale(delta1, mtv, 1 - k);
+ labelLayoutApplyTranslation(layoutPair[0], delta0);
+ labelLayoutApplyTranslation(layoutPair[1], delta1);
}
function updateModelAxisBreak(model, payload) {
var result = {
diff --git a/dist/echarts.esm.js.map b/dist/echarts.esm.js.map
index 385086550..9be8902df 100644
--- a/dist/echarts.esm.js.map
+++ b/dist/echarts.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.esm.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core/ [...]
\ No newline at end of file
+{"version":3,"file":"echarts.esm.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core/ [...]
\ No newline at end of file
diff --git a/dist/echarts.esm.min.js b/dist/echarts.esm.min.js
index f27201556..3e8844cee 100644
--- a/dist/echarts.esm.min.js
+++ b/dist/echarts.esm.min.js
@@ -32,7 +32,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
-var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){this.firefox=!1,this.ie [...]
+var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){this.firefox=!1,this.ie [...]
/*!
* ZRender, a high performance 2d drawing library.
*
@@ -42,4 +42,4 @@ var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
-var to={},eo={};var no,io=function(){function t(t,e,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new pn,a=n.renderer||"canvas";to[a]||(a=G(to)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new to[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=i.node||i.worker||l?null:new fr(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
+var to={},eo={};var no,io=function(){function t(t,e,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new pn,a=n.renderer||"canvas";to[a]||(a=G(to)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new to[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,c=i.node||i.worker||l?null:new fr(s.getViewportRoot(),s.root),h=n.useCoarsePointer;(null==h|| [...]
diff --git a/dist/echarts.esm.min.mjs b/dist/echarts.esm.min.mjs
index f27201556..3e8844cee 100644
--- a/dist/echarts.esm.min.mjs
+++ b/dist/echarts.esm.min.mjs
@@ -32,7 +32,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
-var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){this.firefox=!1,this.ie [...]
+var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){this.firefox=!1,this.ie [...]
/*!
* ZRender, a high performance 2d drawing library.
*
@@ -42,4 +42,4 @@ var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
-var to={},eo={};var no,io=function(){function t(t,e,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new pn,a=n.renderer||"canvas";to[a]||(a=G(to)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new to[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=i.node||i.worker||l?null:new fr(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
+var to={},eo={};var no,io=function(){function t(t,e,n){var r=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new pn,a=n.renderer||"canvas";to[a]||(a=G(to)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new to[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,c=i.node||i.worker||l?null:new fr(s.getViewportRoot(),s.root),h=n.useCoarsePointer;(null==h|| [...]
diff --git a/dist/echarts.esm.mjs b/dist/echarts.esm.mjs
index ab22aed97..bfc06b2b0 100644
--- a/dist/echarts.esm.mjs
+++ b/dist/echarts.esm.mjs
@@ -7558,7 +7558,7 @@ function getElementSSRData(el) {
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
-var version = '6.0.0-rc.1';
+var version = '6.0.0';
var zrender = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -7672,6 +7672,8 @@ function parsePositionSizeOption(option, percentBase, percentOffset) {
}
function round(x, precision, returnStr) {
if (precision == null) {
+ // FIXME: the default precision should not be provided, since there is no universally adaptable
+ // precision. The caller need to input a precision according to the scenarios.
precision = 10;
}
// Avoid range error
@@ -8700,7 +8702,7 @@ function preParseFinder(finderInput, opt) {
var others = {};
var mainTypeSpecified = false;
each(finder, function (value, key) {
- // Exclude 'dataIndex' and other illgal keys.
+ // Exclude 'dataIndex' and other illegal keys.
if (key === 'dataIndex' || key === 'dataIndexInside') {
others[key] = value;
return;
@@ -8898,6 +8900,10 @@ var ListIterator = /** @class */function () {
};
return ListIterator;
}();
+function clearTmpModel(model) {
+ // Clear to avoid memory leak.
+ model.option = model.parentModel = model.ecModel = null;
+}
var TYPE_DELIMITER = '.';
var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';
@@ -9342,8 +9348,8 @@ function estimateLength(text, contentWidth, fontMeasureInfo) {
}
return i;
}
-function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
- text != null && (text += '');
+function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
+ var text = formatText(rawText);
var overflow = style.overflow;
var padding = style.padding;
var paddingH = padding ? padding[1] + padding[3] : 0;
@@ -9443,9 +9449,9 @@ var RichTextContentBlock = (function () {
}
return RichTextContentBlock;
}());
-function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
+function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
var contentBlock = new RichTextContentBlock();
- text != null && (text += '');
+ var text = formatText(rawText);
if (!text) {
return contentBlock;
}
@@ -9771,6 +9777,33 @@ function calcInnerTextOverflowArea(out, overflowRect, baseX, baseY, textAlign, t
}
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
+function formatText(text) {
+ return text != null ? (text += '') : (text = '');
+}
+function tSpanCreateBoundingRect(style) {
+ var text = formatText(style.text);
+ var font = style.font;
+ var contentWidth = measureWidth(ensureFontMeasureInfo(font), text);
+ var contentHeight = getLineHeight(font);
+ return tSpanCreateBoundingRect2(style, contentWidth, contentHeight, null);
+}
+function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
+ var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY$1(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
+ var lineWidth = forceLineWidth != null
+ ? forceLineWidth
+ : (tSpanHasStroke(style) ? style.lineWidth : 0);
+ if (lineWidth > 0) {
+ rect.x -= lineWidth / 2;
+ rect.y -= lineWidth / 2;
+ rect.width += lineWidth;
+ rect.height += lineWidth;
+ }
+ return rect;
+}
+function tSpanHasStroke(style) {
+ var stroke = style.stroke;
+ return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+}
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
@@ -11741,9 +11774,7 @@ var TSpan = (function (_super) {
return _super !== null && _super.apply(this, arguments) || this;
}
TSpan.prototype.hasStroke = function () {
- var style = this.style;
- var stroke = style.stroke;
- return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ return tSpanHasStroke(this.style);
};
TSpan.prototype.hasFill = function () {
var style = this.style;
@@ -11757,21 +11788,8 @@ var TSpan = (function (_super) {
this._rect = rect;
};
TSpan.prototype.getBoundingRect = function () {
- var style = this.style;
if (!this._rect) {
- var text = style.text;
- text != null ? (text += '') : (text = '');
- var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
- rect.x += style.x || 0;
- rect.y += style.y || 0;
- if (this.hasStroke()) {
- var w = style.lineWidth;
- rect.x -= w / 2;
- rect.y -= w / 2;
- rect.width += w;
- rect.height += w;
- }
- this._rect = rect;
+ this._rect = tSpanCreateBoundingRect(this.style);
}
return this._rect;
};
@@ -12229,7 +12247,6 @@ var ZRText = (function (_super) {
var bgColorDrawn = !!(style.backgroundColor);
var outerHeight = contentBlock.outerHeight;
var outerWidth = contentBlock.outerWidth;
- var contentWidth = contentBlock.contentWidth;
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
this.isTruncated = !!contentBlock.isTruncated;
@@ -12251,6 +12268,7 @@ var ZRText = (function (_super) {
}
}
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var useDefaultFill = false;
var textFill = getFill('fill' in style
? style.fill
@@ -12259,12 +12277,9 @@ var ZRText = (function (_super) {
? style.stroke
: (!bgColorDrawn
&& (!defaultStyle.autoStroke || useDefaultFill))
- ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = style.textShadowBlur > 0;
- var fixedBoundingRect = style.width != null
- && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
- var calculatedLineHeight = contentBlock.calculatedLineHeight;
for (var i = 0; i < textLines.length; i++) {
var el = this._getOrCreateChild(TSpan);
var subElStyle = el.createStyle();
@@ -12294,9 +12309,7 @@ var ZRText = (function (_super) {
subElStyle.font = textFont;
setSeparateFont(subElStyle, style);
textY += lineHeight;
- if (fixedBoundingRect) {
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
- }
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, contentBlock.contentWidth, contentBlock.calculatedLineHeight, usingDefaultStroke ? 0 : null));
}
};
ZRText.prototype._updateRichTexts = function () {
@@ -12393,6 +12406,7 @@ var ZRText = (function (_super) {
var defaultStyle = this._defaultStyle;
var useDefaultFill = false;
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill
: 'fill' in style ? style.fill
: (useDefaultFill = true, defaultStyle.fill));
@@ -12400,7 +12414,7 @@ var ZRText = (function (_super) {
: 'stroke' in style ? style.stroke
: (!bgColorDrawn
&& !parentBgColorDrawn
- && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = tokenStyle.textShadowBlur > 0
|| style.textShadowBlur > 0;
@@ -12427,9 +12441,7 @@ var ZRText = (function (_super) {
if (textFill) {
subElStyle.fill = textFill;
}
- var textWidth = token.contentWidth;
- var textHeight = token.contentHeight;
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, token.contentWidth, token.contentHeight, usingDefaultStroke ? 0 : null));
};
ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
var textBackgroundColor = style.backgroundColor;
@@ -12585,25 +12597,6 @@ function needDrawBackground(style) {
|| (style.borderWidth && style.borderColor));
}
-var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
-var SOURCE_FORMAT_ORIGINAL = 'original';
-var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
-var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
-var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
-var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
-var SOURCE_FORMAT_UNKNOWN = 'unknown';
-var SERIES_LAYOUT_BY_COLUMN = 'column';
-var SERIES_LAYOUT_BY_ROW = 'row';
-/**
- * PENDING: Temporary impl. unify them?
- * @see {LabelCommonOption['textMargin']}
- * @see {LabelCommonOption['minMargin']}
- */
-var LabelMarginType = {
- minMargin: 0,
- textMargin: 1
-};
-
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
if (el) {
@@ -15335,7 +15328,7 @@ function nearZero(val) {
* `false` - expand if `delta[i]` is positive, commmonly used in `margin` case. (default)
* @param noNegative
* `true` - negative `delta[i]` will be clampped to 0.
- * `false` - No clamp to `delta`. (defualt).
+ * `false` - No clamp to `delta`. (default).
* @return The input `rect`.
*/
function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize // by default [0, 0].
@@ -15345,6 +15338,9 @@ function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize //
} else if (isNumber(delta)) {
_tmpExpandRectDelta[0] = _tmpExpandRectDelta[1] = _tmpExpandRectDelta[2] = _tmpExpandRectDelta[3] = delta;
} else {
+ if ("development" !== 'production') {
+ assert(delta.length === 4);
+ }
_tmpExpandRectDelta[0] = delta[0];
_tmpExpandRectDelta[1] = delta[1];
_tmpExpandRectDelta[2] = delta[2];
@@ -15445,6 +15441,27 @@ function isBoundingRectAxisAligned(transform) {
return !transform || mathAbs$1(transform[1]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[2]) < AXIS_ALIGN_EPSILON || mathAbs$1(transform[0]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[3]) < AXIS_ALIGN_EPSILON;
}
var AXIS_ALIGN_EPSILON = 1e-5;
+/**
+ * Create or copy to the existing bounding rect to avoid modifying `source`.
+ *
+ * @usage
+ * out.rect = ensureCopyRect(out.rect, sourceRect);
+ */
+function ensureCopyRect(target, source) {
+ return target ? BoundingRect.copy(target, source) : source.clone();
+}
+/**
+ * Create or copy to the existing transform to avoid modifying `source`.
+ *
+ * [CAUTION]: transform is `NullUndefined` if no transform, following convention of zrender,
+ * and enable to bypass some unnecessary calculation, since in most cases there is no transform.
+ *
+ * @usage
+ * out.transform = ensureCopyTransform(out.transform, sourceTransform);
+ */
+function ensureCopyTransform(target, source) {
+ return source ? copy$1(target || create$1(), source) : undefined;
+}
function retrieveZInfo(model) {
return {
z: model.get('z') || 0,
@@ -15498,9 +15515,9 @@ function traverseUpdateZ(el, z, zlevel) {
doUpdateZ(el, z, zlevel, -Infinity);
}
function doUpdateZ(el, z, zlevel,
-// FIXME: ideally all the labels shold be above all the glyphs by default,
+// FIXME: Ideally all the labels should be above all the glyphs by default,
// e.g. in graph, edge labels should be above node elements.
-// currenly impl does not garaentee that.
+// Currently impl does not guarantee that.
maxZ2) {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
@@ -15585,6 +15602,8 @@ var graphic = /*#__PURE__*/Object.freeze({
setTooltipConfig: setTooltipConfig,
traverseElements: traverseElements,
isBoundingRectAxisAligned: isBoundingRectAxisAligned,
+ ensureCopyRect: ensureCopyRect,
+ ensureCopyTransform: ensureCopyTransform,
retrieveZInfo: retrieveZInfo,
calcZ2Range: calcZ2Range,
traverseUpdateZ: traverseUpdateZ,
@@ -15844,23 +15863,26 @@ function setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttac
if (overflow) {
textStyle.overflow = overflow;
}
- var minMargin = textStyleModel.get('minMargin');
- if (minMargin != null) {
- textStyle.margin = minMargin;
- textStyle.__marginType = LabelMarginType.minMargin;
- }
- var textMargin = textStyleModel.get('textMargin');
- if (textMargin != null) {
- textStyle.margin = clone(textMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- } else if (opt.defaultTextMargin != null) {
- textStyle.margin = clone(opt.defaultTextMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- }
var lineOverflow = textStyleModel.get('lineOverflow');
if (lineOverflow) {
textStyle.lineOverflow = lineOverflow;
}
+ var labelTextStyle = textStyle;
+ // `minMargin` has a higher precedence than `textMargin`, because `textMargin` is allowed
+ // to be set in `defaultOption`.
+ var minMargin = textStyleModel.get('minMargin');
+ if (minMargin != null) {
+ // `minMargin` only support number value.
+ minMargin = !isNumber(minMargin) ? 0 : minMargin / 2;
+ labelTextStyle.margin = [minMargin, minMargin, minMargin, minMargin];
+ labelTextStyle.__marginType = LabelMarginType.minMargin;
+ } else {
+ var textMargin = textStyleModel.get('textMargin');
+ if (textMargin != null) {
+ labelTextStyle.margin = normalizeCssArray(textMargin);
+ labelTextStyle.__marginType = LabelMarginType.textMargin;
+ }
+ }
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, null, null, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
@@ -16078,6 +16100,15 @@ function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetche
percent: 1
}, animatableModel, dataIndex, null, during);
}
+/**
+ * PENDING: Temporary impl. unify them?
+ * @see {LabelCommonOption['textMargin']}
+ * @see {LabelCommonOption['minMargin']}
+ */
+var LabelMarginType = {
+ minMargin: 1,
+ textMargin: 2
+};
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
@@ -17762,7 +17793,7 @@ function getLayoutRect(positionInfo, containerRect,
// Commonly used in option `legend.padding`, `timeline.padding`, `title.padding`,
// `visualMap.padding`, ...
// [NOTICE]:
-// It's named `margin`, becuase it's the space that outside the bounding rect. But from
+// It's named `margin`, because it's the space that outside the bounding rect. But from
// the perspective of the the caller, it's commonly used as the `padding` of a component,
// because conventionally background color covers this space.
// [BEHAVIOR]:
@@ -18425,7 +18456,7 @@ for (var key in color$1) {
tokens.darkColor[key] = modifyHSL(hex, null, function (s) {
return s * 0.9;
}, function (l) {
- return 1 - l;
+ return 1 - Math.pow(l, 1.5);
});
}
}
@@ -18532,6 +18563,16 @@ var globalDefault = {
useUTC: false
};
+var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
+var SOURCE_FORMAT_ORIGINAL = 'original';
+var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
+var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
+var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
+var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
+var SOURCE_FORMAT_UNKNOWN = 'unknown';
+var SERIES_LAYOUT_BY_COLUMN = 'column';
+var SERIES_LAYOUT_BY_ROW = 'row';
+
// The result of `guessOrdinal`.
var BE_ORDINAL = {
Must: 1,
@@ -25499,7 +25540,10 @@ var matrixAxis = {
color: color$2.secondary
},
itemStyle: {
- borderColor: color$2.neutral20
+ borderColor: color$2.borderTint
+ },
+ dividerLineStyle: {
+ color: color$2.border
}
};
var theme = {
@@ -25589,9 +25633,6 @@ var theme = {
textStyle: {
color: color$2.secondary
},
- inRange: {
- color: [color$2.neutral10, color$2.theme[0]]
- },
handleStyle: {
borderColor: color$2.neutral30
}
@@ -25627,10 +25668,12 @@ var theme = {
x: matrixAxis,
y: matrixAxis,
backgroundColor: {
- borderColor: '#817f91'
+ borderColor: color$2.axisLine
},
- innerBackgroundStyle: {
- borderColor: '#484753'
+ body: {
+ itemStyle: {
+ borderColor: color$2.borderTint
+ }
}
},
timeAxis: axisCommon(),
@@ -27562,9 +27605,9 @@ function getCustomSeries(type) {
return customRenderers[type];
}
-var version$1 = '6.0.0-beta.1';
+var version$1 = '6.0.0';
var dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
@@ -28729,15 +28772,16 @@ var ECharts = /** @class */function (_super) {
coordSysMgr.update(ecModel, api);
clearColorPalette(ecModel);
scheduler.performVisualTasks(ecModel, payload);
- render(this, ecModel, api, payload, updateParams);
- // Set background
+ // Set background and dark mode before rendering, because they affect auto-color-determination
+ // in zrender Text, and consequently affect the bounding rect if stroke is added.
var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
- var darkMode = ecModel.get('darkMode');
zr.setBackgroundColor(backgroundColor);
// Force set dark mode.
+ var darkMode = ecModel.get('darkMode');
if (darkMode != null && darkMode !== 'auto') {
zr.setDarkMode(darkMode);
}
+ render(this, ecModel, api, payload, updateParams);
lifecycle.trigger('afterupdate', ecModel, api);
},
updateTransform: function (payload) {
@@ -32724,8 +32768,9 @@ var IntervalScale = /** @class */function (_super) {
var minorTicksGroup = [];
var interval = nextTick.value - prevTick.value;
var minorInterval = interval / splitNumber;
+ var minorIntervalPrecision = getIntervalPrecision(minorInterval);
while (count < splitNumber - 1) {
- var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
+ var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval, minorIntervalPrecision);
// For the first and last interval. The count may be less than splitNumber.
if (minorTick > extent[0] && minorTick < extent[1]) {
minorTicksGroup.push(minorTick);
@@ -32764,6 +32809,12 @@ var IntervalScale = /** @class */function (_super) {
return addCommas(dataNum);
};
/**
+ * FIXME: refactor - disallow override, use composition instead.
+ *
+ * The override of `calcNiceTicks` should ensure these members are provided:
+ * this._intervalPrecision
+ * this._interval
+ *
* @param splitNumber By default `5`.
*/
IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
@@ -32819,11 +32870,12 @@ var IntervalScale = /** @class */function (_super) {
extent = this._extent.slice();
this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
var interval = this._interval;
+ var intervalPrecition = this._intervalPrecision;
if (!opt.fixMin) {
- extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
+ extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval, intervalPrecition);
}
if (!opt.fixMax) {
- extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
+ extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval, intervalPrecition);
}
this._innerSetExtent(extent[0], extent[1]);
};
@@ -33415,6 +33467,7 @@ var TimeScale = /** @class */function (_super) {
var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
// Interval that can be used to calculate ticks
this._interval = scaleIntervals[idx][1];
+ this._intervalPrecision = getIntervalPrecision(this._interval);
// Min level used when picking ticks from top down.
// We check one more level to avoid the ticks are to sparse in some case.
this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
@@ -33805,8 +33858,8 @@ var LogScale = /** @class */function (_super) {
var scaleBreakHelper = getScaleBreakHelper();
return map(ticks, function (tick) {
var val = tick.value;
- var powVal = fixRound(mathPow$1(base, val));
var roundingCriterion = null;
+ var powVal = mathPow$1(base, val);
// Fix #4158
if (val === extent[0] && this._fixMin) {
roundingCriterion = originalExtent[0];
@@ -33880,6 +33933,7 @@ var LogScale = /** @class */function (_super) {
}
var niceExtent = [fixRound(mathCeil(extent[0] / interval) * interval), fixRound(mathFloor(extent[1] / interval) * interval)];
this._interval = interval;
+ this._intervalPrecision = getIntervalPrecision(interval);
this._niceExtent = niceExtent;
};
LogScale.prototype.calcNiceExtent = function (opt) {
@@ -36135,140 +36189,192 @@ function getLabelLineStatesModels(itemModel, labelLineName) {
return statesModels;
}
-// Also prevent duck typing.
-var LABEL_LAYOUT_INFO_KIND_RAW = 1;
-var LABEL_LAYOUT_INFO_KIND_COMPUTED = 2;
-function createLabelLayoutList(rawList) {
- var resultList = [];
- each(rawList, function (raw) {
- // PENDING: necessary?
- raw = extend({}, raw);
- var layoutInfo = prepareLabelLayoutInfo(raw);
- if (layoutInfo) {
- resultList.push(layoutInfo);
- }
- });
- return resultList;
+var LABEL_LAYOUT_BASE_PROPS = ['label', 'labelLine', 'layoutOption', 'priority', 'defaultAttr', 'marginForce', 'minMarginForce', 'marginDefault', 'suggestIgnore'];
+var LABEL_LAYOUT_DIRTY_BIT_OTHERS = 1;
+var LABEL_LAYOUT_DIRTY_BIT_OBB = 2;
+var LABEL_LAYOUT_DIRTY_ALL = LABEL_LAYOUT_DIRTY_BIT_OTHERS | LABEL_LAYOUT_DIRTY_BIT_OBB;
+function setLabelLayoutDirty(labelGeometry, dirtyOrClear, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ dirtyOrClear ? labelGeometry.dirty |= dirtyBits : labelGeometry.dirty &= ~dirtyBits;
+}
+function isLabelLayoutDirty(labelGeometry, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ return labelGeometry.dirty == null || !!(labelGeometry.dirty & dirtyBits);
}
/**
- * If `defaultAttr.ignore: true`, return `NullUndefined`.
- * (the caller is reponsible for ensuring the label is always `ignore: true`.)
- * Otherwise the `layoutInfo` will be modified and returned.
- * `label.ignore` is not necessarily falsy, since it might be modified by some overlap resolving handling.
+ * [CAUTION]
+ * - No auto dirty propagation mechanism yet. If the transform of the raw label or any of its ancestors is
+ * changed, must sync the changes to the props of `LabelGeometry` by:
+ * either explicitly call:
+ * `setLabelLayoutDirty(labelLayout, true); ensureLabelLayoutWithGeometry(labelLayout);`
+ * or call (if only translation is performed):
+ * `labelLayoutApplyTranslation(labelLayout);`
+ * - `label.ignore` is not necessarily falsy, and not considered in computing `LabelGeometry`,
+ * since it might be modified by some overlap resolving handling.
+ * - To duplicate or make a variation:
+ * use `newLabelLayoutWithGeometry`.
*
* The result can also be the input of this method.
- *
- * @see ensureLabelLayoutInfoComputed
+ * @return `NullUndefined` if and only if `labelLayout` is `NullUndefined`.
*/
-function prepareLabelLayoutInfo(layoutInfo) {
- if (!layoutInfo || layoutInfo.defaultAttr.ignore) {
+function ensureLabelLayoutWithGeometry(labelLayout) {
+ if (!labelLayout) {
return;
}
- var label = layoutInfo.label;
- var ignoreMargin = layoutInfo.ignoreMargin;
- var transform = label.getComputedTransform();
- // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
- var localRect = label.getBoundingRect();
- var axisAligned = isBoundingRectAxisAligned(transform);
- if (!ignoreMargin) {
- localRect = applyTextMarginToLocalRect(label, localRect);
- }
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- if (!ignoreMargin && label.style.__marginType === LabelMarginType.minMargin) {
- // `minMargin` only support number value.
- var halfMinMargin = (label.style.margin || 0) / 2;
- expandOrShrinkRect(globalRect, halfMinMargin, false, false);
- }
- var computed = layoutInfo;
- computed.kind = LABEL_LAYOUT_INFO_KIND_COMPUTED,
- // --- computed properties ---
- computed.rect = globalRect;
- computed.localRect = localRect;
- computed.obb = null,
- // will be created by `ensureOBB` when using.
- computed.axisAligned = axisAligned;
- computed.transform = transform;
- return computed;
+ if (isLabelLayoutDirty(labelLayout)) {
+ computeLabelGeometry(labelLayout, labelLayout.label, labelLayout);
+ }
+ return labelLayout;
}
/**
- * The reverse operation of `ensureLabelLayoutInfoComputedv`.
+ * The props in `out` will be filled if existing, or created.
*/
-function rollbackToLabelLayoutInfoRaw(labelLayoutInfo) {
- if (labelLayoutInfo == null) {
- return;
- }
- var raw = labelLayoutInfo;
- raw.kind = LABEL_LAYOUT_INFO_KIND_RAW;
- return raw;
+function computeLabelGeometry(out, label, opt) {
+ // [CAUTION] These props may be modified directly for performance consideration,
+ // therefore, do not output the internal data structure of zrender Element.
+ var rawTransform = label.getComputedTransform();
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ // NOTE: should call `getBoundingRect` after `getComputedTransform`, or may get an inaccurate bounding rect.
+ // The reason is that `getComputedTransform` calls `__host.updateInnerText()` internally, which updates the label
+ // by `textConfig` mounted on the host.
+ // PENDING: add a dirty bit for that in zrender?
+ var outLocalRect = out.localRect = ensureCopyRect(out.localRect, label.getBoundingRect());
+ var labelStyleExt = label.style;
+ var margin = labelStyleExt.margin;
+ var marginForce = opt && opt.marginForce;
+ var minMarginForce = opt && opt.minMarginForce;
+ var marginDefault = opt && opt.marginDefault;
+ var marginType = labelStyleExt.__marginType;
+ if (marginType == null && marginDefault) {
+ margin = marginDefault;
+ marginType = LabelMarginType.textMargin;
+ }
+ // `textMargin` and `minMargin` can not exist both.
+ for (var i = 0; i < 4; i++) {
+ _tmpLabelMargin[i] = marginType === LabelMarginType.minMargin && minMarginForce && minMarginForce[i] != null ? minMarginForce[i] : marginForce && marginForce[i] != null ? marginForce[i] : margin ? margin[i] : 0;
+ }
+ if (marginType === LabelMarginType.textMargin) {
+ expandOrShrinkRect(outLocalRect, _tmpLabelMargin, false, false);
+ }
+ var outGlobalRect = out.rect = ensureCopyRect(out.rect, outLocalRect);
+ if (rawTransform) {
+ outGlobalRect.applyTransform(rawTransform);
+ }
+ // Notice: label.style.margin is actually `minMargin / 2`, handled by `setTextStyleCommon`.
+ if (marginType === LabelMarginType.minMargin) {
+ expandOrShrinkRect(outGlobalRect, _tmpLabelMargin, false, false);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ (out.label = out.label || {}).ignore = label.ignore;
+ setLabelLayoutDirty(out, false);
+ setLabelLayoutDirty(out, true, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ // Do not remove `obb` (if existing) for reuse, just reset the dirty bit.
+ return out;
}
+var _tmpLabelMargin = [0, 0, 0, 0];
/**
- * This method supports that the label layout info is not computed until needed,
- * for performance consideration.
- *
- * [CAUTION]
- * - If the raw label is changed, must call
- * `ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(layoutInfo))`
- * to recreate the layout info.
- * - Null checking is needed for the result. @see prepareLabelLayoutInfo
- *
- * Usage:
- * To make a copy of labelLayoutInfo, simply:
- * const layoutInfoCopy = rollbackToLabelLayoutInfoRaw(extends({}, someLabelLayoutInfo));
+ * The props in `out` will be filled if existing, or created.
+ */
+function computeLabelGeometry2(out, rawLocalRect, rawTransform) {
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ out.localRect = ensureCopyRect(out.localRect, rawLocalRect);
+ out.rect = ensureCopyRect(out.rect, rawLocalRect);
+ if (rawTransform) {
+ out.rect.applyTransform(rawTransform);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ out.obb = undefined; // Reset to undefined, will be created by `ensureOBB` when using.
+ (out.label = out.label || {}).ignore = false;
+ return out;
+}
+/**
+ * This is a shortcut of
+ * ```js
+ * labelLayout.label.x = newX;
+ * labelLayout.label.y = newY;
+ * setLabelLayoutDirty(labelLayout, true);
+ * ensureLabelLayoutWithGeometry(labelLayout);
+ * ```
+ * and provide better performance in this common case.
*/
-function ensureLabelLayoutInfoComputed(labelLayoutInfo) {
- if (!labelLayoutInfo) {
+function labelLayoutApplyTranslation(labelLayout, offset) {
+ if (!labelLayout) {
return;
}
- if (labelLayoutInfo.kind !== LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- labelLayoutInfo = prepareLabelLayoutInfo(labelLayoutInfo);
+ labelLayout.label.x += offset.x;
+ labelLayout.label.y += offset.y;
+ labelLayout.label.markRedraw();
+ var transform = labelLayout.transform;
+ if (transform) {
+ transform[4] += offset.x;
+ transform[5] += offset.y;
+ }
+ var globalRect = labelLayout.rect;
+ if (globalRect) {
+ globalRect.x += offset.x;
+ globalRect.y += offset.y;
+ }
+ var obb = labelLayout.obb;
+ if (obb) {
+ obb.fromBoundingRect(labelLayout.localRect, transform);
}
- return labelLayoutInfo;
-}
-function prepareIntersectionCheckInfo(localRect, transform) {
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- return {
- obb: null,
- rect: globalRect,
- localRect: localRect,
- axisAligned: isBoundingRectAxisAligned(transform),
- transform: transform
- };
}
-function createSingleLayoutInfoComputed(el) {
- return ensureLabelLayoutInfoComputed({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
- label: el,
- priority: el.z2,
- defaultAttr: {
- ignore: el.ignore
+/**
+ * To duplicate or make a variation of a label layout.
+ * Copy the only relevant properties to avoid the conflict or wrongly reuse of the props of `LabelLayoutWithGeometry`.
+ */
+function newLabelLayoutWithGeometry(newBaseWithDefaults, source) {
+ for (var i = 0; i < LABEL_LAYOUT_BASE_PROPS.length; i++) {
+ var prop = LABEL_LAYOUT_BASE_PROPS[i];
+ if (newBaseWithDefaults[prop] == null) {
+ newBaseWithDefaults[prop] = source[prop];
}
- });
+ }
+ return ensureLabelLayoutWithGeometry(newBaseWithDefaults);
}
/**
* Create obb if no one, can cache it.
*/
-function ensureOBB(layoutInfo) {
- return layoutInfo.obb || (layoutInfo.obb = new OrientedBoundingRect(layoutInfo.localRect, layoutInfo.transform));
+function ensureOBB(labelGeometry) {
+ var obb = labelGeometry.obb;
+ if (!obb || isLabelLayoutDirty(labelGeometry, LABEL_LAYOUT_DIRTY_BIT_OBB)) {
+ labelGeometry.obb = obb = obb || new OrientedBoundingRect();
+ obb.fromBoundingRect(labelGeometry.localRect, labelGeometry.transform);
+ setLabelLayoutDirty(labelGeometry, false, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ }
+ return obb;
}
/**
- * The input localRect is never modified.
- * The returned localRect maybe the input localRect.
+ * Adjust labels on x/y direction to avoid overlap.
+ *
+ * PENDING: the current implementation is based on the global bounding rect rather than the local rect,
+ * which may be not preferable in some edge cases when the label has rotation, but works for most cases,
+ * since rotation is unnecessary when there is sufficient space, while squeezing is applied regardless
+ * of overlapping when there is no enough space.
+ *
+ * NOTICE:
+ * - The input `list` and its content will be modified (sort, label.x/y, rect).
+ * - The caller should sync the modifications to the other parts by
+ * `setLabelLayoutDirty` and `ensureLabelLayoutWithGeometry` if needed.
+ *
+ * @return adjusted
*/
-function applyTextMarginToLocalRect(label, localRect) {
- if (label.style.__marginType !== LabelMarginType.textMargin) {
- return localRect;
- }
- var textMargin = normalizeCssArray$1(retrieve2(label.style.margin, [0, 0]));
- localRect = localRect.clone();
- expandOrShrinkRect(localRect, textMargin, false, false);
- return localRect;
-}
-function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
+function shiftLayoutOnXY(list, xyDimIdx,
+// 0 for x, 1 for y
+minBound,
+// for x, leftBound; for y, topBound
+maxBound,
+// for x, rightBound; for y, bottomBound
+// If average the shifts on all labels and add them to 0
+// TODO: Not sure if should enable it.
+// Pros: The angle of lines will distribute more equally
+// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
+balanceShift) {
var len = list.length;
+ var xyDim = XY$1[xyDimIdx];
+ var sizeDim = WH$1[xyDimIdx];
if (len < 2) {
- return;
+ return false;
}
list.sort(function (a, b) {
return a.rect[xyDim] - b.rect[xyDim];
@@ -36276,6 +36382,7 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
var lastPos = 0;
var delta;
var adjusted = false;
+ // const shifts = [];
var totalShifts = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
@@ -36288,6 +36395,7 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
adjusted = true;
}
var shift = Math.max(-delta, 0);
+ // shifts.push(shift);
totalShifts += shift;
lastPos = rect[xyDim] + rect[sizeDim];
}
@@ -36400,33 +36508,29 @@ function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
return adjusted;
}
/**
- * Adjust labels on x direction to avoid overlap.
- */
-function shiftLayoutOnX(list, leftBound, rightBound,
-// If average the shifts on all labels and add them to 0
-// TODO: Not sure if should enable it.
-// Pros: The angle of lines will distribute more equally
-// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
-balanceShift) {
- return shiftLayout(list, 'x', 'width', leftBound, rightBound, balanceShift);
-}
-/**
- * Adjust labels on y direction to avoid overlap.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * @see `hideOverlap`
*/
-function shiftLayoutOnY(list, topBound, bottomBound,
-// If average the shifts on all labels and add them to 0
-balanceShift) {
- return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
+function restoreIgnore(labelList) {
+ for (var i = 0; i < labelList.length; i++) {
+ var labelItem = labelList[i];
+ var defaultAttr = labelItem.defaultAttr;
+ var labelLine = labelItem.labelLine;
+ labelItem.label.attr('ignore', defaultAttr.ignore);
+ labelLine && labelLine.attr('ignore', defaultAttr.labelGuideIgnore);
+ }
}
/**
- * [CAUTION]: the `label.ignore` in the input is not necessarily falsy.
- * this method checks intersection regardless of current `ignore`,
- * if no intersection, restore the `ignore` to `defaultAttr.ignore`.
- * And `labelList` will be modified.
- * Therefore, if some other overlap resolving strategy has ignored some elements,
- * do not input them to this method.
- * PENDING: review the diff between the requirements from LabelManager and AxisBuilder,
- * and uniform the behavior?
+ * [NOTICE - restore]:
+ * 'series:layoutlabels' may be triggered during some shortcut passes, such as zooming in series.graph/geo
+ * (`updateLabelLayout`), where the modified `Element` props should be restorable from `defaultAttr`.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * `restoreIgnore` can be called to perform the restore, if needed.
+ *
+ * [NOTICE - state]:
+ * Regarding Element's states, this method is only designed for the normal state.
+ * PENDING: although currently this method is effectively called in other states in `updateLabelLayout` case,
+ * the bad case is not noticeable in the zooming scenario.
*/
function hideOverlap(labelList) {
var displayedLabels = [];
@@ -36445,8 +36549,10 @@ function hideOverlap(labelList) {
el.ignore = true;
}
for (var i = 0; i < labelList.length; i++) {
- var labelItem = ensureLabelLayoutInfoComputed(labelList[i]);
- if (!labelItem || labelItem.label.ignore) {
+ var labelItem = ensureLabelLayoutWithGeometry(labelList[i]);
+ // The current `el.ignore` is involved, since some previous overlap
+ // resolving strategies may have set `el.ignore` to true.
+ if (labelItem.label.ignore) {
continue;
}
var label = labelItem.label;
@@ -36469,24 +36575,24 @@ function hideOverlap(labelList) {
hideEl(label);
labelLine && hideEl(labelLine);
} else {
- label.attr('ignore', labelItem.defaultAttr.ignore);
- labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
displayedLabels.push(labelItem);
}
}
}
/**
- * [NOTICE]:
- * - `label.ignore` is not considered - no requirement so far.
- * - `baseLayoutInfo` and `targetLayoutInfo` may be modified - obb may be created and saved.
- *
* Enable fast check for performance; use obb if inevitable.
* If `mtv` is used, `targetLayoutInfo` can be moved based on the values filled into `mtv`.
+ *
+ * This method is based only on the current `Element` states (regardless of other states).
+ * Typically this method (and the entire layout process) is performed in normal state.
*/
function labelIntersect(baseLayoutInfo, targetLayoutInfo, mtv, intersectOpt) {
if (!baseLayoutInfo || !targetLayoutInfo) {
return false;
}
+ if (baseLayoutInfo.label && baseLayoutInfo.label.ignore || targetLayoutInfo.label && targetLayoutInfo.label.ignore) {
+ return false;
+ }
// Fast rejection.
if (!baseLayoutInfo.rect.intersect(targetLayoutInfo.rect, mtv, intersectOpt)) {
return false;
@@ -36573,7 +36679,6 @@ var LabelManager = /** @class */function () {
}
var labelGuide = hostRect && host.getTextGuideLine();
this._labelList.push({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
labelLine: labelGuide,
seriesModel: seriesModel,
@@ -36730,18 +36835,24 @@ var LabelManager = /** @class */function () {
LabelManager.prototype.layout = function (api) {
var width = api.getWidth();
var height = api.getHeight();
- var labelList = createLabelLayoutList(this._labelList);
+ var labelList = [];
+ each(this._labelList, function (inputItem) {
+ if (!inputItem.defaultAttr.ignore) {
+ labelList.push(newLabelLayoutWithGeometry({}, inputItem));
+ }
+ });
var labelsNeedsAdjustOnX = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftX';
});
var labelsNeedsAdjustOnY = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftY';
});
- shiftLayoutOnX(labelsNeedsAdjustOnX, 0, width);
- shiftLayoutOnY(labelsNeedsAdjustOnY, 0, height);
+ shiftLayoutOnXY(labelsNeedsAdjustOnX, 0, 0, width);
+ shiftLayoutOnXY(labelsNeedsAdjustOnY, 1, 0, height);
var labelsNeedsHideOverlap = filter(labelList, function (item) {
return item.layoutOption.hideOverlap;
});
+ restoreIgnore(labelsNeedsHideOverlap);
hideOverlap(labelsNeedsHideOverlap);
};
/**
@@ -43467,7 +43578,7 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft,
list[i].label.x = farthestX;
}
}
- if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
+ if (shiftLayoutOnXY(list, 1, viewTop, viewTop + viewHeight)) {
recalculateX(list);
}
}
@@ -43518,7 +43629,7 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLef
}
}
layout.targetTextWidth = targetTextWidth;
- constrainTextWidth(layout, targetTextWidth);
+ constrainTextWidth(layout, targetTextWidth, false);
}
}
adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
@@ -43564,9 +43675,6 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLef
* which case, previous wrapping should be redo.
*/
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
- if (forceRecalculate === void 0) {
- forceRecalculate = false;
- }
if (layout.labelStyleWidth != null) {
// User-defined style.width has the highest priority.
return;
@@ -43581,7 +43689,6 @@ function constrainTextWidth(layout, availableWidth, forceRecalculate) {
// textRect.width already contains paddingH if bgColor is set
var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
if (availableWidth < oldOuterWidth || forceRecalculate) {
- var oldHeight = textRect.height;
if (overflow && overflow.match('break')) {
// Temporarily set background to be null to calculate
// the bounding box without background.
@@ -43613,13 +43720,18 @@ function constrainTextWidth(layout, availableWidth, forceRecalculate) {
: null;
label.setStyle('width', newWidth);
}
- var newRect = label.getBoundingRect();
- textRect.width = newRect.width;
- var margin = (label.style.margin || 0) + 2.1;
- textRect.height = newRect.height + margin;
- textRect.y -= (textRect.height - oldHeight) / 2;
+ computeLabelGlobalRect(textRect, label);
}
}
+function computeLabelGlobalRect(out, label) {
+ _tmpLabelGeometry.rect = out;
+ computeLabelGeometry(_tmpLabelGeometry, label, _computeLabelGeometryOpt);
+}
+var _computeLabelGeometryOpt = {
+ minMarginForce: [null, 0, null, 0],
+ marginDefault: [1, 0, 1, 0]
+};
+var _tmpLabelGeometry = {};
function isPositionCenter(sectorShape) {
// Not change x for center label
return sectorShape.position === 'center';
@@ -43751,12 +43863,8 @@ function pieLabelLayout(seriesModel) {
});
// Not sectorShape the inside label
if (!isLabelInside) {
- var textRect = label.getBoundingRect().clone();
- textRect.applyTransform(label.getComputedTransform());
- // Text has a default 1px stroke. Exclude this.
- var margin = (label.style.margin || 0) + 2.1;
- textRect.y -= margin / 2;
- textRect.height += margin;
+ var textRect = new BoundingRect(0, 0, 0, 0);
+ computeLabelGlobalRect(textRect, label);
labelLayoutList.push({
label: label,
labelLine: labelLine,
@@ -45471,17 +45579,15 @@ function registerAction$1(registers) {
}
var PI$5 = Math.PI;
-// This tune is also for backward compat, since nameMoveOverlap is set as default,
-// in compact layout (multiple charts in one canvas), name should be more close to the axis line and labels.
-var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2], [5, 3], [8, 3]];
-var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1], [0, 3], [0, 3]];
+var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]];
+var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]];
var getLabelInner = makeInner();
var getTickInner = makeInner();
/**
* A context shared by difference axisBuilder instances.
* For cross-axes overlap resolving.
*
- * Lifecycle constrait: should not over a pass of ec main process.
+ * Lifecycle constraint: should not over a pass of ec main process.
* If model is changed, the context must be disposed.
*
* @see AxisBuilderLocalContext
@@ -45511,14 +45617,14 @@ var AxisBuilderSharedContext = /** @class */function () {
* (such as `hideOverlap`, `fixMinMaxLabelShow`) and after transform calculating.
* 2. Can be called multiple times and should be idempotent.
*/
-function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutInfoList) {
+function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) {
var axis = axisModel.axis;
var record = shared.ensureRecord(axisModel);
var labelInfoList = [];
var stOccupiedRect;
var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation);
- each(labelLayoutInfoList, function (layout) {
- var layoutInfo = ensureLabelLayoutInfoComputed(layout);
+ each(labelLayoutList, function (layout) {
+ var layoutInfo = ensureLabelLayoutWithGeometry(layout);
if (!layoutInfo || layoutInfo.label.ignore) {
return;
}
@@ -45562,7 +45668,7 @@ var resolveAxisNameOverlapDefault = function (cfg, ctx, axisModel, nameLayoutInf
if (isNameLocationCenter(cfg.nameLocation)) {
var stOccupiedRect = thisRecord.stOccupiedRect;
if (stOccupiedRect) {
- moveIfOverlap(prepareIntersectionCheckInfo(stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
+ moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
}
} else {
moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec);
@@ -45576,8 +45682,7 @@ function moveIfOverlap(basedLayoutInfo, movableLayoutInfo, moveDirVec) {
bidirectional: false,
touchThreshold: 0.05
})) {
- Point.add(movableLayoutInfo.label, movableLayoutInfo.label, mtv);
- ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(movableLayoutInfo));
+ labelLayoutApplyTranslation(movableLayoutInfo, mtv);
}
}
function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) {
@@ -45856,7 +45961,7 @@ var builders = {
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
}
},
/**
@@ -45870,7 +45975,7 @@ var builders = {
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
}
var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel);
syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls);
@@ -45955,14 +46060,6 @@ var builders = {
fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
align: textStyleModel.get('align') || labelLayout.textAlign,
verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
- }, {
- defaultTextMargin: isNameLocationCenter(nameLocation)
- // Make axis name visually far from axis labels.
- // (but not too aggressive, consider multiple small charts)
- ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
- // top/button margin is set to `0` to inserted the xAxis name into the indention
- // above the axis labels to save space. (see example below.)
- : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
}),
z2: 1
});
@@ -45983,7 +46080,20 @@ var builders = {
transformGroup.add(textEl);
textEl.updateTransform();
local.nameEl = textEl;
- var nameLayout = sharedRecord.nameLayout = createSingleLayoutInfoComputed(textEl);
+ var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({
+ label: textEl,
+ priority: textEl.z2,
+ defaultAttr: {
+ ignore: textEl.ignore
+ },
+ marginDefault: isNameLocationCenter(nameLocation)
+ // Make axis name visually far from axis labels.
+ // (but not too aggressive, consider multiple small charts)
+ ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
+ // top/button margin is set to `0` to inserted the xAxis name into the indention
+ // above the axis labels to save space. (see example below.)
+ : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
+ });
sharedRecord.nameLocation = nameLocation;
group.add(textEl);
textEl.decomposeTransform();
@@ -45996,7 +46106,7 @@ var builders = {
}
}
};
-function axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
+function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
if (!axisLabelBuildResultExists(local)) {
buildAxisLabel(cfg, local, group, kind, axisModel, api);
}
@@ -46056,53 +46166,47 @@ function fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap) {
// Have not consider onBand yet, where tick els is more than label els.
// Assert no ignore in labels.
function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) {
- var outmostLabelLayout = labelLayoutList[outmostLabelIdx];
- var innerLabelLayout = labelLayoutList[innerLabelIdx];
+ var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]);
+ var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]);
if (!outmostLabelLayout || !innerLabelLayout) {
return;
}
- if (showMinMaxLabel === false) {
+ if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) {
ignoreEl(outmostLabelLayout.label);
+ return;
}
- // PENDING: Originally we thougth `optionHideOverlap === false` means do not hide anything,
+ if (innerLabelLayout.suggestIgnore) {
+ ignoreEl(innerLabelLayout.label);
+ return;
+ }
+ // PENDING: Originally we thought `optionHideOverlap === false` means do not hide anything,
// since currently the bounding rect of text might not accurate enough and might slightly bigger,
// which causes false positive. But `optionHideOverlap: null/undfined` is falsy and likely
// be treated as false.
- else {
- // In most fonts the glyph does not reach the boundary of the bouding rect.
- // This is needed to avoid too aggressive to hide two elements that meet at the edge
- // due to compact layout by the same bounding rect or OBB.
- var touchThreshold = 0.1;
- // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
- // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
- // should be conservative, since the space might be sufficient in this case.
- var ignoreMargin = !optionHideOverlap;
- if (ignoreMargin) {
- // Make a copy to apply `ignoreMargin`.
- outmostLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, outmostLabelLayout));
- innerLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, innerLabelLayout));
- }
- var anyIgnored = false;
- if (outmostLabelLayout.suggestIgnore) {
- ignoreEl(outmostLabelLayout.label);
- anyIgnored = true;
- }
- if (innerLabelLayout.suggestIgnore) {
+ // In most fonts the glyph does not reach the boundary of the bounding rect.
+ // This is needed to avoid too aggressive to hide two elements that meet at the edge
+ // due to compact layout by the same bounding rect or OBB.
+ var touchThreshold = 0.1;
+ // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
+ // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
+ // should be conservative, since the space might be sufficient in this case.
+ if (!optionHideOverlap) {
+ var marginForce = [0, 0, 0, 0];
+ // Make a copy to apply `ignoreMargin`.
+ outmostLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, outmostLabelLayout);
+ innerLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, innerLabelLayout);
+ }
+ if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, {
+ touchThreshold: touchThreshold
+ })) {
+ if (showMinMaxLabel) {
ignoreEl(innerLabelLayout.label);
- anyIgnored = true;
- }
- if (!anyIgnored && labelIntersect(ensureLabelLayoutInfoComputed(outmostLabelLayout), ensureLabelLayoutInfoComputed(innerLabelLayout), null, {
- touchThreshold: touchThreshold
- })) {
- if (showMinMaxLabel) {
- ignoreEl(innerLabelLayout.label);
- } else {
- ignoreEl(outmostLabelLayout.label);
- }
+ } else {
+ ignoreEl(outmostLabelLayout.label);
}
}
}
@@ -46115,7 +46219,7 @@ function fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap) {
deal(showMinLabel, 0, 1);
deal(showMaxLabel, labelsLen - 1, labelsLen - 2);
}
-// PENDING: is it necessary to display a tick while the cooresponding label is ignored?
+// PENDING: Is it necessary to display a tick while the corresponding label is ignored?
function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) {
if (cfg.showMinorTicks) {
// It probably unreaasonable to hide major ticks when show minor ticks.
@@ -46222,7 +46326,7 @@ function buildAxisMinorTicks(cfg, group, transformGroup, axisModel, tickDirectio
}
}
}
-// Return whether need to call `axisTickLabelLayout` again.
+// Return whether need to call `layOutAxisTickLabel` again.
function dealLastTickLabelResultReusable(local, group, extraParams) {
if (axisLabelBuildResultExists(local)) {
var axisLabelsCreationContext = local.axisLabelsCreationContext;
@@ -46358,7 +46462,6 @@ function buildAxisLabel(cfg, local, group, kind, axisModel, api) {
});
var labelLayoutList = map(labelEls, function (label) {
return {
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) // Make break labels be highest priority.
: label.z2,
@@ -46369,7 +46472,7 @@ function buildAxisLabel(cfg, local, group, kind, axisModel, api) {
});
axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx);
}
-// Indicate that `axisTickLabelLayout` has been called.
+// Indicate that `layOutAxisTickLabel` has been called.
function axisLabelBuildResultExists(local) {
return !!local.labelLayoutList;
}
@@ -46381,14 +46484,15 @@ function axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelsC
}
function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) {
var labelMargin = axisModel.get(['axisLabel', 'margin']);
- each(labelLayoutList, function (layoutInfo, idx) {
- if (!layoutInfo) {
+ each(labelLayoutList, function (layout, idx) {
+ var geometry = ensureLabelLayoutWithGeometry(layout);
+ if (!geometry) {
return;
}
- var labelEl = layoutInfo.label;
+ var labelEl = geometry.label;
var inner = getLabelInner(labelEl);
// See the comment in `suggestIgnore`.
- layoutInfo.suggestIgnore = labelEl.ignore;
+ geometry.suggestIgnore = labelEl.ignore;
// Currently no `ignore:true` is set in `buildAxisLabel`
// But `ignore:true` may be set subsequently for overlap handling, thus reset it here.
labelEl.ignore = false;
@@ -46402,9 +46506,8 @@ function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transfor
_tmpLayoutEl.decomposeTransform();
copyTransform(labelEl, _tmpLayoutEl);
labelEl.markRedraw();
- if (layoutInfo.kind === LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- rollbackToLabelLayoutInfoRaw(layoutInfo);
- }
+ setLabelLayoutDirty(geometry, true);
+ ensureLabelLayoutWithGeometry(geometry);
});
}
var _tmpLayoutEl = new Rect();
@@ -46436,7 +46539,7 @@ function adjustBreakLabels(axisModel, axisRotation, labelLayoutList) {
var moveOverlap = axisModel.get(['breakLabelLayout', 'moveOverlap'], true);
if (moveOverlap === true || moveOverlap === 'auto') {
each(breakLabelIndexPairs, function (idxPair) {
- getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[0]]), ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[1]])]);
+ getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[0]]), ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[1]])]);
});
}
}
@@ -47132,7 +47235,7 @@ function layOutGridByOuterBounds(outerBoundsRect, outerBoundsContain, outerBound
// Assume `updateAllAxisExtentTransByGridRect` has been performed once before this call.
// [NOTE]:
// - The bounding rect of the axis elements might be sensitve to variations in `axis.extent` due to strategies
- // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutInfoBase['suggestIgnore']`.
+ // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutBase['suggestIgnore']`.
// - The final `gridRect` might be slightly smaller than the ideally expected result if labels are giant and
// get hidden due to overlapping. More iterations could improve precision, but not performant. We consider
// the current result acceptable, since no alignment among charts can be guaranteed when using this feature.
@@ -47998,79 +48101,55 @@ function fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius) {
function fixJitterAvoidOverlaps(fixedAxis, fixedCoord, floatCoord, radius, jitter, margin) {
var store = inner$6(fixedAxis);
if (!store.items) {
- store.items = {
- fixedCoord: -1,
- floatCoord: -1,
- r: -1,
- next: null,
- prev: null
- };
- store.items.next = store.items;
- store.items.prev = store.items;
+ store.items = [];
}
var items = store.items;
+ // Try both positive and negative directions, choose the one with smaller movement
var overlapA = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, 1);
var overlapB = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, -1);
- var overlapResult = Math.abs(overlapA.resultCoord - floatCoord) < Math.abs(overlapB.resultCoord - floatCoord) ? overlapA : overlapB;
- var minFloat = overlapResult.resultCoord;
+ var minFloat = Math.abs(overlapA - floatCoord) < Math.abs(overlapB - floatCoord) ? overlapA : overlapB;
// Clamp only category axis
var bandWidth = fixedAxis.scale.type === 'ordinal' ? fixedAxis.getBandWidth() : null;
var distance = Math.abs(minFloat - floatCoord);
if (distance > jitter / 2 || bandWidth && distance > bandWidth / 2 - radius) {
// If the new item is moved too far, then give up.
// Fall back to random jitter.
- minFloat = fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
- }
- // Insert to store
- var insertBy = overlapResult.insertBy;
- var resultDirection = overlapResult.direction;
- var pointer1 = resultDirection > 0 ? 'next' : 'prev';
- var pointer2 = resultDirection > 0 ? 'prev' : 'next';
- var newItem = {
+ return fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
+ }
+ // Add new point to array
+ items.push({
fixedCoord: fixedCoord,
- floatCoord: overlapResult.resultCoord,
- r: radius,
- next: null,
- prev: null
- };
- newItem[pointer1] = insertBy[pointer1];
- newItem[pointer2] = insertBy;
- insertBy[pointer1][pointer2] = newItem;
- insertBy[pointer1] = newItem;
+ floatCoord: minFloat,
+ r: radius
+ });
return minFloat;
}
function placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, direction) {
- // Check for overlap with previous items.
var y = floatCoord;
- var pointer1 = direction > 0 ? 'next' : 'prev';
- var insertBy = items;
- var item = items[pointer1];
- while (item !== items) {
+ // Check all existing items for overlap and find the maximum adjustment needed
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
var dx = fixedCoord - item.fixedCoord;
var dy = y - item.floatCoord;
var d2 = dx * dx + dy * dy;
var r = radius + item.r + margin;
if (d2 < r * r) {
- // Overlap. Try to move the new item along otherCoord direction.
- y = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
- insertBy = item;
- if (Math.abs(y - floatCoord) > jitter / 2) {
- // If the new item is moved too far, then give up.
- // Fall back to random jitter.
- return {
- resultCoord: Number.MAX_VALUE,
- insertBy: insertBy,
- direction: direction
- };
+ // Has overlap, calculate required adjustment
+ var requiredY = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
+ // Check if this adjustment would move too far
+ if (Math.abs(requiredY - floatCoord) > jitter / 2) {
+ return Number.MAX_VALUE; // Give up
+ }
+ // Update y only when it's larger to the center
+ if (direction === 1 && requiredY > y || direction === -1 && requiredY < y) {
+ y = requiredY;
+ // Loop from the start again
+ i = -1; // Reset index to recheck all items
+ continue; // Recalculate with the new y position
}
}
- item = item[pointer1];
}
- return {
- resultCoord: y,
- insertBy: insertBy,
- direction: direction
- };
+ return y;
}
function jitterLayout(ecModel) {
@@ -48307,14 +48386,21 @@ var RadarView = /** @class */function (_super) {
var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty();
// Won't be ignore if normal state is not ignore.
polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;
+ var lineStyle = itemModel.getModel([stateName, 'lineStyle']).getLineStyle();
+ polyline.ensureState(stateName).style = lineStyle;
+ var areaStyle = stateModel.getAreaStyle();
+ polygon.ensureState(stateName).style = areaStyle;
+ var itemStateStyle = itemModel.getModel([stateName, 'itemStyle']).getItemStyle();
+ symbolGroup.eachChild(function (symbolPath) {
+ symbolPath.ensureState(stateName).style = clone(itemStateStyle);
+ });
});
- polygon.useStyle(defaults(areaStyleModel.getAreaStyle(), {
+ polygon.useStyle(defaults(itemModel.getModel('areaStyle').getAreaStyle(), {
fill: color,
opacity: 0.7,
decal: itemStyle.decal
}));
var emphasisModel = itemModel.getModel('emphasis');
- var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();
symbolGroup.eachChild(function (symbolPath) {
if (symbolPath instanceof ZRImage) {
var pathStyle = symbolPath.style;
@@ -48331,8 +48417,6 @@ var RadarView = /** @class */function (_super) {
symbolPath.setColor(color);
symbolPath.style.strokeNoScale = true;
}
- var pathEmphasisState = symbolPath.ensureState('emphasis');
- pathEmphasisState.style = clone(itemHoverStyle);
var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
@@ -69450,7 +69534,7 @@ function isEC4CompatibleStyle(style, elType, hasOwnTextContentOption, hasOwnText
// `legacy: false`, force do not compat.
// `legacy` not set: auto detect whether legacy.
// But in this case we do not compat (difficult to detect and rare case):
- // Becuse custom series and graphic component support "merge", users may firstly
+ // Because custom series and graphic component support "merge", users may firstly
// only set `textStrokeWidth` style or secondly only set `text`.
return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
// Difficult to detect whether legacy for a "text" el.
@@ -74858,7 +74942,7 @@ function resetXYLocatorRange(out) {
return rg;
}
/**
- * If illegal or out of boundary, set NaN to `locOut`. (See `isLocatorRangeInvalidOnDim`)
+ * If illegal or out of boundary, set NaN to `locOut`. See `isXYLocatorRangeInvalidOnDim`.
* x dimension and y dimension are calculated separately.
*/
function parseCoordRangeOption(locOut,
@@ -74877,14 +74961,18 @@ function parseCoordRangeOptionOnOneDim(locDimOut, reasonOut, clamp, data, dims,
var coordValArr = isArray(dataOnDim) ? dataOnDim : [dataOnDim];
var len = coordValArr.length;
var hasClamp = !!clamp;
- if (len === 1 || len === 2) {
+ if (len >= 1) {
parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 0);
if (len > 1) {
- parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 1);
+ // Users may intuitively input the coords like `[[x1, x2, x3], ...]`;
+ // consider the range as `[x1, x3]` in this case.
+ parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, len - 1);
}
} else {
- if (reasonOut) {
- reasonOut.push("Can only contain 1 or 2 coords, rather than " + len + ".");
+ if ("development" !== 'production') {
+ if (reasonOut) {
+ reasonOut.push('Should be like [["x1", "x2"], ["y1", "y2"]], or ["x1", "y1"], rather than empty.');
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
}
@@ -74916,8 +75004,10 @@ function parseCoordRangeOptionOnOneDim(locDimOut, reasonOut, clamp, data, dims,
function parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, partIdx) {
var layout = coordDataToAllCellLevelLayout(coordValArr[partIdx], dims, dimIdx);
if (!layout) {
- if (!hasClamp && reasonOut) {
- reasonOut.push("Can not find layout by coord[" + dimIdx + "][" + partIdx + "].");
+ if ("development" !== 'production') {
+ if (!hasClamp && reasonOut) {
+ reasonOut.push("Can not find cell by coord[" + dimIdx + "][" + partIdx + "].");
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
return;
@@ -75407,7 +75497,7 @@ var MatrixBodyCorner = /** @class */function () {
if ("development" !== 'production') {
reasonArr = [];
}
- parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, MatrixClampOption[self._kind]);
+ parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, option.coordClamp ? MatrixClampOption[self._kind] : MatrixClampOption.none);
if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) || isXYLocatorRangeInvalidOnDim(locatorRange, 1)) {
if ("development" !== 'production') {
error("Can not determine cells by option matrix." + self._kind + ".data[" + idx + "]: " + ("" + reasonArr.join(' ')));
@@ -75522,13 +75612,13 @@ var MatrixBodyCorner = /** @class */function () {
* @param locatorRange Must be the return of `parseCoordRangeOption`.
*/
MatrixBodyCorner.prototype.expandRangeByCellMerge = function (locatorRange) {
- if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) && isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
+ if (!isXYLocatorRangeInvalidOnDim(locatorRange, 0) && !isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
// If it locates to a single cell, use this quick path to avoid travelling.
// It is based on the fact that any cell is not contained by more than one cell merging rect.
_tmpERBCMLocator[0] = locatorRange[0][0];
_tmpERBCMLocator[1] = locatorRange[1][0];
var cell = this.getCell(_tmpERBCMLocator);
- var inSpanOf = cell.inSpanOf;
+ var inSpanOf = cell && cell.inSpanOf;
if (inSpanOf) {
cloneXYLocatorRange(locatorRange, inSpanOf.locatorRange);
return;
@@ -75666,7 +75756,7 @@ var MatrixView = /** @class */function (_super) {
_this.type = MatrixView.type;
return _this;
}
- MatrixView.prototype.render = function (matrixModel) {
+ MatrixView.prototype.render = function (matrixModel, ecModel) {
this.group.removeAll();
var group = this.group;
var coordSys = matrixModel.coordinateSystem;
@@ -75677,8 +75767,8 @@ var MatrixView = /** @class */function (_super) {
var yDim = yDimModel.dim;
// PENDING:
// reuse the existing text and rect elements for performance?
- renderDimensionCells(group, matrixModel);
- createBodyAndCorner(group, matrixModel, xDim, yDim);
+ renderDimensionCells(group, matrixModel, ecModel);
+ createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel);
var borderZ2Option = matrixModel.getShallow('borderZ2', true);
var outerBorderZ2 = retrieve2(borderZ2Option, Z2_OUTER_BORDER);
var dividerLineZ2 = outerBorderZ2 - 1;
@@ -75722,7 +75812,7 @@ var MatrixView = /** @class */function (_super) {
MatrixView.type = 'matrix';
return MatrixView;
}(ComponentView);
-function renderDimensionCells(group, matrixModel) {
+function renderDimensionCells(group, matrixModel, ecModel) {
renderOnDimension(0);
renderOnDimension(1);
function renderOnDimension(dimIdx) {
@@ -75740,11 +75830,11 @@ function renderDimensionCells(group, matrixModel) {
var shape = {};
BoundingRect.copy(shape, dimCell.rect);
set(xyLocator, dimCell.id.x, dimCell.id.y);
- createMatrixCell(xyLocator, matrixModel, group, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
}
}
}
-function createBodyAndCorner(group, matrixModel, xDim, yDim) {
+function createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel) {
createBodyOrCornerCells('body', matrixModel.getBody(), xDim, yDim);
if (xDim.shouldShow() && yDim.shouldShow()) {
createBodyOrCornerCells('corner', matrixModel.getCorner(), yDim, xDim);
@@ -75778,19 +75868,19 @@ function createBodyAndCorner(group, matrixModel, xDim, yDim) {
yLayout.dim.getLayout(shape, 1, xyLocator[1]);
}
var bodyCornerCellOption = bodyCornerCell ? bodyCornerCell.option : null;
- createMatrixCell(xyLocator, matrixModel, group, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
}
}
} // End of createBodyOrCornerCells
}
-function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
+function createMatrixCell(xyLocator, matrixModel, group, ecModel, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
var _a;
// Do not use getModel for handy performance optimization.
_tmpCellItemStyleModel.option = cellOption ? cellOption.itemStyle : null;
_tmpCellItemStyleModel.parentModel = parentItemStyleModel;
_tmpCellModel.option = cellOption;
_tmpCellModel.parentModel = parentCellModel;
- // Use different z2 becuase special border may be defined in itemStyle.
+ // Use different z2 because special border may be defined in itemStyle.
var z2 = retrieve2(_tmpCellModel.getShallow('z2'), cellOption && cellOption.itemStyle ? zrCellDefault.special : zrCellDefault.normal);
var tooltipOptionShow = tooltipOption && tooltipOption.show;
var cellRect = createMatrixRect(shape, _tmpCellItemStyleModel.getItemStyle(), z2);
@@ -75804,6 +75894,8 @@ function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemS
var text = textValue + '';
_tmpCellLabelModel.option = cellOption ? cellOption.label : null;
_tmpCellLabelModel.parentModel = parentLabelModel;
+ // This is to accept `option.textStyle` as the default.
+ _tmpCellLabelModel.ecModel = ecModel;
setLabelStyle(cellRect,
// Currently do not support other states (`emphasis`, `select`, `blur`)
{
@@ -75864,6 +75956,9 @@ function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemS
!cellRect.style || cellRect.style.fill === 'none' || !cellRect.style.fill;
}
cellRect.silent = rectSilent;
+ clearTmpModel(_tmpCellModel);
+ clearTmpModel(_tmpCellItemStyleModel);
+ clearTmpModel(_tmpCellLabelModel);
}
var _tmpCellModel = new Model();
var _tmpCellItemStyleModel = new Model();
@@ -79928,9 +80023,11 @@ var TooltipHTMLContent = /** @class */function () {
clearTimeout(this._longHideTimeout);
var zr = this._zr;
transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
- if (this.el) {
- var parentNode = this.el.parentNode;
- parentNode && parentNode.removeChild(this.el);
+ var el = this.el;
+ if (el) {
+ el.onmouseenter = el.onmousemove = el.onmouseleave = null;
+ var parentNode = el.parentNode;
+ parentNode && parentNode.removeChild(el);
}
this.el = this._container = null;
};
@@ -82867,6 +82964,7 @@ var MarkerModel = /** @class */function (_super) {
* If marker model is created by self from series
*/
_this.createdBySelf = false;
+ _this.preventAutoZ = true;
return _this;
}
/**
@@ -83190,6 +83288,7 @@ var MarkerView = /** @class */function (_super) {
markerGroupMap.each(function (item) {
!inner$j(item).keep && _this.group.remove(item.group);
});
+ updateZ$2(ecModel, markerGroupMap, this.type);
};
MarkerView.prototype.markKeep = function (drawGroup) {
inner$j(drawGroup).keep = true;
@@ -83211,6 +83310,18 @@ var MarkerView = /** @class */function (_super) {
MarkerView.type = 'marker';
return MarkerView;
}(ComponentView);
+function updateZ$2(ecModel, markerGroupMap, type) {
+ ecModel.eachSeries(function (seriesModel) {
+ var markerModel = MarkerModel.getMarkerModelFromSeries(seriesModel, type);
+ var markerDraw = markerGroupMap.get(seriesModel.id);
+ if (markerModel && markerDraw && markerDraw.group) {
+ var _a = retrieveZInfo(markerModel),
+ z = _a.z,
+ zlevel = _a.zlevel;
+ traverseUpdateZ(markerDraw.group, z, zlevel);
+ }
+ });
+}
function updateMarkerLayout(mpData, seriesModel, api) {
var coordSys = seriesModel.coordinateSystem;
@@ -87217,9 +87328,8 @@ var ContinuousModel = /** @class */function (_super) {
ContinuousModel.prototype.getValueState = function (value) {
var range = this.option.range;
var dataExtent = this.getExtent();
- // When range[0] === dataExtent[0], any value larger than dataExtent[0] maps to 'inRange'.
- // range[1] is processed likewise.
- return (range[0] <= dataExtent[0] || range[0] <= value) && (range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
+ var unboundedRange = retrieve2(this.option.unboundedRange, true);
+ return (unboundedRange && range[0] <= dataExtent[0] || range[0] <= value) && (unboundedRange && range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
};
ContinuousModel.prototype.findTargetDataIndices = function (range) {
var result = [];
@@ -89042,7 +89152,7 @@ var ThumbnailView = /** @class */function (_super) {
}));
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(thumbnailModel, this);
+ updateZ$3(thumbnailModel, this);
};
/**
* Can be called asynchronously directly.
@@ -89053,7 +89163,7 @@ var ThumbnailView = /** @class */function (_super) {
if (this._isEnabled()) {
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(this._model, this);
+ updateZ$3(this._model, this);
}
};
ThumbnailView.prototype._dealRenderContent = function () {
@@ -89208,7 +89318,7 @@ function makeRoamPayload(baseMapProvider, params) {
extend(payload, params);
return payload;
}
-function updateZ$2(thumbnailModel, thumbnailView) {
+function updateZ$3(thumbnailModel, thumbnailView) {
var zInfo = retrieveZInfo(thumbnailModel);
traverseUpdateZ(thumbnailView.group, zInfo.z, zInfo.zlevel);
}
@@ -92603,7 +92713,7 @@ function adjustBreakLabelPair(axisInverse, axisRotation, layoutPair) {
return layout.transform ? mul$1(create$1(), axisStTrans, layout.transform) : axisStTrans;
});
function isParallelToAxis(whIdx) {
- // Assert label[0] and lable[1] has the same rotation, so only use [0].
+ // Assert label[0] and label[1] has the same rotation, so only use [0].
var localRect = layoutPair[0].localRect;
var labelVec0 = new Point(localRect[WH$1[whIdx]] * labelPairStTrans[0][0], localRect[WH$1[whIdx]] * labelPairStTrans[0][1]);
return Math.abs(labelVec0.y) < 1e-5;
@@ -92644,8 +92754,12 @@ function adjustBreakLabelPair(axisInverse, axisRotation, layoutPair) {
var uval = uvalMax < 0 ? uvalMax : uvalMin > 0 ? uvalMin : 0;
k = (qval - uval) / mtvSt.x;
}
- Point.scaleAndAdd(layoutPair[0].label, layoutPair[0].label, mtv, -k);
- Point.scaleAndAdd(layoutPair[1].label, layoutPair[1].label, mtv, 1 - k);
+ var delta0 = new Point();
+ var delta1 = new Point();
+ Point.scale(delta0, mtv, -k);
+ Point.scale(delta1, mtv, 1 - k);
+ labelLayoutApplyTranslation(layoutPair[0], delta0);
+ labelLayoutApplyTranslation(layoutPair[1], delta1);
}
function updateModelAxisBreak(model, payload) {
var result = {
diff --git a/dist/echarts.esm.mjs.map b/dist/echarts.esm.mjs.map
index 57819bddd..fcd8c8e1b 100644
--- a/dist/echarts.esm.mjs.map
+++ b/dist/echarts.esm.mjs.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.esm.mjs","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core [...]
\ No newline at end of file
+{"version":3,"file":"echarts.esm.mjs","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core [...]
\ No newline at end of file
diff --git a/dist/echarts.js b/dist/echarts.js
index c14f36a43..d1714191e 100644
--- a/dist/echarts.js
+++ b/dist/echarts.js
@@ -7564,7 +7564,7 @@
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
- var version = '6.0.0-rc.1';
+ var version = '6.0.0';
var zrender = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -7678,6 +7678,8 @@
}
function round(x, precision, returnStr) {
if (precision == null) {
+ // FIXME: the default precision should not be provided, since there is no universally adaptable
+ // precision. The caller need to input a precision according to the scenarios.
precision = 10;
}
// Avoid range error
@@ -8706,7 +8708,7 @@
var others = {};
var mainTypeSpecified = false;
each(finder, function (value, key) {
- // Exclude 'dataIndex' and other illgal keys.
+ // Exclude 'dataIndex' and other illegal keys.
if (key === 'dataIndex' || key === 'dataIndexInside') {
others[key] = value;
return;
@@ -8904,6 +8906,10 @@
};
return ListIterator;
}();
+ function clearTmpModel(model) {
+ // Clear to avoid memory leak.
+ model.option = model.parentModel = model.ecModel = null;
+ }
var TYPE_DELIMITER = '.';
var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';
@@ -9348,8 +9354,8 @@
}
return i;
}
- function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
- text != null && (text += '');
+ function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
+ var text = formatText(rawText);
var overflow = style.overflow;
var padding = style.padding;
var paddingH = padding ? padding[1] + padding[3] : 0;
@@ -9449,9 +9455,9 @@
}
return RichTextContentBlock;
}());
- function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
+ function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
var contentBlock = new RichTextContentBlock();
- text != null && (text += '');
+ var text = formatText(rawText);
if (!text) {
return contentBlock;
}
@@ -9777,6 +9783,33 @@
}
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
+ function formatText(text) {
+ return text != null ? (text += '') : (text = '');
+ }
+ function tSpanCreateBoundingRect(style) {
+ var text = formatText(style.text);
+ var font = style.font;
+ var contentWidth = measureWidth(ensureFontMeasureInfo(font), text);
+ var contentHeight = getLineHeight(font);
+ return tSpanCreateBoundingRect2(style, contentWidth, contentHeight, null);
+ }
+ function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
+ var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY$1(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
+ var lineWidth = forceLineWidth != null
+ ? forceLineWidth
+ : (tSpanHasStroke(style) ? style.lineWidth : 0);
+ if (lineWidth > 0) {
+ rect.x -= lineWidth / 2;
+ rect.y -= lineWidth / 2;
+ rect.width += lineWidth;
+ rect.height += lineWidth;
+ }
+ return rect;
+ }
+ function tSpanHasStroke(style) {
+ var stroke = style.stroke;
+ return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ }
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
@@ -11747,9 +11780,7 @@
return _super !== null && _super.apply(this, arguments) || this;
}
TSpan.prototype.hasStroke = function () {
- var style = this.style;
- var stroke = style.stroke;
- return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ return tSpanHasStroke(this.style);
};
TSpan.prototype.hasFill = function () {
var style = this.style;
@@ -11763,21 +11794,8 @@
this._rect = rect;
};
TSpan.prototype.getBoundingRect = function () {
- var style = this.style;
if (!this._rect) {
- var text = style.text;
- text != null ? (text += '') : (text = '');
- var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
- rect.x += style.x || 0;
- rect.y += style.y || 0;
- if (this.hasStroke()) {
- var w = style.lineWidth;
- rect.x -= w / 2;
- rect.y -= w / 2;
- rect.width += w;
- rect.height += w;
- }
- this._rect = rect;
+ this._rect = tSpanCreateBoundingRect(this.style);
}
return this._rect;
};
@@ -12235,7 +12253,6 @@
var bgColorDrawn = !!(style.backgroundColor);
var outerHeight = contentBlock.outerHeight;
var outerWidth = contentBlock.outerWidth;
- var contentWidth = contentBlock.contentWidth;
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
this.isTruncated = !!contentBlock.isTruncated;
@@ -12257,6 +12274,7 @@
}
}
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var useDefaultFill = false;
var textFill = getFill('fill' in style
? style.fill
@@ -12265,12 +12283,9 @@
? style.stroke
: (!bgColorDrawn
&& (!defaultStyle.autoStroke || useDefaultFill))
- ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = style.textShadowBlur > 0;
- var fixedBoundingRect = style.width != null
- && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
- var calculatedLineHeight = contentBlock.calculatedLineHeight;
for (var i = 0; i < textLines.length; i++) {
var el = this._getOrCreateChild(TSpan);
var subElStyle = el.createStyle();
@@ -12300,9 +12315,7 @@
subElStyle.font = textFont;
setSeparateFont(subElStyle, style);
textY += lineHeight;
- if (fixedBoundingRect) {
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
- }
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, contentBlock.contentWidth, contentBlock.calculatedLineHeight, usingDefaultStroke ? 0 : null));
}
};
ZRText.prototype._updateRichTexts = function () {
@@ -12399,6 +12412,7 @@
var defaultStyle = this._defaultStyle;
var useDefaultFill = false;
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill
: 'fill' in style ? style.fill
: (useDefaultFill = true, defaultStyle.fill));
@@ -12406,7 +12420,7 @@
: 'stroke' in style ? style.stroke
: (!bgColorDrawn
&& !parentBgColorDrawn
- && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = tokenStyle.textShadowBlur > 0
|| style.textShadowBlur > 0;
@@ -12433,9 +12447,7 @@
if (textFill) {
subElStyle.fill = textFill;
}
- var textWidth = token.contentWidth;
- var textHeight = token.contentHeight;
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, token.contentWidth, token.contentHeight, usingDefaultStroke ? 0 : null));
};
ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
var textBackgroundColor = style.backgroundColor;
@@ -12591,25 +12603,6 @@
|| (style.borderWidth && style.borderColor));
}
- var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
- var SOURCE_FORMAT_ORIGINAL = 'original';
- var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
- var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
- var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
- var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
- var SOURCE_FORMAT_UNKNOWN = 'unknown';
- var SERIES_LAYOUT_BY_COLUMN = 'column';
- var SERIES_LAYOUT_BY_ROW = 'row';
- /**
- * PENDING: Temporary impl. unify them?
- * @see {LabelCommonOption['textMargin']}
- * @see {LabelCommonOption['minMargin']}
- */
- var LabelMarginType = {
- minMargin: 0,
- textMargin: 1
- };
-
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
if (el) {
@@ -15341,7 +15334,7 @@
* `false` - expand if `delta[i]` is positive, commmonly used in `margin` case. (default)
* @param noNegative
* `true` - negative `delta[i]` will be clampped to 0.
- * `false` - No clamp to `delta`. (defualt).
+ * `false` - No clamp to `delta`. (default).
* @return The input `rect`.
*/
function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize // by default [0, 0].
@@ -15351,6 +15344,9 @@
} else if (isNumber(delta)) {
_tmpExpandRectDelta[0] = _tmpExpandRectDelta[1] = _tmpExpandRectDelta[2] = _tmpExpandRectDelta[3] = delta;
} else {
+ if ("development" !== 'production') {
+ assert(delta.length === 4);
+ }
_tmpExpandRectDelta[0] = delta[0];
_tmpExpandRectDelta[1] = delta[1];
_tmpExpandRectDelta[2] = delta[2];
@@ -15451,6 +15447,27 @@
return !transform || mathAbs$1(transform[1]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[2]) < AXIS_ALIGN_EPSILON || mathAbs$1(transform[0]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[3]) < AXIS_ALIGN_EPSILON;
}
var AXIS_ALIGN_EPSILON = 1e-5;
+ /**
+ * Create or copy to the existing bounding rect to avoid modifying `source`.
+ *
+ * @usage
+ * out.rect = ensureCopyRect(out.rect, sourceRect);
+ */
+ function ensureCopyRect(target, source) {
+ return target ? BoundingRect.copy(target, source) : source.clone();
+ }
+ /**
+ * Create or copy to the existing transform to avoid modifying `source`.
+ *
+ * [CAUTION]: transform is `NullUndefined` if no transform, following convention of zrender,
+ * and enable to bypass some unnecessary calculation, since in most cases there is no transform.
+ *
+ * @usage
+ * out.transform = ensureCopyTransform(out.transform, sourceTransform);
+ */
+ function ensureCopyTransform(target, source) {
+ return source ? copy$1(target || create$1(), source) : undefined;
+ }
function retrieveZInfo(model) {
return {
z: model.get('z') || 0,
@@ -15504,9 +15521,9 @@
doUpdateZ(el, z, zlevel, -Infinity);
}
function doUpdateZ(el, z, zlevel,
- // FIXME: ideally all the labels shold be above all the glyphs by default,
+ // FIXME: Ideally all the labels should be above all the glyphs by default,
// e.g. in graph, edge labels should be above node elements.
- // currenly impl does not garaentee that.
+ // Currently impl does not guarantee that.
maxZ2) {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
@@ -15591,6 +15608,8 @@
setTooltipConfig: setTooltipConfig,
traverseElements: traverseElements,
isBoundingRectAxisAligned: isBoundingRectAxisAligned,
+ ensureCopyRect: ensureCopyRect,
+ ensureCopyTransform: ensureCopyTransform,
retrieveZInfo: retrieveZInfo,
calcZ2Range: calcZ2Range,
traverseUpdateZ: traverseUpdateZ,
@@ -15850,23 +15869,26 @@
if (overflow) {
textStyle.overflow = overflow;
}
- var minMargin = textStyleModel.get('minMargin');
- if (minMargin != null) {
- textStyle.margin = minMargin;
- textStyle.__marginType = LabelMarginType.minMargin;
- }
- var textMargin = textStyleModel.get('textMargin');
- if (textMargin != null) {
- textStyle.margin = clone(textMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- } else if (opt.defaultTextMargin != null) {
- textStyle.margin = clone(opt.defaultTextMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- }
var lineOverflow = textStyleModel.get('lineOverflow');
if (lineOverflow) {
textStyle.lineOverflow = lineOverflow;
}
+ var labelTextStyle = textStyle;
+ // `minMargin` has a higher precedence than `textMargin`, because `textMargin` is allowed
+ // to be set in `defaultOption`.
+ var minMargin = textStyleModel.get('minMargin');
+ if (minMargin != null) {
+ // `minMargin` only support number value.
+ minMargin = !isNumber(minMargin) ? 0 : minMargin / 2;
+ labelTextStyle.margin = [minMargin, minMargin, minMargin, minMargin];
+ labelTextStyle.__marginType = LabelMarginType.minMargin;
+ } else {
+ var textMargin = textStyleModel.get('textMargin');
+ if (textMargin != null) {
+ labelTextStyle.margin = normalizeCssArray(textMargin);
+ labelTextStyle.__marginType = LabelMarginType.textMargin;
+ }
+ }
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, null, null, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
@@ -16084,6 +16106,15 @@
percent: 1
}, animatableModel, dataIndex, null, during);
}
+ /**
+ * PENDING: Temporary impl. unify them?
+ * @see {LabelCommonOption['textMargin']}
+ * @see {LabelCommonOption['minMargin']}
+ */
+ var LabelMarginType = {
+ minMargin: 1,
+ textMargin: 2
+ };
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
@@ -17768,7 +17799,7 @@
// Commonly used in option `legend.padding`, `timeline.padding`, `title.padding`,
// `visualMap.padding`, ...
// [NOTICE]:
- // It's named `margin`, becuase it's the space that outside the bounding rect. But from
+ // It's named `margin`, because it's the space that outside the bounding rect. But from
// the perspective of the the caller, it's commonly used as the `padding` of a component,
// because conventionally background color covers this space.
// [BEHAVIOR]:
@@ -18431,7 +18462,7 @@
tokens.darkColor[key] = modifyHSL(hex, null, function (s) {
return s * 0.9;
}, function (l) {
- return 1 - l;
+ return 1 - Math.pow(l, 1.5);
});
}
}
@@ -18538,6 +18569,16 @@
useUTC: false
};
+ var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
+ var SOURCE_FORMAT_ORIGINAL = 'original';
+ var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
+ var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
+ var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
+ var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
+ var SOURCE_FORMAT_UNKNOWN = 'unknown';
+ var SERIES_LAYOUT_BY_COLUMN = 'column';
+ var SERIES_LAYOUT_BY_ROW = 'row';
+
// The result of `guessOrdinal`.
var BE_ORDINAL = {
Must: 1,
@@ -25505,7 +25546,10 @@
color: color$2.secondary
},
itemStyle: {
- borderColor: color$2.neutral20
+ borderColor: color$2.borderTint
+ },
+ dividerLineStyle: {
+ color: color$2.border
}
};
var theme = {
@@ -25595,9 +25639,6 @@
textStyle: {
color: color$2.secondary
},
- inRange: {
- color: [color$2.neutral10, color$2.theme[0]]
- },
handleStyle: {
borderColor: color$2.neutral30
}
@@ -25633,10 +25674,12 @@
x: matrixAxis,
y: matrixAxis,
backgroundColor: {
- borderColor: '#817f91'
+ borderColor: color$2.axisLine
},
- innerBackgroundStyle: {
- borderColor: '#484753'
+ body: {
+ itemStyle: {
+ borderColor: color$2.borderTint
+ }
}
},
timeAxis: axisCommon(),
@@ -27568,9 +27611,9 @@
return customRenderers[type];
}
- var version$1 = '6.0.0-beta.1';
+ var version$1 = '6.0.0';
var dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
@@ -28735,15 +28778,16 @@
coordSysMgr.update(ecModel, api);
clearColorPalette(ecModel);
scheduler.performVisualTasks(ecModel, payload);
- render(this, ecModel, api, payload, updateParams);
- // Set background
+ // Set background and dark mode before rendering, because they affect auto-color-determination
+ // in zrender Text, and consequently affect the bounding rect if stroke is added.
var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
- var darkMode = ecModel.get('darkMode');
zr.setBackgroundColor(backgroundColor);
// Force set dark mode.
+ var darkMode = ecModel.get('darkMode');
if (darkMode != null && darkMode !== 'auto') {
zr.setDarkMode(darkMode);
}
+ render(this, ecModel, api, payload, updateParams);
lifecycle.trigger('afterupdate', ecModel, api);
},
updateTransform: function (payload) {
@@ -32730,8 +32774,9 @@
var minorTicksGroup = [];
var interval = nextTick.value - prevTick.value;
var minorInterval = interval / splitNumber;
+ var minorIntervalPrecision = getIntervalPrecision(minorInterval);
while (count < splitNumber - 1) {
- var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
+ var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval, minorIntervalPrecision);
// For the first and last interval. The count may be less than splitNumber.
if (minorTick > extent[0] && minorTick < extent[1]) {
minorTicksGroup.push(minorTick);
@@ -32770,6 +32815,12 @@
return addCommas(dataNum);
};
/**
+ * FIXME: refactor - disallow override, use composition instead.
+ *
+ * The override of `calcNiceTicks` should ensure these members are provided:
+ * this._intervalPrecision
+ * this._interval
+ *
* @param splitNumber By default `5`.
*/
IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
@@ -32825,11 +32876,12 @@
extent = this._extent.slice();
this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
var interval = this._interval;
+ var intervalPrecition = this._intervalPrecision;
if (!opt.fixMin) {
- extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
+ extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval, intervalPrecition);
}
if (!opt.fixMax) {
- extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
+ extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval, intervalPrecition);
}
this._innerSetExtent(extent[0], extent[1]);
};
@@ -33421,6 +33473,7 @@
var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
// Interval that can be used to calculate ticks
this._interval = scaleIntervals[idx][1];
+ this._intervalPrecision = getIntervalPrecision(this._interval);
// Min level used when picking ticks from top down.
// We check one more level to avoid the ticks are to sparse in some case.
this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
@@ -33811,8 +33864,8 @@
var scaleBreakHelper = getScaleBreakHelper();
return map(ticks, function (tick) {
var val = tick.value;
- var powVal = fixRound(mathPow$1(base, val));
var roundingCriterion = null;
+ var powVal = mathPow$1(base, val);
// Fix #4158
if (val === extent[0] && this._fixMin) {
roundingCriterion = originalExtent[0];
@@ -33886,6 +33939,7 @@
}
var niceExtent = [fixRound(mathCeil(extent[0] / interval) * interval), fixRound(mathFloor(extent[1] / interval) * interval)];
this._interval = interval;
+ this._intervalPrecision = getIntervalPrecision(interval);
this._niceExtent = niceExtent;
};
LogScale.prototype.calcNiceExtent = function (opt) {
@@ -36141,140 +36195,192 @@
return statesModels;
}
- // Also prevent duck typing.
- var LABEL_LAYOUT_INFO_KIND_RAW = 1;
- var LABEL_LAYOUT_INFO_KIND_COMPUTED = 2;
- function createLabelLayoutList(rawList) {
- var resultList = [];
- each(rawList, function (raw) {
- // PENDING: necessary?
- raw = extend({}, raw);
- var layoutInfo = prepareLabelLayoutInfo(raw);
- if (layoutInfo) {
- resultList.push(layoutInfo);
- }
- });
- return resultList;
+ var LABEL_LAYOUT_BASE_PROPS = ['label', 'labelLine', 'layoutOption', 'priority', 'defaultAttr', 'marginForce', 'minMarginForce', 'marginDefault', 'suggestIgnore'];
+ var LABEL_LAYOUT_DIRTY_BIT_OTHERS = 1;
+ var LABEL_LAYOUT_DIRTY_BIT_OBB = 2;
+ var LABEL_LAYOUT_DIRTY_ALL = LABEL_LAYOUT_DIRTY_BIT_OTHERS | LABEL_LAYOUT_DIRTY_BIT_OBB;
+ function setLabelLayoutDirty(labelGeometry, dirtyOrClear, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ dirtyOrClear ? labelGeometry.dirty |= dirtyBits : labelGeometry.dirty &= ~dirtyBits;
+ }
+ function isLabelLayoutDirty(labelGeometry, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ return labelGeometry.dirty == null || !!(labelGeometry.dirty & dirtyBits);
}
/**
- * If `defaultAttr.ignore: true`, return `NullUndefined`.
- * (the caller is reponsible for ensuring the label is always `ignore: true`.)
- * Otherwise the `layoutInfo` will be modified and returned.
- * `label.ignore` is not necessarily falsy, since it might be modified by some overlap resolving handling.
+ * [CAUTION]
+ * - No auto dirty propagation mechanism yet. If the transform of the raw label or any of its ancestors is
+ * changed, must sync the changes to the props of `LabelGeometry` by:
+ * either explicitly call:
+ * `setLabelLayoutDirty(labelLayout, true); ensureLabelLayoutWithGeometry(labelLayout);`
+ * or call (if only translation is performed):
+ * `labelLayoutApplyTranslation(labelLayout);`
+ * - `label.ignore` is not necessarily falsy, and not considered in computing `LabelGeometry`,
+ * since it might be modified by some overlap resolving handling.
+ * - To duplicate or make a variation:
+ * use `newLabelLayoutWithGeometry`.
*
* The result can also be the input of this method.
- *
- * @see ensureLabelLayoutInfoComputed
+ * @return `NullUndefined` if and only if `labelLayout` is `NullUndefined`.
*/
- function prepareLabelLayoutInfo(layoutInfo) {
- if (!layoutInfo || layoutInfo.defaultAttr.ignore) {
+ function ensureLabelLayoutWithGeometry(labelLayout) {
+ if (!labelLayout) {
return;
}
- var label = layoutInfo.label;
- var ignoreMargin = layoutInfo.ignoreMargin;
- var transform = label.getComputedTransform();
- // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
- var localRect = label.getBoundingRect();
- var axisAligned = isBoundingRectAxisAligned(transform);
- if (!ignoreMargin) {
- localRect = applyTextMarginToLocalRect(label, localRect);
- }
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- if (!ignoreMargin && label.style.__marginType === LabelMarginType.minMargin) {
- // `minMargin` only support number value.
- var halfMinMargin = (label.style.margin || 0) / 2;
- expandOrShrinkRect(globalRect, halfMinMargin, false, false);
- }
- var computed = layoutInfo;
- computed.kind = LABEL_LAYOUT_INFO_KIND_COMPUTED,
- // --- computed properties ---
- computed.rect = globalRect;
- computed.localRect = localRect;
- computed.obb = null,
- // will be created by `ensureOBB` when using.
- computed.axisAligned = axisAligned;
- computed.transform = transform;
- return computed;
+ if (isLabelLayoutDirty(labelLayout)) {
+ computeLabelGeometry(labelLayout, labelLayout.label, labelLayout);
+ }
+ return labelLayout;
}
/**
- * The reverse operation of `ensureLabelLayoutInfoComputedv`.
+ * The props in `out` will be filled if existing, or created.
*/
- function rollbackToLabelLayoutInfoRaw(labelLayoutInfo) {
- if (labelLayoutInfo == null) {
- return;
- }
- var raw = labelLayoutInfo;
- raw.kind = LABEL_LAYOUT_INFO_KIND_RAW;
- return raw;
+ function computeLabelGeometry(out, label, opt) {
+ // [CAUTION] These props may be modified directly for performance consideration,
+ // therefore, do not output the internal data structure of zrender Element.
+ var rawTransform = label.getComputedTransform();
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ // NOTE: should call `getBoundingRect` after `getComputedTransform`, or may get an inaccurate bounding rect.
+ // The reason is that `getComputedTransform` calls `__host.updateInnerText()` internally, which updates the label
+ // by `textConfig` mounted on the host.
+ // PENDING: add a dirty bit for that in zrender?
+ var outLocalRect = out.localRect = ensureCopyRect(out.localRect, label.getBoundingRect());
+ var labelStyleExt = label.style;
+ var margin = labelStyleExt.margin;
+ var marginForce = opt && opt.marginForce;
+ var minMarginForce = opt && opt.minMarginForce;
+ var marginDefault = opt && opt.marginDefault;
+ var marginType = labelStyleExt.__marginType;
+ if (marginType == null && marginDefault) {
+ margin = marginDefault;
+ marginType = LabelMarginType.textMargin;
+ }
+ // `textMargin` and `minMargin` can not exist both.
+ for (var i = 0; i < 4; i++) {
+ _tmpLabelMargin[i] = marginType === LabelMarginType.minMargin && minMarginForce && minMarginForce[i] != null ? minMarginForce[i] : marginForce && marginForce[i] != null ? marginForce[i] : margin ? margin[i] : 0;
+ }
+ if (marginType === LabelMarginType.textMargin) {
+ expandOrShrinkRect(outLocalRect, _tmpLabelMargin, false, false);
+ }
+ var outGlobalRect = out.rect = ensureCopyRect(out.rect, outLocalRect);
+ if (rawTransform) {
+ outGlobalRect.applyTransform(rawTransform);
+ }
+ // Notice: label.style.margin is actually `minMargin / 2`, handled by `setTextStyleCommon`.
+ if (marginType === LabelMarginType.minMargin) {
+ expandOrShrinkRect(outGlobalRect, _tmpLabelMargin, false, false);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ (out.label = out.label || {}).ignore = label.ignore;
+ setLabelLayoutDirty(out, false);
+ setLabelLayoutDirty(out, true, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ // Do not remove `obb` (if existing) for reuse, just reset the dirty bit.
+ return out;
}
+ var _tmpLabelMargin = [0, 0, 0, 0];
/**
- * This method supports that the label layout info is not computed until needed,
- * for performance consideration.
- *
- * [CAUTION]
- * - If the raw label is changed, must call
- * `ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(layoutInfo))`
- * to recreate the layout info.
- * - Null checking is needed for the result. @see prepareLabelLayoutInfo
- *
- * Usage:
- * To make a copy of labelLayoutInfo, simply:
- * const layoutInfoCopy = rollbackToLabelLayoutInfoRaw(extends({}, someLabelLayoutInfo));
+ * The props in `out` will be filled if existing, or created.
+ */
+ function computeLabelGeometry2(out, rawLocalRect, rawTransform) {
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ out.localRect = ensureCopyRect(out.localRect, rawLocalRect);
+ out.rect = ensureCopyRect(out.rect, rawLocalRect);
+ if (rawTransform) {
+ out.rect.applyTransform(rawTransform);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ out.obb = undefined; // Reset to undefined, will be created by `ensureOBB` when using.
+ (out.label = out.label || {}).ignore = false;
+ return out;
+ }
+ /**
+ * This is a shortcut of
+ * ```js
+ * labelLayout.label.x = newX;
+ * labelLayout.label.y = newY;
+ * setLabelLayoutDirty(labelLayout, true);
+ * ensureLabelLayoutWithGeometry(labelLayout);
+ * ```
+ * and provide better performance in this common case.
*/
- function ensureLabelLayoutInfoComputed(labelLayoutInfo) {
- if (!labelLayoutInfo) {
+ function labelLayoutApplyTranslation(labelLayout, offset) {
+ if (!labelLayout) {
return;
}
- if (labelLayoutInfo.kind !== LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- labelLayoutInfo = prepareLabelLayoutInfo(labelLayoutInfo);
+ labelLayout.label.x += offset.x;
+ labelLayout.label.y += offset.y;
+ labelLayout.label.markRedraw();
+ var transform = labelLayout.transform;
+ if (transform) {
+ transform[4] += offset.x;
+ transform[5] += offset.y;
+ }
+ var globalRect = labelLayout.rect;
+ if (globalRect) {
+ globalRect.x += offset.x;
+ globalRect.y += offset.y;
+ }
+ var obb = labelLayout.obb;
+ if (obb) {
+ obb.fromBoundingRect(labelLayout.localRect, transform);
}
- return labelLayoutInfo;
- }
- function prepareIntersectionCheckInfo(localRect, transform) {
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- return {
- obb: null,
- rect: globalRect,
- localRect: localRect,
- axisAligned: isBoundingRectAxisAligned(transform),
- transform: transform
- };
}
- function createSingleLayoutInfoComputed(el) {
- return ensureLabelLayoutInfoComputed({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
- label: el,
- priority: el.z2,
- defaultAttr: {
- ignore: el.ignore
+ /**
+ * To duplicate or make a variation of a label layout.
+ * Copy the only relevant properties to avoid the conflict or wrongly reuse of the props of `LabelLayoutWithGeometry`.
+ */
+ function newLabelLayoutWithGeometry(newBaseWithDefaults, source) {
+ for (var i = 0; i < LABEL_LAYOUT_BASE_PROPS.length; i++) {
+ var prop = LABEL_LAYOUT_BASE_PROPS[i];
+ if (newBaseWithDefaults[prop] == null) {
+ newBaseWithDefaults[prop] = source[prop];
}
- });
+ }
+ return ensureLabelLayoutWithGeometry(newBaseWithDefaults);
}
/**
* Create obb if no one, can cache it.
*/
- function ensureOBB(layoutInfo) {
- return layoutInfo.obb || (layoutInfo.obb = new OrientedBoundingRect(layoutInfo.localRect, layoutInfo.transform));
+ function ensureOBB(labelGeometry) {
+ var obb = labelGeometry.obb;
+ if (!obb || isLabelLayoutDirty(labelGeometry, LABEL_LAYOUT_DIRTY_BIT_OBB)) {
+ labelGeometry.obb = obb = obb || new OrientedBoundingRect();
+ obb.fromBoundingRect(labelGeometry.localRect, labelGeometry.transform);
+ setLabelLayoutDirty(labelGeometry, false, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ }
+ return obb;
}
/**
- * The input localRect is never modified.
- * The returned localRect maybe the input localRect.
+ * Adjust labels on x/y direction to avoid overlap.
+ *
+ * PENDING: the current implementation is based on the global bounding rect rather than the local rect,
+ * which may be not preferable in some edge cases when the label has rotation, but works for most cases,
+ * since rotation is unnecessary when there is sufficient space, while squeezing is applied regardless
+ * of overlapping when there is no enough space.
+ *
+ * NOTICE:
+ * - The input `list` and its content will be modified (sort, label.x/y, rect).
+ * - The caller should sync the modifications to the other parts by
+ * `setLabelLayoutDirty` and `ensureLabelLayoutWithGeometry` if needed.
+ *
+ * @return adjusted
*/
- function applyTextMarginToLocalRect(label, localRect) {
- if (label.style.__marginType !== LabelMarginType.textMargin) {
- return localRect;
- }
- var textMargin = normalizeCssArray$1(retrieve2(label.style.margin, [0, 0]));
- localRect = localRect.clone();
- expandOrShrinkRect(localRect, textMargin, false, false);
- return localRect;
- }
- function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
+ function shiftLayoutOnXY(list, xyDimIdx,
+ // 0 for x, 1 for y
+ minBound,
+ // for x, leftBound; for y, topBound
+ maxBound,
+ // for x, rightBound; for y, bottomBound
+ // If average the shifts on all labels and add them to 0
+ // TODO: Not sure if should enable it.
+ // Pros: The angle of lines will distribute more equally
+ // Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
+ balanceShift) {
var len = list.length;
+ var xyDim = XY$1[xyDimIdx];
+ var sizeDim = WH$1[xyDimIdx];
if (len < 2) {
- return;
+ return false;
}
list.sort(function (a, b) {
return a.rect[xyDim] - b.rect[xyDim];
@@ -36282,6 +36388,7 @@
var lastPos = 0;
var delta;
var adjusted = false;
+ // const shifts = [];
var totalShifts = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
@@ -36294,6 +36401,7 @@
adjusted = true;
}
var shift = Math.max(-delta, 0);
+ // shifts.push(shift);
totalShifts += shift;
lastPos = rect[xyDim] + rect[sizeDim];
}
@@ -36406,33 +36514,29 @@
return adjusted;
}
/**
- * Adjust labels on x direction to avoid overlap.
- */
- function shiftLayoutOnX(list, leftBound, rightBound,
- // If average the shifts on all labels and add them to 0
- // TODO: Not sure if should enable it.
- // Pros: The angle of lines will distribute more equally
- // Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
- balanceShift) {
- return shiftLayout(list, 'x', 'width', leftBound, rightBound, balanceShift);
- }
- /**
- * Adjust labels on y direction to avoid overlap.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * @see `hideOverlap`
*/
- function shiftLayoutOnY(list, topBound, bottomBound,
- // If average the shifts on all labels and add them to 0
- balanceShift) {
- return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
+ function restoreIgnore(labelList) {
+ for (var i = 0; i < labelList.length; i++) {
+ var labelItem = labelList[i];
+ var defaultAttr = labelItem.defaultAttr;
+ var labelLine = labelItem.labelLine;
+ labelItem.label.attr('ignore', defaultAttr.ignore);
+ labelLine && labelLine.attr('ignore', defaultAttr.labelGuideIgnore);
+ }
}
/**
- * [CAUTION]: the `label.ignore` in the input is not necessarily falsy.
- * this method checks intersection regardless of current `ignore`,
- * if no intersection, restore the `ignore` to `defaultAttr.ignore`.
- * And `labelList` will be modified.
- * Therefore, if some other overlap resolving strategy has ignored some elements,
- * do not input them to this method.
- * PENDING: review the diff between the requirements from LabelManager and AxisBuilder,
- * and uniform the behavior?
+ * [NOTICE - restore]:
+ * 'series:layoutlabels' may be triggered during some shortcut passes, such as zooming in series.graph/geo
+ * (`updateLabelLayout`), where the modified `Element` props should be restorable from `defaultAttr`.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * `restoreIgnore` can be called to perform the restore, if needed.
+ *
+ * [NOTICE - state]:
+ * Regarding Element's states, this method is only designed for the normal state.
+ * PENDING: although currently this method is effectively called in other states in `updateLabelLayout` case,
+ * the bad case is not noticeable in the zooming scenario.
*/
function hideOverlap(labelList) {
var displayedLabels = [];
@@ -36451,8 +36555,10 @@
el.ignore = true;
}
for (var i = 0; i < labelList.length; i++) {
- var labelItem = ensureLabelLayoutInfoComputed(labelList[i]);
- if (!labelItem || labelItem.label.ignore) {
+ var labelItem = ensureLabelLayoutWithGeometry(labelList[i]);
+ // The current `el.ignore` is involved, since some previous overlap
+ // resolving strategies may have set `el.ignore` to true.
+ if (labelItem.label.ignore) {
continue;
}
var label = labelItem.label;
@@ -36475,24 +36581,24 @@
hideEl(label);
labelLine && hideEl(labelLine);
} else {
- label.attr('ignore', labelItem.defaultAttr.ignore);
- labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
displayedLabels.push(labelItem);
}
}
}
/**
- * [NOTICE]:
- * - `label.ignore` is not considered - no requirement so far.
- * - `baseLayoutInfo` and `targetLayoutInfo` may be modified - obb may be created and saved.
- *
* Enable fast check for performance; use obb if inevitable.
* If `mtv` is used, `targetLayoutInfo` can be moved based on the values filled into `mtv`.
+ *
+ * This method is based only on the current `Element` states (regardless of other states).
+ * Typically this method (and the entire layout process) is performed in normal state.
*/
function labelIntersect(baseLayoutInfo, targetLayoutInfo, mtv, intersectOpt) {
if (!baseLayoutInfo || !targetLayoutInfo) {
return false;
}
+ if (baseLayoutInfo.label && baseLayoutInfo.label.ignore || targetLayoutInfo.label && targetLayoutInfo.label.ignore) {
+ return false;
+ }
// Fast rejection.
if (!baseLayoutInfo.rect.intersect(targetLayoutInfo.rect, mtv, intersectOpt)) {
return false;
@@ -36579,7 +36685,6 @@
}
var labelGuide = hostRect && host.getTextGuideLine();
this._labelList.push({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
labelLine: labelGuide,
seriesModel: seriesModel,
@@ -36736,18 +36841,24 @@
LabelManager.prototype.layout = function (api) {
var width = api.getWidth();
var height = api.getHeight();
- var labelList = createLabelLayoutList(this._labelList);
+ var labelList = [];
+ each(this._labelList, function (inputItem) {
+ if (!inputItem.defaultAttr.ignore) {
+ labelList.push(newLabelLayoutWithGeometry({}, inputItem));
+ }
+ });
var labelsNeedsAdjustOnX = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftX';
});
var labelsNeedsAdjustOnY = filter(labelList, function (item) {
return item.layoutOption.moveOverlap === 'shiftY';
});
- shiftLayoutOnX(labelsNeedsAdjustOnX, 0, width);
- shiftLayoutOnY(labelsNeedsAdjustOnY, 0, height);
+ shiftLayoutOnXY(labelsNeedsAdjustOnX, 0, 0, width);
+ shiftLayoutOnXY(labelsNeedsAdjustOnY, 1, 0, height);
var labelsNeedsHideOverlap = filter(labelList, function (item) {
return item.layoutOption.hideOverlap;
});
+ restoreIgnore(labelsNeedsHideOverlap);
hideOverlap(labelsNeedsHideOverlap);
};
/**
@@ -43473,7 +43584,7 @@
list[i].label.x = farthestX;
}
}
- if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
+ if (shiftLayoutOnXY(list, 1, viewTop, viewTop + viewHeight)) {
recalculateX(list);
}
}
@@ -43524,7 +43635,7 @@
}
}
layout.targetTextWidth = targetTextWidth;
- constrainTextWidth(layout, targetTextWidth);
+ constrainTextWidth(layout, targetTextWidth, false);
}
}
adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
@@ -43570,9 +43681,6 @@
* which case, previous wrapping should be redo.
*/
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
- if (forceRecalculate === void 0) {
- forceRecalculate = false;
- }
if (layout.labelStyleWidth != null) {
// User-defined style.width has the highest priority.
return;
@@ -43587,7 +43695,6 @@
// textRect.width already contains paddingH if bgColor is set
var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
if (availableWidth < oldOuterWidth || forceRecalculate) {
- var oldHeight = textRect.height;
if (overflow && overflow.match('break')) {
// Temporarily set background to be null to calculate
// the bounding box without background.
@@ -43619,13 +43726,18 @@
: null;
label.setStyle('width', newWidth);
}
- var newRect = label.getBoundingRect();
- textRect.width = newRect.width;
- var margin = (label.style.margin || 0) + 2.1;
- textRect.height = newRect.height + margin;
- textRect.y -= (textRect.height - oldHeight) / 2;
+ computeLabelGlobalRect(textRect, label);
}
}
+ function computeLabelGlobalRect(out, label) {
+ _tmpLabelGeometry.rect = out;
+ computeLabelGeometry(_tmpLabelGeometry, label, _computeLabelGeometryOpt);
+ }
+ var _computeLabelGeometryOpt = {
+ minMarginForce: [null, 0, null, 0],
+ marginDefault: [1, 0, 1, 0]
+ };
+ var _tmpLabelGeometry = {};
function isPositionCenter(sectorShape) {
// Not change x for center label
return sectorShape.position === 'center';
@@ -43757,12 +43869,8 @@
});
// Not sectorShape the inside label
if (!isLabelInside) {
- var textRect = label.getBoundingRect().clone();
- textRect.applyTransform(label.getComputedTransform());
- // Text has a default 1px stroke. Exclude this.
- var margin = (label.style.margin || 0) + 2.1;
- textRect.y -= margin / 2;
- textRect.height += margin;
+ var textRect = new BoundingRect(0, 0, 0, 0);
+ computeLabelGlobalRect(textRect, label);
labelLayoutList.push({
label: label,
labelLine: labelLine,
@@ -45477,17 +45585,15 @@
}
var PI$5 = Math.PI;
- // This tune is also for backward compat, since nameMoveOverlap is set as default,
- // in compact layout (multiple charts in one canvas), name should be more close to the axis line and labels.
- var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2], [5, 3], [8, 3]];
- var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1], [0, 3], [0, 3]];
+ var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]];
+ var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]];
var getLabelInner = makeInner();
var getTickInner = makeInner();
/**
* A context shared by difference axisBuilder instances.
* For cross-axes overlap resolving.
*
- * Lifecycle constrait: should not over a pass of ec main process.
+ * Lifecycle constraint: should not over a pass of ec main process.
* If model is changed, the context must be disposed.
*
* @see AxisBuilderLocalContext
@@ -45517,14 +45623,14 @@
* (such as `hideOverlap`, `fixMinMaxLabelShow`) and after transform calculating.
* 2. Can be called multiple times and should be idempotent.
*/
- function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutInfoList) {
+ function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) {
var axis = axisModel.axis;
var record = shared.ensureRecord(axisModel);
var labelInfoList = [];
var stOccupiedRect;
var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation);
- each(labelLayoutInfoList, function (layout) {
- var layoutInfo = ensureLabelLayoutInfoComputed(layout);
+ each(labelLayoutList, function (layout) {
+ var layoutInfo = ensureLabelLayoutWithGeometry(layout);
if (!layoutInfo || layoutInfo.label.ignore) {
return;
}
@@ -45568,7 +45674,7 @@
if (isNameLocationCenter(cfg.nameLocation)) {
var stOccupiedRect = thisRecord.stOccupiedRect;
if (stOccupiedRect) {
- moveIfOverlap(prepareIntersectionCheckInfo(stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
+ moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
}
} else {
moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec);
@@ -45582,8 +45688,7 @@
bidirectional: false,
touchThreshold: 0.05
})) {
- Point.add(movableLayoutInfo.label, movableLayoutInfo.label, mtv);
- ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(movableLayoutInfo));
+ labelLayoutApplyTranslation(movableLayoutInfo, mtv);
}
}
function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) {
@@ -45862,7 +45967,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
}
},
/**
@@ -45876,7 +45981,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
}
var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel);
syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls);
@@ -45961,14 +46066,6 @@
fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
align: textStyleModel.get('align') || labelLayout.textAlign,
verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
- }, {
- defaultTextMargin: isNameLocationCenter(nameLocation)
- // Make axis name visually far from axis labels.
- // (but not too aggressive, consider multiple small charts)
- ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
- // top/button margin is set to `0` to inserted the xAxis name into the indention
- // above the axis labels to save space. (see example below.)
- : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
}),
z2: 1
});
@@ -45989,7 +46086,20 @@
transformGroup.add(textEl);
textEl.updateTransform();
local.nameEl = textEl;
- var nameLayout = sharedRecord.nameLayout = createSingleLayoutInfoComputed(textEl);
+ var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({
+ label: textEl,
+ priority: textEl.z2,
+ defaultAttr: {
+ ignore: textEl.ignore
+ },
+ marginDefault: isNameLocationCenter(nameLocation)
+ // Make axis name visually far from axis labels.
+ // (but not too aggressive, consider multiple small charts)
+ ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
+ // top/button margin is set to `0` to inserted the xAxis name into the indention
+ // above the axis labels to save space. (see example below.)
+ : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
+ });
sharedRecord.nameLocation = nameLocation;
group.add(textEl);
textEl.decomposeTransform();
@@ -46002,7 +46112,7 @@
}
}
};
- function axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
+ function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
if (!axisLabelBuildResultExists(local)) {
buildAxisLabel(cfg, local, group, kind, axisModel, api);
}
@@ -46062,53 +46172,47 @@
// Have not consider onBand yet, where tick els is more than label els.
// Assert no ignore in labels.
function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) {
- var outmostLabelLayout = labelLayoutList[outmostLabelIdx];
- var innerLabelLayout = labelLayoutList[innerLabelIdx];
+ var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]);
+ var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]);
if (!outmostLabelLayout || !innerLabelLayout) {
return;
}
- if (showMinMaxLabel === false) {
+ if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) {
ignoreEl(outmostLabelLayout.label);
+ return;
}
- // PENDING: Originally we thougth `optionHideOverlap === false` means do not hide anything,
+ if (innerLabelLayout.suggestIgnore) {
+ ignoreEl(innerLabelLayout.label);
+ return;
+ }
+ // PENDING: Originally we thought `optionHideOverlap === false` means do not hide anything,
// since currently the bounding rect of text might not accurate enough and might slightly bigger,
// which causes false positive. But `optionHideOverlap: null/undfined` is falsy and likely
// be treated as false.
- else {
- // In most fonts the glyph does not reach the boundary of the bouding rect.
- // This is needed to avoid too aggressive to hide two elements that meet at the edge
- // due to compact layout by the same bounding rect or OBB.
- var touchThreshold = 0.1;
- // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
- // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
- // should be conservative, since the space might be sufficient in this case.
- var ignoreMargin = !optionHideOverlap;
- if (ignoreMargin) {
- // Make a copy to apply `ignoreMargin`.
- outmostLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, outmostLabelLayout));
- innerLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, innerLabelLayout));
- }
- var anyIgnored = false;
- if (outmostLabelLayout.suggestIgnore) {
- ignoreEl(outmostLabelLayout.label);
- anyIgnored = true;
- }
- if (innerLabelLayout.suggestIgnore) {
+ // In most fonts the glyph does not reach the boundary of the bounding rect.
+ // This is needed to avoid too aggressive to hide two elements that meet at the edge
+ // due to compact layout by the same bounding rect or OBB.
+ var touchThreshold = 0.1;
+ // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
+ // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
+ // should be conservative, since the space might be sufficient in this case.
+ if (!optionHideOverlap) {
+ var marginForce = [0, 0, 0, 0];
+ // Make a copy to apply `ignoreMargin`.
+ outmostLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, outmostLabelLayout);
+ innerLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, innerLabelLayout);
+ }
+ if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, {
+ touchThreshold: touchThreshold
+ })) {
+ if (showMinMaxLabel) {
ignoreEl(innerLabelLayout.label);
- anyIgnored = true;
- }
- if (!anyIgnored && labelIntersect(ensureLabelLayoutInfoComputed(outmostLabelLayout), ensureLabelLayoutInfoComputed(innerLabelLayout), null, {
- touchThreshold: touchThreshold
- })) {
- if (showMinMaxLabel) {
- ignoreEl(innerLabelLayout.label);
- } else {
- ignoreEl(outmostLabelLayout.label);
- }
+ } else {
+ ignoreEl(outmostLabelLayout.label);
}
}
}
@@ -46121,7 +46225,7 @@
deal(showMinLabel, 0, 1);
deal(showMaxLabel, labelsLen - 1, labelsLen - 2);
}
- // PENDING: is it necessary to display a tick while the cooresponding label is ignored?
+ // PENDING: Is it necessary to display a tick while the corresponding label is ignored?
function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) {
if (cfg.showMinorTicks) {
// It probably unreaasonable to hide major ticks when show minor ticks.
@@ -46228,7 +46332,7 @@
}
}
}
- // Return whether need to call `axisTickLabelLayout` again.
+ // Return whether need to call `layOutAxisTickLabel` again.
function dealLastTickLabelResultReusable(local, group, extraParams) {
if (axisLabelBuildResultExists(local)) {
var axisLabelsCreationContext = local.axisLabelsCreationContext;
@@ -46364,7 +46468,6 @@
});
var labelLayoutList = map(labelEls, function (label) {
return {
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) // Make break labels be highest priority.
: label.z2,
@@ -46375,7 +46478,7 @@
});
axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx);
}
- // Indicate that `axisTickLabelLayout` has been called.
+ // Indicate that `layOutAxisTickLabel` has been called.
function axisLabelBuildResultExists(local) {
return !!local.labelLayoutList;
}
@@ -46387,14 +46490,15 @@
}
function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) {
var labelMargin = axisModel.get(['axisLabel', 'margin']);
- each(labelLayoutList, function (layoutInfo, idx) {
- if (!layoutInfo) {
+ each(labelLayoutList, function (layout, idx) {
+ var geometry = ensureLabelLayoutWithGeometry(layout);
+ if (!geometry) {
return;
}
- var labelEl = layoutInfo.label;
+ var labelEl = geometry.label;
var inner = getLabelInner(labelEl);
// See the comment in `suggestIgnore`.
- layoutInfo.suggestIgnore = labelEl.ignore;
+ geometry.suggestIgnore = labelEl.ignore;
// Currently no `ignore:true` is set in `buildAxisLabel`
// But `ignore:true` may be set subsequently for overlap handling, thus reset it here.
labelEl.ignore = false;
@@ -46408,9 +46512,8 @@
_tmpLayoutEl.decomposeTransform();
copyTransform(labelEl, _tmpLayoutEl);
labelEl.markRedraw();
- if (layoutInfo.kind === LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- rollbackToLabelLayoutInfoRaw(layoutInfo);
- }
+ setLabelLayoutDirty(geometry, true);
+ ensureLabelLayoutWithGeometry(geometry);
});
}
var _tmpLayoutEl = new Rect();
@@ -46442,7 +46545,7 @@
var moveOverlap = axisModel.get(['breakLabelLayout', 'moveOverlap'], true);
if (moveOverlap === true || moveOverlap === 'auto') {
each(breakLabelIndexPairs, function (idxPair) {
- getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[0]]), ensureLabelLayoutInfoComputed(labelLayoutList[idxPair[1]])]);
+ getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[0]]), ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[1]])]);
});
}
}
@@ -47138,7 +47241,7 @@
// Assume `updateAllAxisExtentTransByGridRect` has been performed once before this call.
// [NOTE]:
// - The bounding rect of the axis elements might be sensitve to variations in `axis.extent` due to strategies
- // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutInfoBase['suggestIgnore']`.
+ // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutBase['suggestIgnore']`.
// - The final `gridRect` might be slightly smaller than the ideally expected result if labels are giant and
// get hidden due to overlapping. More iterations could improve precision, but not performant. We consider
// the current result acceptable, since no alignment among charts can be guaranteed when using this feature.
@@ -48004,79 +48107,55 @@
function fixJitterAvoidOverlaps(fixedAxis, fixedCoord, floatCoord, radius, jitter, margin) {
var store = inner$6(fixedAxis);
if (!store.items) {
- store.items = {
- fixedCoord: -1,
- floatCoord: -1,
- r: -1,
- next: null,
- prev: null
- };
- store.items.next = store.items;
- store.items.prev = store.items;
+ store.items = [];
}
var items = store.items;
+ // Try both positive and negative directions, choose the one with smaller movement
var overlapA = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, 1);
var overlapB = placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, -1);
- var overlapResult = Math.abs(overlapA.resultCoord - floatCoord) < Math.abs(overlapB.resultCoord - floatCoord) ? overlapA : overlapB;
- var minFloat = overlapResult.resultCoord;
+ var minFloat = Math.abs(overlapA - floatCoord) < Math.abs(overlapB - floatCoord) ? overlapA : overlapB;
// Clamp only category axis
var bandWidth = fixedAxis.scale.type === 'ordinal' ? fixedAxis.getBandWidth() : null;
var distance = Math.abs(minFloat - floatCoord);
if (distance > jitter / 2 || bandWidth && distance > bandWidth / 2 - radius) {
// If the new item is moved too far, then give up.
// Fall back to random jitter.
- minFloat = fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
- }
- // Insert to store
- var insertBy = overlapResult.insertBy;
- var resultDirection = overlapResult.direction;
- var pointer1 = resultDirection > 0 ? 'next' : 'prev';
- var pointer2 = resultDirection > 0 ? 'prev' : 'next';
- var newItem = {
+ return fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
+ }
+ // Add new point to array
+ items.push({
fixedCoord: fixedCoord,
- floatCoord: overlapResult.resultCoord,
- r: radius,
- next: null,
- prev: null
- };
- newItem[pointer1] = insertBy[pointer1];
- newItem[pointer2] = insertBy;
- insertBy[pointer1][pointer2] = newItem;
- insertBy[pointer1] = newItem;
+ floatCoord: minFloat,
+ r: radius
+ });
return minFloat;
}
function placeJitterOnDirection(items, fixedCoord, floatCoord, radius, jitter, margin, direction) {
- // Check for overlap with previous items.
var y = floatCoord;
- var pointer1 = direction > 0 ? 'next' : 'prev';
- var insertBy = items;
- var item = items[pointer1];
- while (item !== items) {
+ // Check all existing items for overlap and find the maximum adjustment needed
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
var dx = fixedCoord - item.fixedCoord;
var dy = y - item.floatCoord;
var d2 = dx * dx + dy * dy;
var r = radius + item.r + margin;
if (d2 < r * r) {
- // Overlap. Try to move the new item along otherCoord direction.
- y = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
- insertBy = item;
- if (Math.abs(y - floatCoord) > jitter / 2) {
- // If the new item is moved too far, then give up.
- // Fall back to random jitter.
- return {
- resultCoord: Number.MAX_VALUE,
- insertBy: insertBy,
- direction: direction
- };
+ // Has overlap, calculate required adjustment
+ var requiredY = item.floatCoord + Math.sqrt(r * r - dx * dx) * direction;
+ // Check if this adjustment would move too far
+ if (Math.abs(requiredY - floatCoord) > jitter / 2) {
+ return Number.MAX_VALUE; // Give up
+ }
+ // Update y only when it's larger to the center
+ if (direction === 1 && requiredY > y || direction === -1 && requiredY < y) {
+ y = requiredY;
+ // Loop from the start again
+ i = -1; // Reset index to recheck all items
+ continue; // Recalculate with the new y position
}
}
- item = item[pointer1];
}
- return {
- resultCoord: y,
- insertBy: insertBy,
- direction: direction
- };
+ return y;
}
function jitterLayout(ecModel) {
@@ -48313,14 +48392,21 @@
var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty();
// Won't be ignore if normal state is not ignore.
polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;
+ var lineStyle = itemModel.getModel([stateName, 'lineStyle']).getLineStyle();
+ polyline.ensureState(stateName).style = lineStyle;
+ var areaStyle = stateModel.getAreaStyle();
+ polygon.ensureState(stateName).style = areaStyle;
+ var itemStateStyle = itemModel.getModel([stateName, 'itemStyle']).getItemStyle();
+ symbolGroup.eachChild(function (symbolPath) {
+ symbolPath.ensureState(stateName).style = clone(itemStateStyle);
+ });
});
- polygon.useStyle(defaults(areaStyleModel.getAreaStyle(), {
+ polygon.useStyle(defaults(itemModel.getModel('areaStyle').getAreaStyle(), {
fill: color,
opacity: 0.7,
decal: itemStyle.decal
}));
var emphasisModel = itemModel.getModel('emphasis');
- var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();
symbolGroup.eachChild(function (symbolPath) {
if (symbolPath instanceof ZRImage) {
var pathStyle = symbolPath.style;
@@ -48337,8 +48423,6 @@
symbolPath.setColor(color);
symbolPath.style.strokeNoScale = true;
}
- var pathEmphasisState = symbolPath.ensureState('emphasis');
- pathEmphasisState.style = clone(itemHoverStyle);
var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
@@ -69456,7 +69540,7 @@
// `legacy: false`, force do not compat.
// `legacy` not set: auto detect whether legacy.
// But in this case we do not compat (difficult to detect and rare case):
- // Becuse custom series and graphic component support "merge", users may firstly
+ // Because custom series and graphic component support "merge", users may firstly
// only set `textStrokeWidth` style or secondly only set `text`.
return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
// Difficult to detect whether legacy for a "text" el.
@@ -74864,7 +74948,7 @@
return rg;
}
/**
- * If illegal or out of boundary, set NaN to `locOut`. (See `isLocatorRangeInvalidOnDim`)
+ * If illegal or out of boundary, set NaN to `locOut`. See `isXYLocatorRangeInvalidOnDim`.
* x dimension and y dimension are calculated separately.
*/
function parseCoordRangeOption(locOut,
@@ -74883,14 +74967,18 @@
var coordValArr = isArray(dataOnDim) ? dataOnDim : [dataOnDim];
var len = coordValArr.length;
var hasClamp = !!clamp;
- if (len === 1 || len === 2) {
+ if (len >= 1) {
parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 0);
if (len > 1) {
- parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, 1);
+ // Users may intuitively input the coords like `[[x1, x2, x3], ...]`;
+ // consider the range as `[x1, x3]` in this case.
+ parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, len - 1);
}
} else {
- if (reasonOut) {
- reasonOut.push("Can only contain 1 or 2 coords, rather than " + len + ".");
+ if ("development" !== 'production') {
+ if (reasonOut) {
+ reasonOut.push('Should be like [["x1", "x2"], ["y1", "y2"]], or ["x1", "y1"], rather than empty.');
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
}
@@ -74922,8 +75010,10 @@
function parseCoordRangeOptionOnOneDimOnePart(locDimOut, reasonOut, coordValArr, hasClamp, dims, dimIdx, partIdx) {
var layout = coordDataToAllCellLevelLayout(coordValArr[partIdx], dims, dimIdx);
if (!layout) {
- if (!hasClamp && reasonOut) {
- reasonOut.push("Can not find layout by coord[" + dimIdx + "][" + partIdx + "].");
+ if ("development" !== 'production') {
+ if (!hasClamp && reasonOut) {
+ reasonOut.push("Can not find cell by coord[" + dimIdx + "][" + partIdx + "].");
+ }
}
locDimOut[0] = locDimOut[1] = NaN;
return;
@@ -75413,7 +75503,7 @@
if ("development" !== 'production') {
reasonArr = [];
}
- parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, MatrixClampOption[self._kind]);
+ parseCoordRangeOption(locatorRange, reasonArr, option.coord, self._dims, option.coordClamp ? MatrixClampOption[self._kind] : MatrixClampOption.none);
if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) || isXYLocatorRangeInvalidOnDim(locatorRange, 1)) {
if ("development" !== 'production') {
error("Can not determine cells by option matrix." + self._kind + ".data[" + idx + "]: " + ("" + reasonArr.join(' ')));
@@ -75528,13 +75618,13 @@
* @param locatorRange Must be the return of `parseCoordRangeOption`.
*/
MatrixBodyCorner.prototype.expandRangeByCellMerge = function (locatorRange) {
- if (isXYLocatorRangeInvalidOnDim(locatorRange, 0) && isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
+ if (!isXYLocatorRangeInvalidOnDim(locatorRange, 0) && !isXYLocatorRangeInvalidOnDim(locatorRange, 1) && locatorRange[0][0] === locatorRange[0][1] && locatorRange[1][0] === locatorRange[1][1]) {
// If it locates to a single cell, use this quick path to avoid travelling.
// It is based on the fact that any cell is not contained by more than one cell merging rect.
_tmpERBCMLocator[0] = locatorRange[0][0];
_tmpERBCMLocator[1] = locatorRange[1][0];
var cell = this.getCell(_tmpERBCMLocator);
- var inSpanOf = cell.inSpanOf;
+ var inSpanOf = cell && cell.inSpanOf;
if (inSpanOf) {
cloneXYLocatorRange(locatorRange, inSpanOf.locatorRange);
return;
@@ -75672,7 +75762,7 @@
_this.type = MatrixView.type;
return _this;
}
- MatrixView.prototype.render = function (matrixModel) {
+ MatrixView.prototype.render = function (matrixModel, ecModel) {
this.group.removeAll();
var group = this.group;
var coordSys = matrixModel.coordinateSystem;
@@ -75683,8 +75773,8 @@
var yDim = yDimModel.dim;
// PENDING:
// reuse the existing text and rect elements for performance?
- renderDimensionCells(group, matrixModel);
- createBodyAndCorner(group, matrixModel, xDim, yDim);
+ renderDimensionCells(group, matrixModel, ecModel);
+ createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel);
var borderZ2Option = matrixModel.getShallow('borderZ2', true);
var outerBorderZ2 = retrieve2(borderZ2Option, Z2_OUTER_BORDER);
var dividerLineZ2 = outerBorderZ2 - 1;
@@ -75728,7 +75818,7 @@
MatrixView.type = 'matrix';
return MatrixView;
}(ComponentView);
- function renderDimensionCells(group, matrixModel) {
+ function renderDimensionCells(group, matrixModel, ecModel) {
renderOnDimension(0);
renderOnDimension(1);
function renderOnDimension(dimIdx) {
@@ -75746,11 +75836,11 @@
var shape = {};
BoundingRect.copy(shape, dimCell.rect);
set(xyLocator, dimCell.id.x, dimCell.id.y);
- createMatrixCell(xyLocator, matrixModel, group, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, dimCell.option, thisDimBgStyleModel, thisDimLabelModel, thisDimModel, shape, dimCell.option.value, Z2_DIMENSION_CELL_DEFAULT, tooltipOption);
}
}
}
- function createBodyAndCorner(group, matrixModel, xDim, yDim) {
+ function createBodyAndCorner(group, matrixModel, xDim, yDim, ecModel) {
createBodyOrCornerCells('body', matrixModel.getBody(), xDim, yDim);
if (xDim.shouldShow() && yDim.shouldShow()) {
createBodyOrCornerCells('corner', matrixModel.getCorner(), yDim, xDim);
@@ -75784,19 +75874,19 @@
yLayout.dim.getLayout(shape, 1, xyLocator[1]);
}
var bodyCornerCellOption = bodyCornerCell ? bodyCornerCell.option : null;
- createMatrixCell(xyLocator, matrixModel, group, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
+ createMatrixCell(xyLocator, matrixModel, group, ecModel, bodyCornerCellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, bodyCornerCellOption ? bodyCornerCellOption.value : null, Z2_BODY_CORNER_CELL_DEFAULT, tooltipOption);
}
}
} // End of createBodyOrCornerCells
}
- function createMatrixCell(xyLocator, matrixModel, group, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
+ function createMatrixCell(xyLocator, matrixModel, group, ecModel, cellOption, parentItemStyleModel, parentLabelModel, parentCellModel, shape, textValue, zrCellDefault, tooltipOption) {
var _a;
// Do not use getModel for handy performance optimization.
_tmpCellItemStyleModel.option = cellOption ? cellOption.itemStyle : null;
_tmpCellItemStyleModel.parentModel = parentItemStyleModel;
_tmpCellModel.option = cellOption;
_tmpCellModel.parentModel = parentCellModel;
- // Use different z2 becuase special border may be defined in itemStyle.
+ // Use different z2 because special border may be defined in itemStyle.
var z2 = retrieve2(_tmpCellModel.getShallow('z2'), cellOption && cellOption.itemStyle ? zrCellDefault.special : zrCellDefault.normal);
var tooltipOptionShow = tooltipOption && tooltipOption.show;
var cellRect = createMatrixRect(shape, _tmpCellItemStyleModel.getItemStyle(), z2);
@@ -75810,6 +75900,8 @@
var text = textValue + '';
_tmpCellLabelModel.option = cellOption ? cellOption.label : null;
_tmpCellLabelModel.parentModel = parentLabelModel;
+ // This is to accept `option.textStyle` as the default.
+ _tmpCellLabelModel.ecModel = ecModel;
setLabelStyle(cellRect,
// Currently do not support other states (`emphasis`, `select`, `blur`)
{
@@ -75870,6 +75962,9 @@
!cellRect.style || cellRect.style.fill === 'none' || !cellRect.style.fill;
}
cellRect.silent = rectSilent;
+ clearTmpModel(_tmpCellModel);
+ clearTmpModel(_tmpCellItemStyleModel);
+ clearTmpModel(_tmpCellLabelModel);
}
var _tmpCellModel = new Model();
var _tmpCellItemStyleModel = new Model();
@@ -79934,9 +80029,11 @@
clearTimeout(this._longHideTimeout);
var zr = this._zr;
transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
- if (this.el) {
- var parentNode = this.el.parentNode;
- parentNode && parentNode.removeChild(this.el);
+ var el = this.el;
+ if (el) {
+ el.onmouseenter = el.onmousemove = el.onmouseleave = null;
+ var parentNode = el.parentNode;
+ parentNode && parentNode.removeChild(el);
}
this.el = this._container = null;
};
@@ -82873,6 +82970,7 @@
* If marker model is created by self from series
*/
_this.createdBySelf = false;
+ _this.preventAutoZ = true;
return _this;
}
/**
@@ -83196,6 +83294,7 @@
markerGroupMap.each(function (item) {
!inner$j(item).keep && _this.group.remove(item.group);
});
+ updateZ$2(ecModel, markerGroupMap, this.type);
};
MarkerView.prototype.markKeep = function (drawGroup) {
inner$j(drawGroup).keep = true;
@@ -83217,6 +83316,18 @@
MarkerView.type = 'marker';
return MarkerView;
}(ComponentView);
+ function updateZ$2(ecModel, markerGroupMap, type) {
+ ecModel.eachSeries(function (seriesModel) {
+ var markerModel = MarkerModel.getMarkerModelFromSeries(seriesModel, type);
+ var markerDraw = markerGroupMap.get(seriesModel.id);
+ if (markerModel && markerDraw && markerDraw.group) {
+ var _a = retrieveZInfo(markerModel),
+ z = _a.z,
+ zlevel = _a.zlevel;
+ traverseUpdateZ(markerDraw.group, z, zlevel);
+ }
+ });
+ }
function updateMarkerLayout(mpData, seriesModel, api) {
var coordSys = seriesModel.coordinateSystem;
@@ -87223,9 +87334,8 @@
ContinuousModel.prototype.getValueState = function (value) {
var range = this.option.range;
var dataExtent = this.getExtent();
- // When range[0] === dataExtent[0], any value larger than dataExtent[0] maps to 'inRange'.
- // range[1] is processed likewise.
- return (range[0] <= dataExtent[0] || range[0] <= value) && (range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
+ var unboundedRange = retrieve2(this.option.unboundedRange, true);
+ return (unboundedRange && range[0] <= dataExtent[0] || range[0] <= value) && (unboundedRange && range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
};
ContinuousModel.prototype.findTargetDataIndices = function (range) {
var result = [];
@@ -89048,7 +89158,7 @@
}));
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(thumbnailModel, this);
+ updateZ$3(thumbnailModel, this);
};
/**
* Can be called asynchronously directly.
@@ -89059,7 +89169,7 @@
if (this._isEnabled()) {
this._dealRenderContent();
this._dealUpdateWindow();
- updateZ$2(this._model, this);
+ updateZ$3(this._model, this);
}
};
ThumbnailView.prototype._dealRenderContent = function () {
@@ -89214,7 +89324,7 @@
extend(payload, params);
return payload;
}
- function updateZ$2(thumbnailModel, thumbnailView) {
+ function updateZ$3(thumbnailModel, thumbnailView) {
var zInfo = retrieveZInfo(thumbnailModel);
traverseUpdateZ(thumbnailView.group, zInfo.z, zInfo.zlevel);
}
@@ -92609,7 +92719,7 @@
return layout.transform ? mul$1(create$1(), axisStTrans, layout.transform) : axisStTrans;
});
function isParallelToAxis(whIdx) {
- // Assert label[0] and lable[1] has the same rotation, so only use [0].
+ // Assert label[0] and label[1] has the same rotation, so only use [0].
var localRect = layoutPair[0].localRect;
var labelVec0 = new Point(localRect[WH$1[whIdx]] * labelPairStTrans[0][0], localRect[WH$1[whIdx]] * labelPairStTrans[0][1]);
return Math.abs(labelVec0.y) < 1e-5;
@@ -92650,8 +92760,12 @@
var uval = uvalMax < 0 ? uvalMax : uvalMin > 0 ? uvalMin : 0;
k = (qval - uval) / mtvSt.x;
}
- Point.scaleAndAdd(layoutPair[0].label, layoutPair[0].label, mtv, -k);
- Point.scaleAndAdd(layoutPair[1].label, layoutPair[1].label, mtv, 1 - k);
+ var delta0 = new Point();
+ var delta1 = new Point();
+ Point.scale(delta0, mtv, -k);
+ Point.scale(delta1, mtv, 1 - k);
+ labelLayoutApplyTranslation(layoutPair[0], delta0);
+ labelLayoutApplyTranslation(layoutPair[1], delta1);
}
function updateModelAxisBreak(model, payload) {
var result = {
diff --git a/dist/echarts.js.map b/dist/echarts.js.map
index 8d034c22e..7f25bb58d 100644
--- a/dist/echarts.js.map
+++ b/dist/echarts.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core/even [...]
\ No newline at end of file
+{"version":3,"file":"echarts.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/core/even [...]
\ No newline at end of file
diff --git a/dist/echarts.min.js b/dist/echarts.min.js
index 3f3d3290e..22b33ffe0 100644
--- a/dist/echarts.min.js
+++ b/dist/echarts.min.js
@@ -42,4 +42,4 @@
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
-var eo={},no={};var io,ro=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new fn,a=n.renderer||"canvas";eo[a]||(a=F(eo)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new eo[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,c=r.node||r.worker||l?null:new gr(s.getViewportRoot(),s.root),h=n.useCoarsePointer;(null==h|| [...]
+var eo={},no={};var io,ro=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new fn,a=n.renderer||"canvas";eo[a]||(a=F(eo)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new eo[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,c=r.node||r.worker||l?null:new gr(s.getViewportRoot(),s.root),h=n.useCoarsePointer;(null==h|| [...]
diff --git a/dist/echarts.simple.js b/dist/echarts.simple.js
index cd11d435c..5ae1fdcfb 100644
--- a/dist/echarts.simple.js
+++ b/dist/echarts.simple.js
@@ -7414,7 +7414,7 @@
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
- var version = '6.0.0-rc.1';
+ var version = '6.0.0';
var zrender = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -7528,6 +7528,8 @@
}
function round(x, precision, returnStr) {
if (precision == null) {
+ // FIXME: the default precision should not be provided, since there is no universally adaptable
+ // precision. The caller need to input a precision according to the scenarios.
precision = 10;
}
// Avoid range error
@@ -8503,7 +8505,7 @@
var others = {};
var mainTypeSpecified = false;
each(finder, function (value, key) {
- // Exclude 'dataIndex' and other illgal keys.
+ // Exclude 'dataIndex' and other illegal keys.
if (key === 'dataIndex' || key === 'dataIndexInside') {
others[key] = value;
return;
@@ -9072,8 +9074,8 @@
}
return i;
}
- function parsePlainText(text, style, defaultOuterWidth, defaultOuterHeight) {
- text != null && (text += '');
+ function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
+ var text = formatText(rawText);
var overflow = style.overflow;
var padding = style.padding;
var paddingH = padding ? padding[1] + padding[3] : 0;
@@ -9173,9 +9175,9 @@
}
return RichTextContentBlock;
}());
- function parseRichText(text, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
+ function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
var contentBlock = new RichTextContentBlock();
- text != null && (text += '');
+ var text = formatText(rawText);
if (!text) {
return contentBlock;
}
@@ -9501,6 +9503,33 @@
}
var tmpCITCTextRect = new BoundingRect(0, 0, 0, 0);
var tmpCITCIntersectRectOpt = { outIntersectRect: {}, clamp: true };
+ function formatText(text) {
+ return text != null ? (text += '') : (text = '');
+ }
+ function tSpanCreateBoundingRect(style) {
+ var text = formatText(style.text);
+ var font = style.font;
+ var contentWidth = measureWidth(ensureFontMeasureInfo(font), text);
+ var contentHeight = getLineHeight(font);
+ return tSpanCreateBoundingRect2(style, contentWidth, contentHeight, null);
+ }
+ function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
+ var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
+ var lineWidth = forceLineWidth != null
+ ? forceLineWidth
+ : (tSpanHasStroke(style) ? style.lineWidth : 0);
+ if (lineWidth > 0) {
+ rect.x -= lineWidth / 2;
+ rect.y -= lineWidth / 2;
+ rect.width += lineWidth;
+ rect.height += lineWidth;
+ }
+ return rect;
+ }
+ function tSpanHasStroke(style) {
+ var stroke = style.stroke;
+ return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ }
var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
@@ -11450,9 +11479,7 @@
return _super !== null && _super.apply(this, arguments) || this;
}
TSpan.prototype.hasStroke = function () {
- var style = this.style;
- var stroke = style.stroke;
- return stroke != null && stroke !== 'none' && style.lineWidth > 0;
+ return tSpanHasStroke(this.style);
};
TSpan.prototype.hasFill = function () {
var style = this.style;
@@ -11466,21 +11493,8 @@
this._rect = rect;
};
TSpan.prototype.getBoundingRect = function () {
- var style = this.style;
if (!this._rect) {
- var text = style.text;
- text != null ? (text += '') : (text = '');
- var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
- rect.x += style.x || 0;
- rect.y += style.y || 0;
- if (this.hasStroke()) {
- var w = style.lineWidth;
- rect.x -= w / 2;
- rect.y -= w / 2;
- rect.width += w;
- rect.height += w;
- }
- this._rect = rect;
+ this._rect = tSpanCreateBoundingRect(this.style);
}
return this._rect;
};
@@ -11938,7 +11952,6 @@
var bgColorDrawn = !!(style.backgroundColor);
var outerHeight = contentBlock.outerHeight;
var outerWidth = contentBlock.outerWidth;
- var contentWidth = contentBlock.contentWidth;
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
this.isTruncated = !!contentBlock.isTruncated;
@@ -11960,6 +11973,7 @@
}
}
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var useDefaultFill = false;
var textFill = getFill('fill' in style
? style.fill
@@ -11968,12 +11982,9 @@
? style.stroke
: (!bgColorDrawn
&& (!defaultStyle.autoStroke || useDefaultFill))
- ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = style.textShadowBlur > 0;
- var fixedBoundingRect = style.width != null
- && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
- var calculatedLineHeight = contentBlock.calculatedLineHeight;
for (var i = 0; i < textLines.length; i++) {
var el = this._getOrCreateChild(TSpan);
var subElStyle = el.createStyle();
@@ -12003,9 +12014,7 @@
subElStyle.font = textFont;
setSeparateFont(subElStyle, style);
textY += lineHeight;
- if (fixedBoundingRect) {
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
- }
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, contentBlock.contentWidth, contentBlock.calculatedLineHeight, usingDefaultStroke ? 0 : null));
}
};
ZRText.prototype._updateRichTexts = function () {
@@ -12102,6 +12111,7 @@
var defaultStyle = this._defaultStyle;
var useDefaultFill = false;
var defaultLineWidth = 0;
+ var usingDefaultStroke = false;
var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill
: 'fill' in style ? style.fill
: (useDefaultFill = true, defaultStyle.fill));
@@ -12109,7 +12119,7 @@
: 'stroke' in style ? style.stroke
: (!bgColorDrawn
&& !parentBgColorDrawn
- && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)
+ && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, usingDefaultStroke = true, defaultStyle.stroke)
: null);
var hasShadow = tokenStyle.textShadowBlur > 0
|| style.textShadowBlur > 0;
@@ -12136,9 +12146,7 @@
if (textFill) {
subElStyle.fill = textFill;
}
- var textWidth = token.contentWidth;
- var textHeight = token.contentHeight;
- el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
+ el.setBoundingRect(tSpanCreateBoundingRect2(subElStyle, token.contentWidth, token.contentHeight, usingDefaultStroke ? 0 : null));
};
ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
var textBackgroundColor = style.backgroundColor;
@@ -12294,25 +12302,6 @@
|| (style.borderWidth && style.borderColor));
}
- var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
- var SOURCE_FORMAT_ORIGINAL = 'original';
- var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
- var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
- var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
- var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
- var SOURCE_FORMAT_UNKNOWN = 'unknown';
- var SERIES_LAYOUT_BY_COLUMN = 'column';
- var SERIES_LAYOUT_BY_ROW = 'row';
- /**
- * PENDING: Temporary impl. unify them?
- * @see {LabelCommonOption['textMargin']}
- * @see {LabelCommonOption['minMargin']}
- */
- var LabelMarginType = {
- minMargin: 0,
- textMargin: 1
- };
-
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
if (el) {
@@ -14899,7 +14888,7 @@
* `false` - expand if `delta[i]` is positive, commmonly used in `margin` case. (default)
* @param noNegative
* `true` - negative `delta[i]` will be clampped to 0.
- * `false` - No clamp to `delta`. (defualt).
+ * `false` - No clamp to `delta`. (default).
* @return The input `rect`.
*/
function expandOrShrinkRect(rect, delta, shrinkOrExpand, noNegative, minSize // by default [0, 0].
@@ -14909,6 +14898,9 @@
} else if (isNumber(delta)) {
_tmpExpandRectDelta[0] = _tmpExpandRectDelta[1] = _tmpExpandRectDelta[2] = _tmpExpandRectDelta[3] = delta;
} else {
+ if ("development" !== 'production') {
+ assert(delta.length === 4);
+ }
_tmpExpandRectDelta[0] = delta[0];
_tmpExpandRectDelta[1] = delta[1];
_tmpExpandRectDelta[2] = delta[2];
@@ -15009,6 +15001,27 @@
return !transform || mathAbs$1(transform[1]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[2]) < AXIS_ALIGN_EPSILON || mathAbs$1(transform[0]) < AXIS_ALIGN_EPSILON && mathAbs$1(transform[3]) < AXIS_ALIGN_EPSILON;
}
var AXIS_ALIGN_EPSILON = 1e-5;
+ /**
+ * Create or copy to the existing bounding rect to avoid modifying `source`.
+ *
+ * @usage
+ * out.rect = ensureCopyRect(out.rect, sourceRect);
+ */
+ function ensureCopyRect(target, source) {
+ return target ? BoundingRect.copy(target, source) : source.clone();
+ }
+ /**
+ * Create or copy to the existing transform to avoid modifying `source`.
+ *
+ * [CAUTION]: transform is `NullUndefined` if no transform, following convention of zrender,
+ * and enable to bypass some unnecessary calculation, since in most cases there is no transform.
+ *
+ * @usage
+ * out.transform = ensureCopyTransform(out.transform, sourceTransform);
+ */
+ function ensureCopyTransform(target, source) {
+ return source ? copy$1(target || create$1(), source) : undefined;
+ }
function retrieveZInfo(model) {
return {
z: model.get('z') || 0,
@@ -15019,9 +15032,9 @@
doUpdateZ(el, z, zlevel, -Infinity);
}
function doUpdateZ(el, z, zlevel,
- // FIXME: ideally all the labels shold be above all the glyphs by default,
+ // FIXME: Ideally all the labels should be above all the glyphs by default,
// e.g. in graph, edge labels should be above node elements.
- // currenly impl does not garaentee that.
+ // Currently impl does not guarantee that.
maxZ2) {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
@@ -15306,23 +15319,26 @@
if (overflow) {
textStyle.overflow = overflow;
}
- var minMargin = textStyleModel.get('minMargin');
- if (minMargin != null) {
- textStyle.margin = minMargin;
- textStyle.__marginType = LabelMarginType.minMargin;
- }
- var textMargin = textStyleModel.get('textMargin');
- if (textMargin != null) {
- textStyle.margin = clone(textMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- } else if (opt.defaultTextMargin != null) {
- textStyle.margin = clone(opt.defaultTextMargin);
- textStyle.__marginType = LabelMarginType.textMargin;
- }
var lineOverflow = textStyleModel.get('lineOverflow');
if (lineOverflow) {
textStyle.lineOverflow = lineOverflow;
}
+ var labelTextStyle = textStyle;
+ // `minMargin` has a higher precedence than `textMargin`, because `textMargin` is allowed
+ // to be set in `defaultOption`.
+ var minMargin = textStyleModel.get('minMargin');
+ if (minMargin != null) {
+ // `minMargin` only support number value.
+ minMargin = !isNumber(minMargin) ? 0 : minMargin / 2;
+ labelTextStyle.margin = [minMargin, minMargin, minMargin, minMargin];
+ labelTextStyle.__marginType = LabelMarginType.minMargin;
+ } else {
+ var textMargin = textStyleModel.get('textMargin');
+ if (textMargin != null) {
+ labelTextStyle.margin = normalizeCssArray(textMargin);
+ labelTextStyle.__marginType = LabelMarginType.textMargin;
+ }
+ }
setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, null, null, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
@@ -15513,6 +15529,15 @@
obj.statesModels = labelStatesModels;
}
}
+ /**
+ * PENDING: Temporary impl. unify them?
+ * @see {LabelCommonOption['textMargin']}
+ * @see {LabelCommonOption['minMargin']}
+ */
+ var LabelMarginType = {
+ minMargin: 1,
+ textMargin: 2
+ };
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
@@ -17122,7 +17147,7 @@
// Commonly used in option `legend.padding`, `timeline.padding`, `title.padding`,
// `visualMap.padding`, ...
// [NOTICE]:
- // It's named `margin`, becuase it's the space that outside the bounding rect. But from
+ // It's named `margin`, because it's the space that outside the bounding rect. But from
// the perspective of the the caller, it's commonly used as the `padding` of a component,
// because conventionally background color covers this space.
// [BEHAVIOR]:
@@ -17658,7 +17683,7 @@
tokens.darkColor[key] = modifyHSL(hex, null, function (s) {
return s * 0.9;
}, function (l) {
- return 1 - l;
+ return 1 - Math.pow(l, 1.5);
});
}
}
@@ -17765,6 +17790,16 @@
useUTC: false
};
+ var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
+ var SOURCE_FORMAT_ORIGINAL = 'original';
+ var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
+ var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
+ var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
+ var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
+ var SOURCE_FORMAT_UNKNOWN = 'unknown';
+ var SERIES_LAYOUT_BY_COLUMN = 'column';
+ var SERIES_LAYOUT_BY_ROW = 'row';
+
// The result of `guessOrdinal`.
var BE_ORDINAL = {
Must: 1,
@@ -24172,7 +24207,10 @@
color: color$2.secondary
},
itemStyle: {
- borderColor: color$2.neutral20
+ borderColor: color$2.borderTint
+ },
+ dividerLineStyle: {
+ color: color$2.border
}
};
var theme = {
@@ -24262,9 +24300,6 @@
textStyle: {
color: color$2.secondary
},
- inRange: {
- color: [color$2.neutral10, color$2.theme[0]]
- },
handleStyle: {
borderColor: color$2.neutral30
}
@@ -24300,10 +24335,12 @@
x: matrixAxis,
y: matrixAxis,
backgroundColor: {
- borderColor: '#817f91'
+ borderColor: color$2.axisLine
},
- innerBackgroundStyle: {
- borderColor: '#484753'
+ body: {
+ itemStyle: {
+ borderColor: color$2.borderTint
+ }
}
},
timeAxis: axisCommon(),
@@ -26180,9 +26217,9 @@
return implsStore[name];
}
- var version$1 = '6.0.0-beta.1';
+ var version$1 = '6.0.0';
var dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
@@ -27347,15 +27384,16 @@
coordSysMgr.update(ecModel, api);
clearColorPalette(ecModel);
scheduler.performVisualTasks(ecModel, payload);
- render(this, ecModel, api, payload, updateParams);
- // Set background
+ // Set background and dark mode before rendering, because they affect auto-color-determination
+ // in zrender Text, and consequently affect the bounding rect if stroke is added.
var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
- var darkMode = ecModel.get('darkMode');
zr.setBackgroundColor(backgroundColor);
// Force set dark mode.
+ var darkMode = ecModel.get('darkMode');
if (darkMode != null && darkMode !== 'auto') {
zr.setDarkMode(darkMode);
}
+ render(this, ecModel, api, payload, updateParams);
lifecycle.trigger('afterupdate', ecModel, api);
},
updateTransform: function (payload) {
@@ -31326,8 +31364,9 @@
var minorTicksGroup = [];
var interval = nextTick.value - prevTick.value;
var minorInterval = interval / splitNumber;
+ var minorIntervalPrecision = getIntervalPrecision(minorInterval);
while (count < splitNumber - 1) {
- var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
+ var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval, minorIntervalPrecision);
// For the first and last interval. The count may be less than splitNumber.
if (minorTick > extent[0] && minorTick < extent[1]) {
minorTicksGroup.push(minorTick);
@@ -31366,6 +31405,12 @@
return addCommas(dataNum);
};
/**
+ * FIXME: refactor - disallow override, use composition instead.
+ *
+ * The override of `calcNiceTicks` should ensure these members are provided:
+ * this._intervalPrecision
+ * this._interval
+ *
* @param splitNumber By default `5`.
*/
IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
@@ -31421,11 +31466,12 @@
extent = this._extent.slice();
this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
var interval = this._interval;
+ var intervalPrecition = this._intervalPrecision;
if (!opt.fixMin) {
- extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
+ extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval, intervalPrecition);
}
if (!opt.fixMax) {
- extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
+ extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval, intervalPrecition);
}
this._innerSetExtent(extent[0], extent[1]);
};
@@ -31959,6 +32005,7 @@
var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
// Interval that can be used to calculate ticks
this._interval = scaleIntervals[idx][1];
+ this._intervalPrecision = getIntervalPrecision(this._interval);
// Min level used when picking ticks from top down.
// We check one more level to avoid the ticks are to sparse in some case.
this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
@@ -32348,8 +32395,8 @@
var originalBreaks = this._originalScale._innerGetBreaks();
return map(ticks, function (tick) {
var val = tick.value;
- var powVal = fixRound(mathPow$1(base, val));
var roundingCriterion = null;
+ var powVal = mathPow$1(base, val);
// Fix #4158
if (val === extent[0] && this._fixMin) {
roundingCriterion = originalExtent[0];
@@ -32416,6 +32463,7 @@
}
var niceExtent = [fixRound(mathCeil(extent[0] / interval) * interval), fixRound(mathFloor(extent[1] / interval) * interval)];
this._interval = interval;
+ this._intervalPrecision = getIntervalPrecision(interval);
this._niceExtent = niceExtent;
};
LogScale.prototype.calcNiceExtent = function (opt) {
@@ -34399,128 +34447,192 @@
return statesModels;
}
- // Also prevent duck typing.
- var LABEL_LAYOUT_INFO_KIND_RAW = 1;
- var LABEL_LAYOUT_INFO_KIND_COMPUTED = 2;
+ var LABEL_LAYOUT_BASE_PROPS = ['label', 'labelLine', 'layoutOption', 'priority', 'defaultAttr', 'marginForce', 'minMarginForce', 'marginDefault', 'suggestIgnore'];
+ var LABEL_LAYOUT_DIRTY_BIT_OTHERS = 1;
+ var LABEL_LAYOUT_DIRTY_BIT_OBB = 2;
+ var LABEL_LAYOUT_DIRTY_ALL = LABEL_LAYOUT_DIRTY_BIT_OTHERS | LABEL_LAYOUT_DIRTY_BIT_OBB;
+ function setLabelLayoutDirty(labelGeometry, dirtyOrClear, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ dirtyOrClear ? labelGeometry.dirty |= dirtyBits : labelGeometry.dirty &= ~dirtyBits;
+ }
+ function isLabelLayoutDirty(labelGeometry, dirtyBits) {
+ dirtyBits = dirtyBits || LABEL_LAYOUT_DIRTY_ALL;
+ return labelGeometry.dirty == null || !!(labelGeometry.dirty & dirtyBits);
+ }
/**
- * If `defaultAttr.ignore: true`, return `NullUndefined`.
- * (the caller is reponsible for ensuring the label is always `ignore: true`.)
- * Otherwise the `layoutInfo` will be modified and returned.
- * `label.ignore` is not necessarily falsy, since it might be modified by some overlap resolving handling.
+ * [CAUTION]
+ * - No auto dirty propagation mechanism yet. If the transform of the raw label or any of its ancestors is
+ * changed, must sync the changes to the props of `LabelGeometry` by:
+ * either explicitly call:
+ * `setLabelLayoutDirty(labelLayout, true); ensureLabelLayoutWithGeometry(labelLayout);`
+ * or call (if only translation is performed):
+ * `labelLayoutApplyTranslation(labelLayout);`
+ * - `label.ignore` is not necessarily falsy, and not considered in computing `LabelGeometry`,
+ * since it might be modified by some overlap resolving handling.
+ * - To duplicate or make a variation:
+ * use `newLabelLayoutWithGeometry`.
*
* The result can also be the input of this method.
- *
- * @see ensureLabelLayoutInfoComputed
+ * @return `NullUndefined` if and only if `labelLayout` is `NullUndefined`.
*/
- function prepareLabelLayoutInfo(layoutInfo) {
- if (!layoutInfo || layoutInfo.defaultAttr.ignore) {
+ function ensureLabelLayoutWithGeometry(labelLayout) {
+ if (!labelLayout) {
return;
}
- var label = layoutInfo.label;
- var ignoreMargin = layoutInfo.ignoreMargin;
- var transform = label.getComputedTransform();
- // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
- var localRect = label.getBoundingRect();
- var axisAligned = isBoundingRectAxisAligned(transform);
- if (!ignoreMargin) {
- localRect = applyTextMarginToLocalRect(label, localRect);
- }
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- if (!ignoreMargin && label.style.__marginType === LabelMarginType.minMargin) {
- // `minMargin` only support number value.
- var halfMinMargin = (label.style.margin || 0) / 2;
- expandOrShrinkRect(globalRect, halfMinMargin, false, false);
- }
- var computed = layoutInfo;
- computed.kind = LABEL_LAYOUT_INFO_KIND_COMPUTED,
- // --- computed properties ---
- computed.rect = globalRect;
- computed.localRect = localRect;
- computed.obb = null,
- // will be created by `ensureOBB` when using.
- computed.axisAligned = axisAligned;
- computed.transform = transform;
- return computed;
+ if (isLabelLayoutDirty(labelLayout)) {
+ computeLabelGeometry(labelLayout, labelLayout.label, labelLayout);
+ }
+ return labelLayout;
}
/**
- * The reverse operation of `ensureLabelLayoutInfoComputedv`.
+ * The props in `out` will be filled if existing, or created.
*/
- function rollbackToLabelLayoutInfoRaw(labelLayoutInfo) {
- if (labelLayoutInfo == null) {
- return;
- }
- var raw = labelLayoutInfo;
- raw.kind = LABEL_LAYOUT_INFO_KIND_RAW;
- return raw;
+ function computeLabelGeometry(out, label, opt) {
+ // [CAUTION] These props may be modified directly for performance consideration,
+ // therefore, do not output the internal data structure of zrender Element.
+ var rawTransform = label.getComputedTransform();
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ // NOTE: should call `getBoundingRect` after `getComputedTransform`, or may get an inaccurate bounding rect.
+ // The reason is that `getComputedTransform` calls `__host.updateInnerText()` internally, which updates the label
+ // by `textConfig` mounted on the host.
+ // PENDING: add a dirty bit for that in zrender?
+ var outLocalRect = out.localRect = ensureCopyRect(out.localRect, label.getBoundingRect());
+ var labelStyleExt = label.style;
+ var margin = labelStyleExt.margin;
+ var marginForce = opt && opt.marginForce;
+ var minMarginForce = opt && opt.minMarginForce;
+ var marginDefault = opt && opt.marginDefault;
+ var marginType = labelStyleExt.__marginType;
+ if (marginType == null && marginDefault) {
+ margin = marginDefault;
+ marginType = LabelMarginType.textMargin;
+ }
+ // `textMargin` and `minMargin` can not exist both.
+ for (var i = 0; i < 4; i++) {
+ _tmpLabelMargin[i] = marginType === LabelMarginType.minMargin && minMarginForce && minMarginForce[i] != null ? minMarginForce[i] : marginForce && marginForce[i] != null ? marginForce[i] : margin ? margin[i] : 0;
+ }
+ if (marginType === LabelMarginType.textMargin) {
+ expandOrShrinkRect(outLocalRect, _tmpLabelMargin, false, false);
+ }
+ var outGlobalRect = out.rect = ensureCopyRect(out.rect, outLocalRect);
+ if (rawTransform) {
+ outGlobalRect.applyTransform(rawTransform);
+ }
+ // Notice: label.style.margin is actually `minMargin / 2`, handled by `setTextStyleCommon`.
+ if (marginType === LabelMarginType.minMargin) {
+ expandOrShrinkRect(outGlobalRect, _tmpLabelMargin, false, false);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ (out.label = out.label || {}).ignore = label.ignore;
+ setLabelLayoutDirty(out, false);
+ setLabelLayoutDirty(out, true, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ // Do not remove `obb` (if existing) for reuse, just reset the dirty bit.
+ return out;
+ }
+ var _tmpLabelMargin = [0, 0, 0, 0];
+ /**
+ * The props in `out` will be filled if existing, or created.
+ */
+ function computeLabelGeometry2(out, rawLocalRect, rawTransform) {
+ out.transform = ensureCopyTransform(out.transform, rawTransform);
+ out.localRect = ensureCopyRect(out.localRect, rawLocalRect);
+ out.rect = ensureCopyRect(out.rect, rawLocalRect);
+ if (rawTransform) {
+ out.rect.applyTransform(rawTransform);
+ }
+ out.axisAligned = isBoundingRectAxisAligned(rawTransform);
+ out.obb = undefined; // Reset to undefined, will be created by `ensureOBB` when using.
+ (out.label = out.label || {}).ignore = false;
+ return out;
}
/**
- * This method supports that the label layout info is not computed until needed,
- * for performance consideration.
- *
- * [CAUTION]
- * - If the raw label is changed, must call
- * `ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(layoutInfo))`
- * to recreate the layout info.
- * - Null checking is needed for the result. @see prepareLabelLayoutInfo
- *
- * Usage:
- * To make a copy of labelLayoutInfo, simply:
- * const layoutInfoCopy = rollbackToLabelLayoutInfoRaw(extends({}, someLabelLayoutInfo));
+ * This is a shortcut of
+ * ```js
+ * labelLayout.label.x = newX;
+ * labelLayout.label.y = newY;
+ * setLabelLayoutDirty(labelLayout, true);
+ * ensureLabelLayoutWithGeometry(labelLayout);
+ * ```
+ * and provide better performance in this common case.
*/
- function ensureLabelLayoutInfoComputed(labelLayoutInfo) {
- if (!labelLayoutInfo) {
+ function labelLayoutApplyTranslation(labelLayout, offset) {
+ if (!labelLayout) {
return;
}
- if (labelLayoutInfo.kind !== LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- labelLayoutInfo = prepareLabelLayoutInfo(labelLayoutInfo);
+ labelLayout.label.x += offset.x;
+ labelLayout.label.y += offset.y;
+ labelLayout.label.markRedraw();
+ var transform = labelLayout.transform;
+ if (transform) {
+ transform[4] += offset.x;
+ transform[5] += offset.y;
+ }
+ var globalRect = labelLayout.rect;
+ if (globalRect) {
+ globalRect.x += offset.x;
+ globalRect.y += offset.y;
+ }
+ var obb = labelLayout.obb;
+ if (obb) {
+ obb.fromBoundingRect(labelLayout.localRect, transform);
}
- return labelLayoutInfo;
- }
- function prepareIntersectionCheckInfo(localRect, transform) {
- var globalRect = localRect.clone();
- globalRect.applyTransform(transform);
- return {
- obb: null,
- rect: globalRect,
- localRect: localRect,
- axisAligned: isBoundingRectAxisAligned(transform),
- transform: transform
- };
}
- function createSingleLayoutInfoComputed(el) {
- return ensureLabelLayoutInfoComputed({
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
- label: el,
- priority: el.z2,
- defaultAttr: {
- ignore: el.ignore
+ /**
+ * To duplicate or make a variation of a label layout.
+ * Copy the only relevant properties to avoid the conflict or wrongly reuse of the props of `LabelLayoutWithGeometry`.
+ */
+ function newLabelLayoutWithGeometry(newBaseWithDefaults, source) {
+ for (var i = 0; i < LABEL_LAYOUT_BASE_PROPS.length; i++) {
+ var prop = LABEL_LAYOUT_BASE_PROPS[i];
+ if (newBaseWithDefaults[prop] == null) {
+ newBaseWithDefaults[prop] = source[prop];
}
- });
+ }
+ return ensureLabelLayoutWithGeometry(newBaseWithDefaults);
}
/**
* Create obb if no one, can cache it.
*/
- function ensureOBB(layoutInfo) {
- return layoutInfo.obb || (layoutInfo.obb = new OrientedBoundingRect(layoutInfo.localRect, layoutInfo.transform));
+ function ensureOBB(labelGeometry) {
+ var obb = labelGeometry.obb;
+ if (!obb || isLabelLayoutDirty(labelGeometry, LABEL_LAYOUT_DIRTY_BIT_OBB)) {
+ labelGeometry.obb = obb = obb || new OrientedBoundingRect();
+ obb.fromBoundingRect(labelGeometry.localRect, labelGeometry.transform);
+ setLabelLayoutDirty(labelGeometry, false, LABEL_LAYOUT_DIRTY_BIT_OBB);
+ }
+ return obb;
}
/**
- * The input localRect is never modified.
- * The returned localRect maybe the input localRect.
+ * Adjust labels on x/y direction to avoid overlap.
+ *
+ * PENDING: the current implementation is based on the global bounding rect rather than the local rect,
+ * which may be not preferable in some edge cases when the label has rotation, but works for most cases,
+ * since rotation is unnecessary when there is sufficient space, while squeezing is applied regardless
+ * of overlapping when there is no enough space.
+ *
+ * NOTICE:
+ * - The input `list` and its content will be modified (sort, label.x/y, rect).
+ * - The caller should sync the modifications to the other parts by
+ * `setLabelLayoutDirty` and `ensureLabelLayoutWithGeometry` if needed.
+ *
+ * @return adjusted
*/
- function applyTextMarginToLocalRect(label, localRect) {
- if (label.style.__marginType !== LabelMarginType.textMargin) {
- return localRect;
- }
- var textMargin = normalizeCssArray$1(retrieve2(label.style.margin, [0, 0]));
- localRect = localRect.clone();
- expandOrShrinkRect(localRect, textMargin, false, false);
- return localRect;
- }
- function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
+ function shiftLayoutOnXY(list, xyDimIdx,
+ // 0 for x, 1 for y
+ minBound,
+ // for x, leftBound; for y, topBound
+ maxBound,
+ // for x, rightBound; for y, bottomBound
+ // If average the shifts on all labels and add them to 0
+ // TODO: Not sure if should enable it.
+ // Pros: The angle of lines will distribute more equally
+ // Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
+ balanceShift) {
var len = list.length;
+ var xyDim = XY$1[xyDimIdx];
+ var sizeDim = WH$1[xyDimIdx];
if (len < 2) {
- return;
+ return false;
}
list.sort(function (a, b) {
return a.rect[xyDim] - b.rect[xyDim];
@@ -34528,6 +34640,7 @@
var lastPos = 0;
var delta;
var adjusted = false;
+ // const shifts = [];
var totalShifts = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
@@ -34540,6 +34653,7 @@
adjusted = true;
}
var shift = Math.max(-delta, 0);
+ // shifts.push(shift);
totalShifts += shift;
lastPos = rect[xyDim] + rect[sizeDim];
}
@@ -34652,22 +34766,16 @@
return adjusted;
}
/**
- * Adjust labels on y direction to avoid overlap.
- */
- function shiftLayoutOnY(list, topBound, bottomBound,
- // If average the shifts on all labels and add them to 0
- balanceShift) {
- return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
- }
- /**
- * [CAUTION]: the `label.ignore` in the input is not necessarily falsy.
- * this method checks intersection regardless of current `ignore`,
- * if no intersection, restore the `ignore` to `defaultAttr.ignore`.
- * And `labelList` will be modified.
- * Therefore, if some other overlap resolving strategy has ignored some elements,
- * do not input them to this method.
- * PENDING: review the diff between the requirements from LabelManager and AxisBuilder,
- * and uniform the behavior?
+ * [NOTICE - restore]:
+ * 'series:layoutlabels' may be triggered during some shortcut passes, such as zooming in series.graph/geo
+ * (`updateLabelLayout`), where the modified `Element` props should be restorable from `defaultAttr`.
+ * @see `SavedLabelAttr` in `LabelManager.ts`
+ * `restoreIgnore` can be called to perform the restore, if needed.
+ *
+ * [NOTICE - state]:
+ * Regarding Element's states, this method is only designed for the normal state.
+ * PENDING: although currently this method is effectively called in other states in `updateLabelLayout` case,
+ * the bad case is not noticeable in the zooming scenario.
*/
function hideOverlap(labelList) {
var displayedLabels = [];
@@ -34686,8 +34794,10 @@
el.ignore = true;
}
for (var i = 0; i < labelList.length; i++) {
- var labelItem = ensureLabelLayoutInfoComputed(labelList[i]);
- if (!labelItem || labelItem.label.ignore) {
+ var labelItem = ensureLabelLayoutWithGeometry(labelList[i]);
+ // The current `el.ignore` is involved, since some previous overlap
+ // resolving strategies may have set `el.ignore` to true.
+ if (labelItem.label.ignore) {
continue;
}
var label = labelItem.label;
@@ -34710,24 +34820,24 @@
hideEl(label);
labelLine && hideEl(labelLine);
} else {
- label.attr('ignore', labelItem.defaultAttr.ignore);
- labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
displayedLabels.push(labelItem);
}
}
}
/**
- * [NOTICE]:
- * - `label.ignore` is not considered - no requirement so far.
- * - `baseLayoutInfo` and `targetLayoutInfo` may be modified - obb may be created and saved.
- *
* Enable fast check for performance; use obb if inevitable.
* If `mtv` is used, `targetLayoutInfo` can be moved based on the values filled into `mtv`.
+ *
+ * This method is based only on the current `Element` states (regardless of other states).
+ * Typically this method (and the entire layout process) is performed in normal state.
*/
function labelIntersect(baseLayoutInfo, targetLayoutInfo, mtv, intersectOpt) {
if (!baseLayoutInfo || !targetLayoutInfo) {
return false;
}
+ if (baseLayoutInfo.label && baseLayoutInfo.label.ignore || targetLayoutInfo.label && targetLayoutInfo.label.ignore) {
+ return false;
+ }
// Fast rejection.
if (!baseLayoutInfo.rect.intersect(targetLayoutInfo.rect, mtv, intersectOpt)) {
return false;
@@ -39703,7 +39813,7 @@
list[i].label.x = farthestX;
}
}
- if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
+ if (shiftLayoutOnXY(list, 1, viewTop, viewTop + viewHeight)) {
recalculateX(list);
}
}
@@ -39754,7 +39864,7 @@
}
}
layout.targetTextWidth = targetTextWidth;
- constrainTextWidth(layout, targetTextWidth);
+ constrainTextWidth(layout, targetTextWidth, false);
}
}
adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
@@ -39800,9 +39910,6 @@
* which case, previous wrapping should be redo.
*/
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
- if (forceRecalculate === void 0) {
- forceRecalculate = false;
- }
if (layout.labelStyleWidth != null) {
// User-defined style.width has the highest priority.
return;
@@ -39817,7 +39924,6 @@
// textRect.width already contains paddingH if bgColor is set
var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
if (availableWidth < oldOuterWidth || forceRecalculate) {
- var oldHeight = textRect.height;
if (overflow && overflow.match('break')) {
// Temporarily set background to be null to calculate
// the bounding box without background.
@@ -39849,13 +39955,18 @@
: null;
label.setStyle('width', newWidth);
}
- var newRect = label.getBoundingRect();
- textRect.width = newRect.width;
- var margin = (label.style.margin || 0) + 2.1;
- textRect.height = newRect.height + margin;
- textRect.y -= (textRect.height - oldHeight) / 2;
+ computeLabelGlobalRect(textRect, label);
}
}
+ function computeLabelGlobalRect(out, label) {
+ _tmpLabelGeometry.rect = out;
+ computeLabelGeometry(_tmpLabelGeometry, label, _computeLabelGeometryOpt);
+ }
+ var _computeLabelGeometryOpt = {
+ minMarginForce: [null, 0, null, 0],
+ marginDefault: [1, 0, 1, 0]
+ };
+ var _tmpLabelGeometry = {};
function isPositionCenter(sectorShape) {
// Not change x for center label
return sectorShape.position === 'center';
@@ -39987,12 +40098,8 @@
});
// Not sectorShape the inside label
if (!isLabelInside) {
- var textRect = label.getBoundingRect().clone();
- textRect.applyTransform(label.getComputedTransform());
- // Text has a default 1px stroke. Exclude this.
- var margin = (label.style.margin || 0) + 2.1;
- textRect.y -= margin / 2;
- textRect.height += margin;
+ var textRect = new BoundingRect(0, 0, 0, 0);
+ computeLabelGlobalRect(textRect, label);
labelLayoutList.push({
label: label,
labelLine: labelLine,
@@ -41228,17 +41335,15 @@
var AXIS_BREAK_EXPAND_ACTION_TYPE = 'expandAxisBreak';
var PI$4 = Math.PI;
- // This tune is also for backward compat, since nameMoveOverlap is set as default,
- // in compact layout (multiple charts in one canvas), name should be more close to the axis line and labels.
- var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2], [5, 3], [8, 3]];
- var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1], [0, 3], [0, 3]];
+ var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]];
+ var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]];
var getLabelInner = makeInner();
var getTickInner = makeInner();
/**
* A context shared by difference axisBuilder instances.
* For cross-axes overlap resolving.
*
- * Lifecycle constrait: should not over a pass of ec main process.
+ * Lifecycle constraint: should not over a pass of ec main process.
* If model is changed, the context must be disposed.
*
* @see AxisBuilderLocalContext
@@ -41268,14 +41373,14 @@
* (such as `hideOverlap`, `fixMinMaxLabelShow`) and after transform calculating.
* 2. Can be called multiple times and should be idempotent.
*/
- function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutInfoList) {
+ function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) {
var axis = axisModel.axis;
var record = shared.ensureRecord(axisModel);
var labelInfoList = [];
var stOccupiedRect;
var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation);
- each(labelLayoutInfoList, function (layout) {
- var layoutInfo = ensureLabelLayoutInfoComputed(layout);
+ each(labelLayoutList, function (layout) {
+ var layoutInfo = ensureLabelLayoutWithGeometry(layout);
if (!layoutInfo || layoutInfo.label.ignore) {
return;
}
@@ -41319,7 +41424,7 @@
if (isNameLocationCenter(cfg.nameLocation)) {
var stOccupiedRect = thisRecord.stOccupiedRect;
if (stOccupiedRect) {
- moveIfOverlap(prepareIntersectionCheckInfo(stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
+ moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec);
}
} else {
moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec);
@@ -41333,8 +41438,7 @@
bidirectional: false,
touchThreshold: 0.05
})) {
- Point.add(movableLayoutInfo.label, movableLayoutInfo.label, mtv);
- ensureLabelLayoutInfoComputed(rollbackToLabelLayoutInfoRaw(movableLayoutInfo));
+ labelLayoutApplyTranslation(movableLayoutInfo, mtv);
}
}
function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) {
@@ -41613,7 +41717,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate);
}
},
/**
@@ -41627,7 +41731,7 @@
}
var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams);
if (needCallLayout) {
- axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
+ layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine);
}
var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel);
syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls);
@@ -41712,14 +41816,6 @@
fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
align: textStyleModel.get('align') || labelLayout.textAlign,
verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
- }, {
- defaultTextMargin: isNameLocationCenter(nameLocation)
- // Make axis name visually far from axis labels.
- // (but not too aggressive, consider multiple small charts)
- ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
- // top/button margin is set to `0` to inserted the xAxis name into the indention
- // above the axis labels to save space. (see example below.)
- : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
}),
z2: 1
});
@@ -41740,7 +41836,20 @@
transformGroup.add(textEl);
textEl.updateTransform();
local.nameEl = textEl;
- var nameLayout = sharedRecord.nameLayout = createSingleLayoutInfoComputed(textEl);
+ var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({
+ label: textEl,
+ priority: textEl.z2,
+ defaultAttr: {
+ ignore: textEl.ignore
+ },
+ marginDefault: isNameLocationCenter(nameLocation)
+ // Make axis name visually far from axis labels.
+ // (but not too aggressive, consider multiple small charts)
+ ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel]
+ // top/button margin is set to `0` to inserted the xAxis name into the indention
+ // above the axis labels to save space. (see example below.)
+ : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel]
+ });
sharedRecord.nameLocation = nameLocation;
group.add(textEl);
textEl.decomposeTransform();
@@ -41753,7 +41862,7 @@
}
}
};
- function axisTickLabelLayout(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
+ function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) {
if (!axisLabelBuildResultExists(local)) {
buildAxisLabel(cfg, local, group, kind, axisModel, api);
}
@@ -41813,53 +41922,47 @@
// Have not consider onBand yet, where tick els is more than label els.
// Assert no ignore in labels.
function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) {
- var outmostLabelLayout = labelLayoutList[outmostLabelIdx];
- var innerLabelLayout = labelLayoutList[innerLabelIdx];
+ var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]);
+ var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]);
if (!outmostLabelLayout || !innerLabelLayout) {
return;
}
- if (showMinMaxLabel === false) {
+ if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) {
ignoreEl(outmostLabelLayout.label);
+ return;
+ }
+ if (innerLabelLayout.suggestIgnore) {
+ ignoreEl(innerLabelLayout.label);
+ return;
}
- // PENDING: Originally we thougth `optionHideOverlap === false` means do not hide anything,
+ // PENDING: Originally we thought `optionHideOverlap === false` means do not hide anything,
// since currently the bounding rect of text might not accurate enough and might slightly bigger,
// which causes false positive. But `optionHideOverlap: null/undfined` is falsy and likely
// be treated as false.
- else {
- // In most fonts the glyph does not reach the boundary of the bouding rect.
- // This is needed to avoid too aggressive to hide two elements that meet at the edge
- // due to compact layout by the same bounding rect or OBB.
- var touchThreshold = 0.1;
- // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
- // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
- // should be conservative, since the space might be sufficient in this case.
- var ignoreMargin = !optionHideOverlap;
- if (ignoreMargin) {
- // Make a copy to apply `ignoreMargin`.
- outmostLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, outmostLabelLayout));
- innerLabelLayout = rollbackToLabelLayoutInfoRaw(defaults({
- ignoreMargin: ignoreMargin
- }, innerLabelLayout));
- }
- var anyIgnored = false;
- if (outmostLabelLayout.suggestIgnore) {
- ignoreEl(outmostLabelLayout.label);
- anyIgnored = true;
- }
- if (innerLabelLayout.suggestIgnore) {
+ // In most fonts the glyph does not reach the boundary of the bounding rect.
+ // This is needed to avoid too aggressive to hide two elements that meet at the edge
+ // due to compact layout by the same bounding rect or OBB.
+ var touchThreshold = 0.1;
+ // This treatment is for backward compatibility. And `!optionHideOverlap` implies that
+ // the user accepts the visual touch between adjacent labels, thus "hide min/max label"
+ // should be conservative, since the space might be sufficient in this case.
+ if (!optionHideOverlap) {
+ var marginForce = [0, 0, 0, 0];
+ // Make a copy to apply `ignoreMargin`.
+ outmostLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, outmostLabelLayout);
+ innerLabelLayout = newLabelLayoutWithGeometry({
+ marginForce: marginForce
+ }, innerLabelLayout);
+ }
+ if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, {
+ touchThreshold: touchThreshold
+ })) {
+ if (showMinMaxLabel) {
ignoreEl(innerLabelLayout.label);
- anyIgnored = true;
- }
- if (!anyIgnored && labelIntersect(ensureLabelLayoutInfoComputed(outmostLabelLayout), ensureLabelLayoutInfoComputed(innerLabelLayout), null, {
- touchThreshold: touchThreshold
- })) {
- if (showMinMaxLabel) {
- ignoreEl(innerLabelLayout.label);
- } else {
- ignoreEl(outmostLabelLayout.label);
- }
+ } else {
+ ignoreEl(outmostLabelLayout.label);
}
}
}
@@ -41872,7 +41975,7 @@
deal(showMinLabel, 0, 1);
deal(showMaxLabel, labelsLen - 1, labelsLen - 2);
}
- // PENDING: is it necessary to display a tick while the cooresponding label is ignored?
+ // PENDING: Is it necessary to display a tick while the corresponding label is ignored?
function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) {
if (cfg.showMinorTicks) {
// It probably unreaasonable to hide major ticks when show minor ticks.
@@ -41979,7 +42082,7 @@
}
}
}
- // Return whether need to call `axisTickLabelLayout` again.
+ // Return whether need to call `layOutAxisTickLabel` again.
function dealLastTickLabelResultReusable(local, group, extraParams) {
if (axisLabelBuildResultExists(local)) {
var axisLabelsCreationContext = local.axisLabelsCreationContext;
@@ -42115,7 +42218,6 @@
});
var labelLayoutList = map(labelEls, function (label) {
return {
- kind: LABEL_LAYOUT_INFO_KIND_RAW,
label: label,
priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) // Make break labels be highest priority.
: label.z2,
@@ -42126,7 +42228,7 @@
});
axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx);
}
- // Indicate that `axisTickLabelLayout` has been called.
+ // Indicate that `layOutAxisTickLabel` has been called.
function axisLabelBuildResultExists(local) {
return !!local.labelLayoutList;
}
@@ -42138,14 +42240,15 @@
}
function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) {
var labelMargin = axisModel.get(['axisLabel', 'margin']);
- each(labelLayoutList, function (layoutInfo, idx) {
- if (!layoutInfo) {
+ each(labelLayoutList, function (layout, idx) {
+ var geometry = ensureLabelLayoutWithGeometry(layout);
+ if (!geometry) {
return;
}
- var labelEl = layoutInfo.label;
+ var labelEl = geometry.label;
var inner = getLabelInner(labelEl);
// See the comment in `suggestIgnore`.
- layoutInfo.suggestIgnore = labelEl.ignore;
+ geometry.suggestIgnore = labelEl.ignore;
// Currently no `ignore:true` is set in `buildAxisLabel`
// But `ignore:true` may be set subsequently for overlap handling, thus reset it here.
labelEl.ignore = false;
@@ -42159,9 +42262,8 @@
_tmpLayoutEl.decomposeTransform();
copyTransform(labelEl, _tmpLayoutEl);
labelEl.markRedraw();
- if (layoutInfo.kind === LABEL_LAYOUT_INFO_KIND_COMPUTED) {
- rollbackToLabelLayoutInfoRaw(layoutInfo);
- }
+ setLabelLayoutDirty(geometry, true);
+ ensureLabelLayoutWithGeometry(geometry);
});
}
var _tmpLayoutEl = new Rect();
@@ -42870,7 +42972,7 @@
// Assume `updateAllAxisExtentTransByGridRect` has been performed once before this call.
// [NOTE]:
// - The bounding rect of the axis elements might be sensitve to variations in `axis.extent` due to strategies
- // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutInfoBase['suggestIgnore']`.
+ // like hideOverlap/moveOverlap. @see the comment in `LabelLayoutBase['suggestIgnore']`.
// - The final `gridRect` might be slightly smaller than the ideally expected result if labels are giant and
// get hidden due to overlapping. More iterations could improve precision, but not performant. We consider
// the current result acceptable, since no alignment among charts can be guaranteed when using this feature.
diff --git a/dist/echarts.simple.js.map b/dist/echarts.simple.js.map
index 5ba6339a4..ea51723e0 100644
--- a/dist/echarts.simple.js.map
+++ b/dist/echarts.simple.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.simple.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/co [...]
\ No newline at end of file
+{"version":3,"file":"echarts.simple.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/zrender/lib/core/env.js","../node_modules/zrender/lib/core/platform.js","../node_modules/zrender/lib/core/util.js","../node_modules/zrender/lib/core/vector.js","../node_modules/zrender/lib/mixin/Draggable.js","../node_modules/zrender/lib/core/Eventful.js","../node_modules/zrender/lib/core/fourPointsTransform.js","../node_modules/zrender/lib/core/dom.js","../node_modules/zrender/lib/co [...]
\ No newline at end of file
diff --git a/dist/echarts.simple.min.js b/dist/echarts.simple.min.js
index a0f3b227f..dd77bf35b 100644
--- a/dist/echarts.simple.min.js
+++ b/dist/echarts.simple.min.js
@@ -42,4 +42,4 @@
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
-var kr={},Cr={};var Dr,Ir=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new rn,a=n.renderer||"canvas";kr[a]||(a=F(kr)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new kr[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=r.node||r.worker||l?null:new Vi(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
+var kr={},Cr={};var Dr,Ir=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var o=new rn,a=n.renderer||"canvas";kr[a]||(a=F(kr)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var s=new kr[a](e,o,n,t),l=n.ssr||s.ssrOnly;this.storage=o,this.painter=s;var u,h=r.node||r.worker||l?null:new Vi(s.getViewportRoot(),s.root),c=n.useCoarsePointer;(null==c|| [...]
diff --git a/i18n/langEL-obj.js b/i18n/langEL-obj.js
new file mode 100644
index 000000000..73bf19476
--- /dev/null
+++ b/i18n/langEL-obj.js
@@ -0,0 +1,175 @@
+
+
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+/**
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
+ */
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['exports'], factory);
+ } else if (
+ typeof exports === 'object' &&
+ typeof exports.nodeName !== 'string'
+ ) {
+ // CommonJS
+ factory(exports);
+ } else {
+ // Browser globals
+ factory({});
+ }
+})(this, function(exports) {
+
+
+/**
+ * Language: Greek.
+ */
+
+var localeObj = {
+ time: {
+ month: [
+ 'Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος',
+ 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'
+ ],
+ monthAbbr: [
+ 'Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν',
+ 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'
+ ],
+ dayOfWeek: [
+ 'Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'
+ ],
+ dayOfWeekAbbr: [
+ 'Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'
+ ]
+ },
+ legend: {
+ selector: {
+ all: 'Όλα',
+ inverse: 'Αντιστροφή'
+ }
+ },
+ toolbox: {
+ brush: {
+ title: {
+ rect: 'Επιλογή με πλαίσιο',
+ polygon: 'Επιλογή με λάσο',
+ lineX: 'Οριζόντια επιλογή',
+ lineY: 'Κατακόρυφη επιλογή',
+ keep: 'Διατήρηση επιλογών',
+ clear: 'Καθαρισμός επιλογών'
+ }
+ },
+ dataView: {
+ title: 'Προβολή δεδομένων',
+ lang: ['Προβολή δεδομένων', 'Κλείσιμο', 'Ανανένωση']
+ },
+ dataZoom: {
+ title: {
+ zoom: 'Μεγέθυνση',
+ back: 'Επαναφορά μεγέθυνσης'
+ }
+ },
+ magicType: {
+ title: {
+ line: 'Αλλαγή σε γραμμικό διάγραμμα',
+ bar: 'Αλλαγή σε ραβδογράφημα',
+ stack: 'Στοίβα',
+ tiled: 'Πλακίδια'
+ }
+ },
+ restore: {
+ title: 'Επαναφορά'
+ },
+ saveAsImage: {
+ title: 'Αποθήκευση ως εικόνα',
+ lang: ['Δεξί κλικ για αποθήκευση εικόνας']
+ }
+ },
+ series: {
+ typeNames: {
+ pie: 'Γράφημα πίτας',
+ bar: 'Ραβδογράφημα',
+ line: 'Γραμμικό διάγραμμα',
+ scatter: 'Διάγραμμα διασποράς',
+ effectScatter: 'Διάγραμμα διασποράς με κυματισμό',
+ radar: 'Διάγραμμα ραντάρ',
+ tree: 'Δενδρόγραμμα',
+ treemap: 'Διάγραμμα διαμερισματοποίησης',
+ boxplot: 'Γράφημα πλαισίου-απολήξεων',
+ candlestick: 'Διάγραμμα κηροπηγίων',
+ k: 'Διάγραμμα Κ',
+ heatmap: 'Θερμικός χάρτης',
+ map: 'Χάρτης',
+ parallel: 'Χάρτης παράλληλων συντεταγμένων',
+ lines: 'Γράφημα γραμμών',
+ graph: 'Γράφος σχέσεων',
+ sankey: 'Διάγραμμα Sankey',
+ funnel: 'Διάγραμμα χωνιού',
+ gauge: 'Διάγραμμα μετρητή',
+ pictorialBar: 'Εικονογραφικό ραβδογράφημα',
+ themeRiver: 'Γράφημα Ροής Κατηγοριών',
+ sunburst: 'Γράφημα Ιεραρχικών Δακτυλίων',
+ custom: 'Προσαρμοσμένο διάγραμμα',
+ chart: 'Διάγραμμα'
+ }
+ },
+ aria: {
+ general: {
+ withTitle: 'Αυτό είναι ένα διάγραμμα με τίτλο "{title}"',
+ withoutTitle: 'Αυτό είναι ένα διάγραμμα'
+ },
+ series: {
+ single: {
+ prefix: '',
+ withName: ' με τύπο {seriesType} και όνομα {seriesName}.',
+ withoutName: ' με τύπο {seriesType}.'
+ },
+ multiple: {
+ prefix: '. Αποτελείται από {seriesCount} σειρές δεδομένων.',
+ withName: ' Η σειρά {seriesId} είναι {seriesType} με όνομα {seriesName}.',
+ withoutName: ' Η σειρά {seriesId} είναι {seriesType}.',
+ separator: {
+ middle: '',
+ end: ''
+ }
+ }
+ },
+ data: {
+ allData: 'Τα δεδομένα είναι τα εξής:',
+ partialData: 'Τα πρώτα {displayCnt} στοιχεία είναι: ',
+ withName: 'τα δεδομένα για {name} είναι {value}',
+ withoutName: '{value}',
+ separator: {
+ middle: ', ',
+ end: '. '
+ }
+ }
+ }
+};
+
+ for (var key in localeObj) {
+ if (localeObj.hasOwnProperty(key)) {
+ exports[key] = localeObj[key];
+ }
+ }
+
+});
\ No newline at end of file
diff --git a/i18n/langEL.js b/i18n/langEL.js
new file mode 100644
index 000000000..875f391d8
--- /dev/null
+++ b/i18n/langEL.js
@@ -0,0 +1,171 @@
+
+
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+/**
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
+ */
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['exports', 'echarts'], factory);
+ } else if (
+ typeof exports === 'object' &&
+ typeof exports.nodeName !== 'string'
+ ) {
+ // CommonJS
+ factory(exports, require('echarts/lib/echarts'));
+ } else {
+ // Browser globals
+ factory({}, root.echarts);
+ }
+})(this, function(exports, echarts) {
+
+
+/**
+ * Language: Greek.
+ */
+
+var localeObj = {
+ time: {
+ month: [
+ 'Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος',
+ 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'
+ ],
+ monthAbbr: [
+ 'Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν',
+ 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'
+ ],
+ dayOfWeek: [
+ 'Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'
+ ],
+ dayOfWeekAbbr: [
+ 'Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'
+ ]
+ },
+ legend: {
+ selector: {
+ all: 'Όλα',
+ inverse: 'Αντιστροφή'
+ }
+ },
+ toolbox: {
+ brush: {
+ title: {
+ rect: 'Επιλογή με πλαίσιο',
+ polygon: 'Επιλογή με λάσο',
+ lineX: 'Οριζόντια επιλογή',
+ lineY: 'Κατακόρυφη επιλογή',
+ keep: 'Διατήρηση επιλογών',
+ clear: 'Καθαρισμός επιλογών'
+ }
+ },
+ dataView: {
+ title: 'Προβολή δεδομένων',
+ lang: ['Προβολή δεδομένων', 'Κλείσιμο', 'Ανανένωση']
+ },
+ dataZoom: {
+ title: {
+ zoom: 'Μεγέθυνση',
+ back: 'Επαναφορά μεγέθυνσης'
+ }
+ },
+ magicType: {
+ title: {
+ line: 'Αλλαγή σε γραμμικό διάγραμμα',
+ bar: 'Αλλαγή σε ραβδογράφημα',
+ stack: 'Στοίβα',
+ tiled: 'Πλακίδια'
+ }
+ },
+ restore: {
+ title: 'Επαναφορά'
+ },
+ saveAsImage: {
+ title: 'Αποθήκευση ως εικόνα',
+ lang: ['Δεξί κλικ για αποθήκευση εικόνας']
+ }
+ },
+ series: {
+ typeNames: {
+ pie: 'Γράφημα πίτας',
+ bar: 'Ραβδογράφημα',
+ line: 'Γραμμικό διάγραμμα',
+ scatter: 'Διάγραμμα διασποράς',
+ effectScatter: 'Διάγραμμα διασποράς με κυματισμό',
+ radar: 'Διάγραμμα ραντάρ',
+ tree: 'Δενδρόγραμμα',
+ treemap: 'Διάγραμμα διαμερισματοποίησης',
+ boxplot: 'Γράφημα πλαισίου-απολήξεων',
+ candlestick: 'Διάγραμμα κηροπηγίων',
+ k: 'Διάγραμμα Κ',
+ heatmap: 'Θερμικός χάρτης',
+ map: 'Χάρτης',
+ parallel: 'Χάρτης παράλληλων συντεταγμένων',
+ lines: 'Γράφημα γραμμών',
+ graph: 'Γράφος σχέσεων',
+ sankey: 'Διάγραμμα Sankey',
+ funnel: 'Διάγραμμα χωνιού',
+ gauge: 'Διάγραμμα μετρητή',
+ pictorialBar: 'Εικονογραφικό ραβδογράφημα',
+ themeRiver: 'Γράφημα Ροής Κατηγοριών',
+ sunburst: 'Γράφημα Ιεραρχικών Δακτυλίων',
+ custom: 'Προσαρμοσμένο διάγραμμα',
+ chart: 'Διάγραμμα'
+ }
+ },
+ aria: {
+ general: {
+ withTitle: 'Αυτό είναι ένα διάγραμμα με τίτλο "{title}"',
+ withoutTitle: 'Αυτό είναι ένα διάγραμμα'
+ },
+ series: {
+ single: {
+ prefix: '',
+ withName: ' με τύπο {seriesType} και όνομα {seriesName}.',
+ withoutName: ' με τύπο {seriesType}.'
+ },
+ multiple: {
+ prefix: '. Αποτελείται από {seriesCount} σειρές δεδομένων.',
+ withName: ' Η σειρά {seriesId} είναι {seriesType} με όνομα {seriesName}.',
+ withoutName: ' Η σειρά {seriesId} είναι {seriesType}.',
+ separator: {
+ middle: '',
+ end: ''
+ }
+ }
+ },
+ data: {
+ allData: 'Τα δεδομένα είναι τα εξής:',
+ partialData: 'Τα πρώτα {displayCnt} στοιχεία είναι: ',
+ withName: 'τα δεδομένα για {name} είναι {value}',
+ withoutName: '{value}',
+ separator: {
+ middle: ', ',
+ end: '. '
+ }
+ }
+ }
+};
+
+ echarts.registerLocale('EL', localeObj);
+
+});
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index e3b9b6a8d..14d763dcd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,16 +1,16 @@
{
"name": "echarts",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "echarts",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.3.0",
- "zrender": "6.0.0-rc.1"
+ "zrender": "6.0.0"
},
"devDependencies": {
"@babel/code-frame": "7.10.4",
@@ -11798,9 +11798,9 @@
"optional": true
},
"node_modules/zrender": {
- "version": "6.0.0-rc.1",
- "resolved": "https://registry.npmjs.org/zrender/-/zrender-6.0.0-rc.1.tgz",
- "integrity": "sha512-DWYxDvSHb69PlZ9bs2C4NHt0xHMojHztGForDFAiNSzw9XDwycwXAhJydFrNyq/vy0I8usTZ+KbtZyrX+6ePJQ==",
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/zrender/-/zrender-6.0.0.tgz",
+ "integrity": "sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==",
"license": "BSD-3-Clause",
"dependencies": {
"tslib": "2.3.0"
@@ -20568,9 +20568,9 @@
}
},
"zrender": {
- "version": "6.0.0-rc.1",
- "resolved": "https://registry.npmjs.org/zrender/-/zrender-6.0.0-rc.1.tgz",
- "integrity": "sha512-DWYxDvSHb69PlZ9bs2C4NHt0xHMojHztGForDFAiNSzw9XDwycwXAhJydFrNyq/vy0I8usTZ+KbtZyrX+6ePJQ==",
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/zrender/-/zrender-6.0.0.tgz",
+ "integrity": "sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==",
"requires": {
"tslib": "2.3.0"
}
diff --git a/package.json b/package.json
index 73246c2fe..8d6ffd99c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "echarts",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0",
"description": "Apache ECharts is a powerful, interactive charting and data visualization library for browser",
"license": "Apache-2.0",
"keywords": [
@@ -65,7 +65,7 @@
},
"dependencies": {
"tslib": "2.3.0",
- "zrender": "6.0.0-rc.1"
+ "zrender": "6.0.0"
},
"devDependencies": {
"@babel/code-frame": "7.10.4",
diff --git a/src/core/echarts.ts b/src/core/echarts.ts
index fe5b995ec..b37012ae3 100644
--- a/src/core/echarts.ts
+++ b/src/core/echarts.ts
@@ -144,10 +144,10 @@ declare let global: any;
type ModelFinder = modelUtil.ModelFinder;
-export const version = '6.0.0-beta.1';
+export const version = '6.0.0';
export const dependencies = {
- zrender: '6.0.0-rc.1'
+ zrender: '6.0.0'
};
const TEST_FRAME_REMAIN_TIME = 1;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org