From 9e93bc754ddfabb67a2dc09d2adbfcc469af1533 Mon Sep 17 00:00:00 2001 From: chenxianhui Date: Mon, 9 Oct 2023 17:05:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=9B=BE=E8=A1=A8=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=AA=E6=95=B0=E4=B8=8D=E5=AF=B9=20review?= =?UTF-8?q?=20by=20luoxiao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/_utils/EchartsDataService.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/_utils/EchartsDataService.js b/src/common/_utils/EchartsDataService.js index b4e5de2c..f657ac1d 100644 --- a/src/common/_utils/EchartsDataService.js +++ b/src/common/_utils/EchartsDataService.js @@ -81,7 +81,8 @@ export default class EchartsDataService { let promise = new Promise((resolve, reject) => { // 请求数据,请求成功后,解析数据 const matchItem = this.datasetOptions.find(item => item.sort !== 'unsort'); - const maxFeatures = matchItem ? '' : dataset.maxFeatures; + const isStastic = this.datasetOptions.find(item => item.isStastic === true); + const maxFeatures = matchItem || isStastic ? '' : dataset.maxFeatures; getFeatures({ ...dataset, maxFeatures }) .then(data => { // 兼容三方服务接口返回的一个普通的对象 @@ -120,10 +121,10 @@ export default class EchartsDataService { this._clearChartCache(); // 设置datasetOptions this.setDatasetOptions(datasetOptions); - // 设置this.data - data = this._setData(data, xBar); // 统计后的数据 let features = this._createStatisticData(data, datasetOptions, xBar); + // 设置this.data + data = this._setData(data, xBar); // 生成seriedata datasetOptions.forEach(item => { // 生成YData, XData @@ -180,6 +181,10 @@ export default class EchartsDataService { ); xBar && features.reverse(); } + const maxLen = +this.dataset.maxFeatures; + if (maxLen && features.length > maxLen) { + features.length = maxLen; + } return features; }