From aec8a2ff041e65a9aba5ce0e6e42533883b5107f Mon Sep 17 00:00:00 2001 From: ngfchl Date: Wed, 7 Dec 2022 10:11:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E5=A2=9E=E9=87=8F=EF=BC=8C=E5=9B=A0=E6=95=B0=E6=8D=AE=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E8=AE=A1=E7=AE=97=E5=BE=97=E5=87=BA=E8=B4=9F=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E9=87=8D=E7=BD=AE=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/auto_pt/status.html | 179 +++++++++++++++++++++++++++++----- 1 file changed, 155 insertions(+), 24 deletions(-) diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index ca61f03..829a999 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -346,15 +346,14 @@ {#
#} {#

-历史数据

#} {#
#} -
+
+ + + - - - - @@ -955,7 +954,9 @@ let seedingSizeList = [] let dateList = [] let increment = [] - + dataList.sort((a, b) => { + return a.info_date - b.info_date + }) dataList.forEach((info, index) => { uploadedList.push(info.uploaded) ratioList.push(info.ratio) @@ -964,12 +965,22 @@ spList.push(info.sp) bonusList.push(info.bonus) dateList.push(info.info_date) + if (index > 1 && index < dataList.length) { + console.log(info.info_date, info.uploaded, dataList[index - 1].uploaded, info.uploaded - dataList[index - 1].uploaded,) + } }) let uploaded1 = uploadedList.filter((item, index) => index > 0) let uploaded2 = uploadedList.filter((item, index) => index < uploadedList.length) let diff = [0,] uploaded1.forEach((item, index) => { - diff.push(item - uploaded2[index]) + let d = item - uploaded2[index] + + console.log(dateList[index], item, uploaded2[index], d) + if (!d || d < 0) { + diff.push(0) + } else { + diff.push(d) + } }) console.log(diff) let option = { @@ -1012,34 +1023,126 @@ boundaryGap: false, data: dateList }, - yAxis: { + yAxis: [{ type: 'value', axisLabel: { formatter: function (value, index) { return renderSize(value); } }, - }, + + }, { + type: 'value', + axisLabel: { + formatter: function (v, i) { + if (i === 0) { + v = '0'; + } + if (i === 1) { + v = '1'; + } + if (i === 2) { + v = '3'; + } + if (i === 3) { + v = '5'; + } + if (i === 4) { + v = '30'; + } + if (i === 5) { + v = '1000'; + } + if (i === 6) { + v = '5000'; + } + if (i === 7) { + v = '12000'; + } + return v; + } + }, + }], series: [ { name: '做种量', type: 'line', + yAxisIndex: 0, {#stack: 'Total',#} data: seedingSizeList }, { name: '上传量', type: 'line', + yAxisIndex: 0, {#stack: 'Total',#} data: uploadedList }, { name: '下载量', type: 'line', + yAxisIndex: 0, {#stack: 'Total',#} data: downloadedList }, - + { + name: '上传增量', + type: 'bar', + yAxisIndex: 0, + {#stack: 'Total',#} + data: diff + }, + { + name: '魔力值', + type: 'line', + yAxisIndex: 1, + tooltip: { + show: true, + trigger: 'axis', + //formatter: function (params) { + // return params.name + '\t' + renderSize(params.data.value) + //}, + valueFormatter: function (value) { + return numberFormat(value) + } + }, + {#stack: 'Total',#} + data: spList + }, + { + name: '积分', + type: 'line', + yAxisIndex: 1, + tooltip: { + show: true, + trigger: 'axis', + //formatter: function (params) { + // return params.name + '\t' + renderSize(params.data.value) + //}, + valueFormatter: function (value) { + return numberFormat(value) + } + }, + {#stack: 'Total',#} + data: bonusList + }, + { + name: '分享率', + type: 'line', + yAxisIndex: 1, + {#stack: 'Total',#} + tooltip: { + show: true, + trigger: 'axis', + //formatter: function (params) { + // return params.name + '\t' + renderSize(params.data.value) + //}, + valueFormatter: function (value) { + return value + } + }, + data: ratioList + } ] }; @@ -1055,24 +1158,52 @@ }] this.setChartOption(this.$refs.diff_charts.chart, option) {#option.title.text = `${site.name} - 魔力积分`#} + option.series = [{ name: '魔力值', type: 'line', + yAxisIndex: 0, + tooltip: { + show: true, + trigger: 'axis', + //formatter: function (params) { + // return params.name + '\t' + renderSize(params.data.value) + //}, + valueFormatter: function (value) { + return numberFormat(value) + } + }, {#stack: 'Total',#} data: spList - }, - { - name: '积分', - type: 'line', - {#stack: 'Total',#} - data: bonusList - }] - option.tooltip.valueFormatter = function (value) { - return numberFormat(value) - } - option.yAxis.axisLabel.formatter = function (value) { - return numberFormat(value) - } + }, { + name: '积分', + type: 'line', + yAxisIndex: 0, + tooltip: { + show: true, + trigger: 'axis', + //formatter: function (params) { + // return params.name + '\t' + renderSize(params.data.value) + //}, + valueFormatter: function (value) { + return numberFormat(value) + } + }, + {#stack: 'Total',#} + data: bonusList + }, { + name: '分享率', + type: 'line', + yAxisIndex: 1, + {#stack: 'Total',#} + data: ratioList + }] + //option.tooltip.valueFormatter = function (value) { + // return numberFormat(value) + //} + //option.yAxis.axisLabel.formatter = function (value) { + // return numberFormat(value) + //} this.setChartOption(this.$refs.bonus_charts.chart, option) {#option.title.text = `${site.name} - 分享率`#} option.series = [{ @@ -1082,7 +1213,7 @@ data: ratioList }] option.tooltip.valueFormatter = null - option.yAxis.axisLabel.formatter = null + option.yAxis = {} this.setChartOption(this.$refs.ratio_charts.chart, option) }, 50)