diff options
| author | zhangyu <[email protected]> | 2024-01-04 17:07:50 +0800 |
|---|---|---|
| committer | zhangyu <[email protected]> | 2024-01-04 17:07:50 +0800 |
| commit | d4584fdad8f6df90ccc60e2f977c7dce5b0cf23c (patch) | |
| tree | e7e5ad9c6b28dd1b8c83c3b3f1283345eea78c90 | |
| parent | 9a1270b09a17bd875bfccef229049300e025f597 (diff) | |
fix: 修复右Y轴 只有最后一个生效的问题
| -rw-r--r-- | nezha-fronted/src/components/chart/chartMixin.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js index ef546147f..48ef1af3b 100644 --- a/nezha-fronted/src/components/chart/chartMixin.js +++ b/nezha-fronted/src/components/chart/chartMixin.js @@ -100,15 +100,17 @@ export default { // 设置右y轴 if (chartInfo.param.enable.rightYAxis) { - chartInfo.param.rightYAxis && chartInfo.param.rightYAxis.elementNames.forEach(item => { - if ((data.elements.name == item) && !s.yAxisIndex) { + if (chartInfo.param.rightYAxis) { + const findItem = chartInfo.param.rightYAxis.elementNames.find(item => data.elements.name == item) + console.log(findItem) + if (findItem) { s.yAxisIndex = 1 data.yAxisIndex = 1 } else { s.yAxisIndex = 0 data.yAxisIndex = 0 } - }) + } } // 右y轴数据类型 |
