tvcharts 0.6.21 → 0.6.22
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 +45 -17
- package/dist/echarts.js.map +2 -2
- package/lib/chart/labels/labelsLayout.js +5 -0
- package/lib/chart/labels/labelsVisual.js +5 -0
- package/lib/chart/linesPlot/linesPlotLayout.js +8 -3
- package/lib/core/echarts.js +13 -9
- package/lib/util/states.js +22 -12
- 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/labels/LabelsSeries.d.ts +1 -0
- package/types/src/chart/linesPlot/LinesPlotSeries.d.ts +1 -0
- package/types/src/util/states.d.ts +2 -0
- package/types/src/util/types.d.ts +1 -0
package/dist/echarts.js
CHANGED
|
@@ -11886,18 +11886,26 @@ function getAllSelectedIndices(ecModel) {
|
|
|
11886
11886
|
}
|
|
11887
11887
|
function getSeriesPointData(ecModel, payload = {}) {
|
|
11888
11888
|
const seriesPointData = {};
|
|
11889
|
+
const {dataIndex, rawDataIndex} = payload;
|
|
11889
11890
|
ecModel.eachSeries(function(seriesModel) {
|
|
11890
11891
|
if (seriesModel.get("statusLineInvisible")) {
|
|
11891
11892
|
return;
|
|
11892
11893
|
}
|
|
11893
11894
|
const formatter = seriesModel.get("formatter");
|
|
11895
|
+
const offset = seriesModel.get("offset") ?? 0;
|
|
11896
|
+
const showLast = seriesModel.get("showLast") ?? 0;
|
|
11894
11897
|
const data = seriesModel.getData();
|
|
11895
|
-
|
|
11896
|
-
const
|
|
11897
|
-
|
|
11898
|
-
|
|
11898
|
+
let isRaw = !dataIndex;
|
|
11899
|
+
const lastIndex = data.count(true) - 1;
|
|
11900
|
+
let index = dataIndex ? dataIndex - offset : rawDataIndex ? rawDataIndex - offset : lastIndex;
|
|
11901
|
+
if (showLast && (isRaw ? index : data.getRawIndex(index)) <= lastIndex - showLast) {
|
|
11902
|
+
index = lastIndex;
|
|
11903
|
+
isRaw = true;
|
|
11904
|
+
}
|
|
11905
|
+
index = Math.min(lastIndex, index);
|
|
11906
|
+
let values = isRaw ? data.getValuesByRawIndex(index) : data.getValues(index);
|
|
11907
|
+
let color2 = data.getItemVisual(index, "style")?.fill;
|
|
11899
11908
|
const isCandlesStick = seriesModel.subType === "candlestick";
|
|
11900
|
-
const isLinesPlot = seriesModel.subType === "linesPlot";
|
|
11901
11909
|
const dim = seriesModel.subType === "candlestick" ? "close" : "y";
|
|
11902
11910
|
const fnKey = isRaw ? "getByRawIndex" : "get";
|
|
11903
11911
|
if (isCandlesStick) {
|
|
@@ -11909,9 +11917,13 @@ function getSeriesPointData(ecModel, payload = {}) {
|
|
|
11909
11917
|
if (fill) {
|
|
11910
11918
|
color2 = fill;
|
|
11911
11919
|
}
|
|
11912
|
-
} else if (
|
|
11920
|
+
} else if (["linesPlot", "labels"].includes(seriesModel.subType)) {
|
|
11921
|
+
const isLinesPlot = seriesModel.subType === "linesPlot";
|
|
11913
11922
|
const dataItem = data.getItemModel(index, isRaw);
|
|
11914
|
-
const fill = dataItem.get(["lineStyle", "color"]);
|
|
11923
|
+
const fill = dataItem.get([isLinesPlot ? "lineStyle" : "itemStyle", "color"]);
|
|
11924
|
+
if (!isLinesPlot) {
|
|
11925
|
+
values = [index, dataItem.get("showValue")];
|
|
11926
|
+
}
|
|
11915
11927
|
if (fill) {
|
|
11916
11928
|
color2 = fill;
|
|
11917
11929
|
}
|
|
@@ -23510,7 +23522,7 @@ var enableConnect;
|
|
|
23510
23522
|
var markStatusToUpdate;
|
|
23511
23523
|
var applyChangedStates;
|
|
23512
23524
|
var triggerSelectItem = ({messageCenter, ecModel, type, eventObj = {}}) => {
|
|
23513
|
-
const data = getSeriesPointData(ecModel, {dataIndex: eventObj.dataIndexInside});
|
|
23525
|
+
const data = getSeriesPointData(ecModel, {dataIndex: eventObj.dataIndexInside, rawDataIndex: eventObj.dataIndex});
|
|
23514
23526
|
messageCenter.trigger("selectitem", {
|
|
23515
23527
|
data,
|
|
23516
23528
|
dataIndex: eventObj.dataIndex,
|
|
@@ -23520,7 +23532,7 @@ var triggerSelectItem = ({messageCenter, ecModel, type, eventObj = {}}) => {
|
|
|
23520
23532
|
var ECharts = class extends Eventful_default {
|
|
23521
23533
|
constructor(dom, theme2, opts) {
|
|
23522
23534
|
super(new ECEventProcessor());
|
|
23523
|
-
this._throttledSelectItem = throttle(triggerSelectItem,
|
|
23535
|
+
this._throttledSelectItem = throttle(triggerSelectItem, 80);
|
|
23524
23536
|
this._chartsViews = [];
|
|
23525
23537
|
this._chartsMap = {};
|
|
23526
23538
|
this._componentsViews = [];
|
|
@@ -24288,12 +24300,13 @@ var ECharts = class extends Eventful_default {
|
|
|
24288
24300
|
const coordSys = firstSeriesModel.coordinateSystem;
|
|
24289
24301
|
const baseAxis = coordSys.getBaseAxis();
|
|
24290
24302
|
const scale4 = baseAxis.scale;
|
|
24303
|
+
const isMove = !isUpdateData && scale4.lastBarRightSideDiffBarCount < 1.5;
|
|
24291
24304
|
const payload = {
|
|
24292
24305
|
type: "dataZoom",
|
|
24293
24306
|
barSpace: scale4.barSpace,
|
|
24294
|
-
lastBarRightSideDiffBarCount:
|
|
24307
|
+
lastBarRightSideDiffBarCount: isMove ? scale4.lastBarRightSideDiffBarCount - 1 : scale4.lastBarRightSideDiffBarCount
|
|
24295
24308
|
};
|
|
24296
|
-
doDispatchAction.call(this, payload,
|
|
24309
|
+
doDispatchAction.call(this, payload, !isMove);
|
|
24297
24310
|
}
|
|
24298
24311
|
updateXAxisData(time) {
|
|
24299
24312
|
if (this._disposed) {
|
|
@@ -24841,9 +24854,11 @@ ECharts.internalField = function() {
|
|
|
24841
24854
|
updateStates(seriesModel, chartView);
|
|
24842
24855
|
});
|
|
24843
24856
|
updateHoverLayerStatus(ecIns, ecModel);
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
24857
|
+
ecIns._throttledSelectItem({
|
|
24858
|
+
messageCenter: ecIns._messageCenter,
|
|
24859
|
+
ecModel,
|
|
24860
|
+
type: "series"
|
|
24861
|
+
});
|
|
24847
24862
|
lifecycle_default.trigger("series:afterupdate", ecModel, api2, updateParams);
|
|
24848
24863
|
};
|
|
24849
24864
|
markStatusToUpdate = function(ecIns) {
|
|
@@ -55073,13 +55088,12 @@ var linesPlotLayout = {
|
|
|
55073
55088
|
const xOffset = seriesModel.get("offset") || 0;
|
|
55074
55089
|
const symbolVisible = seriesModel.get("symbolVisible");
|
|
55075
55090
|
const symbolSize = seriesModel.get("symbolSize");
|
|
55076
|
-
const
|
|
55091
|
+
const showLast = seriesModel.get("showLast");
|
|
55077
55092
|
return {
|
|
55078
55093
|
progress(params, lineData) {
|
|
55079
55094
|
const linePointsByKey = {};
|
|
55080
55095
|
const symbolPointsByColor = {};
|
|
55081
55096
|
let lastKey = "";
|
|
55082
|
-
let offset = 0;
|
|
55083
55097
|
const stroke = seriesModel.getLineStyle().stroke;
|
|
55084
55098
|
const defaultColor = Array.isArray(stroke) ? stroke[0] : stroke;
|
|
55085
55099
|
function setSymbolPoint(point, index) {
|
|
@@ -55098,8 +55112,12 @@ var linesPlotLayout = {
|
|
|
55098
55112
|
});
|
|
55099
55113
|
symbolPointsByColor[symbolKey] = symbolData;
|
|
55100
55114
|
}
|
|
55115
|
+
const lastIndex = data.count(true) - 1;
|
|
55101
55116
|
for (let i = params.start; i < params.end; i++) {
|
|
55102
|
-
|
|
55117
|
+
if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
|
|
55118
|
+
continue;
|
|
55119
|
+
}
|
|
55120
|
+
const isRawLast = i + 1 === params.end ? data.getRawIndex(i) === lastIndex : false;
|
|
55103
55121
|
const isRawFirst = i === 0 ? data.getRawIndex(i) === 0 : false;
|
|
55104
55122
|
const x = store.get(dimIdx0, i);
|
|
55105
55123
|
const y = store.get(dimIdx1, i);
|
|
@@ -55479,6 +55497,7 @@ var LabelsVisual = {
|
|
|
55479
55497
|
const bandWidth = Math.max(1, Math.round(seriesModel.coordinateSystem.getAxesByScale("ordinal")[0].scale.barSpace * 0.8));
|
|
55480
55498
|
const data = seriesModel.getData();
|
|
55481
55499
|
const location = seriesModel.get("location");
|
|
55500
|
+
const showLast = seriesModel.get("showLast");
|
|
55482
55501
|
const symbolOptions = {};
|
|
55483
55502
|
for (let i = 0; i < SYMBOL_PROPS_WITH_CB2.length; i++) {
|
|
55484
55503
|
const symbolPropName = SYMBOL_PROPS_WITH_CB2[i];
|
|
@@ -55489,7 +55508,11 @@ var LabelsVisual = {
|
|
|
55489
55508
|
data.setVisual(extend({
|
|
55490
55509
|
symbolKeepAspect: seriesModel.get("symbolKeepAspect")
|
|
55491
55510
|
}, symbolOptions));
|
|
55511
|
+
const lastIndex = data.count(true) - 1;
|
|
55492
55512
|
function dataEach(data2, idx) {
|
|
55513
|
+
if (showLast && lastIndex - data2.getRawIndex(idx) >= showLast) {
|
|
55514
|
+
return;
|
|
55515
|
+
}
|
|
55493
55516
|
const itemModel = data2.getItemModel(idx);
|
|
55494
55517
|
let symbol = itemModel.getShallow("symbol");
|
|
55495
55518
|
let symbolSize = itemModel.getShallow("symbolSize");
|
|
@@ -55582,11 +55605,16 @@ var labelsLayout = {
|
|
|
55582
55605
|
const dimIdx1 = data.getDimensionIndex(dims[1]);
|
|
55583
55606
|
const xOffset = seriesModel.get("offset") || 0;
|
|
55584
55607
|
const price = getYByLocation(seriesModel);
|
|
55608
|
+
const showLast = seriesModel.get("showLast");
|
|
55585
55609
|
return {
|
|
55586
55610
|
progress(params, labelsData) {
|
|
55587
55611
|
const tmpIn = [];
|
|
55588
55612
|
const tmpOut = [];
|
|
55613
|
+
const lastIndex = data.count(true) - 1;
|
|
55589
55614
|
for (let i = params.start; i < params.end; i++) {
|
|
55615
|
+
if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
|
|
55616
|
+
continue;
|
|
55617
|
+
}
|
|
55590
55618
|
tmpIn[0] = store.get(dimIdx0, i) + xOffset;
|
|
55591
55619
|
tmpIn[1] = store.get(dimIdx1, i);
|
|
55592
55620
|
const point = coordSys.dataToPoint(tmpIn, null, tmpOut);
|