From 0a057450878bb6ad8982bb543fd551b729c3f3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= <93301500+xushubieli@users.noreply.github.com> Date: Tue, 30 May 2023 15:16:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=9F=E8=AE=A1=E5=9B=BE?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E9=A2=9C=E8=89=B2=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/js/body.js | 82 +++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/src/admin/js/body.js b/src/admin/js/body.js index 874cd9c6..a9f5630a 100644 --- a/src/admin/js/body.js +++ b/src/admin/js/body.js @@ -108,13 +108,13 @@ function LoadServer() { } Date.prototype.Format = function (fmt) { 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)); for (var k in o) @@ -167,6 +167,8 @@ function LoadStat() { }); } async function LoadStatChart() { + Chart.defaults.font.size = 14; + Chart.defaults.color = '#545b62'; const ctx = document.getElementById('statChart').getContext('2d'); let labels = []; let dates = []; @@ -193,46 +195,46 @@ async function LoadStatChart() { }); } 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 } ] },