liyongri

시각화

1 +/* axios v0.20.0 | (c) 2020 by Matt Zabriskie */
2 +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(4),a=n(22),u=n(10),c=r(u);c.Axios=s,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(9),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"undefined"==typeof e}function i(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function s(e){return"[object ArrayBuffer]"===R.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function u(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function c(e){return"string"==typeof e}function f(e){return"number"==typeof e}function p(e){return null!==e&&"object"==typeof e}function d(e){if("[object Object]"!==R.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Date]"===R.call(e)}function h(e){return"[object File]"===R.call(e)}function m(e){return"[object Blob]"===R.call(e)}function y(e){return"[object Function]"===R.call(e)}function g(e){return p(e)&&y(e.pipe)}function v(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function x(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function w(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function E(){function e(e,n){d(t[n])&&d(e)?t[n]=E(t[n],e):d(e)?t[n]=E({},e):r(e)?t[n]=e.slice():t[n]=e}for(var t={},n=0,o=arguments.length;n<o;n++)b(arguments[n],e);return t}function C(e,t,n){return b(t,function(t,r){n&&"function"==typeof t?e[r]=S(t,n):e[r]=t}),e}function j(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}var S=n(3),R=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:s,isBuffer:i,isFormData:a,isArrayBufferView:u,isString:c,isNumber:f,isObject:p,isPlainObject:d,isUndefined:o,isDate:l,isFile:h,isBlob:m,isFunction:y,isStream:g,isURLSearchParams:v,isStandardBrowserEnv:w,forEach:b,merge:E,extend:C,trim:x,stripBOM:j}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var o=n(2),i=n(5),s=n(6),a=n(7),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=u(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(u(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(u(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(8),s=n(9),a=n(10);e.exports=function(e){r(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(12):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=n(12)),e}var i=n(2),s=n(11),a={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:o(),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){u.headers[e]={}}),i.forEach(["post","put","patch"],function(e){u.headers[e]=i.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(13),i=n(16),s=n(5),a=n(17),u=n(20),c=n(21),f=n(14);e.exports=function(e){return new Promise(function(t,n){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"],(r.isBlob(p)||r.isFile(p))&&p.type&&delete d["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=unescape(encodeURIComponent(e.auth.password))||"";d.Authorization="Basic "+btoa(h+":"+m)}var y=a(e.baseURL,e.url);if(l.open(e.method.toUpperCase(),s(y,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l.onreadystatechange=function(){if(l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in l?u(l.getAllResponseHeaders()):null,i=e.responseType&&"text"!==e.responseType?l.response:l.responseText,s={data:i,status:l.status,statusText:l.statusText,headers:r,config:e,request:l};o(t,n,s),l=null}},l.onabort=function(){l&&(n(f("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(f("Network Error",e,null,l)),l=null},l.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(f(t,e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=(e.withCredentials||c(y))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;g&&(d[e.xsrfHeaderName]=g)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),r.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),n(e),l=null)}),p||(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";var r=n(18),o=n(19);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){function n(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(i[o]=n(void 0,e[o])):i[o]=n(e[o],t[o])}t=t||{};var i={},s=["url","method","data"],a=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],c=["validateStatus"];r.forEach(s,function(e){r.isUndefined(t[e])||(i[e]=n(void 0,t[e]))}),r.forEach(a,o),r.forEach(u,function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(i[o]=n(void 0,e[o])):i[o]=n(void 0,t[o])}),r.forEach(c,function(r){r in t?i[r]=n(e[r],t[r]):r in e&&(i[r]=n(void 0,e[r]))});var f=s.concat(a).concat(u).concat(c),p=Object.keys(e).concat(Object.keys(t)).filter(function(e){return f.indexOf(e)===-1});return r.forEach(p,o),i}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])});
3 +//# sourceMappingURL=axios.min.map
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 +<!DOCTYPE html>
2 +<html lang="zh">
3 +<head>
4 + <meta charset="UTF-8">
5 + <title>Title</title>
6 + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
7 + <script src="echarts.min.js"></script>
8 + <script src="axios.min.js"></script>
9 + <script src="vue.js"></script>
10 + <style>
11 + .ui.segments {
12 + margin-bottom: 50px;
13 + }
14 + p {
15 + color: red;
16 + }
17 + </style>
18 +</head>
19 +<body>
20 +<div id="app">
21 + <div class="ui segments">
22 + <div class="ui red segment">
23 + <p>call records</p>
24 + </div>
25 + <table class="ui attached selectable celled table">
26 + <thead>
27 + <tr>
28 + <th>number</th>
29 + <th>name</th>
30 + <th>incoming</th>
31 + <th>outgoing</th>
32 + <th>duration</th>
33 + </tr>
34 + </thead>
35 + <tbody>
36 + <tr v-for="(item,index) in calls">
37 + <th>{{item.number}}</th>
38 + <th>{{item.name}}</th>
39 + <th>{{item.incoming}}</th>
40 + <th>{{item.outgoing}}</th>
41 + <th>{{item.duration}}</th>
42 + </tr>
43 + </tbody>
44 + </table>
45 + </div>
46 + <div class="ui segments">
47 + <div class="ui red segment">
48 + <p>message</p>
49 + </div>
50 + <table class="ui attached selectable table">
51 + <thead>
52 + <tr>
53 + <th>address</th>
54 + <th>body</th>
55 + <th>date</th>
56 + </tr>
57 + </thead>
58 + <tbody>
59 + <tr v-for="(item,index) in messages">
60 + <th>{{item.address}}</th>
61 + <th>{{item.body}}</th>
62 + <th>{{item.date}}</th>
63 + </tr>
64 + </tbody>
65 + </table>
66 + </div>
67 + <div id="chart1" style="width: 100%;height:800px;margin-top: 40px;"></div>
68 + <div class="ui segments">
69 + <div class="ui red segment">
70 + <p>cmd</p>
71 + </div>
72 + <table class="ui attached selectable celled table">
73 + <thead>
74 + <tr>
75 + <th>uid</th>
76 + <th>pid</th>
77 + <th>ppid</th>
78 + <th>stime</th>
79 + <th>time</th>
80 + <th>cmd</th>
81 + </tr>
82 + </thead>
83 + <tbody>
84 + <tr v-for="(item,index) in processes">
85 + <th>{{item.uid}}</th>
86 + <th>{{item.pid}}</th>
87 + <th>{{item.ppid}}</th>
88 + <th>{{item.stime}}</th>
89 + <th>{{item.time}}</th>
90 + <th>{{item.cmd}}</th>
91 + </tr>
92 + </tbody>
93 + </table>
94 + </div>
95 + <div class="ui segments">
96 + <div class="ui red segment">
97 + <p>alarms</p>
98 + </div>
99 + <table class="ui attached selectable celled table">
100 + <thead>
101 + <tr>
102 + <th>id</th>
103 + <th>when</th>
104 + <th>history</th>
105 + </tr>
106 + </thead>
107 + <tbody>
108 + <tr v-for="(item,index) in alarms">
109 + <th>{{item.id}}</th>
110 + <th>{{item.when}}</th>
111 + <th>
112 + type: {{item.history[0].type}} , when: {{item.history[0].when}}<br>
113 + type: {{item.history[1].type}} , when: {{item.history[1].when}}<br>
114 + </th>
115 + </tr>
116 + </tbody>
117 + </table>
118 + </div>
119 + <div id="chart2" style="width: 100%;height:800px;margin-top: 40px;"></div>
120 +</div>
121 +<script>
122 + let app = new Vue({
123 + el: "#app",
124 + data: {
125 + messages: [],
126 + alarms: [],
127 + processes: [],
128 + calls: []
129 + },
130 + methods: {},
131 + created() {
132 + axios.get("http://3.35.21.200/extractions/inner/calls/analyses").then(res => {
133 + this.calls = res.data.map(item => ({
134 + number: item.number,
135 + name: "null",
136 + incoming: item.incoming,
137 + outgoing: item.outgoing,
138 + duration: item.duration,
139 + })
140 + );
141 + })
142 + axios.get("http://3.35.21.200/extractions/inner/messages").then(res => {
143 + this.messages = res.data
144 + })
145 + axios.get("http://3.35.21.200/extractions/adb/processes").then(res => {
146 + this.processes=res.data
147 + let myChart = echarts.init(document.getElementById('chart1'));
148 +
149 + let xAxisData=[]
150 + let seriesData=[]
151 + for (const item of res.data) {
152 + if (xAxisData.indexOf(item.stime) === -1) {
153 + xAxisData.push(item.stime);
154 + }
155 + seriesData.push(getSeconds(item.time))
156 + }
157 + let option = {
158 + color:["#2f89cf"],
159 + title: {
160 + text: 'process'
161 + },
162 + tooltip: {
163 + trigger: "axis",
164 + axisPointer:{
165 + // type: "line"
166 + type: "shadow"
167 + }
168 + },
169 + legend: {
170 + data:['time']
171 + },
172 + xAxis: {
173 + data: xAxisData,
174 + axisLabel:{
175 + color: "rgb(119,3,244)",
176 + fontSize: "16"
177 + },
178 + axisLine:{
179 + show:false
180 + }
181 + },
182 + yAxis: {
183 + splitLine: {
184 + lineStyle:{
185 + color:"rgb(119,3,244)"
186 + }
187 + },
188 + axisLabel:{
189 + //函数模板
190 + formatter:function (value, index) {
191 + return formatSeconds(value);
192 + }
193 + }
194 + },
195 + series: [{
196 + name: 'time',
197 + type: 'bar',
198 + barWidth: "30%",
199 + data: seriesData,
200 + itemStyle:{
201 + borderRadius:15,
202 + }
203 + }]
204 + };
205 + option.tooltip.formatter = function(data) {
206 + return data[0].name + '<br/>' +data[0].seriesName+formatSeconds(data[0].value);
207 + }
208 + myChart.setOption(option);
209 + })
210 + axios.get("http://3.35.21.200/extractions/adb/alarms").then(res => {
211 + this.alarms=res.data
212 + })
213 + axios.get("http://3.35.21.200/extractions/inner/apps/analyses").then(res => {
214 + let myChart = echarts.init(document.getElementById('chart2'));
215 +
216 + let xAxisData=[]
217 + let seriesData=[]
218 + for (let data of res.data) {
219 + xAxisData.push(data.foreground_time);
220 + if (seriesData.indexOf(data.wifi_usage)) {
221 + seriesData.push(data.wifi_usage);
222 + }
223 + }
224 +
225 + let option = {
226 + color:["#2f89cf"],
227 + title: {
228 + text: 'app'
229 + },
230 + tooltip: {
231 + trigger: "axis",
232 + axisPointer:{
233 + // type: "line"
234 + type: "shadow"
235 + }
236 + },
237 + legend: {
238 + data:['usage']
239 + },
240 + xAxis: {
241 + data: xAxisData,
242 + axisLabel:{
243 + color: "rgb(119,3,244)",
244 + fontSize: "16"
245 + },
246 + axisLine:{
247 + show:false
248 + }
249 + },
250 + yAxis: {
251 + splitLine: {
252 + lineStyle:{
253 + color:"rgb(119,3,244)"
254 + }
255 + },
256 + axisLabel:{
257 + //函数模板
258 + // formatter:function (value, index) {
259 + // return formatSeconds(value);
260 + // }
261 + }
262 + },
263 + series: [{
264 + name: 'usage',
265 + type: 'bar',
266 + barWidth: "30%",
267 + data: seriesData,
268 + itemStyle:{
269 + borderRadius:15,
270 + }
271 + }]
272 + };
273 + option.tooltip.formatter = function(data) {
274 + let name=''
275 + for (let item of res.data) {
276 + if (item.foreground_time === parseInt(data[0].name) && item.wifi_usage === parseInt(data[0].value)) {
277 + name=item.name
278 + break
279 + }
280 + }
281 + return 'name:' +name + '<br/>'+
282 + 'foreground_time:' +data[0].name + '<br/>' +data[0].seriesName+':'+data[0].value;
283 + }
284 + myChart.setOption(option);
285 + })
286 + }
287 + })
288 +
289 + function getSeconds(time) {
290 + let split = time.split(":");
291 + let arr=split.map((v,i)=>{
292 + return parseInt(v)
293 + })
294 + return arr[0]*60*60+arr[1]*60+arr[2]
295 + }
296 + /**
297 + * 格式化秒
298 + * @param value 总秒数
299 + * @returns {string} result 格式化后的字符串
300 + */
301 + function formatSeconds(value) {
302 + var theTime = parseInt(value);// 需要转换的时间秒
303 + var theTime1 = 0;// 分
304 + var theTime2 = 0;// 小时
305 + var theTime3 = 0;// 天
306 + if(theTime > 60) {
307 + theTime1 = parseInt(theTime/60);
308 + theTime = parseInt(theTime%60);
309 + if(theTime1 > 60) {
310 + theTime2 = parseInt(theTime1/60);
311 + theTime1 = parseInt(theTime1%60);
312 + if(theTime2 > 24){
313 + //大于24小时
314 + theTime3 = parseInt(theTime2/24);
315 + theTime2 = parseInt(theTime2%24);
316 + }
317 + }
318 + }
319 + return '00:'+addZero(theTime1)+":"+addZero(theTime);
320 + }
321 + function addZero(obj) {
322 + if(obj<10) return "0" + obj;
323 + else return obj;
324 + }
325 +
326 +</script>
327 +</body>
328 +</html>
This diff could not be displayed because it is too large.