Browse Source

调整统计图字体颜色大小

tags/6.2.8
叙述、别离 2 years ago
parent
commit
0a05745087
1 changed files with 42 additions and 40 deletions
  1. +42
    -40
      src/admin/js/body.js

+ 42
- 40
src/admin/js/body.js View File

@@ -108,13 +108,13 @@ function LoadServer() {
} }
Date.prototype.Format = function (fmt) { Date.prototype.Format = function (fmt) {
var o = { var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
"M+" : this.getMonth() + 1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth() + 3) / 3), //季度
"S" : this.getMilliseconds() //毫秒
}; };
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) for (var k in o)
@@ -167,6 +167,8 @@ function LoadStat() {
}); });
} }
async function LoadStatChart() { async function LoadStatChart() {
Chart.defaults.font.size = 14;
Chart.defaults.color = '#545b62';
const ctx = document.getElementById('statChart').getContext('2d'); const ctx = document.getElementById('statChart').getContext('2d');
let labels = []; let labels = [];
let dates = []; let dates = [];
@@ -193,46 +195,46 @@ async function LoadStatChart() {
}); });
} }
const myChart = new Chart(ctx, { const myChart = new Chart(ctx, {
type:'line',
options:{
responsive:true,
plugins:{
legend:{
position:'right',
type: 'line',
options: {
responsive: true,
plugins: {
legend: {
position: 'right',
} }
} }
}, },
data:{
labels:labels,
datasets:[
data: {
labels: labels,
datasets: [
{ {
label:'PV',
data:pvs,
lineTension:.5,
borderColor:'rgba(54, 162, 235, 1)',
backgroundColor:'rgba(54, 162, 235, 0.2)',
borderWidth:2
label: 'PV',
data: pvs,
lineTension: .5,
borderColor: 'rgba(54, 162, 235, 1)',
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderWidth: 2
}, { }, {
label:'UV',
data:uvs,
lineTension:.5,
borderColor:'rgba(255, 206, 86, 1)',
backgroundColor:'rgba(255, 206, 86, 0.2)',
borderWidth:2
label: 'UV',
data: uvs,
lineTension: .5,
borderColor: 'rgba(255, 206, 86, 1)',
backgroundColor: 'rgba(255, 206, 86, 0.2)',
borderWidth: 2
}, { }, {
label:'IP',
data:ips,
lineTension:.5,
borderColor:'rgba(255, 99, 132, 1)',
backgroundColor:'rgba(255, 99, 132, 0.2)',
borderWidth:2
label: 'IP',
data: ips,
lineTension: .5,
borderColor: 'rgba(255, 99, 132, 1)',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderWidth: 2
}, { }, {
label:'VV',
data:vvs,
lineTension:.5,
borderColor:'rgba(75, 192, 192, 1)',
backgroundColor:'rgba(75, 192, 192, 0.2)',
borderWidth:2
label: 'VV',
data: vvs,
lineTension: .5,
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderWidth: 2
} }
] ]
}, },


Loading…
Cancel
Save