series处理
const stackInfo = {}; for (let i = 0; i < series[0].data.length; ++i) { for (let j = 0; j < series.length; ++j) { const stackName = series[j].stack; if (!stackName) { continue; } if (!stackInfo[stackName]) { stackInfo[stackName] = { stackStart: [], stackEnd: [], }; } const info = stackInfo[stackName]; const data = series[j].data[i]; if (data && data !== "-") { if (info.stackStart[i] == null) { info.stackStart[i] = j; } info.stackEnd[i] = j; } } } for (let i = 0; i < series.length; ++i) { const data = series[i].data; const info = stackInfo[series[i].stack]; for (let j = 0; j < series[i].data.length; ++j) { const isEnd = info.stackEnd[j] === i; const topBorder = isEnd ? 20 : 0; const bottomBorder = 0; data[j] = { value: data[j], itemStyle: { barBorderRadius: [ topBorder, topBorder, bottomBorder, bottomBorder, ], }, }; } }
标签:info,倒圆角,const,stackInfo,series,4.9,stackName,柱状图,data From: https://www.cnblogs.com/dianzan/p/18371492