tvcharts 0.6.51 → 0.6.53
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 +179 -25
- package/dist/echarts.js.map +3 -3
- package/lib/chart/strategy/StrategyLayout.js +24 -10
- package/lib/chart/strategy/StrategyView.js +65 -7
- package/lib/chart/strategy/constants.js +31 -0
- package/lib/component/marker/MarkLabelView.js +1 -0
- package/lib/coord/axisHelper.js +0 -1
- package/lib/coord/axisTickLabelBuilder.js +8 -3
- package/lib/data/OrdinalMeta.js +1 -3
- package/lib/util/symbol.js +79 -1
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +2 -0
- package/types/dist/shared.d.ts +2 -0
- package/types/src/chart/strategy/StrategySeries.d.ts +1 -0
- package/types/src/chart/strategy/constants.d.ts +6 -0
- package/types/src/coord/axisCommonTypes.d.ts +1 -0
package/dist/echarts.js
CHANGED
|
@@ -22287,6 +22287,33 @@ var ArrowUp = Path_default.extend({
|
|
|
22287
22287
|
ctx.closePath();
|
|
22288
22288
|
}
|
|
22289
22289
|
});
|
|
22290
|
+
var ArrowUpClose = Path_default.extend({
|
|
22291
|
+
type: "arrowUpClose",
|
|
22292
|
+
shape: {
|
|
22293
|
+
cx: 0,
|
|
22294
|
+
cy: 0,
|
|
22295
|
+
width: 0,
|
|
22296
|
+
height: 0,
|
|
22297
|
+
rectWidth: 0,
|
|
22298
|
+
triangleHeight: 0
|
|
22299
|
+
},
|
|
22300
|
+
buildPath: function(ctx, shape) {
|
|
22301
|
+
const {cx, cy, rectWidth, triangleHeight} = shape;
|
|
22302
|
+
const width = shape.width / 2;
|
|
22303
|
+
const height = shape.height / 2;
|
|
22304
|
+
const triangleY = cy - height + triangleHeight;
|
|
22305
|
+
const rectHeight = 3;
|
|
22306
|
+
ctx.moveTo(cx, cy - height);
|
|
22307
|
+
ctx.lineTo(cx + width, triangleY);
|
|
22308
|
+
ctx.lineTo(cx + width - rectWidth, triangleY);
|
|
22309
|
+
ctx.lineTo(cx + width - rectWidth, cy + height);
|
|
22310
|
+
ctx.lineTo(cx - width + rectWidth, cy + height);
|
|
22311
|
+
ctx.lineTo(cx - width + rectWidth, triangleY);
|
|
22312
|
+
ctx.lineTo(cx - width, triangleY);
|
|
22313
|
+
ctx.closePath();
|
|
22314
|
+
ctx.rect(cx - width + 0.5, cy - height - 0.5 - rectHeight, shape.width - 0.5, rectHeight);
|
|
22315
|
+
}
|
|
22316
|
+
});
|
|
22290
22317
|
var ArrowDown = Path_default.extend({
|
|
22291
22318
|
type: "arrowDown",
|
|
22292
22319
|
shape: {
|
|
@@ -22312,6 +22339,33 @@ var ArrowDown = Path_default.extend({
|
|
|
22312
22339
|
ctx.closePath();
|
|
22313
22340
|
}
|
|
22314
22341
|
});
|
|
22342
|
+
var ArrowDownClose = Path_default.extend({
|
|
22343
|
+
type: "arrowDownClose",
|
|
22344
|
+
shape: {
|
|
22345
|
+
cx: 0,
|
|
22346
|
+
cy: 0,
|
|
22347
|
+
width: 0,
|
|
22348
|
+
height: 0,
|
|
22349
|
+
rectWidth: 0,
|
|
22350
|
+
triangleHeight: 0
|
|
22351
|
+
},
|
|
22352
|
+
buildPath: function(ctx, shape) {
|
|
22353
|
+
const {cx, cy, rectWidth, triangleHeight} = shape;
|
|
22354
|
+
const width = shape.width / 2;
|
|
22355
|
+
const height = shape.height / 2;
|
|
22356
|
+
const triangleY = cy + height - triangleHeight;
|
|
22357
|
+
const rectHeight = 3;
|
|
22358
|
+
ctx.moveTo(cx, cy + height);
|
|
22359
|
+
ctx.lineTo(cx + width, triangleY);
|
|
22360
|
+
ctx.lineTo(cx + width - rectWidth, triangleY);
|
|
22361
|
+
ctx.lineTo(cx + width - rectWidth, cy - height);
|
|
22362
|
+
ctx.lineTo(cx - width + rectWidth, cy - height);
|
|
22363
|
+
ctx.lineTo(cx - width + rectWidth, triangleY);
|
|
22364
|
+
ctx.lineTo(cx - width, triangleY);
|
|
22365
|
+
ctx.closePath();
|
|
22366
|
+
ctx.rect(cx - width + 0.5, cy + height + 0.5, shape.width - 0.5, rectHeight);
|
|
22367
|
+
}
|
|
22368
|
+
});
|
|
22315
22369
|
var symbolCtors = {
|
|
22316
22370
|
line: Line_default,
|
|
22317
22371
|
rect: Rect_default,
|
|
@@ -22339,7 +22393,9 @@ var symbolCtors = {
|
|
|
22339
22393
|
triangleDown: TriangleDown,
|
|
22340
22394
|
triangleLeft: TriangleLeft,
|
|
22341
22395
|
triangleRight: TriangleRight,
|
|
22342
|
-
arrowDown: ArrowDown
|
|
22396
|
+
arrowDown: ArrowDown,
|
|
22397
|
+
arrowUpClose: ArrowUpClose,
|
|
22398
|
+
arrowDownClose: ArrowDownClose
|
|
22343
22399
|
};
|
|
22344
22400
|
var symbolShapeMakers = {
|
|
22345
22401
|
line: function(x, y, w, h, shape) {
|
|
@@ -22556,6 +22612,22 @@ var symbolShapeMakers = {
|
|
|
22556
22612
|
shape.cy = y;
|
|
22557
22613
|
shape.width = w;
|
|
22558
22614
|
shape.height = h;
|
|
22615
|
+
},
|
|
22616
|
+
arrowUpClose: function(x, y, w, h, shape, parentShape) {
|
|
22617
|
+
shape.rectWidth = parentShape.triangleWidth;
|
|
22618
|
+
shape.triangleHeight = parentShape.triangleHeight;
|
|
22619
|
+
shape.cx = x;
|
|
22620
|
+
shape.cy = y;
|
|
22621
|
+
shape.width = w;
|
|
22622
|
+
shape.height = h;
|
|
22623
|
+
},
|
|
22624
|
+
arrowDownClose: function(x, y, w, h, shape, parentShape) {
|
|
22625
|
+
shape.rectWidth = parentShape.triangleWidth;
|
|
22626
|
+
shape.triangleHeight = parentShape.triangleHeight;
|
|
22627
|
+
shape.cx = x;
|
|
22628
|
+
shape.cy = y;
|
|
22629
|
+
shape.width = w;
|
|
22630
|
+
shape.height = h;
|
|
22559
22631
|
}
|
|
22560
22632
|
};
|
|
22561
22633
|
var symbolBuildProxies = {};
|
|
@@ -24538,7 +24610,7 @@ var ECharts = class extends Eventful_default {
|
|
|
24538
24610
|
barSpace: scale4.barSpace,
|
|
24539
24611
|
lastBarRightSideDiffBarCount: startLastBarRightSideDiffBarCount - distanceBarCount
|
|
24540
24612
|
};
|
|
24541
|
-
doDispatchAction.call(this, payload,
|
|
24613
|
+
doDispatchAction.call(this, payload, false);
|
|
24542
24614
|
}
|
|
24543
24615
|
}
|
|
24544
24616
|
scrollToDataIndex(dataIndex, animationDuration) {
|
|
@@ -24554,7 +24626,6 @@ var ECharts = class extends Eventful_default {
|
|
|
24554
24626
|
const size = ordinalMeta.getCategoriesSize();
|
|
24555
24627
|
const distance2 = (scale4.lastBarRightSideDiffBarCount + (size - centerOffset - 1 - dataIndex)) * scale4.barSpace;
|
|
24556
24628
|
this.scrollByDistance(distance2, animationDuration);
|
|
24557
|
-
console.log("%c [ xAxisModal ]-1751", "font-size:13px; background:pink; color:#bf2c9f;", xAxisModal);
|
|
24558
24629
|
}
|
|
24559
24630
|
scrollToTimestamp(timestamp, animationDuration) {
|
|
24560
24631
|
if (this._disposed) {
|
|
@@ -27404,9 +27475,7 @@ var OrdinalMeta = class {
|
|
|
27404
27475
|
const value = val;
|
|
27405
27476
|
if (isSegmentedByTime) {
|
|
27406
27477
|
const index = i + categories.length;
|
|
27407
|
-
|
|
27408
|
-
addItem(value, index);
|
|
27409
|
-
}
|
|
27478
|
+
addItem(value, index);
|
|
27410
27479
|
}
|
|
27411
27480
|
return getName(val);
|
|
27412
27481
|
});
|
|
@@ -29785,13 +29854,18 @@ function calculateCategoryInterval(axis) {
|
|
|
29785
29854
|
const fontSize = typeof labelModel.get("fontSize") === "number" ? +labelModel.get("fontSize") : 12;
|
|
29786
29855
|
return Math.round((fontSize + 4) * 5 / ordinalScale.barSpace);
|
|
29787
29856
|
}
|
|
29857
|
+
if (ordinalExtent[1] - ordinalExtent[0] < 1) {
|
|
29858
|
+
return 0;
|
|
29859
|
+
}
|
|
29860
|
+
const splitIntervalWidth = axis.model.get("splitIntervalWidth");
|
|
29861
|
+
if (axis.model.get("splitIntervalWidth")) {
|
|
29862
|
+
const splitNumber = Math.ceil((axisExtent[1] - axisExtent[0]) / splitIntervalWidth);
|
|
29863
|
+
return Math.ceil((ordinalExtent[1] - ordinalExtent[0]) / splitNumber);
|
|
29864
|
+
}
|
|
29788
29865
|
const params = fetchAutoCategoryIntervalCalculationParams(axis);
|
|
29789
29866
|
const labelFormatter = makeLabelFormatter(axis);
|
|
29790
29867
|
const rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
|
|
29791
29868
|
const tickCount = ordinalScale.count();
|
|
29792
|
-
if (ordinalExtent[1] - ordinalExtent[0] < 1) {
|
|
29793
|
-
return 0;
|
|
29794
|
-
}
|
|
29795
29869
|
let step = 1;
|
|
29796
29870
|
if (tickCount > 40) {
|
|
29797
29871
|
step = Math.max(1, Math.floor(tickCount / 40));
|
|
@@ -55617,6 +55691,13 @@ function install24(registers) {
|
|
|
55617
55691
|
registers.registerLayout(linesPlotLayout_default);
|
|
55618
55692
|
}
|
|
55619
55693
|
|
|
55694
|
+
// src/chart/strategy/constants.ts
|
|
55695
|
+
var LongColor = "rgb(41, 98, 255)";
|
|
55696
|
+
var ShortColor = "rgb(255, 23, 68)";
|
|
55697
|
+
var CloseColor = "rgb(213, 0, 249)";
|
|
55698
|
+
var ArrowSize = [12, 16];
|
|
55699
|
+
var TriangleSize = [6, 10];
|
|
55700
|
+
|
|
55620
55701
|
// src/chart/strategy/SymbolPath.ts
|
|
55621
55702
|
var LargeSymbolPathShape3 = class {
|
|
55622
55703
|
};
|
|
@@ -55649,8 +55730,6 @@ var SymbolPath2 = class extends Path_default {
|
|
|
55649
55730
|
var SymbolPath_default2 = SymbolPath2;
|
|
55650
55731
|
|
|
55651
55732
|
// src/chart/strategy/StrategyView.ts
|
|
55652
|
-
var LongColor = "rgb(41, 98, 255)";
|
|
55653
|
-
var ShortColor = "rgb(255, 23, 68)";
|
|
55654
55733
|
var StrategyView2 = class extends Chart_default {
|
|
55655
55734
|
constructor() {
|
|
55656
55735
|
super(...arguments);
|
|
@@ -55688,7 +55767,7 @@ var StrategyView2 = class extends Chart_default {
|
|
|
55688
55767
|
const upTriangleEl = new SymbolPath_default2({
|
|
55689
55768
|
shape: {
|
|
55690
55769
|
points: upTriangle,
|
|
55691
|
-
size:
|
|
55770
|
+
size: TriangleSize
|
|
55692
55771
|
},
|
|
55693
55772
|
style: {
|
|
55694
55773
|
fill: LongColor
|
|
@@ -55697,11 +55776,24 @@ var StrategyView2 = class extends Chart_default {
|
|
|
55697
55776
|
});
|
|
55698
55777
|
upTriangleEl.symbolProxy = createSymbol("triangleRight", 0, 0, 0, 0);
|
|
55699
55778
|
symbolGroup.add(upTriangleEl);
|
|
55779
|
+
const closeUpTriangle = data.getLayout("closeUpTriangle");
|
|
55780
|
+
const closeUpTriangleEl = new SymbolPath_default2({
|
|
55781
|
+
shape: {
|
|
55782
|
+
points: closeUpTriangle,
|
|
55783
|
+
size: TriangleSize
|
|
55784
|
+
},
|
|
55785
|
+
style: {
|
|
55786
|
+
fill: CloseColor
|
|
55787
|
+
},
|
|
55788
|
+
z2
|
|
55789
|
+
});
|
|
55790
|
+
closeUpTriangleEl.symbolProxy = createSymbol("triangleRight", 0, 0, 0, 0);
|
|
55791
|
+
symbolGroup.add(closeUpTriangleEl);
|
|
55700
55792
|
const upArrow = data.getLayout("upArrow");
|
|
55701
55793
|
const arrowUpEl = new SymbolPath_default2({
|
|
55702
55794
|
shape: {
|
|
55703
55795
|
points: upArrow,
|
|
55704
|
-
size:
|
|
55796
|
+
size: ArrowSize
|
|
55705
55797
|
},
|
|
55706
55798
|
style: {
|
|
55707
55799
|
fill: LongColor
|
|
@@ -55715,11 +55807,29 @@ var StrategyView2 = class extends Chart_default {
|
|
|
55715
55807
|
triangleHeight: 6
|
|
55716
55808
|
};
|
|
55717
55809
|
symbolGroup.add(arrowUpEl);
|
|
55810
|
+
const closeUpArrow = data.getLayout("closeUpArrow");
|
|
55811
|
+
const closeUpArrowEl = new SymbolPath_default2({
|
|
55812
|
+
shape: {
|
|
55813
|
+
points: closeUpArrow,
|
|
55814
|
+
size: ArrowSize
|
|
55815
|
+
},
|
|
55816
|
+
style: {
|
|
55817
|
+
fill: CloseColor
|
|
55818
|
+
},
|
|
55819
|
+
z2
|
|
55820
|
+
});
|
|
55821
|
+
closeUpArrowEl.symbolProxy = createSymbol("arrowUpClose", 0, 0, 0, 0);
|
|
55822
|
+
closeUpArrowEl.symbolProxy.shape = {
|
|
55823
|
+
...closeUpArrowEl.symbolProxy.shape,
|
|
55824
|
+
triangleWidth: 4,
|
|
55825
|
+
triangleHeight: 6
|
|
55826
|
+
};
|
|
55827
|
+
symbolGroup.add(closeUpArrowEl);
|
|
55718
55828
|
const downTriangle = data.getLayout("downTriangle");
|
|
55719
55829
|
const downTriangleEl = new SymbolPath_default2({
|
|
55720
55830
|
shape: {
|
|
55721
55831
|
points: downTriangle,
|
|
55722
|
-
size:
|
|
55832
|
+
size: TriangleSize
|
|
55723
55833
|
},
|
|
55724
55834
|
style: {
|
|
55725
55835
|
fill: ShortColor
|
|
@@ -55728,11 +55838,24 @@ var StrategyView2 = class extends Chart_default {
|
|
|
55728
55838
|
});
|
|
55729
55839
|
downTriangleEl.symbolProxy = createSymbol("triangleLeft", 0, 0, 0, 0);
|
|
55730
55840
|
symbolGroup.add(downTriangleEl);
|
|
55841
|
+
const closeDownTriangle = data.getLayout("closeDownTriangle");
|
|
55842
|
+
const closeDownTriangleEl = new SymbolPath_default2({
|
|
55843
|
+
shape: {
|
|
55844
|
+
points: closeDownTriangle,
|
|
55845
|
+
size: TriangleSize
|
|
55846
|
+
},
|
|
55847
|
+
style: {
|
|
55848
|
+
fill: CloseColor
|
|
55849
|
+
},
|
|
55850
|
+
z2
|
|
55851
|
+
});
|
|
55852
|
+
closeDownTriangleEl.symbolProxy = createSymbol("triangleLeft", 0, 0, 0, 0);
|
|
55853
|
+
symbolGroup.add(closeDownTriangleEl);
|
|
55731
55854
|
const downArrow = data.getLayout("downArrow");
|
|
55732
55855
|
const arrowDownEl = new SymbolPath_default2({
|
|
55733
55856
|
shape: {
|
|
55734
55857
|
points: downArrow,
|
|
55735
|
-
size:
|
|
55858
|
+
size: ArrowSize
|
|
55736
55859
|
},
|
|
55737
55860
|
style: {
|
|
55738
55861
|
fill: ShortColor
|
|
@@ -55746,6 +55869,24 @@ var StrategyView2 = class extends Chart_default {
|
|
|
55746
55869
|
triangleHeight: 6
|
|
55747
55870
|
};
|
|
55748
55871
|
symbolGroup.add(arrowDownEl);
|
|
55872
|
+
const closeDownArrow = data.getLayout("closeDownArrow");
|
|
55873
|
+
const closeDownArrowEl = new SymbolPath_default2({
|
|
55874
|
+
shape: {
|
|
55875
|
+
points: closeDownArrow,
|
|
55876
|
+
size: ArrowSize
|
|
55877
|
+
},
|
|
55878
|
+
style: {
|
|
55879
|
+
fill: CloseColor
|
|
55880
|
+
},
|
|
55881
|
+
z2
|
|
55882
|
+
});
|
|
55883
|
+
closeDownArrowEl.symbolProxy = createSymbol("arrowDownClose", 0, 0, 0, 0);
|
|
55884
|
+
closeDownArrowEl.symbolProxy.shape = {
|
|
55885
|
+
...closeDownArrowEl.symbolProxy.shape,
|
|
55886
|
+
triangleWidth: 4,
|
|
55887
|
+
triangleHeight: 6
|
|
55888
|
+
};
|
|
55889
|
+
symbolGroup.add(closeDownArrowEl);
|
|
55749
55890
|
const texts = data.getLayout("texts");
|
|
55750
55891
|
const textColor = seriesModel.get("textColor");
|
|
55751
55892
|
each(texts, function(item) {
|
|
@@ -55813,7 +55954,8 @@ StrategySeriesModel.defaultOption = {
|
|
|
55813
55954
|
var StrategySeries_default = StrategySeriesModel;
|
|
55814
55955
|
|
|
55815
55956
|
// src/chart/strategy/StrategyLayout.ts
|
|
55816
|
-
var arrowHeight =
|
|
55957
|
+
var arrowHeight = ArrowSize[1];
|
|
55958
|
+
var closeArrowHeight = ArrowSize[1] + 3;
|
|
55817
55959
|
var arrowMargin = 10;
|
|
55818
55960
|
var textMargin = 6;
|
|
55819
55961
|
var textHeight = 26;
|
|
@@ -55847,6 +55989,10 @@ var StrategyLayout = {
|
|
|
55847
55989
|
const downTriangle = [];
|
|
55848
55990
|
const upArrow = [];
|
|
55849
55991
|
const downArrow = [];
|
|
55992
|
+
const closeDownArrow = [];
|
|
55993
|
+
const closeUpArrow = [];
|
|
55994
|
+
const closeUpTriangle = [];
|
|
55995
|
+
const closeDownTriangle = [];
|
|
55850
55996
|
const texts = [];
|
|
55851
55997
|
for (let i = params.start; i < params.end; i++) {
|
|
55852
55998
|
const x = store.get(dimIdx0, i);
|
|
@@ -55859,8 +56005,10 @@ var StrategyLayout = {
|
|
|
55859
56005
|
const baseDownPoint = coordSys.dataToPoint([x, baseDown]);
|
|
55860
56006
|
const optimizeX = baseUpPoint[0] + 0.5;
|
|
55861
56007
|
each(upOrders, function(item) {
|
|
55862
|
-
upTriangle.push(coordSys.dataToPoint([x, item.price]));
|
|
55863
|
-
|
|
56008
|
+
(item.isClose ? closeUpTriangle : upTriangle).push(coordSys.dataToPoint([x, item.price]));
|
|
56009
|
+
const visibleArrowHeight = item.isClose ? closeArrowHeight : arrowHeight;
|
|
56010
|
+
const arrowY = baseUpPoint[1] + arrowMargin + visibleArrowHeight / 2;
|
|
56011
|
+
(item.isClose ? closeUpArrow : upArrow).push([optimizeX, arrowY]);
|
|
55864
56012
|
if (!allInVisible) {
|
|
55865
56013
|
const count2 = countVisible ? "+" + item.count : "";
|
|
55866
56014
|
const comment = signVisible ? item.comment : "";
|
|
@@ -55868,24 +56016,26 @@ var StrategyLayout = {
|
|
|
55868
56016
|
text: `${comment}${split2}${count2}`,
|
|
55869
56017
|
point: [
|
|
55870
56018
|
baseUpPoint[0],
|
|
55871
|
-
baseUpPoint[1] + arrowMargin +
|
|
56019
|
+
baseUpPoint[1] + arrowMargin + visibleArrowHeight + visibleTextMargin
|
|
55872
56020
|
]
|
|
55873
56021
|
});
|
|
55874
56022
|
}
|
|
55875
|
-
baseUpPoint[1] = baseUpPoint[1] + arrowMargin +
|
|
56023
|
+
baseUpPoint[1] = baseUpPoint[1] + arrowMargin + visibleArrowHeight + visibleTextMargin + visibleTextHeight;
|
|
55876
56024
|
});
|
|
55877
56025
|
each(downOrders, function(item) {
|
|
55878
|
-
downTriangle.push(coordSys.dataToPoint([x, item.price]));
|
|
55879
|
-
|
|
56026
|
+
(item.isClose ? closeDownTriangle : downTriangle).push(coordSys.dataToPoint([x, item.price]));
|
|
56027
|
+
const visibleArrowHeight = item.isClose ? closeArrowHeight : arrowHeight;
|
|
56028
|
+
const arrowY = baseDownPoint[1] - arrowMargin - visibleArrowHeight / 2;
|
|
56029
|
+
(item.isClose ? closeDownArrow : downArrow).push([optimizeX, arrowY]);
|
|
55880
56030
|
if (!allInVisible) {
|
|
55881
56031
|
const count2 = countVisible ? "-" + item.count : "";
|
|
55882
56032
|
const comment = signVisible ? item.comment : "";
|
|
55883
56033
|
texts.push({text: `${count2}${split2}${comment}`, point: [
|
|
55884
56034
|
baseDownPoint[0],
|
|
55885
|
-
baseDownPoint[1] - arrowMargin -
|
|
56035
|
+
baseDownPoint[1] - arrowMargin - visibleArrowHeight - visibleTextMargin - visibleTextHeight
|
|
55886
56036
|
]});
|
|
55887
56037
|
}
|
|
55888
|
-
baseDownPoint[1] = baseDownPoint[1] - arrowMargin -
|
|
56038
|
+
baseDownPoint[1] = baseDownPoint[1] - arrowMargin - visibleArrowHeight - visibleTextMargin - visibleTextHeight;
|
|
55889
56039
|
});
|
|
55890
56040
|
}
|
|
55891
56041
|
data.setLayout({
|
|
@@ -55893,7 +56043,11 @@ var StrategyLayout = {
|
|
|
55893
56043
|
downTriangle,
|
|
55894
56044
|
upArrow,
|
|
55895
56045
|
downArrow,
|
|
55896
|
-
texts
|
|
56046
|
+
texts,
|
|
56047
|
+
closeDownArrow,
|
|
56048
|
+
closeUpArrow,
|
|
56049
|
+
closeUpTriangle,
|
|
56050
|
+
closeDownTriangle
|
|
55897
56051
|
});
|
|
55898
56052
|
}
|
|
55899
56053
|
};
|