You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>环形图组件设计</title>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Microsoft+YaHei:wght@400;700&display=swap">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Microsoft YaHei', sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #1a253a, #0d1425);
padding: 20px;
}
.dashboard {
display: flex;
flex-direction: column;
align-items: center;
max-width: 1200px;
width: 100%;
}
.title {
color: #fff;
font-size: 28px;
font-weight: bold;
margin-bottom: 40px;
text-align: center;
text-shadow: 0 0 10px rgba(52, 176, 255, 0.5);
letter-spacing: 1px;
}
.container {
display: flex;
background: linear-gradient(145deg, #0C1D45, #07122E);
padding: 25px;
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
width: 100%;
max-width: 800px;
border: 1px solid rgba(52, 176, 255, 0.2);
position: relative;
overflow: hidden;
}
/* 科技感装饰 */
.container::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 2px;
background: linear-gradient(90deg, transparent, rgba(52, 176, 255, 0.5), transparent);
}
.container::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: linear-gradient(90deg, transparent, rgba(242, 214, 75, 0.5), transparent);
}
.chart-container {
position: relative;
width: 280px;
height: 280px;
display: flex;
justify-content: center;
align-items: center;
}
.chart-center {
position: absolute;
width: 140px;
height: 140px;
border-radius: 50%;
background: rgba(12, 29, 69, 0.7);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 10;
border: 3px solid rgba(52, 176, 255, 0.1);
}
.total-label {
color: rgba(255, 255, 255, 0.7);
font-size: 14px;
}
.total-value {
color: #fff;
font-size: 24px;
font-weight: bold;
margin-top: 5px;
text-shadow: 0 0 8px rgba(52, 176, 255, 0.6);
}
.legend-container {
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 30px;
margin-left: 30px;
border-left: 1px solid rgba(52, 176, 255, 0.2);
width: calc(100% - 310px);
}
.legend-title {
color: #fff;
font-size: 18px;
font-weight: bold;
margin-bottom: 25px;
display: flex;
align-items: center;
}
.legend-title::before {
content: "";
width: 4px;
height: 20px;
background: linear-gradient(to bottom, #34B0FF, #0E8DE0);
border-radius: 2px;
margin-right: 10px;
}
.legend-item {
display: flex;
align-items: center;
margin: 12px 0;
padding: 15px 20px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
transition: all 0.3s ease;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.legend-item:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
background: rgba(255, 255, 255, 0.08);
border-color: rgba(52, 176, 255, 0.3);
}
.color-indicator {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 15px;
position: relative;
overflow: hidden;
}
.color-indicator::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: conic-gradient(var(--color-start) 0%, var(--color-end) var(--percentage), rgba(255,255,255,0.1) var(--percentage), rgba(255,255,255,0.1) 100%);
border-radius: 50%;
animation: rotate 1.2s ease-out;
}
@keyframes rotate {
from { transform: rotate(-90deg); }
to { transform: rotate(0); }
}
.legend-text {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.item-title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
}
.label {
color: rgba(255, 255, 255, 0.8);
font-size: 16px;
letter-spacing: 0.5px;
}
.percentage {
color: #fff;
font-size: 20px;
font-weight: bold;
text-shadow: 0 0 5px rgba(52, 176, 255, 0.5);
}
.progress-container {
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
margin-top: 8px;
}
.progress-bar {
height: 100%;
border-radius: 3px;
transition: width 1.5s ease-out;
}
.footer {
color: rgba(255, 255, 255, 0.6);
font-size: 14px;
text-align: center;
margin-top: 40px;
padding: 15px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
width: 100%;
max-width: 800px;
}
/* 动画装饰元素 */
.decoration {
position: absolute;
border-radius: 50%;
opacity: 0.3;
z-index: 0;
}
.dec-1 {
width: 350px;
height: 350px;
top: -50px;
left: -50px;
background: radial-gradient(circle, #34B0FF, transparent 70%);
animation: pulse 4s infinite ease-in-out;
}
.dec-2 {
width: 200px;
height: 200px;
bottom: -70px;
right: -20px;
background: radial-gradient(circle, #F2D64B, transparent 70%);
animation: pulse 3s infinite ease-in-out 0.5s;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.2; }
50% { transform: scale(1.1); opacity: 0.3; }
}
@media (max-width: 768px) {
.container {
flex-direction: column;
align-items: center;
}
.chart-container {
margin-bottom: 30px;
}
.legend-container {
padding-left: 0;
margin-left: 0;
border-left: none;
border-top: 1px solid rgba(52, 176, 255, 0.2);
padding-top: 30px;
width: 100%;
}
}
</style>
</head>
<body>
<div class="dashboard">
<h1 class="title">撑杆状态监测分析</h1>
<div class="container">
<div class="decoration dec-1"></div>
<div class="decoration dec-2"></div>
<div class="chart-container">
<div id="chart" style="width: 100%; height: 100%; z-index: 5;"></div>
<div class="chart-center">
<div class="total-label">故障总量</div>
<div class="total-value">128</div>
</div>
</div>
<div class="legend-container">
<div class="legend-title">撑杆故障分类</div>
<div class="legend-item">
<div class="color-indicator" style="--color-start: #34B0FF; --color-end: #0E8DE0; --percentage: 65%">
<div class="inner-circle"></div>
</div>
<div class="legend-text">
<div class="item-title">
<div class="label">撑杆折断</div>
<div class="percentage">65%</div>
</div>
<div class="progress-container">
<div class="progress-bar" style="width: 65%; background: linear-gradient(90deg, #34B0FF, #0E8DE0);"></div>
</div>
</div>
</div>
<div class="legend-item">
<div class="color-indicator" style="--color-start: #F2D64B; --color-end: #E6B400; --percentage: 35%">
<div class="inner-circle"></div>
</div>
<div class="legend-text">
<div class="item-title">
<div class="label">撑杆弯曲</div>
<div class="percentage">35%</div>
</div>
<div class="progress-container">
<div class="progress-bar" style="width: 35%; background: linear-gradient(90deg, #F2D64B, #E6B400);"></div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
数据更新时间: 2023年11月15日 | 监测系统版本 v2.4.1
</div>
</div>
<script>
// 初始化图表
const chartDom = document.getElementById('chart');
const myChart = echarts.init(chartDom);
// 创建渐变效果
const createGradient = (start, end) => {
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: start },
{ offset: 1, color: end }
]);
};
// 图表配置
const option = {
backgroundColor: 'transparent',
series: [{
name: '撑杆状态',
type: 'pie',
radius: ['65%', '85%'],
center: ['50%', '50%'],
startAngle: 90,
avoidLabelOverlap: false,
itemStyle: {
borderColor: 'rgba(12, 29, 69, 0.7)',
borderWidth: 3
},
label: {
show: false
},
labelLine: {
show: false
},
data: [
{
value: 65,
name: '撑杆折断',
itemStyle: {
color: createGradient('#34B0FF', '#0E8DE0')
}
},
{
value: 35,
name: '撑杆弯曲',
itemStyle: {
color: createGradient('#F2D64B', '#E6B400')
}
}
],
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200;
}
}]
};
// 应用配置
myChart.setOption(option);
// 响应式调整
window.addEventListener('resize', function() {
myChart.resize();
});
// 进度条动画
document.querySelectorAll('.progress-bar').forEach(bar => {
const width = bar.style.width;
bar.style.width = '0';
setTimeout(() => {
bar.style.width = width;
}, 300);
});
</script>
</body>
</html>