tvcharts 0.6.22 → 0.6.23
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 +102 -15
- package/dist/echarts.js.map +2 -2
- package/lib/chart/bgColor/BgColorLayout.js +5 -0
- package/lib/chart/fills/fillsLayout.js +5 -0
- package/lib/chart/linesPlot/linesPlotLayout.js +2 -1
- package/lib/core/echarts.js +41 -12
- package/lib/data/DataStore.js +17 -0
- package/lib/data/SeriesData.js +7 -0
- package/lib/data/helper/dataProvider.js +40 -3
- package/lib/model/Series.js +5 -1
- package/lib/util/states.js +1 -1
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +13 -2
- package/types/dist/shared.d.ts +13 -2
- package/types/src/core/echarts.d.ts +2 -2
- package/types/src/data/DataStore.d.ts +1 -0
- package/types/src/data/SeriesData.d.ts +4 -0
- package/types/src/data/helper/dataProvider.d.ts +6 -0
- package/types/src/model/Series.d.ts +3 -0
package/dist/echarts.js
CHANGED
|
@@ -11946,12 +11946,13 @@ function getSeriesPointData(ecModel, payload = {}) {
|
|
|
11946
11946
|
seriesPointData[seriesName] = {
|
|
11947
11947
|
name: seriesName,
|
|
11948
11948
|
data: values.map((item, index2) => {
|
|
11949
|
-
return formatter && index2 !== 0 ? formatter(item) : item;
|
|
11949
|
+
return formatter && index2 !== 0 && item ? formatter(item) : item;
|
|
11950
11950
|
}),
|
|
11951
11951
|
color: color2,
|
|
11952
11952
|
seriesId,
|
|
11953
11953
|
changePercent,
|
|
11954
|
-
diffValue
|
|
11954
|
+
diffValue,
|
|
11955
|
+
type: seriesModel.subType
|
|
11955
11956
|
};
|
|
11956
11957
|
});
|
|
11957
11958
|
return seriesPointData;
|
|
@@ -17740,6 +17741,9 @@ var DefaultDataProvider2 = class {
|
|
|
17740
17741
|
}
|
|
17741
17742
|
appendData(newData) {
|
|
17742
17743
|
}
|
|
17744
|
+
updateData(newData) {
|
|
17745
|
+
return {update: 0, append: 0};
|
|
17746
|
+
}
|
|
17743
17747
|
clean() {
|
|
17744
17748
|
}
|
|
17745
17749
|
};
|
|
@@ -17807,7 +17811,8 @@ DefaultDataProvider.internalField = function() {
|
|
|
17807
17811
|
providerMethods = {
|
|
17808
17812
|
[SOURCE_FORMAT_ARRAY_ROWS + "_" + SERIES_LAYOUT_BY_COLUMN]: {
|
|
17809
17813
|
pure: true,
|
|
17810
|
-
appendData: appendDataSimply
|
|
17814
|
+
appendData: appendDataSimply,
|
|
17815
|
+
updateData: updateDataSimply
|
|
17811
17816
|
},
|
|
17812
17817
|
[SOURCE_FORMAT_ARRAY_ROWS + "_" + SERIES_LAYOUT_BY_ROW]: {
|
|
17813
17818
|
pure: true,
|
|
@@ -17817,7 +17822,8 @@ DefaultDataProvider.internalField = function() {
|
|
|
17817
17822
|
},
|
|
17818
17823
|
[SOURCE_FORMAT_OBJECT_ROWS]: {
|
|
17819
17824
|
pure: true,
|
|
17820
|
-
appendData: appendDataSimply
|
|
17825
|
+
appendData: appendDataSimply,
|
|
17826
|
+
updateData: updateDataSimply
|
|
17821
17827
|
},
|
|
17822
17828
|
[SOURCE_FORMAT_KEYED_COLUMNS]: {
|
|
17823
17829
|
pure: true,
|
|
@@ -17832,7 +17838,8 @@ DefaultDataProvider.internalField = function() {
|
|
|
17832
17838
|
}
|
|
17833
17839
|
},
|
|
17834
17840
|
[SOURCE_FORMAT_ORIGINAL]: {
|
|
17835
|
-
appendData: appendDataSimply
|
|
17841
|
+
appendData: appendDataSimply,
|
|
17842
|
+
updateData: updateDataSimply
|
|
17836
17843
|
},
|
|
17837
17844
|
[SOURCE_FORMAT_TYPED_ARRAY]: {
|
|
17838
17845
|
persistent: false,
|
|
@@ -17854,6 +17861,30 @@ DefaultDataProvider.internalField = function() {
|
|
|
17854
17861
|
this._data.push(newData[i]);
|
|
17855
17862
|
}
|
|
17856
17863
|
}
|
|
17864
|
+
function updateDataSimply(newData) {
|
|
17865
|
+
const data = this._data;
|
|
17866
|
+
let lastIndex = data.length - 1;
|
|
17867
|
+
for (let i = 0; i < newData.length; i++) {
|
|
17868
|
+
const ele = newData[i];
|
|
17869
|
+
if (Array.isArray(ele)) {
|
|
17870
|
+
if (ele[0] === data[lastIndex][0]) {
|
|
17871
|
+
data[lastIndex] = ele;
|
|
17872
|
+
lastIndex++;
|
|
17873
|
+
continue;
|
|
17874
|
+
}
|
|
17875
|
+
} else if (typeof ele === "object" && Array.isArray(ele.value) && ele.value[0] == data[lastIndex][0]) {
|
|
17876
|
+
data[lastIndex] = ele;
|
|
17877
|
+
lastIndex++;
|
|
17878
|
+
continue;
|
|
17879
|
+
}
|
|
17880
|
+
data.push(newData[i]);
|
|
17881
|
+
}
|
|
17882
|
+
const update = lastIndex - data.length - 1;
|
|
17883
|
+
return {
|
|
17884
|
+
update,
|
|
17885
|
+
append: newData.length - update
|
|
17886
|
+
};
|
|
17887
|
+
}
|
|
17857
17888
|
}();
|
|
17858
17889
|
var getItemSimply = function(rawData, startIndex, dimsDef, idx) {
|
|
17859
17890
|
return rawData[idx];
|
|
@@ -18788,6 +18819,23 @@ var DataStore2 = class {
|
|
|
18788
18819
|
}
|
|
18789
18820
|
return [start2, end2];
|
|
18790
18821
|
}
|
|
18822
|
+
updateData(data) {
|
|
18823
|
+
if (true) {
|
|
18824
|
+
assert(!this._indices, "appendData can only be called on raw data.");
|
|
18825
|
+
}
|
|
18826
|
+
const provider = this._provider;
|
|
18827
|
+
let start2 = this.count();
|
|
18828
|
+
const {update} = provider.updateData(data);
|
|
18829
|
+
let end2 = provider.count();
|
|
18830
|
+
start2 = start2 - update;
|
|
18831
|
+
if (!provider.persistent) {
|
|
18832
|
+
end2 += start2;
|
|
18833
|
+
}
|
|
18834
|
+
if (start2 < end2) {
|
|
18835
|
+
this._initDataFromProvider(start2, end2, true);
|
|
18836
|
+
}
|
|
18837
|
+
return [start2, end2];
|
|
18838
|
+
}
|
|
18791
18839
|
appendValues(values, minFillLen) {
|
|
18792
18840
|
const chunks = this._chunks;
|
|
18793
18841
|
const dimensions = this._dimensions;
|
|
@@ -20013,10 +20061,14 @@ var SeriesModel2 = class extends Component_default {
|
|
|
20013
20061
|
const data = this.getRawData();
|
|
20014
20062
|
data.appendData(params.data);
|
|
20015
20063
|
}
|
|
20016
|
-
|
|
20064
|
+
updateValue(params) {
|
|
20017
20065
|
const data = this.getRawData();
|
|
20018
20066
|
data.updateValue(params.data[0]);
|
|
20019
20067
|
}
|
|
20068
|
+
updateData(params) {
|
|
20069
|
+
const data = this.getRawData();
|
|
20070
|
+
data.appendData(params.data);
|
|
20071
|
+
}
|
|
20020
20072
|
getData(dataType) {
|
|
20021
20073
|
const task = getCurrentTask(this);
|
|
20022
20074
|
if (task) {
|
|
@@ -24249,7 +24301,7 @@ var ECharts = class extends Eventful_default {
|
|
|
24249
24301
|
this._scheduler.unfinished = true;
|
|
24250
24302
|
this.getZr().wakeUp();
|
|
24251
24303
|
}
|
|
24252
|
-
updateData(batch) {
|
|
24304
|
+
updateData(batch, silent = false) {
|
|
24253
24305
|
if (this._disposed) {
|
|
24254
24306
|
disposedWarning(this.id);
|
|
24255
24307
|
return;
|
|
@@ -24257,28 +24309,45 @@ var ECharts = class extends Eventful_default {
|
|
|
24257
24309
|
let firstSeriesModel = void 0;
|
|
24258
24310
|
let isUpdateData = false;
|
|
24259
24311
|
each(batch, (params, index) => {
|
|
24312
|
+
const ecModel = this.getModel();
|
|
24260
24313
|
const seriesIndex = params.seriesIndex;
|
|
24261
24314
|
const seriesName = params.seriesName;
|
|
24262
|
-
|
|
24315
|
+
if (params.type === "component") {
|
|
24316
|
+
const tableModal = ecModel.findComponents({mainType: "table"})[0];
|
|
24317
|
+
console.log("%c [ tableModal ]-1621", "font-size:13px; background:pink; color:#bf2c9f;", tableModal);
|
|
24318
|
+
return;
|
|
24319
|
+
}
|
|
24263
24320
|
const seriesModel = seriesIndex !== void 0 ? ecModel.getSeriesByIndex(seriesIndex) : ecModel.getSeriesByName(seriesName)[0];
|
|
24264
24321
|
if (true) {
|
|
24265
24322
|
assert(params.data && seriesModel);
|
|
24266
24323
|
}
|
|
24267
24324
|
const seriesData = seriesModel.getData();
|
|
24268
24325
|
const lastIndex = seriesData.count(true) - 1;
|
|
24269
|
-
const paramId = params.data[0][0];
|
|
24270
24326
|
const scale5 = seriesModel.coordinateSystem.getBaseAxis().scale;
|
|
24271
24327
|
const ordinalMeta = scale5.getOrdinalMeta();
|
|
24272
|
-
const
|
|
24273
|
-
const isUpdate = params.operation !== void 0 ? params.operation === "update" : id == paramId;
|
|
24328
|
+
const isUpdate = params.operation === "update";
|
|
24274
24329
|
if (isUpdate) {
|
|
24275
|
-
seriesModel.
|
|
24330
|
+
seriesModel.updateValue({data: map(params.data, (item, index2) => {
|
|
24276
24331
|
const idx = lastIndex + index2;
|
|
24277
24332
|
seriesModel.option.data[idx] = item.slice(1);
|
|
24278
24333
|
item[0] = idx;
|
|
24279
24334
|
return item;
|
|
24280
24335
|
})});
|
|
24281
24336
|
isUpdateData = true;
|
|
24337
|
+
} else if (params.operation === "script") {
|
|
24338
|
+
const categories = [];
|
|
24339
|
+
const data = map(params.data, (item, index2) => {
|
|
24340
|
+
const idx = lastIndex + index2;
|
|
24341
|
+
seriesModel.option.data[idx] = item;
|
|
24342
|
+
if (idx > lastIndex) {
|
|
24343
|
+
categories.push(item.value[0]);
|
|
24344
|
+
}
|
|
24345
|
+
return item;
|
|
24346
|
+
});
|
|
24347
|
+
if (params.isMainSeries && data.length > 1) {
|
|
24348
|
+
ordinalMeta.appendData(categories);
|
|
24349
|
+
}
|
|
24350
|
+
seriesModel.updateData({data});
|
|
24282
24351
|
} else {
|
|
24283
24352
|
const categories = [];
|
|
24284
24353
|
const formatData = map(params.data, (item) => {
|
|
@@ -24297,6 +24366,9 @@ var ECharts = class extends Eventful_default {
|
|
|
24297
24366
|
firstSeriesModel = seriesModel;
|
|
24298
24367
|
}
|
|
24299
24368
|
});
|
|
24369
|
+
if (!firstSeriesModel) {
|
|
24370
|
+
return;
|
|
24371
|
+
}
|
|
24300
24372
|
const coordSys = firstSeriesModel.coordinateSystem;
|
|
24301
24373
|
const baseAxis = coordSys.getBaseAxis();
|
|
24302
24374
|
const scale4 = baseAxis.scale;
|
|
@@ -24306,7 +24378,7 @@ var ECharts = class extends Eventful_default {
|
|
|
24306
24378
|
barSpace: scale4.barSpace,
|
|
24307
24379
|
lastBarRightSideDiffBarCount: isMove ? scale4.lastBarRightSideDiffBarCount - 1 : scale4.lastBarRightSideDiffBarCount
|
|
24308
24380
|
};
|
|
24309
|
-
doDispatchAction.call(this, payload,
|
|
24381
|
+
doDispatchAction.call(this, payload, true);
|
|
24310
24382
|
}
|
|
24311
24383
|
updateXAxisData(time) {
|
|
24312
24384
|
if (this._disposed) {
|
|
@@ -24324,7 +24396,7 @@ var ECharts = class extends Eventful_default {
|
|
|
24324
24396
|
barSpace: scale4.barSpace,
|
|
24325
24397
|
lastBarRightSideDiffBarCount: scale4.lastBarRightSideDiffBarCount < 1.5 ? scale4.lastBarRightSideDiffBarCount - 1 : scale4.lastBarRightSideDiffBarCount
|
|
24326
24398
|
};
|
|
24327
|
-
doDispatchAction.call(this, payload,
|
|
24399
|
+
doDispatchAction.call(this, payload, false);
|
|
24328
24400
|
}
|
|
24329
24401
|
}
|
|
24330
24402
|
};
|
|
@@ -26002,6 +26074,10 @@ var SeriesData2 = class {
|
|
|
26002
26074
|
const range = this._store.appendData(data);
|
|
26003
26075
|
this._doInit(range[0], range[1]);
|
|
26004
26076
|
}
|
|
26077
|
+
updateData(data) {
|
|
26078
|
+
const range = this._store.updateData(data);
|
|
26079
|
+
this._doInit(range[0], range[1]);
|
|
26080
|
+
}
|
|
26005
26081
|
updateValue(value) {
|
|
26006
26082
|
this._store.updateValue(value);
|
|
26007
26083
|
}
|
|
@@ -55102,6 +55178,7 @@ var linesPlotLayout = {
|
|
|
55102
55178
|
}
|
|
55103
55179
|
const dataModal = lineData.getItemModel(index);
|
|
55104
55180
|
const symbolColor = dataModal.get("itemStyle")?.color;
|
|
55181
|
+
console.log("%c [ dataModal ]-94", "font-size:13px; background:pink; color:#bf2c9f;", dataModal);
|
|
55105
55182
|
const symbol = dataModal.get("symbol");
|
|
55106
55183
|
const symbolKey = `${symbol}`;
|
|
55107
55184
|
const symbolData = symbolPointsByColor[symbolKey] || [];
|
|
@@ -55130,7 +55207,7 @@ var linesPlotLayout = {
|
|
|
55130
55207
|
}
|
|
55131
55208
|
let nextPoint = [];
|
|
55132
55209
|
if (!isSingle && isRawLast) {
|
|
55133
|
-
const lastPoints = linePointsByKey[lastKey];
|
|
55210
|
+
const lastPoints = linePointsByKey[lastKey] || [];
|
|
55134
55211
|
lastPoints.push(point);
|
|
55135
55212
|
break;
|
|
55136
55213
|
}
|
|
@@ -55949,6 +56026,7 @@ var fillsLayout = {
|
|
|
55949
56026
|
const data = seriesModel.getData();
|
|
55950
56027
|
const fillgaps = seriesModel.get("fillgaps");
|
|
55951
56028
|
const isMonoHline = seriesModel.get("isMonoHline");
|
|
56029
|
+
const showLast = seriesModel.get("showLast");
|
|
55952
56030
|
const dimIdx0 = 0;
|
|
55953
56031
|
const dimIdP1 = 1;
|
|
55954
56032
|
const dimIdP2 = 2;
|
|
@@ -55976,7 +56054,11 @@ var fillsLayout = {
|
|
|
55976
56054
|
let lastKey = "";
|
|
55977
56055
|
let plot1Points = [];
|
|
55978
56056
|
let plot2Points = [];
|
|
56057
|
+
const lastIndex = fillsData.count(true) - 1;
|
|
55979
56058
|
for (let i = params.start; i < params.end; i++) {
|
|
56059
|
+
if (showLast && lastIndex - fillsData.getRawIndex(i) >= showLast) {
|
|
56060
|
+
continue;
|
|
56061
|
+
}
|
|
55980
56062
|
const last = i + 1 === params.end;
|
|
55981
56063
|
const get2 = last ? "getByRawIndex" : "get";
|
|
55982
56064
|
const index = last ? fillsData.getRawIndex(i) : i;
|
|
@@ -56204,13 +56286,18 @@ var bgColorLayout = {
|
|
|
56204
56286
|
const store = data.getStore();
|
|
56205
56287
|
const dimIdx0 = data.getDimensionIndex(dims[0]);
|
|
56206
56288
|
const xOffset = seriesModel.get("offset") || 0;
|
|
56289
|
+
const showLast = seriesModel.get("showLast");
|
|
56207
56290
|
return {
|
|
56208
56291
|
progress(params, bgColorData) {
|
|
56209
56292
|
const rectsByColor = {};
|
|
56210
56293
|
const width = Math.ceil(coordSys.getBaseAxis().scale.barSpace) || 5;
|
|
56211
56294
|
const leftOffset = width / 2;
|
|
56212
56295
|
const {height, startY} = getHeight(seriesModel);
|
|
56296
|
+
const lastIndex = bgColorData.count(true) - 1;
|
|
56213
56297
|
for (let i = params.start; i < params.end; i++) {
|
|
56298
|
+
if (showLast && lastIndex - bgColorData.getRawIndex(i) >= showLast) {
|
|
56299
|
+
continue;
|
|
56300
|
+
}
|
|
56214
56301
|
const itemModel = bgColorData.getItemModel(i);
|
|
56215
56302
|
const {color: color2} = itemModel.get("itemStyle");
|
|
56216
56303
|
if (!color2) {
|