tvcharts 0.9.31 → 0.9.33

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.
@@ -274,23 +274,23 @@ var volPathLayout = {
274
274
  if (isBuyAndSell || isLadder) {
275
275
  var showSell = isBuyAndSell || item.sellVol > item.buyVol || isPoc;
276
276
  var showBuy = isBuyAndSell || item.buyVol > item.sellVol || isPoc;
277
+ var sellWidthPct = item.sellVol / maxSell;
277
278
  if (showSell) {
278
279
  var sellRectPoint = rectPointsByColor.get(sellColorKey) || new DynamicTypedArray(800);
279
- var widthPct = item.sellVol / maxSell;
280
280
  sellRectPoint.push(sellX);
281
281
  sellRectPoint.push(topY);
282
- sellRectPoint.push(isOverview ? -Math.max(Math.round(textRectWidth * widthPct), 1) : textRectWidth);
282
+ sellRectPoint.push(isOverview ? -Math.max(Math.round(textRectWidth * sellWidthPct), 1) : textRectWidth);
283
283
  sellRectPoint.push(bottomY - topY);
284
284
  if (!rectPointsByColor.get(sellColorKey)) {
285
285
  rectPointsByColor.set(sellColorKey, sellRectPoint);
286
286
  }
287
287
  }
288
+ var buyWidthPct = item.buyVol / maxBuy;
288
289
  if (showBuy) {
289
290
  var buyRectPoint = rectPointsByColor.get(buyColorKey) || new DynamicTypedArray(800);
290
- var widthPct = item.buyVol / maxBuy;
291
291
  buyRectPoint.push(buyX);
292
292
  buyRectPoint.push(topY);
293
- buyRectPoint.push(isOverview ? Math.max(Math.round(textRectWidth * widthPct), 1) : textRectWidth);
293
+ buyRectPoint.push(isOverview ? Math.max(Math.round(textRectWidth * buyWidthPct), 1) : textRectWidth);
294
294
  buyRectPoint.push(bottomY - topY);
295
295
  if (!rectPointsByColor.get(buyColorKey)) {
296
296
  rectPointsByColor.set(buyColorKey, buyRectPoint);
@@ -324,6 +324,9 @@ var volPathLayout = {
324
324
  sellTextPoint.push(textY);
325
325
  sellTextPoint.push(item.sellVol);
326
326
  sellTextPoint.push(isOverview ? -1 : 0);
327
+ if (isOverview) {
328
+ sellTextPoint.push(-Math.max(Math.round(textRectWidth * sellWidthPct), 1));
329
+ }
327
330
  if (!textPointsByColor.get(sellTextColor)) {
328
331
  textPointsByColor.set(sellTextColor, sellTextPoint);
329
332
  }
@@ -332,6 +335,9 @@ var volPathLayout = {
332
335
  buyTextPoint.push(textY);
333
336
  buyTextPoint.push(item.buyVol);
334
337
  buyTextPoint.push(isOverview ? 1 : 0);
338
+ if (isOverview) {
339
+ buyTextPoint.push(Math.max(Math.round(textRectWidth * buyWidthPct), 1));
340
+ }
335
341
  if (!textPointsByColor.get(buyTextColor)) {
336
342
  textPointsByColor.set(buyTextColor, buyTextPoint);
337
343
  }
@@ -380,6 +386,9 @@ var volPathLayout = {
380
386
  textPoint.push(textY);
381
387
  textPoint.push(text);
382
388
  textPoint.push(isOverview ? 1 : 0);
389
+ if (isOverview) {
390
+ textPoint.push(Math.ceil(rectWidth * widthPct));
391
+ }
383
392
  if (!textPointsByColor.get(textColor)) {
384
393
  textPointsByColor.set(textColor, textPoint);
385
394
  }
@@ -389,14 +398,14 @@ var volPathLayout = {
389
398
  if (showTotal) {
390
399
  if (isBuyAndSell || isLadder) {
391
400
  var buyTotalPoint = totalPointsByColor.get(buyVolColor) || new DynamicTypedArray(800);
392
- buyTotalPoint.push(isOverview ? buyX : buyX + textRectWidth / 2);
401
+ buyTotalPoint.push(buyX + textRectWidth / 2);
393
402
  buyTotalPoint.push(firstBottomY);
394
403
  buyTotalPoint.push(buySum);
395
404
  if (!totalPointsByColor.get(buyVolColor)) {
396
405
  totalPointsByColor.set(buyVolColor, buyTotalPoint);
397
406
  }
398
407
  var sellTotalPoint = totalPointsByColor.get(sellVolColor) || new DynamicTypedArray(800);
399
- sellTotalPoint.push(isOverview ? sellX : sellX + textRectWidth / 2);
408
+ sellTotalPoint.push(isOverview ? ocLowX - gapWidth - textRectWidth / 2 : sellX + textRectWidth / 2);
400
409
  sellTotalPoint.push(firstBottomY);
401
410
  sellTotalPoint.push(sellSum);
402
411
  if (!totalPointsByColor.get(sellVolColor)) {
@@ -41,7 +41,7 @@
41
41
  * specific language governing permissions and limitations
42
42
  * under the License.
43
43
  */
44
- import { __extends } from "tslib";
44
+ import { __assign, __extends } from "tslib";
45
45
  import * as zrUtil from 'tvrender/lib/core/util.js';
46
46
  import ChartView from '../../view/Chart.js';
47
47
  import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
@@ -139,7 +139,7 @@ var VolPathView = /** @class */function (_super) {
139
139
  } else {
140
140
  this.group.removeClipPath();
141
141
  }
142
- toggleHoverEmphasis(this.group, null, null, false);
142
+ toggleHoverEmphasis(this.group, null, null, false, false);
143
143
  getECData(this.group).groupId = groupId;
144
144
  };
145
145
  VolPathView.prototype._renderRect = function (seriesModel) {
@@ -152,6 +152,9 @@ var VolPathView = /** @class */function (_super) {
152
152
  var textRectWidth = data.getLayout('textRectWidth');
153
153
  var rectHeight = data.getLayout('rectHeight');
154
154
  var isBuyAndSellLadder = data.getLayout('isBuyAndSellLadder');
155
+ var theme = seriesModel.get('theme');
156
+ var isDark = theme === 'dark';
157
+ var textFill = isDark ? "#fff" : "#000";
155
158
  var isOverview = data.getLayout('isOverview');
156
159
  var maxSumVol = data.getLayout('maxSumVol');
157
160
  rectPointsByColor.forEach(function (rectPoints, key) {
@@ -170,6 +173,7 @@ var VolPathView = /** @class */function (_super) {
170
173
  var textWidth = !isBuyAndSellLadder ? textRectWidth * 2 : textRectWidth;
171
174
  var fontSize = findFontSize(getMaxFormatVol(maxSumVol), textWidth * 0.8, void 0, 2, rectHeight * 0.8, 50);
172
175
  var textOffset = Math.floor(textWidth * 0.1);
176
+ var clipPathRectY = rectHeight / 2;
173
177
  textPointsByColor.forEach(function (textPoint, key) {
174
178
  var list = textPoint.buffer();
175
179
  var size = textPoint.length();
@@ -187,23 +191,52 @@ var VolPathView = /** @class */function (_super) {
187
191
  align = 'right';
188
192
  offset = -textOffset;
189
193
  }
190
- var el = new graphic.Text({
194
+ var clipPath = undefined;
195
+ var formatText = getFormatVol(text);
196
+ if (isOverview) {
197
+ var width = list[i++];
198
+ clipPath = new graphic.Rect({
199
+ shape: {
200
+ x: x,
201
+ y: y - clipPathRectY,
202
+ width: width,
203
+ height: rectHeight
204
+ }
205
+ });
206
+ var el1 = new graphic.Text({
207
+ style: {
208
+ text: formatText,
209
+ fill: textFill,
210
+ verticalAlign: 'middle',
211
+ align: align,
212
+ fontSize: fontSize,
213
+ x: x + offset,
214
+ y: y
215
+ }
216
+ });
217
+ group.add(el1);
218
+ el1.states.emphasis = emphasisState;
219
+ }
220
+ var el = new graphic.Text(__assign({
191
221
  style: {
192
- text: getFormatVol(text),
222
+ text: formatText,
193
223
  fill: key,
194
224
  verticalAlign: 'middle',
195
225
  align: align,
196
- fontSize: fontSize
197
- },
198
- x: x + offset,
199
- y: y
200
- });
226
+ fontSize: fontSize,
227
+ x: x + offset,
228
+ y: y
229
+ }
230
+ }, clipPath ? {
231
+ clipPath: clipPath
232
+ } : {}));
233
+ // if (clipPath) {
234
+ // el.setClipPath(clipPath)
235
+ // }
201
236
  group.add(el);
202
237
  el.states.emphasis = emphasisState;
203
238
  }
204
239
  });
205
- var theme = seriesModel.get('theme');
206
- var isDark = theme === 'dark';
207
240
  var totalPointsByColor = data.getLayout('totalPointsByColor');
208
241
  var totalTextBg = isDark ? 'rgba(0, 0, 0, 0.1)' : 'rgba(255, 255, 255, 0.1)';
209
242
  var top = Math.floor(fontSize * 0.2);
@@ -237,7 +270,6 @@ var VolPathView = /** @class */function (_super) {
237
270
  var rectFill = isDark ? "#000" : "#fff";
238
271
  var computerTotalWidth = totalWidth * 0.7 - 10;
239
272
  var sumFontSize = findFontSize("" + (isBuyAndSellLadder ? "Delta" : "总买入") + getFormatVol(maxSumVol), computerTotalWidth, void 0, 2, rectHeight * 0.8, 50);
240
- var textFill = isDark ? "#fff" : "#000";
241
273
  var shadowColor = isDark ? darkShadowColor : lightShadowColor;
242
274
  if (isBuyAndSellLadder) {
243
275
  var marginTop = fontSize + top * 2;
@@ -126,7 +126,7 @@ var VolPathRectView = /** @class */function (_super) {
126
126
  // el.states.emphasis = emphasisState;
127
127
  // linesGroup.add(el);
128
128
  // });
129
- toggleHoverEmphasis(this.group, null, null, false);
129
+ toggleHoverEmphasis(this.group, null, null, false, false);
130
130
  getECData(this.group).groupId = groupId;
131
131
  };
132
132
  VolPathRectView.prototype.remove = function (ecModel, api) {
@@ -722,16 +722,19 @@ export function getSeriesPointData(ecModel, payload) {
722
722
  * This function should be used on the element with dataIndex, seriesIndex.
723
723
  *
724
724
  */
725
- export function enableHoverEmphasis(el, focus, blurScope) {
725
+ export function enableHoverEmphasis(el, focus, blurScope, updateState) {
726
+ if (updateState === void 0) {
727
+ updateState = true;
728
+ }
726
729
  setAsHighDownDispatcher(el, true);
727
- traverseUpdateState(el, setDefaultStateProxy);
730
+ updateState && traverseUpdateState(el, setDefaultStateProxy);
728
731
  enableHoverFocus(el, focus, blurScope);
729
732
  }
730
733
  export function disableHoverEmphasis(el) {
731
734
  setAsHighDownDispatcher(el, false);
732
735
  }
733
- export function toggleHoverEmphasis(el, focus, blurScope, isDisabled) {
734
- isDisabled ? disableHoverEmphasis(el) : enableHoverEmphasis(el, focus, blurScope);
736
+ export function toggleHoverEmphasis(el, focus, blurScope, isDisabled, updateState) {
737
+ isDisabled ? disableHoverEmphasis(el) : enableHoverEmphasis(el, focus, blurScope, updateState);
735
738
  }
736
739
  export function enableHoverFocus(el, focus, blurScope) {
737
740
  var ecData = getECData(el);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.9.31",
3
+ "version": "0.9.33",
4
4
  "main": "dist/echarts.js",
5
5
  "module": "index.js",
6
6
  "jsdelivr": "dist/echarts.min.js",
@@ -8738,7 +8738,7 @@ declare function createDimensions(source: Source | OptionSourceData, opt?: Prepa
8738
8738
  * This function should be used on the element with dataIndex, seriesIndex.
8739
8739
  *
8740
8740
  */
8741
- declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope): void;
8741
+ declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope, updateState?: boolean): void;
8742
8742
 
8743
8743
  /**
8744
8744
  * Create a multi dimension List structure from seriesModel.
@@ -8739,7 +8739,7 @@ declare function createDimensions(source: Source | OptionSourceData, opt?: Prepa
8739
8739
  * This function should be used on the element with dataIndex, seriesIndex.
8740
8740
  *
8741
8741
  */
8742
- declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope): void;
8742
+ declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope, updateState?: boolean): void;
8743
8743
 
8744
8744
  /**
8745
8745
  * Create a multi dimension List structure from seriesModel.
@@ -82,9 +82,9 @@ export declare function getSeriesPointData(ecModel: GlobalModel, payload?: {
82
82
  * This function should be used on the element with dataIndex, seriesIndex.
83
83
  *
84
84
  */
85
- export declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope): void;
85
+ export declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope, updateState?: boolean): void;
86
86
  export declare function disableHoverEmphasis(el: Element): void;
87
- export declare function toggleHoverEmphasis(el: Element, focus: InnerFocus, blurScope: BlurScope, isDisabled: boolean): void;
87
+ export declare function toggleHoverEmphasis(el: Element, focus: InnerFocus, blurScope: BlurScope, isDisabled: boolean, updateState?: boolean): void;
88
88
  export declare function enableHoverFocus(el: Element, focus: InnerFocus, blurScope: BlurScope): void;
89
89
  /**
90
90
  * Set emphasis/blur/selected states of element.