tvcharts 0.5.60 → 0.5.62
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.common.js +173 -77
- package/dist/echarts.common.js.map +1 -1
- package/dist/echarts.common.min.js +2 -2
- package/dist/echarts.js +44 -15
- package/dist/echarts.js.map +2 -2
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +24 -72
- package/dist/echarts.simple.js.map +1 -1
- package/dist/echarts.simple.min.js +2 -2
- package/lib/component/graphic/GraphicView.js +69 -24
- package/package.json +1 -1
- package/types/src/component/graphic/GraphicView.d.ts +1 -0
package/dist/echarts.common.js
CHANGED
|
@@ -27653,6 +27653,7 @@
|
|
|
27653
27653
|
});
|
|
27654
27654
|
}
|
|
27655
27655
|
function doUpdateZ(el, z, zlevel, maxZ2) {
|
|
27656
|
+
var _a;
|
|
27656
27657
|
// Group may also have textContent
|
|
27657
27658
|
var label = el.getTextContent();
|
|
27658
27659
|
var labelLine = el.getTextGuideLine();
|
|
@@ -27661,7 +27662,7 @@
|
|
|
27661
27662
|
// set z & zlevel of children elements of Group
|
|
27662
27663
|
var children = el.childrenRef();
|
|
27663
27664
|
for (var i = 0; i < children.length; i++) {
|
|
27664
|
-
maxZ2 = Math.max(doUpdateZ(children[i], z, zlevel, maxZ2), maxZ2);
|
|
27665
|
+
maxZ2 = Math.max(doUpdateZ(children[i], z, (_a = el.zLevel) !== null && _a !== void 0 ? _a : zlevel, maxZ2), maxZ2);
|
|
27665
27666
|
}
|
|
27666
27667
|
} else {
|
|
27667
27668
|
// not Group
|
|
@@ -42107,7 +42108,7 @@
|
|
|
42107
42108
|
axisBackground: {
|
|
42108
42109
|
show: false,
|
|
42109
42110
|
backStyle: {
|
|
42110
|
-
opacity:
|
|
42111
|
+
// opacity: 1
|
|
42111
42112
|
}
|
|
42112
42113
|
}
|
|
42113
42114
|
};
|
|
@@ -42531,7 +42532,6 @@
|
|
|
42531
42532
|
// Axis position
|
|
42532
42533
|
layout.position = [axisDim === 'y' ? posBound[idx[axisPosition]] : rectBound[0], axisDim === 'x' ? posBound[idx[axisPosition]] : rectBound[3]];
|
|
42533
42534
|
// Axis rotation
|
|
42534
|
-
// layout.rotation = 0;
|
|
42535
42535
|
layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1);
|
|
42536
42536
|
// Tick and label direction, x y is axisDim
|
|
42537
42537
|
var dirMap = {
|
|
@@ -43101,6 +43101,7 @@
|
|
|
43101
43101
|
};
|
|
43102
43102
|
}
|
|
43103
43103
|
|
|
43104
|
+
// import InsideZoomModel from '../dataZoom/InsideZoomModel.js';
|
|
43104
43105
|
var PI$5 = Math.PI;
|
|
43105
43106
|
/**
|
|
43106
43107
|
* A final axis is translated and rotated from a "standard axis".
|
|
@@ -43150,6 +43151,11 @@
|
|
|
43150
43151
|
// this._transformGroup = transformGroup;
|
|
43151
43152
|
transformGroup.updateTransform();
|
|
43152
43153
|
this._transformGroup = transformGroup;
|
|
43154
|
+
// todo 提高y轴层级
|
|
43155
|
+
if (axisModel.axis.dim === 'y') {
|
|
43156
|
+
// @ts-ignore
|
|
43157
|
+
this.group.zLevel = 2;
|
|
43158
|
+
}
|
|
43153
43159
|
}
|
|
43154
43160
|
AxisBuilder.prototype.hasBuilder = function (name) {
|
|
43155
43161
|
return !!builders[name];
|
|
@@ -43293,73 +43299,25 @@
|
|
|
43293
43299
|
// v2ApplyTransform(pt2, pt2, matrix);
|
|
43294
43300
|
}
|
|
43295
43301
|
|
|
43296
|
-
var style = extend({
|
|
43297
|
-
// lineCap: 'round'
|
|
43298
|
-
}, axisModel.getModel(['axisBackground', 'backStyle']).getLineStyle());
|
|
43302
|
+
var style = extend({}, axisModel.getModel(['axisBackground', 'backStyle']).getAreaStyle());
|
|
43299
43303
|
// const dataZoomModals =
|
|
43300
43304
|
// axisModel.ecModel.queryComponents({ mainType: 'dataZoom', id: axisModel.mainType }) as InsideZoomModel[];
|
|
43301
43305
|
var position = axisModel.axis.position;
|
|
43302
43306
|
// const ecInstance = axisModel.ecModel.scheduler.ecInstance;
|
|
43303
43307
|
var api = axisModel.ecModel.scheduler.api;
|
|
43304
|
-
|
|
43305
|
-
//
|
|
43306
|
-
//
|
|
43307
|
-
//
|
|
43308
|
-
//
|
|
43309
|
-
//
|
|
43310
|
-
//
|
|
43311
|
-
//
|
|
43312
|
-
//
|
|
43313
|
-
//
|
|
43314
|
-
//
|
|
43315
|
-
//
|
|
43316
|
-
//
|
|
43317
|
-
// mouseY = 0;
|
|
43318
|
-
// break;
|
|
43319
|
-
// case 'mousedown':
|
|
43320
|
-
// isMouseDown = true;
|
|
43321
|
-
// break;
|
|
43322
|
-
// case 'mousemove':
|
|
43323
|
-
// let zoomStep = 0.2; // 设置缩放步长
|
|
43324
|
-
// if (isMouseDown && e.offsetY !== mouseY) {
|
|
43325
|
-
// dataZoomModals.forEach(item => {
|
|
43326
|
-
// const { settledOption, componentIndex } = item;
|
|
43327
|
-
// // 下滑
|
|
43328
|
-
// if (mouseY > e.offsetY) {
|
|
43329
|
-
// zoomStep = -zoomStep;
|
|
43330
|
-
// }
|
|
43331
|
-
// ecInstance.dispatchAction({
|
|
43332
|
-
// type: 'dataZoom',
|
|
43333
|
-
// dataZoomIndex: componentIndex,
|
|
43334
|
-
// start:
|
|
43335
|
-
// settledOption.start - zoomStep,
|
|
43336
|
-
// end:
|
|
43337
|
-
// settledOption.end + zoomStep
|
|
43338
|
-
// });
|
|
43339
|
-
// mouseY = e.offsetY;
|
|
43340
|
-
// });
|
|
43341
|
-
// }
|
|
43342
|
-
// break;
|
|
43343
|
-
// case 'mousewheel': {
|
|
43344
|
-
// const zoomStep = e.wheelDelta * 0.8;
|
|
43345
|
-
// dataZoomModals.forEach(item => {
|
|
43346
|
-
// const { settledOption, componentIndex } = item;
|
|
43347
|
-
// ecInstance.dispatchAction({
|
|
43348
|
-
// type: 'dataZoom',
|
|
43349
|
-
// dataZoomIndex: componentIndex,
|
|
43350
|
-
// start:
|
|
43351
|
-
// settledOption.start + zoomStep,
|
|
43352
|
-
// end:
|
|
43353
|
-
// settledOption.end - zoomStep
|
|
43354
|
-
// });
|
|
43355
|
-
// });
|
|
43356
|
-
// }
|
|
43357
|
-
// break;
|
|
43358
|
-
// }
|
|
43359
|
-
// // console.log("y轴交互")
|
|
43360
|
-
// // if () {
|
|
43361
|
-
// // }
|
|
43362
|
-
// });
|
|
43308
|
+
// const width = api.getWidth();
|
|
43309
|
+
// const rect = position === 'left' ? {
|
|
43310
|
+
// left: 0,
|
|
43311
|
+
// right: pt1[0],
|
|
43312
|
+
// top: 0,
|
|
43313
|
+
// bottom: pt1[1]
|
|
43314
|
+
// } : {
|
|
43315
|
+
// left: pt1[0],
|
|
43316
|
+
// right: width,
|
|
43317
|
+
// top: 0,
|
|
43318
|
+
// bottom: pt1[1]
|
|
43319
|
+
// };
|
|
43320
|
+
// const { left, right, top, bottom } = rect;
|
|
43363
43321
|
// todo 先不管x轴
|
|
43364
43322
|
var background = new Rect({
|
|
43365
43323
|
shape: position === 'left' ? {
|
|
@@ -44118,7 +44076,6 @@
|
|
|
44118
44076
|
inner$6(axisView).splitAreaColors = null;
|
|
44119
44077
|
}
|
|
44120
44078
|
|
|
44121
|
-
// import * as globalListener from './globalListener.js';
|
|
44122
44079
|
var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName', 'axisBackground'];
|
|
44123
44080
|
var selfBuilderAttrs = ['splitArea', 'splitLine', 'minorSplitLine'];
|
|
44124
44081
|
var CartesianAxisView = /** @class */function (_super) {
|
|
@@ -44128,10 +44085,6 @@
|
|
|
44128
44085
|
_this.type = CartesianAxisView.type;
|
|
44129
44086
|
_this.axisPointerClass = 'CartesianAxisPointer';
|
|
44130
44087
|
return _this;
|
|
44131
|
-
// dispose(ecModel: GlobalModel, api: ExtensionAPI) {
|
|
44132
|
-
// super.dispose(ecModel, api);
|
|
44133
|
-
// // globalListener.unregister('axisBackground', api);
|
|
44134
|
-
// }
|
|
44135
44088
|
}
|
|
44136
44089
|
/**
|
|
44137
44090
|
* @override
|
|
@@ -44175,8 +44128,7 @@
|
|
|
44175
44128
|
}
|
|
44176
44129
|
_super.prototype.render.call(this, axisModel, ecModel, api, payload);
|
|
44177
44130
|
};
|
|
44178
|
-
CartesianAxisView.prototype.remove = function (
|
|
44179
|
-
// globalListener.unregister('axisBackground', api);
|
|
44131
|
+
CartesianAxisView.prototype.remove = function () {
|
|
44180
44132
|
rectCoordAxisHandleRemove(this);
|
|
44181
44133
|
};
|
|
44182
44134
|
CartesianAxisView.type = 'cartesianAxis';
|
|
@@ -44412,6 +44364,8 @@
|
|
|
44412
44364
|
var moveAnimation = this._moveAnimation = this.determineAnimation(axisModel, axisPointerModel);
|
|
44413
44365
|
if (!group) {
|
|
44414
44366
|
group = this._group = new Group();
|
|
44367
|
+
// @ts-ignore //todo先这样写
|
|
44368
|
+
this._group.zLevel = 2;
|
|
44415
44369
|
this.createPointerEl(group, elOption, axisModel, axisPointerModel);
|
|
44416
44370
|
this.createLabelEl(group, elOption, axisModel, axisPointerModel);
|
|
44417
44371
|
api.getZr().add(group);
|
|
@@ -44488,6 +44442,8 @@
|
|
|
44488
44442
|
BaseAxisPointer.prototype.createLabelEl = function (group, elOption, axisModel, axisPointerModel) {
|
|
44489
44443
|
if (elOption.label) {
|
|
44490
44444
|
var labelEl = inner$7(group).labelEl = new ZRText(clone$3(elOption.label));
|
|
44445
|
+
// todo 因为y层级也提高了,所以这里也得调整
|
|
44446
|
+
labelEl.zlevel = 2;
|
|
44491
44447
|
group.add(labelEl);
|
|
44492
44448
|
updateLabelShowHide(labelEl, axisPointerModel);
|
|
44493
44449
|
}
|
|
@@ -46485,10 +46441,10 @@
|
|
|
46485
46441
|
}
|
|
46486
46442
|
if (['dataZoom', 'resize'].includes(payload === null || payload === void 0 ? void 0 : payload.type)) {
|
|
46487
46443
|
this._dataZoomUpdateElements(graphicModel, ecIns);
|
|
46488
|
-
this._updateLabels();
|
|
46444
|
+
this._updateLabels(ecModel, api);
|
|
46489
46445
|
}
|
|
46490
46446
|
this._lastGraphicModel = graphicModel;
|
|
46491
|
-
this._updateElements(graphicModel);
|
|
46447
|
+
this._updateElements(graphicModel, ecModel, api);
|
|
46492
46448
|
this._relocate(graphicModel, api);
|
|
46493
46449
|
};
|
|
46494
46450
|
GraphicComponentView.prototype._dataZoomUpdateChildrenElements = function (children) {
|
|
@@ -46538,7 +46494,7 @@
|
|
|
46538
46494
|
/**
|
|
46539
46495
|
* Update graphic elements.
|
|
46540
46496
|
*/
|
|
46541
|
-
GraphicComponentView.prototype._updateElements = function (graphicModel) {
|
|
46497
|
+
GraphicComponentView.prototype._updateElements = function (graphicModel, ecModel, api) {
|
|
46542
46498
|
var elOptionsToUpdate = graphicModel.useElOptionsToUpdate();
|
|
46543
46499
|
if (!elOptionsToUpdate) {
|
|
46544
46500
|
return;
|
|
@@ -46666,16 +46622,90 @@
|
|
|
46666
46622
|
applyKeyframeAnimation(el, elOption.keyframeAnimation, graphicModel);
|
|
46667
46623
|
}
|
|
46668
46624
|
});
|
|
46669
|
-
this._updateLabels();
|
|
46625
|
+
this._updateLabels(ecModel, api);
|
|
46670
46626
|
};
|
|
46671
|
-
GraphicComponentView.prototype._updateLabels = function () {
|
|
46627
|
+
GraphicComponentView.prototype._updateLabels = function (ecModel, api) {
|
|
46672
46628
|
var elLabelMap = this._elLabelMap;
|
|
46673
46629
|
var elLabelGroupEls = [];
|
|
46630
|
+
var rootGroup = this.group;
|
|
46631
|
+
// this._clearSeriesLabels();
|
|
46674
46632
|
elLabelMap.each(function (item) {
|
|
46675
46633
|
if (item.isGroup && typeof item.y === 'number') {
|
|
46676
46634
|
elLabelGroupEls.push(item);
|
|
46677
46635
|
}
|
|
46678
46636
|
});
|
|
46637
|
+
var width = api.getWidth();
|
|
46638
|
+
var seriesLabels = this._seriesLabels;
|
|
46639
|
+
// const showLabelElIndex: {[index: number]: boolean } = {}
|
|
46640
|
+
ecModel.eachSeries(function (seriesModel, index) {
|
|
46641
|
+
// const seriesData = seriesModel.getData();
|
|
46642
|
+
var axisModel = seriesModel.getBaseAxis();
|
|
46643
|
+
var extent = axisModel.scale.getExtent();
|
|
46644
|
+
// const dataIndex = extent[1] - extent[0];
|
|
46645
|
+
// const store = seriesData.getStore();
|
|
46646
|
+
var lastIndex = extent[1];
|
|
46647
|
+
var dataSource = seriesModel.get('data');
|
|
46648
|
+
var data = dataSource[lastIndex];
|
|
46649
|
+
var coordSys = seriesModel.coordinateSystem;
|
|
46650
|
+
var el = seriesLabels[index];
|
|
46651
|
+
if (!data) {
|
|
46652
|
+
if (el) {
|
|
46653
|
+
el.ignore = true;
|
|
46654
|
+
}
|
|
46655
|
+
return;
|
|
46656
|
+
}
|
|
46657
|
+
var yAxisModel = coordSys.getAxis('y');
|
|
46658
|
+
var yValue = Array.isArray(data) ? data[2] : data;
|
|
46659
|
+
var y = coordSys.dataToPoint([0, yValue])[1] - 18;
|
|
46660
|
+
var x = yAxisModel.position === 'right' ? width - 65 : 0;
|
|
46661
|
+
var fill = '#26A69A';
|
|
46662
|
+
var text = yValue.toFixed(4);
|
|
46663
|
+
if (seriesModel.subType === 'candlestick') {
|
|
46664
|
+
var sign = void 0;
|
|
46665
|
+
var kSeriesModal = seriesModel;
|
|
46666
|
+
var hasDojiColor = !!kSeriesModal.get(['itemStyle', 'borderColorDoji']);
|
|
46667
|
+
var openVal = data[0],
|
|
46668
|
+
closeVal = data[1];
|
|
46669
|
+
if (openVal > closeVal) {
|
|
46670
|
+
sign = -1;
|
|
46671
|
+
} else if (openVal < closeVal) {
|
|
46672
|
+
sign = 1;
|
|
46673
|
+
} else {
|
|
46674
|
+
sign = hasDojiColor ? 0 : lastIndex > 0 ? kSeriesModal.get('data')[lastIndex - 1][1] <= closeVal ? 1 : -1 : 1;
|
|
46675
|
+
}
|
|
46676
|
+
// const itemModel = seriesData.getItemModel(dataIndex) as any;
|
|
46677
|
+
// const sign = seriesData.getItemLayout(dataIndex)?.sign;
|
|
46678
|
+
fill = kSeriesModal.get(['itemStyle', sign > 0 ? 'color' : 'color0']);
|
|
46679
|
+
// console.log('====', (seriesModel as any).get('itemStyle'))
|
|
46680
|
+
}
|
|
46681
|
+
// showLabelElIndex[index] = true;
|
|
46682
|
+
if (el) {
|
|
46683
|
+
el.x = x;
|
|
46684
|
+
el.y = y;
|
|
46685
|
+
el.ignore = false;
|
|
46686
|
+
el.traverse(function (el) {
|
|
46687
|
+
if (el.type === 'text') {
|
|
46688
|
+
el.attr('style', {
|
|
46689
|
+
fill: fill,
|
|
46690
|
+
text: text
|
|
46691
|
+
});
|
|
46692
|
+
} else {
|
|
46693
|
+
el.style.stroke = fill;
|
|
46694
|
+
}
|
|
46695
|
+
});
|
|
46696
|
+
elLabelGroupEls.push(el);
|
|
46697
|
+
} else {
|
|
46698
|
+
el = getTipsGraphic({
|
|
46699
|
+
x: x,
|
|
46700
|
+
y: y,
|
|
46701
|
+
text: text,
|
|
46702
|
+
fill: fill
|
|
46703
|
+
});
|
|
46704
|
+
rootGroup.add(el);
|
|
46705
|
+
seriesLabels[index] = el;
|
|
46706
|
+
}
|
|
46707
|
+
elLabelGroupEls.push(el);
|
|
46708
|
+
});
|
|
46679
46709
|
avoidOverlap$1(elLabelGroupEls);
|
|
46680
46710
|
};
|
|
46681
46711
|
/**
|
|
@@ -46784,16 +46814,35 @@
|
|
|
46784
46814
|
removeLabelEl(labelOption, elLabelMap);
|
|
46785
46815
|
this._mergeElementLabels(graphicModel, labelOption);
|
|
46786
46816
|
};
|
|
46817
|
+
/**
|
|
46818
|
+
* Clear all elements.
|
|
46819
|
+
*/
|
|
46820
|
+
GraphicComponentView.prototype._clearSeriesLabels = function () {
|
|
46821
|
+
var seriesLabels = this._seriesLabels;
|
|
46822
|
+
each(seriesLabels, function (el) {
|
|
46823
|
+
var parentEl = el.parent;
|
|
46824
|
+
if (parentEl) {
|
|
46825
|
+
parentEl.remove(el);
|
|
46826
|
+
}
|
|
46827
|
+
});
|
|
46828
|
+
this._seriesLabels = [];
|
|
46829
|
+
};
|
|
46787
46830
|
/**
|
|
46788
46831
|
* Clear all elements.
|
|
46789
46832
|
*/
|
|
46790
46833
|
GraphicComponentView.prototype._clear = function () {
|
|
46791
46834
|
var _this = this;
|
|
46792
46835
|
var elMap = this._elMap;
|
|
46836
|
+
var elLabelMap = this._elLabelMap;
|
|
46793
46837
|
elMap.each(function (el) {
|
|
46794
46838
|
removeEl(el, inner$a(el).option, elMap, _this._lastGraphicModel);
|
|
46795
46839
|
});
|
|
46840
|
+
elLabelMap.each(function (el) {
|
|
46841
|
+
removeEl(el, inner$a(el).option, elLabelMap, _this._lastGraphicModel);
|
|
46842
|
+
});
|
|
46843
|
+
this._clearSeriesLabels();
|
|
46796
46844
|
this._elMap = createHashMap();
|
|
46845
|
+
this._elLabelMap = createHashMap();
|
|
46797
46846
|
};
|
|
46798
46847
|
GraphicComponentView.prototype.getGraphicById = function (id) {
|
|
46799
46848
|
return this._elMap.get(id);
|
|
@@ -46924,6 +46973,53 @@
|
|
|
46924
46973
|
eventData.info = elOption.info;
|
|
46925
46974
|
}
|
|
46926
46975
|
}
|
|
46976
|
+
function getWidthFromBytes(text, averageWidthInPixels) {
|
|
46977
|
+
if (averageWidthInPixels === void 0) {
|
|
46978
|
+
averageWidthInPixels = 8;
|
|
46979
|
+
}
|
|
46980
|
+
var byteCount = new TextEncoder().encode(text).length;
|
|
46981
|
+
var width = byteCount * averageWidthInPixels;
|
|
46982
|
+
return width;
|
|
46983
|
+
}
|
|
46984
|
+
var getTipsGraphic = function (_a) {
|
|
46985
|
+
var x = _a.x,
|
|
46986
|
+
y = _a.y,
|
|
46987
|
+
text = _a.text,
|
|
46988
|
+
_b = _a.fill,
|
|
46989
|
+
fill = _b === void 0 ? '#26A69A' : _b;
|
|
46990
|
+
var width = getWidthFromBytes(text);
|
|
46991
|
+
var group = new Group({
|
|
46992
|
+
x: x,
|
|
46993
|
+
y: y
|
|
46994
|
+
});
|
|
46995
|
+
var rect = new Rect({
|
|
46996
|
+
shape: {
|
|
46997
|
+
width: width + 10,
|
|
46998
|
+
height: 18
|
|
46999
|
+
},
|
|
47000
|
+
style: {
|
|
47001
|
+
stroke: fill,
|
|
47002
|
+
lineWidth: 1
|
|
47003
|
+
},
|
|
47004
|
+
z: 100,
|
|
47005
|
+
zlevel: 2
|
|
47006
|
+
});
|
|
47007
|
+
var textEl = new ZRText({
|
|
47008
|
+
style: {
|
|
47009
|
+
fill: fill,
|
|
47010
|
+
width: width,
|
|
47011
|
+
overflow: 'break',
|
|
47012
|
+
text: text
|
|
47013
|
+
},
|
|
47014
|
+
zlevel: 2,
|
|
47015
|
+
z: 100,
|
|
47016
|
+
x: 4,
|
|
47017
|
+
y: 4
|
|
47018
|
+
});
|
|
47019
|
+
group.add(rect);
|
|
47020
|
+
group.add(textEl);
|
|
47021
|
+
return group;
|
|
47022
|
+
};
|
|
46927
47023
|
|
|
46928
47024
|
function install$9(registers) {
|
|
46929
47025
|
registers.registerComponentModel(GraphicComponentModel);
|