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

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

parent ffdbb736
import _ from 'lodash';
import { BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor } from "./theme";
import {BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor} from "./theme";
/**
* 1. 背景
......@@ -9,6 +9,36 @@ import { BISplitLineColor, BIAxisLableColor, BIAxisLabelColor, BIAxisLineColor }
* 5. markPoint的颜色设置
* 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) => {
let _opt = _.cloneDeep(option);
// 1. 修改legend颜色
......@@ -47,36 +77,14 @@ const patchBIOption = (option, theme) => {
..._opt.xAxis.axisLabel,
color: BIAxisLabelColor
};
_opt.yAxis.forEach(item => {
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
}
};
})
if (_opt && _.isArray[_opt.yAxis]) {
_opt.yAxis.forEach(item => {
handleYAxis(item, _opt);
})
} else if (_opt && !_.isArray(_opt.yAxis)) {
handleYAxis(_opt.yAxis, _opt);
}
return _opt;
};
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