|
|
|
|
@ -103,57 +103,76 @@ const defaultOption = {
|
|
|
|
|
xAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: props.data?.options?.xName || '',
|
|
|
|
|
nameLocation: props.data?.options?.xNameLocation || 'end',
|
|
|
|
|
type: 'category',
|
|
|
|
|
boundaryGap: props.data?.options?.boundaryGap || false,
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: props.data?.options?.xAxisLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#DCE2E8'
|
|
|
|
|
color: props.data?.options?.xAxisLineColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
interval: 0,
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: '#fff'
|
|
|
|
|
},
|
|
|
|
|
// 默认x轴字体大小
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
// margin:文字到x轴的距离
|
|
|
|
|
margin: 3
|
|
|
|
|
},
|
|
|
|
|
axisPointer: {
|
|
|
|
|
label: {
|
|
|
|
|
padding: [0, 0, 0, 0],
|
|
|
|
|
margin: 0,
|
|
|
|
|
// 移入时的字体大小
|
|
|
|
|
fontSize: 12
|
|
|
|
|
show: props.data?.options?.xAxisTickShow || false,
|
|
|
|
|
inside: props.data?.options?.xAxisTickInside || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.xAxisTickColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
boundaryGap: true
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: props.data?.options?.xAxisLabelShow || false,
|
|
|
|
|
interval: props.data?.options?.xAxisLabelInterval ? 0 : 'auto',
|
|
|
|
|
inside: props.data?.options?.xAxisLabelInside || false,
|
|
|
|
|
formatter: props.data?.options?.xAxisLabelFormatter || null,
|
|
|
|
|
rotate: props.data?.options?.xAxisLabelRotate || 0,
|
|
|
|
|
color: props.data?.options?.xAxisLabelColor || '#fff',
|
|
|
|
|
fontSize: props.data?.options?.xAxisLabelFontSize || 12,
|
|
|
|
|
margin: props.data?.options?.xAxisLabelMargin || 3
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: props.data?.options?.xAxisSplitLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.xAxisSplitLineColor || '#DCE2E8',
|
|
|
|
|
type: props.data?.options?.xAxisSplitLineType || 'solid'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: props.data?.options?.yName || '',
|
|
|
|
|
nameLocation: props.data?.options?.yNameLocation || 'end',
|
|
|
|
|
type: 'value',
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: true,
|
|
|
|
|
show: props.data?.options?.yAxisLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#fff'
|
|
|
|
|
color: props.data?.options?.yAxisLineColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: props.data?.options?.yAxisTickShow || false,
|
|
|
|
|
inside: props.data?.options?.yAxisTickInside || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.yAxisTickColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: '#fff'
|
|
|
|
|
}
|
|
|
|
|
show: props.data?.options?.yAxisLabelShow || false,
|
|
|
|
|
interval: props.data?.options?.yAxisLabelInterval ? 0 : 'auto',
|
|
|
|
|
inside: props.data?.options?.yAxisLabelInside || false,
|
|
|
|
|
formatter: props.data?.options?.yAxisLabelFormatter || null,
|
|
|
|
|
rotate: props.data?.options?.yAxisLabelRotate || 0,
|
|
|
|
|
color: props.data?.options?.yAxisLabelColor || '#fff',
|
|
|
|
|
fontSize: props.data?.options?.yAxisLabelFontSize || 12,
|
|
|
|
|
margin: props.data?.options?.yAxisLabelMargin || 3
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: false
|
|
|
|
|
}
|
|
|
|
|
show: props.data?.options?.yAxisSplitLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.yAxisSplitLineColor || '#DCE2E8',
|
|
|
|
|
type: props.data?.options?.yAxisSplitLineType || 'solid'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
@ -161,19 +180,11 @@ const defaultOption = {
|
|
|
|
|
type: 'bar',
|
|
|
|
|
showBackground: true,
|
|
|
|
|
backgroundStyle: {
|
|
|
|
|
color: 'rgba(180, 180, 180, 0.2)'
|
|
|
|
|
color: props.data?.options?.backgroundColor || 'rgba(180, 180, 180, 0.2)'
|
|
|
|
|
},
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#0372FF'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#75ECFF'
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
color: '#0372FF'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barMaxWidth: 50,
|
|
|
|
|
@ -205,25 +216,87 @@ const getOption = () => {
|
|
|
|
|
bottom: options?.gridBottom + '%' || '20%',
|
|
|
|
|
right: options?.gridRight + '%' || '20%'
|
|
|
|
|
},
|
|
|
|
|
xAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: options?.xName || ''
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: options?.yName || ''
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
backgroundStyle: {
|
|
|
|
|
color: options?.backgroundColor || 'rgba(180, 180, 180, 0.2)'
|
|
|
|
|
xAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: props.data?.options?.xName || '',
|
|
|
|
|
nameLocation: props.data?.options?.xNameLocation || 'end',
|
|
|
|
|
boundaryGap: props.data?.options?.boundaryGap || false,
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: props.data?.options?.xAxisLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.xAxisLineColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: props.data?.options?.xAxisTickShow || false,
|
|
|
|
|
inside: props.data?.options?.xAxisTickInside || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.xAxisTickColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: props.data?.options?.xAxisLabelShow || false,
|
|
|
|
|
interval: props.data?.options?.xAxisLabelInterval ? 0 : 'auto',
|
|
|
|
|
inside: props.data?.options?.xAxisLabelInside || false,
|
|
|
|
|
formatter: props.data?.options?.xAxisLabelFormatter || null,
|
|
|
|
|
rotate: props.data?.options?.xAxisLabelRotate || 0,
|
|
|
|
|
color: props.data?.options?.xAxisLabelColor || '#fff',
|
|
|
|
|
fontSize: props.data?.options?.xAxisLabelFontSize || 12,
|
|
|
|
|
margin: props.data?.options?.xAxisLabelMargin || 3
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: props.data?.options?.xAxisSplitLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.xAxisSplitLineColor || '#DCE2E8',
|
|
|
|
|
type: props.data?.options?.xAxisSplitLineType || 'solid'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: props.data?.options?.yName || '',
|
|
|
|
|
nameLocation: props.data?.options?.yNameLocation || 'end',
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: props.data?.options?.yAxisLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.yAxisLineColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: props.data?.options?.yAxisTickShow || false,
|
|
|
|
|
inside: props.data?.options?.yAxisTickInside || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.yAxisTickColor || '#DCE2E8'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: props.data?.options?.yAxisLabelShow || false,
|
|
|
|
|
interval: props.data?.options?.yAxisLabelInterval ? 0 : 'auto',
|
|
|
|
|
inside: props.data?.options?.yAxisLabelInside || false,
|
|
|
|
|
formatter: props.data?.options?.yAxisLabelFormatter || null,
|
|
|
|
|
rotate: props.data?.options?.yAxisLabelRotate || 0,
|
|
|
|
|
color: props.data?.options?.yAxisLabelColor || '#fff',
|
|
|
|
|
fontSize: props.data?.options?.yAxisLabelFontSize || 12,
|
|
|
|
|
margin: props.data?.options?.yAxisLabelMargin || 3
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: props.data?.options?.yAxisSplitLineShow || false,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: props.data?.options?.yAxisSplitLineColor || '#DCE2E8',
|
|
|
|
|
type: props.data?.options?.yAxisSplitLineType || 'solid'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
backgroundStyle: {
|
|
|
|
|
color: options?.backgroundColor || 'rgba(180, 180, 180, 0.2)'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
let xData = [data?.x1 || []];
|
|
|
|
|
let yData = [data?.y1 || []];
|
|
|
|
|
let length = Math.min(...xData.map(e => e.length), ...yData.map(e => e.length));
|
|
|
|
|
|