Commit 0375212e authored by 陈龙's avatar 陈龙

fix: 修复yAxis类型不同导致的bug

parent ffdbb736
import _ from 'lodash'; import _ from 'lodash';
import { BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor } from "./theme"; import {BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor} from "./theme";
/** /**
* 1. 背景 * 1. 背景
...@@ -9,6 +9,36 @@ import { BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor } ...@@ -9,6 +9,36 @@ import { BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor }
* 5. markPoint的颜色设置 * 5. markPoint的颜色设置
* 6. tooltip 背景 * 6. tooltip 背景
* */ * */
const handleYAxis = (item, _opt) => {
item.minorSplitLine = {
...item.minorSplitLine,
show: false,
lineStyle: {
type: 'solid',
color: BISplitLineColor
}
};
item.splitLine = {
...item.splitLine,
show: true,
lineStyle: {
type: 'solid',
color: BISplitLineColor
}
};
item.axisLabel = {
...item.axisLabel,
color: BIAxisLabelColor
};
item.axisLine = {
...(_opt?.xAxis?.axisLine ?? {}),
show: true,
lineStyle: {
type: 'solid',
color: BIAxisLineColor
}
};
}
const patchBIOption = (option, theme) => { const patchBIOption = (option, theme) => {
let _opt = _.cloneDeep(option); let _opt = _.cloneDeep(option);
// 1. 修改legend颜色 // 1. 修改legend颜色
...@@ -47,36 +77,14 @@ const patchBIOption = (option, theme) => { ...@@ -47,36 +77,14 @@ const patchBIOption = (option, theme) => {
..._opt.xAxis.axisLabel, ..._opt.xAxis.axisLabel,
color: BIAxisLabelColor color: BIAxisLabelColor
}; };
_opt.yAxis.forEach(item => { if (_opt && _.isArray[_opt.yAxis]) {
item.minorSplitLine = { _opt.yAxis.forEach(item => {
...item.minorSplitLine, handleYAxis(item, _opt);
show: false, })
lineStyle: { } else if (_opt && !_.isArray(_opt.yAxis)) {
type: 'solid', handleYAxis(_opt.yAxis, _opt);
color: BISplitLineColor }
}
};
item.splitLine = {
...item.splitLine,
show: true,
lineStyle: {
type: 'solid',
color: BISplitLineColor
}
};
item.axisLabel = {
...item.axisLabel,
color: BIAxisLabelColor
};
item.axisLine = {
..._opt.xAxis.axisLine,
show: true,
lineStyle: {
type: 'solid',
color: BIAxisLineColor
}
};
})
return _opt; return _opt;
}; };
export default patchBIOption; export default patchBIOption;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment