This commit is contained in:
‘937886381’
2024-07-19 08:37:54 +08:00
parent 5444ff92f7
commit 7d6a0e228f
16 changed files with 467 additions and 325 deletions

View File

@@ -8,19 +8,10 @@
<template>
<chart-container class="left-chart-base">
<div class="legend">
<span
v-for="item in legend"
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '0.72vw' : '0.7vw' }"
>{{ item.label }}</span
>
<span style="color: rgba(223,241,254,.8);" v-for="item in legend" :key="item.label" class="legend-item"
:style="{ fontSize: isFullscreen ? '0.72vw' : '0.7vw' }">{{ item.label }}</span>
</div>
<div
ref="chart"
style="max-width: 22vw"
:style="{ height: vHeight + 'vh' }"
></div>
<div ref="chart" style="max-width: 22vw" :style="{ height: vHeight + 'vh' }"></div>
</chart-container>
</template>
@@ -73,25 +64,32 @@ export default {
color: "rgba(237,237,237,0.5)",
},
},
extraCssText: 'box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.38); border- radius: 4px;opacity: 0.6;backdrop- filter: blur(6px);',
backgroundColor: '#001829',
borderColor: '#001829',
backgroundColor: 'rgba(0,0,0,0)', // tooltip默认背景为白色手动置为透明
extraCssText: 'padding:0;border-width:0',
formatter: params => {
console.log('params', params)
var res = `<span style='color:rgba(255,255,255,0.85)'>${params[0].axisValueLabel}</span>`;
var res = `<span style='display:inline-block;color:rgba(255,255,255,0.85);margin-bottom:8px;font-size:16px;letter-spacing: 2px;'>${params[0].axisValueLabel}</span>`;
for (var i = 0, l = params.length; i < l; i++) {
let color = Object.prototype.toString.call(params[i].color) == "[object String]" ? params[i].color : params[i].color.colorStops ? params[i].color.colorStops[0].color : ''
// console.log(item.color, color);
res +=
"<br/>" +
`<span style='display:inline-block;margin-right:4px;border-radius:2px;width:10px;height:10px;background-color:${color}'></span>` +
`<span style='display:inline-block;width:150px;color:rgba(255,255,255,.85);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(255,255,255,0.65);font-size:14px;'>${params[i].value ? params[i].value + '片' : 0 + '片'}</span>`;
`<span style='display:inline-block;margin-right:4px;border-radius:2px;width:12px;height:12px;background-color:${color}'></span>` +
`<span style='display:inline-block;width:150px;color:rgba(255,255,255,.85);font-size:16px;letter-spacing: 2px;'>${params[i].seriesName}</span>` +
`<span style='width:60px;display:inline-block;color:rgba(255,255,255,0.65);font-size:16px;text-align: right;letter-spacing: 2px;'>${params[i].value ? params[i].value: 0}</span>`;
}
return res;
const htmlContent = `
<div style="padding: 12px 16px;background:rgba(0,24,41,.5);box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.38);backdrop-filter: blur(10px);">
${res}
</div>
`;
return htmlContent;
// return res;
},
},
xAxis: {
type:'category',
axisTick: {
show: false,
},
@@ -101,25 +99,27 @@ export default {
},
},
axisLabel: {
color: "#fff",
fontSize: 14,
textStyle: {
color: "rgba(223,241,254,.8)",
fontSize: 16,
},
},
data: this.xAxis,
},
yAxis: {
name: "单位/片",
position:'left',
// position:'left',
nameTextStyle: {
color: "#fff",
fontSize: 14,
color: "rgba(223,241,254,.8)",
fontSize: 16,
align:'right'
},
axisTick: {
show: false,
},
axisLabel: {
color: "#fff",
fontSize: 14,
color: "rgba(223,241,254,.8)",
fontSize: 16,
},
axisLine: {
show: true,
@@ -143,7 +143,7 @@ export default {
align: 'right', //在上方显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: '#DFF1FE',
color: "rgba(223,241,254,.8)",
fontSize: 14
}
},
@@ -187,8 +187,8 @@ export default {
align: 'left', //在上方显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: '#DFF1FE',
fontSize: 14
color: "rgba(223,241,254,.8)",
fontSize: 16
}
},
itemStyle: {
@@ -260,9 +260,25 @@ export default {
</script>
<style scoped lang="scss">
.left-chart-base {
// position: relative;
.echarts-tooltip{
background: #001829;
// background-color: ;
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.38);
opacity: 0.6;
border-radius: 4px;
.content {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
backdrop-filter: blur(6px);
// transition: .3s transform;
}
}
.left-chart-base {
.legend {
position: absolute;
top: 5.2vh;