联调 过程监督

This commit is contained in:
GGJ
2024-03-19 15:53:01 +08:00
parent da9fb74192
commit aa90a518a4
8 changed files with 579 additions and 98 deletions

View File

@@ -38,7 +38,7 @@ const initChart = () => {
color: '#000',
fontSize: 18
},
...(props.options.title || null)
...(props.options?.title || null)
},
tooltip: {
trigger: 'axis',
@@ -57,7 +57,7 @@ const initChart = () => {
},
backgroundColor: 'rgba(0,0,0,0.35)',
borderWidth: 0,
...(props.options.tooltip || null)
...(props.options?.tooltip || null)
},
legend: {
right: 20,
@@ -70,19 +70,19 @@ const initChart = () => {
},
itemWidth: 15,
itemHeight: 10,
...(props.options.legend || null)
...(props.options?.legend || null)
},
grid: {
top: '50px',
left: '10px',
right: '60px',
bottom: props.options.options?.dataZoom === null ? '10px' : '40px',
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
containLabel: true,
...(props.options.grid || null)
...(props.options?.grid || null)
},
xAxis: props.options.xAxis ? handlerXAxis() : null,
yAxis: props.options.yAxis ? handlerYAxis() : null,
dataZoom: props.options.dataZoom || [
xAxis: props.options?.xAxis ? handlerXAxis() : null,
yAxis: props.options?.yAxis ? handlerYAxis() : null,
dataZoom: props.options?.dataZoom || [
{
type: 'inside',
height: 13,
@@ -97,9 +97,9 @@ const initChart = () => {
end: 100
}
],
color: props.options.color || color,
series: props.options.series,
...props.options.options
color: props.options?.color || color,
series: props.options?.series,
...props.options?.options
}
handlerBar(options)
// 处理柱状图
@@ -120,8 +120,8 @@ const handlerBar = (options: any) => {
if (params.value == 0 || params.value == 3.14159) {
return '#ccc'
} else {
return props.options.color
? props.options.color[params.seriesIndex]
return props.options?.color
? props.options?.color[params.seriesIndex]
: color[params.seriesIndex]
}
}
@@ -135,6 +135,7 @@ const handlerBar = (options: any) => {
const handlerYAxis = () => {
let temp = {
type: 'value',
nameGap: 15,
nameTextStyle: {
color: '#000'
},
@@ -158,9 +159,9 @@ const handlerYAxis = () => {
}
}
}
// props.options.xAxis 是数组还是对象
if (Array.isArray(props.options.yAxis)) {
return props.options.yAxis.map((item: any) => {
// props.options?.xAxis 是数组还是对象
if (Array.isArray(props.options?.yAxis)) {
return props.options?.yAxis.map((item: any) => {
return {
...item,
...temp
@@ -169,7 +170,7 @@ const handlerYAxis = () => {
} else {
return {
...temp,
...props.options.yAxis
...props.options?.yAxis
}
}
}
@@ -190,9 +191,9 @@ const handlerXAxis = () => {
}
}
}
// props.options.xAxis 是数组还是对象
if (Array.isArray(props.options.xAxis)) {
return props.options.xAxis.map((item: any) => {
// props.options?.xAxis 是数组还是对象
if (Array.isArray(props.options?.xAxis)) {
return props.options?.xAxis.map((item: any) => {
return {
...temp,
...item
@@ -201,7 +202,7 @@ const handlerXAxis = () => {
} else {
return {
...temp,
...props.options.xAxis
...props.options?.xAxis
}
}
}