1 Star 0 Fork 26

yangyn/dwz for Public CMS

forked from sanluan/dwz for Public CMS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
chart.html 3.42 KB
一键复制 编辑 原始数据 按行查看 历史
sanluan 提交于 2017-10-29 15:01 . add chart.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>使用报表</title>
<script src="resource/js/jquery-1.9.1.min.js"></script>
<script src="resource/js/echarts.common.min.js"></script>
</head>
<body>
<a href=""><h1 style="margin:20px;">系统监控</h1></a>
<div id="memory" style="width:300px;margin:20px;float:left;"></div>
<div id="memory_count" style="width:300px;margin:20px;float:left;"></div>
<div id="disk" style="width:300px;margin:20px;float:left;"></div>
<script>
document.getElementById('memory').style.height=document.getElementById('memory').offsetWidth+'px';
document.getElementById('memory_count').style.height=document.getElementById('memory_count').offsetWidth+'px';
document.getElementById('disk').style.height=document.getElementById('disk').offsetWidth+'px';
var memoryChart={
chart:echarts.init(document.getElementById('memory')),
countChart:echarts.init(document.getElementById('memory_count')),
data:{
freeMemory:[300,200,100,300,200,100,300,200,100],
usedMemory:[100,200,300,100,200,300,100,200,300],
unUsedMemory:[200,200,200,200,200,200,200,200,200]
},
time:[1,2,3,4,5,6,7,8,9],
toDecimal:function(number) {
var value = parseFloat(number);
if (isNaN(value)) {
return 0;
}
value = Math.round(number*100)/100;
return value;
}
};
memoryChart.chart.setOption({
title: {
text: '内存监测'
},
tooltip : {
trigger: 'axis'
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: memoryChart.time
},
yAxis: {
type: 'value'
},
series: [
{
name:'实际使用',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:memoryChart.data.usedMemory
},
{
name:'闲置内存',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:memoryChart.data.freeMemory
},
{
name:'可用剩余',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:memoryChart.data.unUsedMemory
}]
});
memoryChart.countChart.setOption({
title : {
text: '内存使用',
subtext: '占用内存',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)",
position: [10, 10]
},
toolbox: {
feature: {
saveAsImage: {}
}
},
series : [
{
name: '内存使用',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:40, name:'已用'},
{value:60, name:'闲置'}
]
}
]
});
echarts.init(document.getElementById('disk')).setOption({
title : {
text: '站点磁盘:20G',
subtext: '/data/publiccms/',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)",
position: [10, 10]
},
toolbox: {
feature: {
saveAsImage: {}
}
},
series : [
{
name: '磁盘空间',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:60, name:'已用'},
{value:40, name:'空闲'}
]
}
]
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/yyn_0210/dwz-for-Public-CMS.git
git@gitee.com:yyn_0210/dwz-for-Public-CMS.git
yyn_0210
dwz-for-Public-CMS
dwz for Public CMS
master

搜索帮助