diff --git a/package-lock.json b/package-lock.json index ba32379..f28a84d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2675,6 +2675,14 @@ "stream-shift": "^1.0.0" } }, + "echarts": { + "version": "4.2.0-rc.2", + "resolved": "http://registry.npm.taobao.org/echarts/download/echarts-4.2.0-rc.2.tgz", + "integrity": "sha1-apg5eq+oG2XL8LwV2a/b+yRN+R4=", + "requires": { + "zrender": "4.0.5" + } + }, "ee-first": { "version": "1.1.1", "resolved": "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz", @@ -10760,6 +10768,11 @@ "dev": true } } + }, + "zrender": { + "version": "4.0.5", + "resolved": "http://registry.npm.taobao.org/zrender/download/zrender-4.0.5.tgz", + "integrity": "sha1-bo9ziXHOLNYkqsgrIVZymxwOWoI=" } } } diff --git a/package.json b/package.json index 42a1ba0..ff93bb5 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dependencies": { "ajv": "^6.5.5", "axios": "^0.18.0", + "echarts": "^4.2.0-rc.2", "vue": "^2.5.2" }, "devDependencies": { diff --git a/src/components/barChart.vue b/src/components/barChart.vue new file mode 100644 index 0000000..5e1c04a --- /dev/null +++ b/src/components/barChart.vue @@ -0,0 +1,112 @@ + + + diff --git a/src/utils/debounce.js b/src/utils/debounce.js new file mode 100644 index 0000000..31af964 --- /dev/null +++ b/src/utils/debounce.js @@ -0,0 +1,34 @@ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔last小于设定时间间隔wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} diff --git a/src/views/pdasection.vue b/src/views/pdasection.vue index ae74500..e863b0b 100644 --- a/src/views/pdasection.vue +++ b/src/views/pdasection.vue @@ -3,23 +3,34 @@
+