tvcharts 0.9.25 → 0.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -181,7 +181,7 @@ var BoxesLayout = {
|
|
|
181
181
|
text: text,
|
|
182
182
|
text_color: text_color,
|
|
183
183
|
text_wrap: text_wrap,
|
|
184
|
-
text_size: getFontSize(text_size, text, width_1 - Math.floor(width_1 /
|
|
184
|
+
text_size: getFontSize(text_size, text, width_1 - Math.floor(width_1 / 10), font, height - Math.min(minBoxSize / 2, 10)),
|
|
185
185
|
align: align,
|
|
186
186
|
v_align: v_align,
|
|
187
187
|
width: width_1,
|
|
@@ -57,6 +57,14 @@ function getLineDashByLineStyle(lineStyle) {
|
|
|
57
57
|
}
|
|
58
58
|
return 'solid';
|
|
59
59
|
}
|
|
60
|
+
function getTextOffset(text, fontSize) {
|
|
61
|
+
var hasChinese = /[\u4e00-\u9fa5]/.test(text);
|
|
62
|
+
if (hasChinese) {
|
|
63
|
+
return fontSize * 0.09; // 中文需要较多下移
|
|
64
|
+
}
|
|
65
|
+
// 纯英文/数字通常只需要极小位移或不位移
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
60
68
|
var BoxesView = /** @class */function (_super) {
|
|
61
69
|
__extends(BoxesView, _super);
|
|
62
70
|
function BoxesView() {
|
|
@@ -142,7 +150,7 @@ var BoxesView = /** @class */function (_super) {
|
|
|
142
150
|
y: item.y + 2
|
|
143
151
|
});
|
|
144
152
|
if (item.v_align === 'middle') {
|
|
145
|
-
el.y = item.y - Math.min(el.getBoundingRect().height, item.height) / 2;
|
|
153
|
+
el.y = item.y - Math.min(el.getBoundingRect().height, item.height) / 2 + getTextOffset(item.text, item.text_size);
|
|
146
154
|
} else if (item.v_align === 'bottom') {
|
|
147
155
|
el.y = item.y - Math.min(el.getBoundingRect().height, item.height) - 2;
|
|
148
156
|
}
|
package/lib/chart/boxes/util.js
CHANGED
|
@@ -47,6 +47,8 @@ import ChartView from '../../view/Chart.js';
|
|
|
47
47
|
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
|
|
48
48
|
import NormalBoxPath from './NormalBoxPath.js';
|
|
49
49
|
import WickPath from './WickPath.js';
|
|
50
|
+
import { getECData } from '../../util/innerStore.js';
|
|
51
|
+
import { toggleHoverEmphasis } from '../../util/states.js';
|
|
50
52
|
// const SKIP_PROPS = ['color', 'borderColor'] as const;
|
|
51
53
|
var CandlePlotView = /** @class */function (_super) {
|
|
52
54
|
__extends(CandlePlotView, _super);
|
|
@@ -125,10 +127,9 @@ var CandlePlotView = /** @class */function (_super) {
|
|
|
125
127
|
} else {
|
|
126
128
|
this.group.removeClipPath();
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
toggleHoverEmphasis(this.group, null, null, false);
|
|
131
|
+
getECData(this.group).groupId = groupId;
|
|
130
132
|
};
|
|
131
|
-
|
|
132
133
|
CandlePlotView.prototype.remove = function (ecModel) {
|
|
133
134
|
this._clear();
|
|
134
135
|
};
|
package/lib/core/echarts.js
CHANGED
|
@@ -1001,6 +1001,11 @@ var ECharts = /** @class */function (_super) {
|
|
|
1001
1001
|
else if (ecData.eventData) {
|
|
1002
1002
|
params = extend({}, ecData.eventData);
|
|
1003
1003
|
return true;
|
|
1004
|
+
} else if (ecData.groupId) {
|
|
1005
|
+
params = {
|
|
1006
|
+
groupId: ecData.groupId
|
|
1007
|
+
};
|
|
1008
|
+
return true;
|
|
1004
1009
|
}
|
|
1005
1010
|
}, true);
|
|
1006
1011
|
}
|
|
@@ -1012,6 +1017,12 @@ var ECharts = /** @class */function (_super) {
|
|
|
1012
1017
|
// }
|
|
1013
1018
|
// Otherwise event query can not work.
|
|
1014
1019
|
if (params) {
|
|
1020
|
+
if (params.groupId) {
|
|
1021
|
+
params.event = e;
|
|
1022
|
+
params.type = eveName;
|
|
1023
|
+
_this.trigger(eveName, params);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1015
1026
|
var componentType = params.componentType;
|
|
1016
1027
|
var componentIndex = params.componentIndex;
|
|
1017
1028
|
// Special handling for historic reason: when trigger by
|
|
@@ -2193,7 +2204,7 @@ var ECharts = /** @class */function (_super) {
|
|
|
2193
2204
|
markStatusToUpdate(ecIns);
|
|
2194
2205
|
}
|
|
2195
2206
|
}).on('mousedown', function (e) {
|
|
2196
|
-
if (e.event.zrByTouch) {
|
|
2207
|
+
if (e.event.zrByTouch || e.event.button) {
|
|
2197
2208
|
return;
|
|
2198
2209
|
}
|
|
2199
2210
|
var el = e.target;
|
package/lib/util/states.js
CHANGED
|
@@ -574,11 +574,11 @@ export function handleGlobalMouseDownForHighDown(dispatcher, e, api) {
|
|
|
574
574
|
if (highlightDisabled) {
|
|
575
575
|
return;
|
|
576
576
|
}
|
|
577
|
-
e.event.stopPropagation();
|
|
577
|
+
// e.event.stopPropagation();
|
|
578
578
|
api.setSelectedComponentGroupId(groupId);
|
|
579
579
|
return true;
|
|
580
580
|
} else if (oldSelectedComponentGroupId) {
|
|
581
|
-
e.event.stopPropagation();
|
|
581
|
+
// e.event.stopPropagation();
|
|
582
582
|
api.setSelectedComponentGroupId('');
|
|
583
583
|
return true;
|
|
584
584
|
}
|