更新数据显示优化组件,更新主备切换操作板

master
lyy 5 months ago
parent 1608dd75ab
commit 0239d9462b

@ -0,0 +1,363 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.css" rel="stylesheet" type="text/css" />
<script>
var data=[
{
message:'192.172.0.1 is Master,192.173.0.2 is Backup'
}
];
  renderEl(data.message);
paintVis(data.message);
function renderEl(arr) {
        let str = '';
        str += `
           <table>
<caption>
当前网络中网关情况:
</caption>
<thead>
<tr>
<th scope="col">服务器IP</th>
<th scope="col">服务器状态</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">${arr.substr(0,arr.indexOf("Master")-3)}</th>
<td>Master</td>
</tr>
<tr>
<th scope="row">${arr.substr(arr.indexOf("Master")+6,arr.indexOf("Backup")-3)}</th>
<td>Backup</td>
</tr>
</table>
`;
const el = document.getElementById('wrap');
        el.innerHTML = str;
}
function paintVis(arr){
var nodes = new vis.DataSet([
{ id: 1, label: 'keepalived:vrrp\n 192.168.229.130',color: {background: 'lightgreen'}},
{ id: 2, label: arr.substring(0,arr.indexOf("Master")-3),color: {background: 'lightgreen'}},
{ id: 3, label: arr.substring(arr.indexOf("Master")+6,arr.indexOf("Backup")-3),color: {background: 'grey'}},
{ id: 4, label: 'web Server\n 192.168.229.129.81',color: {background: 'lightgreen'}},
{ id: 5, label: 'web Server\n 192.168.229.129.81',color: {background: 'grey'}},
{ id: 6, label: '客户端',color: {background: 'lightgreen'} },
]);
var edges = new vis.DataSet([
{ from: 6, to: 1 , color: {color:'#00ff00'}},
{ from: 1, to: 2 , color: {color:'#00ff00'}},
{ from: 1, to: 3 , color: {color:'grey'}},
{ from: 2, to: 4 , color: {color:'#00ff00'}},
{ from: 2, to: 5 , color: {color:'#00ff00'}},
{ from: 3, to: 4 , color: {color:'grey'}},
{ from: 3, to: 5 , color: {color:'#00ff00'}},
]);
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {
nodes: {
shape:'dot',
font: {
color: '#000', // 字体的颜色
size: 10 // 显示字体大小
},
scaling: {
min: 20,
max: 40 // 缩放效果比例
},
borderWidth: 1,
color: {
border: 'white',
// 若是引用图标,背景颜色
}
},
groups: {
ws: { // 系统定义的形状 dot等 这些官网都可以找到
shape: 'square',
color: 'white'
}
},
layout: {
randomSeed: 1 // 配置每次生成的节点位置都一样参数为数字1、2等
},
physics: {
// barnesHut: { gravitationalConstant: -30000 },
barnesHut: {
gravitationalConstant: 0,
springConstant: 0,
springLength: 0
},
stabilization: true
// { iterations: 2500 }
},
interaction: {
// navigationButtons: true,
hover: false, // 鼠标移过后加粗该节点和连接线
selectConnectedEdges: false, // 选择节点后是否显示连接线
hoverConnectedEdges: false, // 鼠标滑动节点后是否显示连接线
tooltipDelay: 200,
zoomView: false // 是否能缩放画布
},
edges: {
label:'Solid',
smooth: {type: "discrete"},
color: { // 连接线的样式
hover: '#848484',
inherit: 'from',
opacity: 1.0
},
shadow: true, // 连接线阴影配置
smooth: true // 是否显示方向箭头
// arrows: {to : true }//箭头指向from节点
}
};
var network = new vis.Network(container, data, options);
}
</script>
<style>
table{
width: 50%;
border-collapse: collapse;
margin: auto;
}
table caption{
font-size: large;
font-weight: bold;
margin: 1em 0;
}
th,td{
border: 1px solid #999;
text-align: center;
padding: 20px 0;
}
table thead tr{
background-color: #008c8c;
color: #fff;
}
table tbody tr:nth-child(odd){
background-color: #eee;
}
table tbody tr:hover{
background-color: #ccc;
}
table tbody tr td:first-child{
color: #f40;
}
table tfoot tr td{
text-align: right;
padding-right: 20px;
}
#dropdownMenu {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-item {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-item:hover {
background-color: #f1f1f1;
}
</style>
<header>
<div style="text-align: center; padding-right: 10px; flex: 1 1 0%;font-size: large;background-color: rgb(227, 234, 234);">主备切换</div>
</header>
<body>
<table>
<caption>
当前网络中网关情况:
</caption>
<div id="wrap"></div>
</body>
<div id="dropdownMenu" class="dropdown-content">
<a href="#" class="dropdown-item" id="toggleOpen">开启</a>
<a href="#" class="dropdown-item" id="toggleClose">关闭</a>
</div>
<h1>网络拓扑图<button id="submitBtn">提交</button></h1>
<div id="doubleClickArea">
<div id="mynetwork" style="width:auto; height:500px; border:1px solid lightgray;"></div>
</div>
<script>
var nodes = new vis.DataSet([
{ id: 1, label: 'keepalived:vrrp\n 192.168.229.130',color:'lightgreen'},
{ id: 2, label: 'nginx负载均衡\n 192.168.229.128:80',color:'lightgreen'},
{ id: 3, label: 'nginx负载均衡\n 192.168.229.129.80',color: 'grey'},
{ id: 4, label: 'web Server\n 192.168.229.129.81',color:'lightgreen'},
{ id: 5, label: 'web Server\n 192.168.229.129.81',color: 'grey'},
{ id: 6, label: '客户端',color:'lightgreen' },
]);
var edges = new vis.DataSet([
{ id: 7,from: 6, to: 1 , color: '#00ff00'},
{ id: 8,from: 1, to: 2 , color: '#00ff00'},
{ id: 9,from: 1, to: 3 , color: 'grey'},
{ id: 10,from: 2, to: 4 , color: '#00ff00'},
{ id: 11,from: 2, to: 5 , color: '#00ff00'},
{ id: 12,from: 3, to: 4 , color: 'grey'},
{ id: 13,from: 3, to: 5 , color: '#00ff00'},
]);
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {
nodes: {
shape:'dot',
font: {
color: '#000', // 字体的颜色
size: 10 // 显示字体大小
},
scaling: {
min: 20,
max: 40 // 缩放效果比例
},
borderWidth: 1,
color: {
border: 'white',
// 若是引用图标,背景颜色
}
},
groups: {
ws: { // 系统定义的形状 dot等 这些官网都可以找到
shape: 'square',
color: 'white'
}
},
layout: {
randomSeed: 1 // 配置每次生成的节点位置都一样参数为数字1、2等
},
physics: {
// barnesHut: { gravitationalConstant: -30000 },
barnesHut: {
gravitationalConstant: 0,
springConstant: 0,
springLength: 0
},
stabilization: true
// { iterations: 2500 }
},
interaction: {
// navigationButtons: true,
hover: true, // 鼠标移过后加粗该节点和连接线
selectConnectedEdges: false, // 选择节点后是否显示连接线
hoverConnectedEdges: false, // 鼠标滑动节点后是否显示连接线
tooltipDelay: 200,
zoomView: false // 是否能缩放画布
},
edges: {
label:'Solid',
smooth: {type: "discrete"},
color: { // 连接线的样式
inherit: 'from',
},
shadow: false, // 连接线阴影配置
smooth: true // 是否显示方向箭头
// arrows: {to : true }//箭头指向from节点
}
};
var network = new vis.Network(container, data, options);
network.on('click', function (event) {
nodeId = event.nodes[0]; // 获取被点击的节点ID
nodeData = nodes.get(nodeId); // 根据节点ID获取节点数据
if (nodeData) {
console.log('Clicked on node: ' + nodeData.id + '\n' +
'Entity Info: ' + nodeData.label+ '\n' +
'Color Info:' + nodeData.color);
// 可以在这里添加更多的逻辑来处理点击事件
}
});
var doubleClickArea = document.getElementById('doubleClickArea');
var dropdownMenu = document.getElementById('dropdownMenu');
// 为双击区域添加双击事件监听器
doubleClickArea.addEventListener('dblclick', function(event) {
// 显示下拉菜单
var nodeToUpdate = nodes.get(nodeId);
if (nodeToUpdate.color === 'grey') {
nodeToUpdate.color = '#00ff00';
} else {
nodeToUpdate.color = 'grey';
}
nodes.update([nodeToUpdate]);
});
function updateEdgeColor() {
// 获取所有节点的颜色
for(var i=1;i<=6;i++){
for(var j=1;j<=6;j++)
{
var node1Color =nodes.get(i).color;
var node2Color =nodes.get(j).color;
var edgeColor = ((node1Color =="lightgreen") && (node2Color =="lightgreen")) ? 'green' : 'grey';
var edge = edges.get({ from: i, to: j });
if (edge) {
edge.color = { color: edgeColor };
console.log("Update")
edges.update(edge);
}
}
}
// 更新边的颜色
for(var i=0;i<=6;i++)
{
for(var j=0;j<=6;j++)
{
var edge = edges.get({ from: i, to: j });
if (edge) {
edge.color = { color: edgeColor };
console.log("Update")
edges.update(edge);
}
}
}
}
setInterval(updateEdgeColor, 3000); // 每3000毫秒3秒更新一次
var submitButton = document.getElementById('submitBtn');
// 为提交按钮添加点击事件监听器
submitButton.addEventListener('click', function() {
// 从Vis.js网络图中获取当前的nodes信息
var currentNodes = nodes.get();
// 将nodes信息转换为JSON格式
var nodesJson = JSON.stringify(currentNodes);
// 使用fetch API发送数据到后端服务器
fetch('YOUR_BACKEND_ENDPOINT', { // 替换为你的后端服务器端点
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: nodesJson
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
})
.catch((error) => {
console.error('Error:', error);
});
});
</script>

@ -7,6 +7,8 @@
<link rel="stylesheet" type="text/css" href="msgList.css">
<link rel="stylesheet" href="./assets/css/style.css">
<script type="text/javascript" src="./assets/js/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="./echarts.min.js"></script>
</head>
<style>
#pie {
@ -23,6 +25,9 @@
background-color: #dce0e9;
position: fixed;
}
.wrap-hidden{
transform: translateX(-150%);
}
.header{
width: 100%;
height: 65px;
@ -231,7 +236,7 @@ min-height: 520px;
overflow: hidden;
}
.lie {
width: 23%;
width: 12%;
display: inline-block;
font: 13px sans-serif;
}
@ -253,12 +258,11 @@ min-height: 520px;
overflow: hidden;
}
.lia {
width: 23%;
width: 12%;
display: inline-block;
font: 13px sans-serif;
}
.lia a {
display: block;
font-size: larger;
color: rgb(0, 0, 0);
text-align: center;
@ -277,11 +281,54 @@ min-height: 520px;
background: #06b81a;
}
}
.modal {
display: none;
position: fixed;
z-index: 999;
left: 0;
top: 0;
width: 100px;
height: 100px;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 50%;
max-width: 600px; /* 限制图表的最大宽度 */
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
}
#chart-container {
width: 500px;
height: 800px;
margin: auto;
}
.circle-tag {
width: 20px;
height: 20px;
border-radius: 100%;
background-color: #3498db;
color: white;
text-align:left;
font-size: 16px;
font-family: Arial, sans-serif;
display: grid;
}
</style>
<header class="top-navigation">
<div class="container">
@ -290,6 +337,7 @@ min-height: 520px;
</div>
</header>
<body>
<button id="toggleSidebar">隐藏/显示 侧边栏</button>
<div class="wrap">
<div class="header">消息过滤器</div>
<div class="nav">
@ -366,24 +414,7 @@ min-height: 520px;
<h4 class="h3">消息类别统计表</h4>
<table class="card-table">
<tbody class="table-body flex-center">
<tr class="table-row flex-center">
<th class="table-heading" scope="col">北京</th>
<td class="table-data">
<div class="chart-bar" data-chart-bar="beijing"></div>
</td>
</tr>
<tr class="table-row flex-center">
<th class="table-heading" scope="col">上海</th>
<td class="table-data">
<div class="chart-bar" data-chart-bar="shanghai"></div>
</td>
</tr>
<tr class="table-row flex-center">
<th class="table-heading" scope="col">长沙</th>
<td class="table-data">
<div class="chart-bar" data-chart-bar="长沙"></div>
</td>
</tr>
<div id="graph"></div>
</tbody>
</table>
<span class="tooltip text" data-tooltip></span>
@ -399,108 +430,257 @@ min-height: 520px;
</div>
</div>
</div>
<script src="./assets/js/script.js" type="module" defer></script>
<div class="piechart" id="pie"></div>
<script>
var pie = echarts.init(document.getElementById('pie'));
pieOption = {
title: {
text: '数据统计饼状图'
},
tooltip: {
show: true,
trigger: "item",
backgroundColor: "#1677FF",
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
formatter: "{a}{b}<br/>{c}吨({d}%)"
},
color: ['#3e87ff', '#65b2f3', '#b9cfec'],
series: [
{
name: '品种',
type: 'pie',
// 数组的第一项是内半径,第二项是外半径;可以设置不同的内外半径显示成圆环图
radius: '50%',
// 饼图的中心(圆心)坐标,数组的第一项是横坐标,第二项是纵坐标;设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度
center: ['50%', '50%'],
data: [
{ value: 2000, name: '北京' },
{ value: 2000, name: '上海' },
{ value: 2000, name: '长沙' },
],
itemStyle: {
// 显示图例
normal: {
label: {
show: true
},
labelLine: {
show: true
}
},
emphasis: {
// 图形阴影的模糊大小
shadowBlur: 10,
// 阴影水平方向上的偏移距离
shadowOffsetX: 0,
// 阴影颜色
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
pie.setOption(pieOption);
</script>
<div class="my_msg_list">
<div class="my_msg_list_view">
<div class="my_msg_list_box">
<div class="my_msg_list_con">
<div class="my_msg_list_title">
<span >消息列表:</span>
<a class="fr">清空所有消息</a>
<span class="line fr"></span>
<a class="fr">全部标记为已读</a>
</div>
<div class="ule">
<div class="lie"><a href="#home">服务器列表</a></div>
<div class="lie"><a href="#news">距离上次响应时间</a></div>
<div class="lie"><a href="#contact">当前服务器状态</a></div>
<div class="lie"><a href="#about">返回消息报头</a></div>
</div>
<div class="ula">
<div class="lia"><a href="#home"><span><div class="square"></div></span>北京</a></div>
<div class="lia"><a href="#news">100ms</a></div>
<div class="lia"><a href="#contact">正常</a></div>
<div class="lia"><a href="#about">TCP</a></div>
</div>
<em class="data-time" style="float: right;padding-right:10px">2019-03-28</em>
<li class="msg_list_ul_li">
<div class="ula">
<div class="lia"><a href="#home">长沙</a></div>
<div class="lia"><a href="#news">1300ms</a></div>
<div class="lia"><a href="#contact">受损</a></div>
<div class="lia"><a href="#about">TCP</a></div>
</div>
<em class="data-time" style="float: right;padding-right:10px">2019-03-28</em>
</li>
<li class="msg_list_ul_li">
<div class="ula">
<div class="lia"><a href="#home">上海</a></div>
<div class="lia"><a href="#news">70ms</a></div>
<div class="lia"><a href="#contact">繁忙</a></div>
<div class="lia"><a href="#about">TCP</a></div>
</div>
<em class="data-time" style="float: right;padding-right:10px">2019-03-28</em>
</li>
</ul>
</div>
<div class="page-box">
</div>
</div>
<!-- 假设这是您的消息列表容器 -->
<div id="my_msg_list">
<div class="my_msg_list_view">
<div class="my_msg_list_box">
<div class="my_msg_list_con">
<div class="my_msg_list_title">
<span >消息列表:</span>
<a class="fr">清空所有消息</a>
<span class="line fr"></span>
<a class="fr">全部标记为已读</a>
</div>
<div class="ule">
<div class="lie"><a href="#home">服务器列表</a></div>
<div class="lie"><a href="#location">地区</a></div>
<div class="lie"><a href="#news">距离上次响应时间</a></div>
<div class="lie"><a href="#contact">当前服务器状态</a></div>
<div class="lie"><a href="#about">返回消息报头</a></div>
</div>
<div id="mylist"></div>
<!-- 消息列表将在这里动态生成 -->
<div class="page-box">
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script>
// 假设这是您接收到的JSON数据
var jsonData = [
{
"server": "127.0.0.1",
"location":"北京",
"responseTime": "100ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":200
},
{
"server": "127.0.0.2",
"location":"上海",
"responseTime": "1300ms",
"status": "受损",
"protocol": "TCP",
"date": "2024-07-01",
"value":30
},
{
"server": "127.0.0.3",
"location":"广州",
"responseTime": "70ms",
"status": "繁忙",
"protocol": "TCP",
"date": "2024-07-01",
"value":50
}
];
var jsonData2 = [
{
"server": "127.0.0.1",
"location":"北京",
"responseTime": "70ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":250
},
{
"server": "127.0.0.2",
"location":"上海",
"responseTime": "150ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":70
},
{
"server": "127.0.0.3",
"location":"广州",
"responseTime": "70ms",
"status": "繁忙",
"protocol": "TCP",
"date": "2024-07-01",
"value":50
}
];
var jsonData3 = [
{
"server": "127.0.0.1",
"location":"北京",
"responseTime": "75ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":300
},
{
"server": "127.0.0.2",
"location":"上海",
"responseTime": "120ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":100
},
{
"server": "127.0.0.3",
"location":"广州",
"responseTime": "100ms",
"status": "正常",
"protocol": "TCP",
"date": "2024-07-01",
"value":60
}
];
// 函数用于更新消息列表
function updateMessageList(data) {
var msgListContainer = document.getElementById('mylist');
msgListContainer.innerHTML = ''; // 清空现有内容
data.forEach(function(item) {
var msgItem = document.createElement('div');
msgItem.className = 'msg_item';
msgItem.innerHTML = `
<li class="msg_list_ul_li">
<div class="ula">
<div class="lia"><a href="test.html"><div class="circle-tag"></div><span></span>${item.server}</a></div>
<div class="lia"><a href="#location">${item.location}</a></div>
<div class="lia"><a href="#news">${item.responseTime}</a></div>
<div class="lia"><a href="#contact">${item.status}</a></div>
<div class="lia"><a href="#about">${item.protocol}</a></div>
</div>
<em class="data-time" style="float: right;padding-right:10px">${item.date}</em>
</li>
`;
msgListContainer.appendChild(msgItem);
});
}
function updateGraph(data) {
var msgListContainer = document.getElementById('graph');
msgListContainer.innerHTML = ''; // 清空现有内容
data.forEach(function(item) {
var msgItem = document.createElement('div');
msgItem.className = 'msg_item';
msgItem.innerHTML = `
<tr class="table-row flex-center">
<th class="table-heading" scope="col">${item.server}</th>
<td class="table-data">
<div class="chart-bar" data-chart-bar="&{item.server}">${item.value}</div>
</td>
</tr>
`;
msgListContainer.appendChild(msgItem);
});
}
var pie = echarts.init(document.getElementById('pie'));
// 饼状图配置项
var pieOption = {
title: {
text: '数据统计饼状图'
},
tooltip: {
show: true,
trigger: "item",
backgroundColor: "#1677FF",
formatter: "{a}{b}<br/>{c}次({d}%)"
},
color: ['#3e87ff', '#65b2f3', '#b9cfec'],
series: [
{
name: '服务器名',
type: 'pie',
radius: '50%',
center: ['50%', '50%'],
// 初始化为空数组数据将根据jsonData动态设置
data: [],
itemStyle: {
normal: {
label: {
show: true
},
labelLine: {
show: true
}
},
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 将jsonData转换为饼状图的数据格式
function generatePieData(jsonData) {
return jsonData.map(function (item) {
return {
value: item.value,
name: item.server
};
});
}
function updatePieChart(jsonData) {
pieOption.series[0].data = generatePieData(jsonData);
pie.setOption(pieOption);
}
//侧边栏隐藏显示切换
document.addEventListener('DOMContentLoaded', function () {
var toggleSidebarButton = document.getElementById('toggleSidebar');
var sidebar = document.querySelector('.wrap');
toggleSidebarButton.addEventListener('click', function () {
sidebar.classList.toggle('wrap-hidden');
});
});
function updateAll(){
updatePieChart(jsonData);// 调用函数以更新消息列表
updateGraph(jsonData)
updateMessageList(jsonData);
setTimeout(function(){
updateAll2();
},5000);
}
function updateAll2(){
updatePieChart(jsonData2);// 调用函数以更新消息列表
updateGraph(jsonData2)
updateMessageList(jsonData2);
setTimeout(function(){
updateAll3();
},5000)
}
function updateAll3(){
updatePieChart(jsonData3);// 调用函数以更新消息列表
updateGraph(jsonData3)
updateMessageList(jsonData3);
}
updateAll();
</script>
</body>
</html>

@ -170,9 +170,12 @@
<!-- banner的平铺部分 -->
<div id="banner">
<div class="banner_con">
<a href="./index.html">
<img src="./assets/images/R-C.png"
height="466px"
width="1000px">
width="1000px"
>
</a>
</div>
</div>
<!-- 新闻列表的版心部分 -->

@ -0,0 +1,41 @@
<div class="sidebar">
<div class="menu-item">北京</div>
<div class="menu-item">长沙</div>
<div class="menu-item">上海</div>
<!-- 更多菜单项... -->
</div>
<button id="toggleIndent">切换缩进</button>
<style>
/* 初始的侧边栏样式 */
.sidebar {
width: 200px; /* 侧边栏宽度 */
background-color: #f4f4f4; /* 侧边栏背景颜色 */
padding: 10px; /* 侧边栏内边距 */
}
/* 菜单项样式 */
.menu-item {
padding: 8px 20px; /* 菜单项内边距 */
margin-bottom: 5px; /* 菜单项之间的间隔 */
background-color: #ddd; /* 菜单项背景颜色 */
cursor: pointer; /* 鼠标悬停时显示为指针 */
transition: background-color 0.3s; /* 背景颜色变化的过渡效果 */
}
/* 缩进效果的样式 */
.indented {
margin-left: 20px; /* 缩进的距离 */
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
var toggleIndentButton = document.getElementById('toggleIndent');
var menuItems = document.querySelectorAll('.menu-item');
toggleIndentButton.addEventListener('click', function () {
menuItems.forEach(function (item) {
item.classList.toggle('indented');
});
});
});
</script>

@ -221,7 +221,8 @@ body {
.chart-card .chart-bar {
background-color: var(--medium-slate-blue);
height: 100%;
height: 50%;
width: 100%;
transform-origin: bottom;
transition: transform var(--transition-2);
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,363 @@
@charset "UTF-8";
/* CSS Document */
.bg{
margin:0 auto;
width:100%;
min-height:100vh;
background:url(../images/bg2.jpg) no-repeat;
background-size: cover;
padding-top:0rem;
padding:0rem 0.2rem;
}
/*.conIn{
display:flex;
display: -webkit-flex;}*/
.title{
width:100%;
font-size:0.12rem;
line-height:0.3rem;
color:rgba(14,253,255,1);
text-align:center;
font-weight:bold;
}
.border_bg_leftTop{
position:absolute;
left:-0.008rem;
top:-0.04rem;
width:0.37rem;
height:0.05rem;
display:block;
background: url(../images/title_left_bg.png) no-repeat;
background-size:cover;}
.border_bg_rightTop{
position:absolute;
right:-0.01rem;
top:-0.01rem;
width:0.1rem;
height:0.1rem;
display:block;
background:url(../images/border_bg.jpg) no-repeat;
background-size:cover;}
.border_bg_leftBottom{
position:absolute;
left:-0.008rem;
bottom:-0.008rem;
width:0.1rem;
height:0.1rem;
display:block;
background:url(../images/border_bg.jpg) no-repeat;
background-size:cover;}
.border_bg_rightBottom{
position:absolute;
right:-0.01rem;
bottom:-0.01rem;
width:0.08rem;
height:0.08rem;
display:block;
background:url(../images/title_right_bg.png) no-repeat;
background-size:cover;}
.leftMain{
width:75%;
float:left;
padding-right:0.1rem;
padding-top:0.1rem;
}
.rightMain{
width:25%;
float:left;
padding-top:0.1rem;}
.leftMain_top{
width:100%;
padding-bottom:0.1rem;}
.leftMain_top ul{
display:flex;
display: -webkit-flex;
}
.leftMain_top ul li{
float:left;
width:25%;
padding-right:0.1rem;}
.leftMain_top ul li:last-child{
padding:0;}
.leftMain_top ul li .liIn{
border:0.008rem solid rgba(14,253,255,0.5);
width:100%;
min-height:60px;
position:relative;
padding:0.08rem 0.05rem;
}
.leftMain_top ul li .liIn h3{
font-size:0.08rem;
color:#fff;
margin-bottom:0.05rem;
}
.leftMain_top ul li .liIn .shu{
font-size:0.12rem;
color:rgba(14,253,255,1);
font-family:dig;
margin-bottom:0.02rem;}
.leftMain_top ul li .liIn .shu i{
font-size:0.04rem;
margin-left:0.06rem;
font-style:normal;}
.leftMain_top ul li .liIn .zi{
font-size:0.04rem;
color:#fff;
position:relative;
z-index:10;}
.leftMain_top ul li .liIn .zi .span1{
margin-right:0.1rem;}
.leftMain_middle{
width:100%;
padding-bottom:0.1rem;
display:flex;
display: -webkit-flex;}
.leftMain_middle .leftMain_middle_left{
width:60%;
padding-right:0.1rem;}
.leftMain_middle .leftMain_middle_left .leftMain_middle_leftIn{
border:0.008rem solid rgba(14,253,255,0.5);
width:100%;
min-height:60px;
position:relative;
padding:0.08rem 0.05rem;
}
.leftMain_middle .leftMain_middle_left .leftMain_middle_leftIn h3{
font-size:0.08rem;
color:#fff;
margin-bottom:0.05rem;
}
.leftMain_middle .leftMain_middle_left .leftMain_middle_leftIn .biaoge{
min-height:200px;}
.leftMain_middle .leftMain_middle_right{
width:40%;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn{
border:0.008rem solid rgba(14,253,255,0.5);
width:100%;
min-height:60px;
position:relative;
padding:0.08rem 0.05rem;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn h3{
font-size:0.08rem;
color:#fff;
margin-bottom:0.05rem;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge{
min-height:200px;}
/*左边中间部分排行榜*/
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai{
width:100%;
overflow:hidden;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn{
display:flex;
display: -webkit-flex;
align-items:center;
color:#fff;
font-size:0.06rem;
height:0.18rem;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_left{
width:25%;
position:relative;
padding-left:0.14rem;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_left .bot{
width:0.08rem;
height:0.08rem;
background:#f78cf3;
border-radius:1000px;
display:block;
position:absolute;
left:0.02rem;
top:0;
bottom:0;
margin:auto 0;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn2 .liIn_left .bot{
background:#e7feb8;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn3 .liIn_left .bot{
background:#fdea8a;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn4 .liIn_left .bot{
background:#8ff9f8;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn5 .liIn_left .bot{
background:#d890fa;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn6 .liIn_left .bot{
background:#05d1fc;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_left zi{
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_line{
width:58%;
height:0.08rem;
background:rgba(255,255,255,0.5);
border-radius:2000px;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_line .line_lineIn{
width:100%;
height:0.08rem;
background:#f78cf3;
border-radius:100px;
-webkit-animation: widthMove1 2s ease-in-out ;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn2 .liIn_line .line_lineIn{
background:#e7feb8;
-webkit-animation: widthMove2 2s ease-in-out ;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn3 .liIn_line .line_lineIn{
background:#fdea8a;
-webkit-animation: widthMove3 2s ease-in-out ;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn4 .liIn_line .line_lineIn{
background:#8ff9f8;
-webkit-animation: widthMove4 2s ease-in-out ;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn5 .liIn_line .line_lineIn{
background:#d890fa;
-webkit-animation: widthMove5 2s ease-in-out ;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn6 .liIn_line .line_lineIn{
background:#05d1fc;
-webkit-animation: widthMove6 2s ease-in-out ;}
@-webkit-keyframes widthMove1 {
0% {width:0%; }
100% { width:98.5%; }
}
@-webkit-keyframes widthMove2 {
0% {width:0%; }
100% { width:88.5%; }
}
@-webkit-keyframes widthMove3 {
0% {width:0%; }
100% { width:68.5%; }
}
@-webkit-keyframes widthMove4 {
0% {width:0%; }
100% { width:40.5%; }
}
@-webkit-keyframes widthMove5 {
0% {width:0%; }
100% { width:22.5%; }
}
@-webkit-keyframes widthMove6 {
0% {width:0%; }
100% { width:10.5%; }
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .num{
width:17%;
font-family:dig;
padding-left:0.02rem;}
/*左边底部*/
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_bi ul{
display:flex;
display: -webkit-flex;
flex-wrap:wrap;
width:100%;
}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_bi ul li{
width:33.3%;
text-align:center;
margin-bottom:0.05rem;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_bi ul li .shu{
font-size:0.14rem;
color:rgba(14,253,255,1);
font-family:dig;
padding:0.12rem 0 0.02rem;
font-weight:normal;}
.leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_bi ul li .zi{
font-size:0.06rem;
color:#fff;}
/*右边部分*/
.rightMain .rightMain_top{
width:100%;
padding-bottom:0.1rem;
}
.rightMain .rightMain_topIn{
border:0.008rem solid rgba(14,253,255,0.5);
width:100%;
min-height:60px;
position:relative;
padding:0.08rem 0.05rem;
}
.rightMain .rightMain_topIn h3{
font-size:0.08rem;
color:#fff;
margin-bottom:0.05rem;
}
.rightMain .rightMain_topIn .biaoge{
min-height:200px;}
.rightMain .rightMain_bottom{
width:100%;
}
.rightMain .rightMain_bottomIn{
border:0.008rem solid rgba(14,253,255,0.5);
width:100%;
min-height:60px;
position:relative;
padding:0.08rem 0.05rem;
}
.rightMain .rightMain_bottomIn h3{
font-size:0.08rem;
color:#fff;
margin-bottom:0.05rem;
}
/*右下角表格*/
.rightMain .rightMain_bottomIn .biaoge{
min-height:200px;}
.rightMain .rightMain_bottomIn .biaoge_list{
overflow:hidden;
position: relative;}
.rightMain .rightMain_bottomIn .biaoge_list .biaoge_listIn .ul_list{
overflow:hidden;
position: relative;}
.rightMain .rightMain_bottomIn .biaoge_list .biaoge_listIn .ul_listIn{
-webkit-animation: 14s gundong linear infinite normal;
animation: 14s gundong linear infinite normal;
position: relative;}
@keyframes gundong {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
100% {
-webkit-transform: translate3d(0, -30vh, 0);
transform: translate3d(0, -30vh, 0);
}
}
.rightMain .rightMain_bottomIn .biaoge_list ul{
display:flex;
display: -webkit-flex;
width:100%;
}
.rightMain .rightMain_bottomIn .biaoge_list .ul_title{
background: linear-gradient(left, rgba(255,255,255,0.1), rgba(255,255,255,0.5), rgba(255,255,255,0.1));
background: -ms-linear-gradient(left, rgba(255,255,255,0.1), rgba(255,255,255,0.5), rgba(255,255,255,0.1));
background: -webkit-linear-gradient(left, rgba(255,255,255,0.1), rgba(255,255,255,0.5), rgba(255,255,255,0.1));
background: -moz-linear-gradient(left, rgba(255,255,255,0.1), rgba(255,255,255,0.5), rgba(255,255,255,0.1));
}
.rightMain .rightMain_bottomIn .biaoge_list .ul_con{
border-bottom:0.008rem solid rgba(14,253,255,0.5);}
.rightMain .rightMain_bottomIn .biaoge_list ul li{
width:20%;
text-align:center;
color:#fff;
font-size:0.06rem;
height:0.2rem;
line-height:0.2rem;}
.rightMain .rightMain_bottomIn .biaoge_list ul li:frist-child{
text-align:left;}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -0,0 +1,669 @@
<!doctype html>
<html>
<head>
<!--更多资源https://gitee.com/iGaoWei/big-data-view -->
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>酷炫智能大屏数据中心</title>
<!--大屏-->
<link type="text/css" href="css/public2.css" rel="stylesheet">
<link type="text/css" href="css/icon.css" rel="stylesheet">
<link type="text/css" href="css/index2.css" rel="stylesheet">
<script type="text/javascript">
document.documentElement.style.fontSize = document.documentElement.clientWidth /768*100 + 'px';
</script>
<script src="js/echarts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<div class="bg">
<div class="title">HADG数据分析中心<button type="button" class="refresh-button" onclick="location.reload();"></button></div>
<div class="leftMain">
<div class="leftMain_top">
<div id="mytitle"></div>
</div>
<div class="leftMain_middle">
<div class="leftMain_middle_left">
<div class="leftMain_middle_leftIn">
<h3>系统处理信息数量统计图</h3>
<!-- 为ECharts准备一个具备大小宽高的Dom -->
<div class="biaoge" style="width:100%; height:25vh" id="chartmain"></div>
<script type="text/javascript">
//window.onload = function () {
//指定图表的配置项和数据
//};
</script>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</div>
<div class="leftMain_middle_right">
<div class="leftMain_middle_rightIn">
<h3>服务器错误率情况</h3>
<div class="biaoge biaoge_pai" style="width:100%; height:25vh">
<div class="biaoge_paiIn">
<ul>
<div id="mylist"></div>
</ul>
</div>
</div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</div>
</div>
<div class="leftMain_middle">
<div class="leftMain_middle_left">
<div class="leftMain_middle_leftIn">
<h3>服务器响应时间波动情况</h3>
<div class="biaoge" style="width:100%; height:25vh">
<canvas id="chartmain_zhe"></canvas>
</div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</div>
<div class="leftMain_middle_right">
<div class="leftMain_middle_rightIn">
<h3>服务器存活情况</h3>
<div class="biaoge biaoge_bi" style="width:100%; height:25vh">
<div class="biaoge" style="width:100%; height:30vh" id="chartmain_bing2"></div>
</div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</div>
</div>
</div>
<di class="rightMain">
<div class="rightMain_top">
<div class="rightMain_topIn">
<h3></h3>
<div class="biaoge" style="width:100%; height:30vh" id="chartmain_bing"></div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</div>
<div class="rightMain_bottom">
<div class="rightMain_bottomIn">
<h3>最近处理消息简报</h3>
<div class="biaoge biaoge_list" style="width:100%; height:36vh">
<div class="biaoge_listIn">
<ul class="ul_title">
<li>服务器名</li>
<li>地区</li>
<li>报文格式</li>
<li>响应时间</li>
</ul>
<div class="ul_list">
<div class="ul_listIn">
<ul class="ul_con">
<li>127.0.0.1</li>
<li>北京</li>
<li>TCP</li>
<li>110ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.2</li>
<li>广州</li>
<li>TCP</li>
<li>150ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.2</li>
<li>广州</li>
<li>TCP</li>
<li>144ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.3</li>
<li>上海</li>
<li>TCP</li>
<li>220ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.1</li>
<li>北京</li>
<li>TCP</li>
<li>70ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.3</li>
<li>上海</li>
<li>TCP</li>
<li>170ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.2</li>
<li>广州</li>
<li>TCP</li>
<li>110ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.3</li>
<li>上海</li>
<li>TCP</li>
<li>310ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.1</li>
<li>北京</li>
<li>TCP</li>
<li>120ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.3</li>
<li>上海</li>
<li>TCP</li>
<li>580ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.2</li>
<li>广州</li>
<li>TCP</li>
<li>110ms</li>
</ul>
<ul class="ul_con">
<li>127.0.0.2</li>
<li>广州</li>
<li>TCP</li>
<li>70ms</li>
</ul>
</div>
</div>
<div style="clear:both;"></div>
</div>
<!--大屏-->
<!--数字增长累加动画-->
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="js/jquery.numscroll.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
// var jsonData;
// function a(){
// jsonData='aaaa';
// }
// setInterval(a,1000);
// console.log(jsonData);
//document.addEventListener('DOMContentLoaded', function() {
// 获取表单元素
// window.setInterval(myFunction,5000);
//     function myFunction(){
//         fetch('http://localhost:8080/aaa', {
//             method: 'POST', // 或者 'PUT'
//             headers: {
//                 'Content-Type': 'application/json',
//                 // 如果需要认证添加Authorization头部
//                 // 'Authorization': 'Bearer your_token_here'
//             },
//             body: 'abc' // 将表单数据转换为JSON字符串
//         })
//         .then(response => {return response.json()}) // 转换响应为JSON
//         .then(data => {
//             var jsonData=data;
// console.log(jsonData)
//         })
//     }
// })
var jsonData1={ AveSurRate:0.71,messageCount:2980,//平均存活度
TimeArray:['6.17', '6.18', '6.19', '6.20', '6.21', '6.22', '6.23', '6.24', '6.25', '6.26', '6.27', '6.28', '6.29', '6.30', '7.1'],//系统处理信息数量统计图横轴
DataArray:[220, 182, 191, 234, 290, 330, 310, 123, 442, 321, 90, 149, 210, 122, 150],//系统处理信息数量统计图数据
data1:[//错误率
{value: 0.1, name: '北京'},
{value: 0.6, name: '广州'},
{value: 0.1, name: '长沙'},
{value: 0.2, name: '上海'},
],
data2:[//存活情况
{value: 0.2, name: '良好'},
{value: 0.2, name: '一般'},
{value: 0.3, name: '差'},
{value: 0.3, name: '极差'},
],
data:{
labels: ['16:00', '16:10', '16:20', '16:30', '16:40', '16:50'], // 服务器响应时间波动情况X轴标签
datasets: [//服务器响应时间波动情况数据信息
{
label: '127.0.0.1', // 数据集名称
data: [100, 70, 70, 60, 77, 79], // 数据集数据
},
{
label: '127.0.0.2',
data: [1300, 1300, 1500, 100, 70, 150],
},
{
label: '127.0.0.3',
data: [70, 80, 80, 100, 110, 70],
}]
}
};
var jsonData2={ AveSurRate:0.75,messageCount:3010,//平均存活度
TimeArray:['6.17', '6.18', '6.19', '6.20', '6.21', '6.22', '6.23', '6.24', '6.25', '6.26', '6.27', '6.28', '6.29', '6.30', '7.1'],//系统处理信息数量统计图横轴
DataArray:[220, 182, 191, 234, 290, 330, 310, 123, 442, 321, 90, 149, 210, 122, 350],//系统处理信息数量统计图数据
data1:[//错误率
{value: 0.3, name: '北京'},
{value: 0.4, name: '广州'},
{value: 0.1, name: '长沙'},
{value: 0.2, name: '上海'},
],
data2:[//存活情况
{value: 0.3, name: '良好'},
{value: 0.2, name: '一般'},
{value: 0.1, name: '差'},
{value: 0.2, name: '极差'},
],
data:{
labels: ['16:10', '16:20', '16:30', '16:40', '16:50','17:00'], // 服务器响应时间波动情况X轴标签
datasets: [//服务器响应时间波动情况数据信息
{
label: '127.0.0.1', // 数据集名称
data: [70, 70, 60, 77, 79,80], // 数据集数据
},
{
label: '127.0.0.2',
data: [1300, 1500, 100, 70, 150,170],
},
{
label: '127.0.0.3',
data: [80, 80, 100, 110, 70,100],
}]
}
};
function paintchartmain(jsonData){
console.log('paintchartmain')
var dataAxis = jsonData.TimeArray;
var data = jsonData.DataArray;
var yMax = 500;
var dataShadow = [];
for (var i = 0; i < data.length; i++) {
dataShadow.push(yMax);
}
option = {
title: {
text: '',
subtext: ''
},
grid:{
x:40,
y:40,
x2:20,
y2:20,
},
xAxis: {
data: dataAxis,
axisLabel: {
/*inside: true,*/
interval:0,
textStyle: {
color: '#fff',
fontSize: 12
}
},
axisTick: {
show: false,
},
axisLine: {
show: true,
symbol:['none', 'arrow'],
symbolOffset: 12,
lineStyle:{
color: '#fff',
}
},
z: 10
},
yAxis: {
type: 'value',
name: '条数:条',
axisLine: {
show: true,
symbol: ['none', 'arrow'],
symbolOffset: 12,
lineStyle:{
color: '#fff',
}
},
axisTick: {
show: false
},
axisLabel: {
textStyle: {
color: '#fff',
fontSize: 12
}
}
},
dataZoom: [
{
type: 'inside'
}
],
series: [
{ // For shadow
type: 'bar',
itemStyle: {
color: 'rgba(0,0,0,0.05)'
},
barGap: '-100%',
barCategoryGap: '40%',
data: dataShadow,
animation: false
},
{
type: 'bar',
itemStyle: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#0efdff'},
{offset: 0.5, color: '#188df0'},
{offset: 1, color: '#188df0'}
]
)
},
emphasis: {
itemStyle: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: '#2378f7'},
{offset: 0.7, color: '#2378f7'},
{offset: 1, color: '#0efdff'}
]
)
}
},
data: data
}
]
};
// Enable data zoom when user click bar.
/*var zoomSize = 6;
myChart.on('click', function (params) {
console.log(dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)]);
myChart.dispatchAction({
type: 'dataZoom',
startValue: dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)],
endValue: dataAxis[Math.min(params.dataIndex + zoomSize / 2, data.length - 1)]
});
});*/
//获取dom容器
var myChart = echarts.init(document.getElementById('chartmain'));
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
//console.log(jsonData.data);
function paintchartmainbing(jsonData){
var ctx = document.getElementById('chartmain_zhe').getContext('2d');
myChart = new Chart(ctx, {
type: 'line', // 图表类型
data: jsonData.data, // 传递数据
options: {
scales: {
y: {
beginAtZero: false // Y轴是否从0开始
}
},
responsive: true, // 响应式图表
maintainAspectRatio: false // 保持宽高比
}
});
//获取dom容器
option = {
title: {
text: '数据情况统计',
subtext: '',
left: 'right',
textStyle: {
color: '#fff',
fontSize: 12
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
// orient: 'vertical',
// top: 'middle',
type: 'scroll',
orient: 'vertical',
right: 10,
top: 40,
bottom: 20,
left: 'right',
data: ['西凉', '益州', '兖州', '荆州', '幽州'],
textStyle: {
color: '#fff',
fontSize: 12
}
},
grid:{
x:'-10%',
y:40,
x2:20,
y2:20,
},
color : [ '#09d0fb', '#f88cfb', '#95f8fe', '#f9f390', '#ecfeb7' ],
series: [
{
type: 'pie',
radius: '65%',
center: ['50%', '50%'],
selectedMode: 'single',
data: jsonData.data1,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
//获取dom容器
myChart1 = echarts.init(document.getElementById('chartmain_bing'));
// 使用刚指定的配置项和数据显示图表。
myChart1.setOption(option);
setTimeout(function(){
myChart.destroy();
},8000);
}
function paintchartmainbing2(jsonData){
option2 = {
title: {
text: '',
subtext: '',
left: 'right',
textStyle: {
color: '#fff',
fontSize: 12
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
// orient: 'vertical',
// top: 'middle',
type: 'scroll',
orient: 'vertical',
right: 10,
top: 40,
bottom: 20,
left: 'right',
data: ['西凉', '益州', '兖州', '荆州', '幽州'],
textStyle: {
color: '#fff',
fontSize: 12
}
},
grid:{
x:'-10%',
y:40,
x2:20,
y2:20,
},
color : [ '#09d0fb', '#f88cfb', '#95f8fe', '#f9f390', '#ecfeb7' ],
series: [
{
type: 'pie',
radius: '65%',
center: ['50%', '50%'],
selectedMode: 'single',
data: jsonData.data2,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
//获取dom容器
myChart2 = echarts.init(document.getElementById('chartmain_bing2'));
// 使用刚指定的配置项和数据显示图表。
myChart2.setOption(option2);
}
$(".shu1").numScroll();
$(".shu2").numScroll();
$(".shu3").numScroll();
$(".shu4").numScroll();
$(".shu5").numScroll();
$(".shu6").numScroll();
function updateMessageList(data) {
var msgListContainer = document.getElementById('mylist');
msgListContainer.innerHTML = ''; // 清空现有内容
data.forEach(function(item) {
var msgItem = document.createElement('div');
msgItem.className = 'msg_item';
msgItem.innerHTML = `
<li>
<div class="liIn">
<div class="liIn_left"><span class="bot"></span><span class="zi">${item.name}</span></div>
<div class="liIn_line"><div class="line_lineIn" style="width:98.5%;"></div></div>
<p class="num">${item.value}</p>
</div>
</li>
`;
msgListContainer.appendChild(msgItem);
});
}
function updatetitle(jsonData){
let str='';
str+=`
<div class="leftMain_topIn">
<ul>
<li>
<div class="liIn">
<h3>当前系统版本</h3>
<p class="shu"><span class="shu1">1.15</span><i>version</i></p>
<div class="zi"><span class="span1"></span><span></span></div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</li>
<li>
<div class="liIn">
<h3>已连接服务器数量</h3>
<p class="shu"><span class="shu2">5</span><i></i></p>
<div class="zi"><span class="span1"></span><span></span></div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</li>
<li>
<div class="liIn">
<h3>已处理消息总条数</h3>
<p class="shu"><span class="shu3">${jsonData.messageCount}</span><i></i></p>
<div class="zi"><span class="span1"></span><span></span></div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</li>
<li>
<div class="liIn">
<h3>系统活跃度</h3>
<p class="shu"><span class="shu4">${jsonData.AveSurRate}</span><i></i></p>
<div class="zi"><span class="span1"></span><span></span></div>
<span class="border_bg_leftTop"></span>
<span class="border_bg_rightTop"></span>
<span class="border_bg_leftBottom"></span>
<span class="border_bg_rightBottom"></span>
</div>
</li>
</ul>
</div>
`;
const el = document.getElementById('mytitle');
        el.innerHTML = str;
}
function paintall()
{
console.log("test");
paintchartmain(jsonData1);
paintchartmainbing(jsonData1);
paintchartmainbing2(jsonData1);
updateMessageList(jsonData1.data1);
updatetitle(jsonData1);
setTimeout(function(){
paintall2();
},8000)
}
function paintall2()
{
console.log("test");
paintchartmain(jsonData2);
paintchartmainbing(jsonData2);
paintchartmainbing2(jsonData2);
updateMessageList(jsonData2.data1);
updatetitle(jsonData2);
}
paintall();
// setInterval(paintall,3000);
/*$(".num2").numScroll({
time:5000
});*/
</script>
<!--大屏-->
</body>
</html>

@ -0,0 +1,275 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export * from './src/echarts';
export * from './src/export';
import './src/component/dataset';
// ----------------------------------------------
// All of the modules that are allowed to be
// imported are listed below.
//
// Users MUST NOT import other modules that are
// not included in this list.
// ----------------------------------------------
// ----------------
// Charts (series)
// ----------------
// All of the series types, for example:
// chart.setOption({
// series: [{
// type: 'line' // or 'bar', 'pie', ...
// }]
// });
import './src/chart/bar';
import './src/chart/boxplot';
import './src/chart/candlestick';
import './src/chart/custom';
import './src/chart/effectScatter';
import './src/chart/funnel';
import './src/chart/gauge';
import './src/chart/graph';
import './src/chart/heatmap';
import './src/chart/line';
import './src/chart/lines';
import './src/chart/map';
import './src/chart/parallel';
import './src/chart/pictorialBar';
import './src/chart/pie';
import './src/chart/radar';
import './src/chart/sankey';
import './src/chart/scatter';
import './src/chart/sunburst';
import './src/chart/themeRiver';
import './src/chart/tree';
import './src/chart/treemap';
// -------------------
// Coordinate systems
// -------------------
// All of the axis modules have been included in the
// coordinate system module below, do not need to
// make extra import.
// `cartesian` coordinate system. For some historical
// reasons, it is named as grid, for example:
// chart.setOption({
// grid: {...},
// xAxis: {...},
// yAxis: {...},
// series: [{...}]
// });
import './src/component/grid';
// `polar` coordinate system, for example:
// chart.setOption({
// polar: {...},
// radiusAxis: {...},
// angleAxis: {...},
// series: [{
// coordinateSystem: 'polar'
// }]
// });
import './src/component/polar';
// `geo` coordinate system, for example:
// chart.setOption({
// geo: {...},
// series: [{
// coordinateSystem: 'geo'
// }]
// });
import './src/component/geo';
// `singleAxis` coordinate system (notice, it is a coordinate system
// with only one axis, work for chart like theme river), for example:
// chart.setOption({
// singleAxis: {...}
// series: [{type: 'themeRiver', ...}]
// });
import './src/component/singleAxis';
// `parallel` coordinate system, only work for parallel series, for example:
// chart.setOption({
// parallel: {...},
// parallelAxis: [{...}, ...],
// series: [{
// type: 'parallel'
// }]
// });
import './src/component/parallel';
// `calendar` coordinate system. for example,
// chart.setOptionp({
// calendar: {...},
// series: [{
// coordinateSystem: 'calendar'
// }]
// );
import './src/component/calendar';
// ------------------
// Other components
// ------------------
// `graphic` component, for example:
// chart.setOption({
// graphic: {...}
// });
import './src/component/graphic';
// `toolbox` component, for example:
// chart.setOption({
// toolbox: {...}
// });
import './src/component/toolbox';
// `tooltip` component, for example:
// chart.setOption({
// tooltip: {...}
// });
import './src/component/tooltip';
// `axisPointer` component, for example:
// chart.setOption({
// tooltip: {axisPointer: {...}, ...}
// });
// Or
// chart.setOption({
// axisPointer: {...}
// });
import './src/component/axisPointer';
// `brush` component, for example:
// chart.setOption({
// brush: {...}
// });
// Or
// chart.setOption({
// tooltip: {feature: {brush: {...}}
// })
import './src/component/brush';
// `title` component, for example:
// chart.setOption({
// title: {...}
// });
import './src/component/title';
// `timeline` component, for example:
// chart.setOption({
// timeline: {...}
// });
import './src/component/timeline';
// `markPoint` component, for example:
// chart.setOption({
// series: [{markPoint: {...}}]
// });
import './src/component/markPoint';
// `markLine` component, for example:
// chart.setOption({
// series: [{markLine: {...}}]
// });
import './src/component/markLine';
// `markArea` component, for example:
// chart.setOption({
// series: [{markArea: {...}}]
// });
import './src/component/markArea';
// `legend` component scrollable, for example:
// chart.setOption({
// legend: {type: 'scroll'}
// });
import './src/component/legendScroll';
// `legend` component not scrollable. for example:
// chart.setOption({
// legend: {...}
// });
import './src/component/legend';
// `dataZoom` component including both `dataZoomInside` and `dataZoomSlider`.
import './src/component/dataZoom';
// `dataZoom` component providing drag, pinch, wheel behaviors
// inside coodinate system, for example:
// chart.setOption({
// dataZoom: {type: 'inside'}
// });
import './src/component/dataZoomInside';
// `dataZoom` component providing a slider bar, for example:
// chart.setOption({
// dataZoom: {type: 'slider'}
// });
import './src/component/dataZoomSlider';
// `dataZoom` component including both `visualMapContinuous` and `visualMapPiecewise`.
import './src/component/visualMap';
// `visualMap` component providing continuous bar, for example:
// chart.setOption({
// visualMap: {type: 'continuous'}
// });
import './src/component/visualMapContinuous';
// `visualMap` component providing pieces bar, for example:
// chart.setOption({
// visualMap: {type: 'piecewise'}
// });
import './src/component/visualMapPiecewise';
// -----------------
// Render engines
// -----------------
// Provide IE 6,7,8 compatibility.
import 'zrender/src/vml/vml';
// Render via SVG rather than canvas.
import 'zrender/src/svg/svg';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,84 @@
/*!
* jquery.numscroll.js -- 数字滚动累加动画插件 (Digital rolling cumulative animation)
* version 1.0.0
* 2018-09-22
* author: KevinTseng < 921435247@qq.com@qq.com >
* 文档: https://github.com/chaorenzeng/jquery.numscroll.js.git
* QQ交流群: 739574382
*/
(function($) {
function isInt(num) {
//作用:是否为整数
//返回:true是 false否
var res = false;
try {
if(String(num).indexOf(".") == -1 && String(num).indexOf(",") == -1) {
res = parseInt(num) % 1 === 0 ? true : false;
}
} catch(e) {
res = false;
}
return res;
}
function isFloat(num) {
//作用:是否为小数
//返回:小数位数(-1不是小数)
var res = -1;
try {
if(String(num).indexOf(".") != -1) {
var index = String(num).indexOf(".") + 1; //获取小数点的位置
var count = String(num).length - index; //获取小数点后的个数
if(index > 0) {
res = count;
}
}
} catch(e) {
res = -1;
}
return res;
}
$.fn.numScroll = function(options) {
var settings = $.extend({
'time': 1500,
'delay': 0
}, options);
return this.each(function() {
var $this = $(this);
var $settings = settings;
var num = $this.attr("data-num") || $this.text(); //实际值
var temp = 0; //初始值
$this.text(temp);
var numIsInt = isInt(num);
var numIsFloat = isFloat(num);
var step = (num / $settings.time) * 10; //步长
setTimeout(function() {
var numScroll = setInterval(function() {
if(numIsInt) {
$this.text(Math.floor(temp));
} else if(numIsFloat != -1) {
$this.text(temp.toFixed(numIsFloat));
} else {
$this.text(num);
clearInterval(numScroll);
return;
}
temp += step;
if(temp > num) {
$this.text(num);
clearInterval(numScroll);
}
}, 1);
}, $settings.delay);
});
};
})(jQuery);

@ -154,11 +154,12 @@ min-height: 520px;
overflow: hidden;
}
.lie {
width: 23%;
width: 15%;
display: inline-block;
font: 13px sans-serif;
}
.lie a {
white-space:nowrap;
display: block;
color: rgb(39, 124, 184);
text-align: center;
@ -177,7 +178,7 @@ min-height: 520px;
overflow: hidden;
}
.lia {
width: 23%;
width: 15%;
display: inline-block;
font: 13px sans-serif;
}

@ -0,0 +1,202 @@
<html>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<head>
<title>模态框示例</title>
<style>
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 2.5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.table-container {
margin: auto;
width: 80%;
max-width: 600px; /* 根据需要调整表格的最大宽度 */
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<div>
<canvas id="myChart"></canvas>
</div>
<div class="table-container">
<table>
<caption>响应时间统计</caption>
<tr>
<th>统计指标</th>
<th></th>
</tr>
<tr>
<td>最大响应时间</td>
<td id="maxResponseTime">-</td>
</tr>
<tr>
<td>最小响应时间</td>
<td id="minResponseTime">-</td>
</tr>
<tr>
<td>平均响应时间</td>
<td id="averageResponseTime">-</td>
</tr>
<tr>
<td>错误率</td>
<td id="errorRate">-</td>
</tr>
</table>
</div>
</div>
</div>
</body>
<script>
// 获取按钮和模态框元素
var btn = document.getElementById('openModalBtn');
var modal = document.getElementById('myModal');
var span = document.getElementsByClassName("close")[0];
// 为按钮添加点击事件以打开模态框
modal.style.display = "block";
// 为关闭按钮添加点击事件以关闭模态框
span.onclick = function() {
modal.style.display = "none";
window.history.go(-1); //返回上一页
}
// 在用户点击模态框外部时关闭模态框
// window.onclick = function(event) {
// if (event.target == modal) {
// modal.style.display = "none";
// window.history.go(-1); //返回上一页
// }
// }
//var receiveData={[{"time":"2021.2.19", "responsetime": 10},{"time":"2021.3.19", "responsetime": 10}]};
var receiveData={"servername":"127.0.0.1","DisabledRate": 0.5,
"ResponseTimeArray": [111,110,110,111,111,111],
"Time":["2021.3.19","2021.3.20","2021.3.21","2021.3.22","2021.3.22","2021.3.23"]}
var jsonData = {
"labels": receiveData.Time,
"data": [
{
"label": "响应时间",
"data": receiveData.ResponseTimeArray
},
]
};
// 获取Canvas元素
window.onload=function(){
var ctx = document.getElementById('myChart').getContext('2d');
// 创建折线图
var myChart = new Chart(ctx, {
type: 'line', // 图表类型
data: {
labels:jsonData.labels,
datasets:[{
label:jsonData.data[0].label,
data:jsonData.data[0].data,
backgroundColor: 'rgba(255, 99, 132, 0.2)', // 数据集的背景颜色
borderColor: 'rgba(255, 99, 132, 1)', // 数据集的边框颜色
borderWidth: 1 // 边框宽度
}]
},
options: {
scales: {
y: {
beginAtZero: false // Y轴是否从0开始
}
},
responsive: true, // 响应式图表
maintainAspectRatio: true // 保持宽高比
}
});
};
// 可以添加一个函数来更新图表数据
function updateChartData(newData) {
myChart.data.datasets.forEach((dataset, index) => {
myChart.data.labels = newData.labels;
myChart.data.datasets[index].data = newData.data[index].data;
});
myChart.update();
}
function calculateResponseTimeStats(data) {
const times = data.map(set => set.data);
const flattenedTimes = times.flat();
const maxTime = Math.max(...flattenedTimes);
const minTime = Math.min(...flattenedTimes);
const sumTime = flattenedTimes.reduce((acc, curr) => acc + curr, 0);
const averageTime = sumTime / flattenedTimes.length;
return {
max: maxTime,
min: minTime,
average: averageTime
};
}
// 更新表格中的统计数据
function updateStatsTable(stats,data) {
document.getElementById('maxResponseTime').textContent = stats.max;
document.getElementById('minResponseTime').textContent = stats.min;
document.getElementById('averageResponseTime').textContent = stats.average.toFixed(2);
document.getElementById('errorRate').textContent=data.DisabledRate;
}
// 使用jsonData中的数据更新统计表
const stats = calculateResponseTimeStats(jsonData.data);
updateStatsTable(stats,receiveData);
// 模拟数据更新
setInterval(() => {
// 这里应该根据实际逻辑获取新数据
var newData = {
labels: jsonData.labels,
data: [
// 这里添加新数据点或更新现有数据点
]
};
updateChartData(newData);
}, 1000);
</script>
</html>
Loading…
Cancel
Save