tvcharts 0.9.26 → 0.9.28
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 '../candlePlot/NormalBoxPath.js';
|
|
49
49
|
import WickPath from '../candlePlot/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 HeikinAshiView = /** @class */function (_super) {
|
|
52
54
|
__extends(HeikinAshiView, _super);
|
|
@@ -125,10 +127,9 @@ var HeikinAshiView = /** @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
|
HeikinAshiView.prototype.remove = function (ecModel) {
|
|
133
134
|
this._clear();
|
|
134
135
|
};
|