Skip to content

Commit

Permalink
fix 图表统计字段后,显示的内容个数不对 review by luoxiao
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxianhuii committed Oct 9, 2023
1 parent 114de9f commit 1966a4c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/common/_utils/EchartsDataService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
// 兼容三方服务接口返回的一个普通的对象
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 1966a4c

Please sign in to comment.