tvcharts 0.6.27 → 0.6.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/echarts.js CHANGED
@@ -7178,7 +7178,7 @@ function getElementSSRData(el) {
7178
7178
  function registerSSRDataGetter(getter) {
7179
7179
  ssrDataGetter = getter;
7180
7180
  }
7181
- var version = "5.6.3";
7181
+ var version = "5.6.4";
7182
7182
 
7183
7183
  // src/util/number.ts
7184
7184
  var RADIAN_EPSILON = 1e-4;
@@ -9109,7 +9109,8 @@ var CMD = {
9109
9109
  Z: 6,
9110
9110
  R: 7,
9111
9111
  F: 8,
9112
- B: 9
9112
+ B: 9,
9113
+ S: 10
9113
9114
  };
9114
9115
  var tmpOutX = [];
9115
9116
  var tmpOutY = [];
@@ -9221,6 +9222,15 @@ var PathProxy2 = class {
9221
9222
  }
9222
9223
  return this;
9223
9224
  }
9225
+ strokeStyle(color2) {
9226
+ const {r, g, b, a} = colorToRgba(color2);
9227
+ this.addData(CMD.S, r, g, b, a);
9228
+ if (this._ctx) {
9229
+ this._ctx.strokeStyle = color2;
9230
+ this._ctx.stroke();
9231
+ }
9232
+ return this;
9233
+ }
9224
9234
  beginPathFill() {
9225
9235
  this._ctx && this._ctx.beginPath();
9226
9236
  this.addData(CMD.B);
@@ -9460,6 +9470,9 @@ var PathProxy2 = class {
9460
9470
  case CMD.F:
9461
9471
  i += 4;
9462
9472
  break;
9473
+ case CMD.S:
9474
+ i += 4;
9475
+ break;
9463
9476
  case CMD.Z:
9464
9477
  xi = x0;
9465
9478
  yi = y0;
@@ -9573,6 +9586,9 @@ var PathProxy2 = class {
9573
9586
  case CMD.F:
9574
9587
  i += 4;
9575
9588
  break;
9589
+ case CMD.S:
9590
+ i += 4;
9591
+ break;
9576
9592
  }
9577
9593
  if (l >= 0) {
9578
9594
  pathSegLen[segCount++] = l;
@@ -9782,6 +9798,15 @@ var PathProxy2 = class {
9782
9798
  ctx.fill();
9783
9799
  break;
9784
9800
  }
9801
+ case CMD.S: {
9802
+ const r2 = d[i++];
9803
+ const g = d[i++];
9804
+ const b = d[i++];
9805
+ const a = d[i++];
9806
+ ctx.strokeStyle = `rgba(${r2},${g},${b},${a})`;
9807
+ ctx.stroke();
9808
+ break;
9809
+ }
9785
9810
  case CMD.B:
9786
9811
  ctx.beginPath();
9787
9812
  break;
@@ -12113,6 +12138,7 @@ function transformPath(path, m2) {
12113
12138
  const A = CMD3.A;
12114
12139
  const Q = CMD3.Q;
12115
12140
  const F = CMD3.F;
12141
+ const S = CMD3.S;
12116
12142
  for (i = 0, j = 0; i < len2; ) {
12117
12143
  cmd = data[i++];
12118
12144
  j = i;
@@ -12151,6 +12177,10 @@ function transformPath(path, m2) {
12151
12177
  i += 4;
12152
12178
  j = i;
12153
12179
  break;
12180
+ case S:
12181
+ i += 4;
12182
+ j = i;
12183
+ break;
12154
12184
  case R:
12155
12185
  p[0] = data[i++];
12156
12186
  p[1] = data[i++];
@@ -22140,9 +22170,9 @@ var Flag = Path_default.extend({
22140
22170
  const {x, y} = shape;
22141
22171
  const width = shape.width / 2;
22142
22172
  const height = shape.height / 2;
22143
- const rectWidth = 0.2;
22144
- const range = 0.6;
22145
- const rangeHeight = 1;
22173
+ const rectWidth = width * 0.2;
22174
+ const range = height * 0.6;
22175
+ const rangeHeight = height;
22146
22176
  const startX = x - width + rectWidth;
22147
22177
  const endX = x + width;
22148
22178
  const topY = y - height;
@@ -22416,20 +22446,19 @@ var symbolShapeMakers = {
22416
22446
  shape.offsetWidth = offsetWidth;
22417
22447
  },
22418
22448
  xCross: function(x, y, w, h, shape) {
22419
- shape.x = x + w / 2;
22420
- ;
22449
+ shape.x = x;
22421
22450
  shape.y = y;
22422
22451
  shape.width = w;
22423
22452
  shape.height = h;
22424
22453
  },
22425
22454
  lCross: function(x, y, w, h, shape) {
22426
- shape.x = x + w / 2;
22455
+ shape.x = x;
22427
22456
  shape.y = y;
22428
22457
  shape.width = w;
22429
22458
  shape.height = h;
22430
22459
  },
22431
22460
  flag: function(x, y, w, h, shape) {
22432
- shape.x = x + w / 2;
22461
+ shape.x = x;
22433
22462
  shape.y = y;
22434
22463
  shape.width = w;
22435
22464
  shape.height = h;
@@ -22443,14 +22472,14 @@ var symbolShapeMakers = {
22443
22472
  arrowUp: function(x, y, w, h, shape, parentShape) {
22444
22473
  shape.rectWidth = parentShape.triangleWidth;
22445
22474
  shape.cx = x + 1;
22446
- shape.cy = y - h / 2;
22475
+ shape.cy = y;
22447
22476
  shape.width = w;
22448
22477
  shape.height = h;
22449
22478
  },
22450
22479
  arrowDown: function(x, y, w, h, shape, parentShape) {
22451
22480
  shape.rectWidth = parentShape.triangleWidth;
22452
22481
  shape.cx = x + 1;
22453
- shape.cy = y - h / 2;
22482
+ shape.cy = y;
22454
22483
  shape.width = w;
22455
22484
  shape.height = h;
22456
22485
  }
@@ -33508,7 +33537,19 @@ function getDefaultInterpolatedLabel(data, interpolatedValue) {
33508
33537
  }
33509
33538
 
33510
33539
  // src/chart/helper/Symbol.ts
33511
- var variableTypes = ["labelCenter", "labelDown", "labelUp", "labelLeft", "labelRight", "labelLowerLeft", "labelLowerRight", "labelUpperLeft", "labelUpperRight", "arrowUp", "arrowDown"];
33540
+ var variableTypes = [
33541
+ "labelCenter",
33542
+ "labelDown",
33543
+ "labelUp",
33544
+ "labelLeft",
33545
+ "labelRight",
33546
+ "labelLowerLeft",
33547
+ "labelLowerRight",
33548
+ "labelUpperLeft",
33549
+ "labelUpperRight",
33550
+ "arrowUp",
33551
+ "arrowDown"
33552
+ ];
33512
33553
  var Symbol = class extends Group_default {
33513
33554
  constructor(data, idx, seriesScope, opts) {
33514
33555
  super();
@@ -53292,6 +53333,8 @@ var candlestickLayout = {
53292
53333
  const points4 = isNaN(axisDimVal) || isNaN(val) ? [NaN, NaN] : coordSys.dataToPoint(p);
53293
53334
  if (!isNaN(points4[0])) {
53294
53335
  points4[0] = points4[0] + 0.5;
53336
+ }
53337
+ if (!isNaN(points4[1])) {
53295
53338
  points4[1] = Math.floor(points4[1]);
53296
53339
  }
53297
53340
  return points4;
@@ -53305,6 +53348,8 @@ var candlestickLayout = {
53305
53348
  point1[0] = start2 ? point1[0] - 0.5 : point1[0] + 0.5;
53306
53349
  point2[0] = start2 ? point1[0] + 0.5 : point1[0] - 0.5;
53307
53350
  }
53351
+ point1[1] += 0.5;
53352
+ point2[1] += 0.5;
53308
53353
  start2 ? ends.push(point1, point2) : ends.push(point2, point1);
53309
53354
  }
53310
53355
  function makeBrushRect(lowestVal, highestVal, axisDimVal) {
@@ -53376,10 +53421,7 @@ function calculateCandleWidth(seriesModel, data) {
53376
53421
  const baseAxis = seriesModel.getBaseAxis();
53377
53422
  let extent3;
53378
53423
  const bandWidth = baseAxis.type === "category" ? baseAxis.getBandWidth() : (extent3 = baseAxis.getExtent(), Math.abs(extent3[1] - extent3[0]) / data.count());
53379
- const barMaxWidth = parsePercent2(retrieve2(seriesModel.get("barMaxWidth"), bandWidth), bandWidth);
53380
- const barMinWidth = parsePercent2(retrieve2(seriesModel.get("barMinWidth"), 1), bandWidth);
53381
- const barWidth = seriesModel.get("barWidth");
53382
- return barWidth != null ? parsePercent2(barWidth, bandWidth) : Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth);
53424
+ return Math.max(bandWidth * 0.7, 1);
53383
53425
  }
53384
53426
  var candlestickLayout_default = candlestickLayout;
53385
53427
 
@@ -55348,7 +55390,60 @@ LabelsSeriesModel.defaultOption = {
55348
55390
  };
55349
55391
  var LabelsSeries_default = LabelsSeriesModel;
55350
55392
 
55393
+ // src/chart/labels/SymbolPath.ts
55394
+ var LargeSymbolPathShape3 = class {
55395
+ };
55396
+ var SymbolPath2 = class extends Path_default {
55397
+ constructor(opts) {
55398
+ super(opts);
55399
+ }
55400
+ getDefaultShape() {
55401
+ return new LargeSymbolPathShape3();
55402
+ }
55403
+ buildPath(path, shape) {
55404
+ const points4 = shape.points;
55405
+ const symbolProxy = this.symbolProxy;
55406
+ const symbolProxyShape = symbolProxy.shape;
55407
+ const needCenter = shape.needCenter ?? true;
55408
+ const isLine = shape.isLine;
55409
+ for (let i = 0; i < points4.length; i++) {
55410
+ const {point, color: color2, size, offset = [0, 0]} = points4[i];
55411
+ const [width, height] = size;
55412
+ const [x, y] = point;
55413
+ if (isNaN(x) || isNaN(y)) {
55414
+ continue;
55415
+ }
55416
+ const [xOffset, yOffset] = offset;
55417
+ path.beginPathFill();
55418
+ symbolProxyShape.x = x - (needCenter ? width / 2 : 0) + xOffset;
55419
+ symbolProxyShape.y = y - (needCenter ? height / 2 : 0) + yOffset;
55420
+ symbolProxyShape.width = width;
55421
+ symbolProxyShape.height = height;
55422
+ symbolProxy.buildPath(path, {...symbolProxyShape, ...points4[i].shape}, true);
55423
+ isLine ? path.strokeStyle(color2) : path.fillStyle(color2);
55424
+ }
55425
+ }
55426
+ };
55427
+ var SymbolPath_default2 = SymbolPath2;
55428
+
55351
55429
  // src/chart/labels/LabelsView.ts
55430
+ var variableMap = {
55431
+ labelCenter: 1,
55432
+ labelDown: 1,
55433
+ labelUp: 1,
55434
+ labelLeft: 1,
55435
+ labelRight: 1,
55436
+ labelLowerLeft: 1,
55437
+ labelLowerRight: 1,
55438
+ labelUpperLeft: 1,
55439
+ labelUpperRight: 1,
55440
+ arrowUp: 1,
55441
+ arrowDown: 1,
55442
+ flag: 1,
55443
+ xCross: 1,
55444
+ lCross: 1
55445
+ };
55446
+ var lineSymbols = ["xCross", "lCross"];
55352
55447
  var LabelsView2 = class extends Chart_default {
55353
55448
  constructor() {
55354
55449
  super(...arguments);
@@ -55356,41 +55451,72 @@ var LabelsView2 = class extends Chart_default {
55356
55451
  }
55357
55452
  render(seriesModel, ecModel, api2) {
55358
55453
  const data = seriesModel.getData();
55359
- const symbolDraw = this._updateSymbolDraw(data, seriesModel);
55360
- symbolDraw.updateData(data, {
55361
- clipShape: this._getClipShape(seriesModel)
55362
- });
55454
+ this._renderSymbol(data, seriesModel);
55455
+ this._renderText(data, seriesModel);
55363
55456
  this._finished = true;
55364
55457
  }
55365
- incrementalPrepareRender(seriesModel, ecModel, api2) {
55366
- const data = seriesModel.getData();
55367
- const symbolDraw = this._updateSymbolDraw(data, seriesModel);
55368
- symbolDraw.incrementalPrepareUpdate(data);
55369
- this._finished = false;
55370
- }
55371
- incrementalRender(taskParams, seriesModel, ecModel) {
55372
- this._symbolDraw.incrementalUpdate(taskParams, seriesModel.getData(), {
55373
- clipShape: this._getClipShape(seriesModel)
55458
+ _renderText(data, seriesModel) {
55459
+ if (!this._textGroup) {
55460
+ this._textGroup = new Group_default();
55461
+ this.group.add(this._textGroup);
55462
+ } else {
55463
+ this._textGroup.removeAll();
55464
+ }
55465
+ const textGroup = this._textGroup;
55466
+ const textList = data.getLayout("textList");
55467
+ each(textList, function(item) {
55468
+ const {
55469
+ text,
55470
+ align,
55471
+ textColor,
55472
+ fontSize,
55473
+ fontFamily,
55474
+ point,
55475
+ offset = [0, 0],
55476
+ textBorderColor,
55477
+ textBorderWidth
55478
+ } = item;
55479
+ const el = new Text_default({
55480
+ style: {
55481
+ text,
55482
+ align,
55483
+ fill: textColor,
55484
+ fontFamily,
55485
+ fontSize,
55486
+ stroke: textBorderColor,
55487
+ lineWidth: textBorderWidth
55488
+ },
55489
+ x: point[0] + offset[0],
55490
+ y: point[1] + offset[1]
55491
+ });
55492
+ textGroup.add(el);
55374
55493
  });
55375
- this._finished = taskParams.end === seriesModel.getData().count();
55376
55494
  }
55377
- updateTransform(seriesModel, ecModel, api2) {
55378
- const data = seriesModel.getData();
55379
- this.group.dirty();
55380
- if (!this._finished || data.count() > 1e4) {
55381
- return {
55382
- update: true
55383
- };
55495
+ _renderSymbol(data, seriesModel) {
55496
+ if (!this._symbolGroup) {
55497
+ this._symbolGroup = new Group_default();
55498
+ this.group.add(this._symbolGroup);
55384
55499
  } else {
55385
- const res = pointsLayout("").reset(seriesModel, ecModel, api2);
55386
- if (res.progress) {
55387
- res.progress({start: 0, end: data.count(), count: data.count()}, data);
55388
- }
55389
- this._symbolDraw.updateLayout(data);
55500
+ this._symbolGroup.removeAll();
55390
55501
  }
55391
- }
55392
- eachRendered(cb) {
55393
- this._symbolDraw && this._symbolDraw.eachRendered(cb);
55502
+ const symbolGroup = this._symbolGroup;
55503
+ const symbolStyleMap = data.getLayout("symbolStyleMap");
55504
+ each(symbolStyleMap, function(item, key) {
55505
+ const isLine = lineSymbols.includes(key);
55506
+ const el = new SymbolPath_default2({
55507
+ shape: {
55508
+ points: item,
55509
+ needCenter: !variableMap[key],
55510
+ isLine
55511
+ },
55512
+ style: {
55513
+ fill: "none",
55514
+ lineWidth: isLine ? 2 : void 0
55515
+ }
55516
+ });
55517
+ el.symbolProxy = createSymbol(key, 0, 0, 0, 0);
55518
+ symbolGroup.add(el);
55519
+ });
55394
55520
  }
55395
55521
  _getClipShape(seriesModel) {
55396
55522
  if (!seriesModel.get("clip", true)) {
@@ -55399,22 +55525,11 @@ var LabelsView2 = class extends Chart_default {
55399
55525
  const coordSys = seriesModel.coordinateSystem;
55400
55526
  return coordSys && coordSys.getArea && coordSys.getArea(0.1);
55401
55527
  }
55402
- _updateSymbolDraw(data, seriesModel) {
55403
- let symbolDraw = this._symbolDraw;
55404
- const pipelineContext = seriesModel.pipelineContext;
55405
- const isLargeDraw = pipelineContext.large;
55406
- if (!symbolDraw || isLargeDraw !== this._isLargeDraw) {
55407
- symbolDraw && symbolDraw.remove();
55408
- symbolDraw = this._symbolDraw = isLargeDraw ? new LargeSymbolDraw_default() : new SymbolDraw_default();
55409
- this._isLargeDraw = isLargeDraw;
55410
- this.group.removeAll();
55411
- }
55412
- this.group.add(symbolDraw.group);
55413
- return symbolDraw;
55414
- }
55415
55528
  remove(ecModel, api2) {
55416
- this._symbolDraw && this._symbolDraw.remove(true);
55417
- this._symbolDraw = null;
55529
+ this._symbolGroup && this._symbolGroup.removeAll();
55530
+ this._symbolGroup = null;
55531
+ this._textGroup && this._textGroup.removeAll();
55532
+ this._textGroup = null;
55418
55533
  }
55419
55534
  dispose() {
55420
55535
  }
@@ -55553,148 +55668,55 @@ function getSymbolLabelFontSize(size, width) {
55553
55668
  return labelFontSizeMapping[size] ?? 12;
55554
55669
  }
55555
55670
 
55556
- // src/chart/labels/labelsVisual.ts
55557
- var SYMBOL_PROPS_WITH_CB2 = [
55558
- "symbol",
55559
- "symbolSize",
55560
- "symbolRotate",
55561
- "symbolOffset"
55671
+ // src/chart/labels/labelsLayout.ts
55672
+ function getYByLocation(seriesModel) {
55673
+ const location = seriesModel.get("location");
55674
+ if (!["bottom", "top"].includes(location)) {
55675
+ return null;
55676
+ }
55677
+ const yAxis = seriesModel.coordinateSystem.getAxis("y");
55678
+ const scale4 = yAxis.scale;
55679
+ const [, end2] = yAxis.getExtent();
55680
+ const [boundaryGapX, boundaryGapY] = scale4.rawExtentInfo.getBoundaryGapInner();
55681
+ return Math.floor(location === "top" ? end2 * boundaryGapX + 30 : end2 * (1 - boundaryGapY) + 30);
55682
+ }
55683
+ var labelSymbols = [
55684
+ "labelDown",
55685
+ "labelUp",
55686
+ "labelLeft",
55687
+ "labelRight",
55688
+ "labelLowerLeft",
55689
+ "labelLowerRight",
55690
+ "labelUpperLeft",
55691
+ "labelUpperRight",
55692
+ "labelCenter"
55562
55693
  ];
55563
- var SYMBOL_PROPS2 = SYMBOL_PROPS_WITH_CB2.concat([
55564
- "symbolKeepAspect"
55565
- ]);
55566
- var labelSymbols = ["labelDown", "labelUp", "labelLeft", "labelRight", "labelLowerLeft", "labelLowerRight", "labelUpperLeft", "labelUpperRight", "labelCenter"];
55567
55694
  var labelSymbolByType = {};
55568
55695
  each(labelSymbols, function(type) {
55569
55696
  labelSymbolByType[type] = 1;
55570
55697
  });
55571
- var lineSymbols = ["xCross", "lCross"];
55572
55698
  var padding = 10;
55573
- function changeLabelOffsetBySymbol(symbol, label, shape, oldOffset) {
55574
- const [offsetX, offsetY] = oldOffset ?? [0, 0];
55699
+ function changeLabelOffsetBySymbol(symbol, symbolRect, shape, oldOffset) {
55700
+ const [offsetX, offsetY] = oldOffset;
55575
55701
  switch (symbol) {
55576
55702
  case "labelDown":
55577
- label.option.offset = [offsetX, offsetY - shape.triangleWidth / 2];
55578
- break;
55703
+ return [offsetX, offsetY - shape.triangleWidth];
55579
55704
  case "labelUp":
55580
- label.option.offset = [offsetX, offsetY + shape.triangleWidth / 2];
55581
55705
  break;
55582
55706
  case "labelLeft":
55583
- label.option.offset = [offsetX + shape.triangleWidth / 2, offsetY];
55584
- break;
55707
+ return [offsetX + shape.triangleWidth + symbolRect[0] / 2, offsetY];
55585
55708
  case "labelRight":
55586
- label.option.offset = [offsetX - shape.triangleWidth / 2, offsetY];
55587
- break;
55709
+ return [offsetX - shape.triangleWidth - symbolRect[0] / 2, offsetY];
55588
55710
  case "labelLowerLeft":
55589
- label.option.offset = [offsetX + shape.offsetX / 2, offsetY - shape.offsetY / 2];
55590
- break;
55711
+ return [offsetX + shape.offsetX / 2 + symbolRect[0] / 2, offsetY - shape.offsetY];
55591
55712
  case "labelLowerRight":
55592
- label.option.offset = [offsetX - shape.offsetX / 2, offsetY - shape.offsetY / 2];
55593
- break;
55713
+ return [offsetX - shape.offsetX / 2 - symbolRect[0] / 2, offsetY - shape.offsetY];
55594
55714
  case "labelUpperLeft":
55595
- label.option.offset = [offsetX + shape.offsetX / 2, offsetY + shape.offsetY / 2];
55596
- break;
55715
+ return [offsetX + shape.offsetX + symbolRect[0] / 2, offsetY + shape.offsetWidth - symbolRect[1] / 2];
55597
55716
  case "labelUpperRight":
55598
- label.option.offset = [offsetX - shape.offsetX / 2, offsetY + shape.offsetY / 2];
55599
- break;
55600
- }
55601
- }
55602
- var LabelsVisual = {
55603
- seriesType: "labels",
55604
- reset: function(seriesModel) {
55605
- const bandWidth = Math.max(1, Math.round(seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace * 0.8));
55606
- const data = seriesModel.getData();
55607
- const location = seriesModel.get("location");
55608
- const showLast = seriesModel.get("showLast");
55609
- const symbolOptions = {};
55610
- for (let i = 0; i < SYMBOL_PROPS_WITH_CB2.length; i++) {
55611
- const symbolPropName = SYMBOL_PROPS_WITH_CB2[i];
55612
- const val = seriesModel.get(symbolPropName);
55613
- symbolOptions[symbolPropName] = val;
55614
- }
55615
- symbolOptions.symbol = symbolOptions.symbol || seriesModel.defaultSymbol;
55616
- data.setVisual(extend({
55617
- symbolKeepAspect: seriesModel.get("symbolKeepAspect")
55618
- }, symbolOptions));
55619
- const lastIndex = data.count(true) - 1;
55620
- function dataEach(data2, idx) {
55621
- if (showLast && lastIndex - data2.getRawIndex(idx) >= showLast) {
55622
- return;
55623
- }
55624
- const itemModel = data2.getItemModel(idx);
55625
- let symbol = itemModel.getShallow("symbol");
55626
- let symbolSize = itemModel.getShallow("symbolSize");
55627
- let symbolOffset = itemModel.getShallow("symbolOffset");
55628
- let symbolShape = {};
55629
- const symbolKeepAspect = itemModel.getShallow("symbolKeepAspect");
55630
- const style = itemModel.getModel("itemStyle").getItemStyle();
55631
- let oldOffset = [0, 0];
55632
- const labelModel = itemModel.getModel("label");
55633
- const align = labelModel.get("align");
55634
- const size = itemModel.get("size") ?? "normal";
55635
- const text = labelModel.get("formatter");
55636
- const isLabel = labelSymbolByType[symbol];
55637
- const labelShow = labelModel.get("show");
55638
- if (location === "top") {
55639
- labelModel.option.position = "bottom";
55640
- } else {
55641
- labelModel.option.position = isLabel || symbol === "textOutline" ? "inside" : "top";
55642
- }
55643
- if (!labelModel.option.fontSize) {
55644
- labelModel.option.fontSize = getSymbolLabelFontSize(size, bandWidth);
55645
- }
55646
- if (labelShow && text && (isLabel || ["left", "right"].includes(align))) {
55647
- const rect = labelModel.getTextRect(text);
55648
- if (isLabel) {
55649
- symbolSize = [rect.width + padding, rect.height + padding];
55650
- }
55651
- const align2 = labelModel.get("align");
55652
- if (align2 === "left") {
55653
- labelModel.option.offset = oldOffset = [-rect.width / 2, 0];
55654
- } else if (align2 === "right") {
55655
- labelModel.option.offset = oldOffset = [rect.width / 2, 0];
55656
- }
55657
- }
55658
- const {w, h, shape} = getSymbolSize2(symbol, size, bandWidth);
55659
- if (isLabel ? !labelShow || !text : true) {
55660
- symbolSize = [w, h];
55661
- }
55662
- if (shape) {
55663
- symbolShape = shape;
55664
- if (labelShow) {
55665
- changeLabelOffsetBySymbol(symbol, labelModel, shape, oldOffset);
55666
- }
55667
- }
55668
- if (lineSymbols.includes(symbol)) {
55669
- style.stroke = style.fill;
55670
- if (symbol === "lCross")
55671
- style.lineWidth = 2;
55672
- }
55673
- data2.setItemVisual(idx, {
55674
- symbol,
55675
- symbolSize,
55676
- symbolOffset,
55677
- symbolShape,
55678
- symbolKeepAspect,
55679
- style
55680
- });
55681
- }
55682
- return {dataEach: data.hasItemOption ? dataEach : null};
55683
- }
55684
- };
55685
- var labelsVisual_default = LabelsVisual;
55686
-
55687
- // src/chart/labels/labelsLayout.ts
55688
- function getYByLocation(seriesModel) {
55689
- const location = seriesModel.get("location");
55690
- if (!["bottom", "top"].includes(location)) {
55691
- return null;
55717
+ return [offsetX - shape.offsetX - symbolRect[0] / 2, offsetY];
55692
55718
  }
55693
- const yAxis = seriesModel.coordinateSystem.getAxis("y");
55694
- const scale4 = yAxis.scale;
55695
- const [, end2] = yAxis.getExtent();
55696
- const [boundaryGapX, boundaryGapY] = scale4.rawExtentInfo.getBoundaryGapInner();
55697
- return Math.floor(location === "top" ? end2 * boundaryGapX + 30 : end2 * (1 - boundaryGapY) + 30);
55719
+ return oldOffset;
55698
55720
  }
55699
55721
  var labelsLayout = {
55700
55722
  seriesType: "labels",
@@ -55705,6 +55727,8 @@ var labelsLayout = {
55705
55727
  if (!coordSys) {
55706
55728
  return;
55707
55729
  }
55730
+ const bandWidth = Math.max(1, Math.round(seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace * 0.8));
55731
+ const location = seriesModel.get("location");
55708
55732
  const dims = map(coordSys.dimensions, function(dim) {
55709
55733
  return data.mapDimension(dim);
55710
55734
  }).slice(0, 2);
@@ -55716,8 +55740,9 @@ var labelsLayout = {
55716
55740
  const showLast = seriesModel.get("showLast");
55717
55741
  return {
55718
55742
  progress(params, labelsData) {
55743
+ const symbolStyleMap = {};
55744
+ const textList = [];
55719
55745
  const tmpIn = [];
55720
- const tmpOut = [];
55721
55746
  const lastIndex = data.count(true) - 1;
55722
55747
  for (let i = params.start; i < params.end; i++) {
55723
55748
  if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
@@ -55725,9 +55750,95 @@ var labelsLayout = {
55725
55750
  }
55726
55751
  tmpIn[0] = store.get(dimIdx0, i) + xOffset;
55727
55752
  tmpIn[1] = store.get(dimIdx1, i);
55728
- const point = coordSys.dataToPoint(tmpIn, null, tmpOut);
55729
- labelsData.setItemLayout(i, [point[0], price ?? point[1]]);
55753
+ const point = coordSys.dataToPoint(tmpIn);
55754
+ if (isNaN(point[1])) {
55755
+ continue;
55756
+ }
55757
+ const itemModel = data.getItemModel(i);
55758
+ const symbol = itemModel.getShallow("symbol");
55759
+ let symbolSize = itemModel.getShallow("symbolSize");
55760
+ const symbolOffset = itemModel.getShallow("symbolOffset") || [0, 0];
55761
+ let symbolShape = {};
55762
+ const style = itemModel.getModel("itemStyle").getItemStyle();
55763
+ const labelModel = itemModel.getModel("label");
55764
+ let oldOffset = labelModel.get("offset") || [0, 0];
55765
+ const align = labelModel.get("align");
55766
+ const size = itemModel.get("size") ?? "normal";
55767
+ const text = labelModel.get("formatter");
55768
+ const isLabel = labelSymbolByType[symbol];
55769
+ const labelShow = labelModel.get("show");
55770
+ let fontSize = labelModel.getShallow("fontSize");
55771
+ let position2 = "top";
55772
+ if (location === "top") {
55773
+ position2 = "bottom";
55774
+ } else {
55775
+ position2 = isLabel || symbol === "textOutline" ? "inside" : "top";
55776
+ }
55777
+ if (!fontSize && labelShow) {
55778
+ labelModel.option.fontSize = fontSize = getSymbolLabelFontSize(size, bandWidth);
55779
+ }
55780
+ let textRect = void 0;
55781
+ if (labelShow) {
55782
+ textRect = labelModel.getTextRect(text);
55783
+ if (isLabel) {
55784
+ symbolSize = [textRect.width + padding, textRect.height + padding];
55785
+ }
55786
+ const align2 = labelModel.get("align");
55787
+ if (align2 === "left") {
55788
+ oldOffset = [-textRect.width / 2, 0];
55789
+ } else if (align2 === "right") {
55790
+ oldOffset = [textRect.width / 2, 0];
55791
+ }
55792
+ }
55793
+ const {w, h, shape} = getSymbolSize2(symbol, size, bandWidth);
55794
+ if (isLabel ? !labelShow || !text : true) {
55795
+ symbolSize = [w, h];
55796
+ }
55797
+ const symbolRect = Array.isArray(symbolSize) ? symbolSize : [symbolSize, symbolSize];
55798
+ if (shape) {
55799
+ symbolShape = shape;
55800
+ if (labelShow) {
55801
+ oldOffset = changeLabelOffsetBySymbol(symbol, symbolRect, shape, oldOffset);
55802
+ }
55803
+ }
55804
+ const symbolPoint = [point[0], price || point[1]];
55805
+ if (symbol !== "none" && style.fill) {
55806
+ const symbolStyles = symbolStyleMap[symbol] || [];
55807
+ symbolStyles.push({
55808
+ point: symbolPoint,
55809
+ size: symbolRect,
55810
+ offset: symbolOffset,
55811
+ color: style.fill,
55812
+ shape: symbolShape
55813
+ });
55814
+ symbolStyleMap[symbol] = symbolStyles;
55815
+ }
55816
+ if (labelShow) {
55817
+ const labelPoint = [...symbolPoint];
55818
+ if (position2 === "inside") {
55819
+ labelPoint[1] = labelPoint[1] - textRect.height / 2 - symbolRect[1] / 2;
55820
+ } else if (position2 === "top") {
55821
+ labelPoint[1] = labelPoint[1] - symbolRect[1] - textRect.height / 2 - 10;
55822
+ } else {
55823
+ labelPoint[1] = labelPoint[1] + 10;
55824
+ }
55825
+ textList.push({
55826
+ text,
55827
+ align: align || "center",
55828
+ point: labelPoint,
55829
+ fontSize,
55830
+ textColor: labelModel.get("color") || "#fff",
55831
+ fontFamily: labelModel.get("fontFamily"),
55832
+ offset: [oldOffset[0] + symbolOffset[0], oldOffset[1] + symbolOffset[1]],
55833
+ textBorderColor: labelModel.get("textBorderColor"),
55834
+ textBorderWidth: labelModel.get("textBorderWidth")
55835
+ });
55836
+ }
55730
55837
  }
55838
+ labelsData.setLayout({
55839
+ symbolStyleMap,
55840
+ textList
55841
+ });
55731
55842
  }
55732
55843
  };
55733
55844
  }
@@ -55739,7 +55850,6 @@ function install25(registers) {
55739
55850
  registers.registerSeriesModel(LabelsSeries_default);
55740
55851
  registers.registerChartView(LabelsView_default);
55741
55852
  registers.registerLayout(labelsLayout_default);
55742
- registers.registerVisual(labelsVisual_default);
55743
55853
  }
55744
55854
 
55745
55855
  // src/chart/hlines/HLinesSeries.ts
@@ -64071,8 +64181,8 @@ DataZoomModel.defaultOption = {
64071
64181
  filterMode: "filter",
64072
64182
  start: 0,
64073
64183
  end: 100,
64074
- barSpace: 12,
64075
- lastBarRightSideDiffBarCount: 50 / 12,
64184
+ barSpace: 6,
64185
+ lastBarRightSideDiffBarCount: 50 / 6,
64076
64186
  offsetRightDistance: 50
64077
64187
  };
64078
64188
  function retrieveRawOption(option) {
@@ -75292,6 +75402,9 @@ function pathToBezierCurves(path) {
75292
75402
  case CMD5.F:
75293
75403
  i += 4;
75294
75404
  break;
75405
+ case CMD5.S:
75406
+ i += 4;
75407
+ break;
75295
75408
  case CMD5.Z:
75296
75409
  currentSubpath && addLine(xi, yi, x0, y0);
75297
75410
  xi = x0;