Compare commits

...

54 Commits

Author SHA1 Message Date
peterlu14 b3a745252f [update] add show datastream buffer in dev mode 2022-08-11 00:59:14 +08:00
peterlu14 d229e1be28 [update] add debug button (show data) 2022-08-11 00:51:58 +08:00
peterlu14 c95bc79096 [update] rename developer mode & bind key 2022-08-10 23:56:38 +08:00
peterlu14 ac19737527 [update] default time unit ms -> s 2022-08-10 22:21:18 +08:00
peterlu14 69e4af91af [update] remove x-axis interval and select all buttons & resize grid and dataZoom and asixLabel 2022-08-10 22:20:54 +08:00
peterlu14 cd961f70f9 [warning] remove warning of e-charts update 2022-08-10 22:13:53 +08:00
peterlu14 8b7b92bffb [update] add eis ca mode 2022-08-09 14:54:32 +08:00
peterlu14 1b38bd1c00 [debug] fix library rename cause scheduler not showing problem 2022-08-09 14:53:12 +08:00
peterlu14 ab630b88e6 [update] fix replay show panel (x-axis not yet) 2022-08-09 09:11:56 +08:00
peterlu14 d83ae9370f remove brush in factory & hide value 2022-08-08 17:51:51 +08:00
peterlu14 a11393f512 Merge branch 'dev/sg-filter' into release/v1.3.0/replay-capture-sgFilter 2022-08-08 17:34:02 +08:00
peterlu14 69d604045e Merge remote-tracking branch 'origin/testing/echarts-update' into release/v1.3.0/replay-capture-sgFilter 2022-08-08 17:32:09 +08:00
peterlu14 26cb680e6f Merge remote-tracking branch 'origin/dev/capture_chartData' into release/v1.3.0/replay-capture-sgFilter 2022-08-08 17:31:50 +08:00
peterlu14 815754ddf6 [debug] fix file name not refresh problem 2022-08-08 17:25:55 +08:00
peterlu14 d29a5a11e1 [update] fix ca mode naming problem 2022-08-08 17:05:42 +08:00
peterlu14 f1781037be [update] sg-filter 2022-08-08 17:03:42 +08:00
108000207 cfab65e4a0 [update] check the calculation of specific integral done 2022-08-08 16:43:52 +08:00
sss28072637 fdd8c29bfb [update] finish capture data & boundaryGap 2022-08-08 16:36:09 +08:00
108000207 ad4d31ce64 [update] SpecificIntegral component works 2022-08-08 10:29:21 +08:00
sss28072637 5a9349d903 [update] add boundaryGap (need to be adjustable) 2022-08-05 18:23:10 +08:00
108000207 e1453cf107 [update] new component for Specific Integral, but haven't connect with TopControlPanel 2022-08-05 18:18:44 +08:00
108000207 1453e70915 [update] add auto refresh after blur the va-input 2022-08-05 18:00:37 +08:00
108000207 2791d20173 [update] add va-input for the brush boundary 2022-08-05 17:36:52 +08:00
108000207 bd314b03dc [update] add specific integral on replay 2022-08-05 11:33:11 +08:00
sss28072637 a801c0626a [update] add the new function of capturing chart to a new chart 2022-08-04 17:47:34 +08:00
peterlu14 5f3f3110d9 [update] fix loading 2022-08-04 13:33:38 +08:00
peterlu14 41b00129ef [update] echarts update version 5.3.3 2022-08-04 10:39:27 +08:00
peterlu14 13cb610302 Merge branch 'release/v1.2.8/realtime-tool' into testing/echarts-update 2022-08-04 10:14:54 +08:00
peterlu14 b7b70b86e2 Merge remote-tracking branch 'origin/dev/fix_dataZoom' into release/v1.2.8/realtime-tool 2022-08-03 14:50:36 +08:00
peterlu14 a1f09942d9 Merge branch 'release/v1.2.9/fix-testing-bugs' into release/v1.2.8/realtime-tool 2022-08-02 18:42:49 +08:00
peterlu14 e9dc718d85 [update] fix cache with controller id 2022-08-02 16:25:47 +08:00
108000207 2f7a6b97e7 Merge branch 'dev/replay-calculation' into release/v1.2.8/realtime-tool 2022-08-02 14:35:31 +08:00
108000207 11a6de5e57 [update] add the getPanelInfo for tooltips formatter 2022-08-02 14:21:13 +08:00
peterlu14 7630951470 Merge remote-tracking branch 'origin/dev/realTimeDisplay_realTimeCalculation' into release/v1.2.8/realtime-tool 2022-08-02 12:52:16 +08:00
nthu1080112244 eb672d9c0a [update] real time cycle display 2022-08-02 12:51:19 +08:00
peterlu14 f06003304a Merge branch 'release/v1.2.9/fix-testing-bugs' into release/v1.2.8/realtime-tool 2022-07-29 14:54:26 +08:00
peterlu14 c0fc13c451 [update] cp-mode rename 2022-07-29 14:54:07 +08:00
peterlu14 ab1df2cfe1 [update] add time duration in excel and replay & add cp mode volt unit 2022-07-29 10:16:05 +08:00
peterlu14 0b01d6c785 [update] fix display problem & help pic 2022-07-28 16:56:26 +08:00
peterlu14 d769a50459 [debug] charge/discharge value error 2022-07-28 14:58:47 +08:00
peterlu14 dac276c9de [debug] fix cc mode charge display error 2022-07-28 14:40:36 +08:00
peterlu14 65c00031e3 [debug] fix volt step unit error 2022-07-28 10:35:51 +08:00
peterlu14 0ff3dd556f [update] remove vue warn 2022-07-28 10:30:09 +08:00
peterlu14 968c578cee Merge branch 'dev/realTimeDisplay_realTimeCalculation' into 'release/v1.2.8/realtime-tool'
[debug]  fix the conflict between display tool and funtional tool

See merge request wisetop/controller/wisetopvue!1
2022-07-28 02:22:44 +00:00
peterlu14 b3510b1990 [debug] fix volt step unit error 2022-07-28 10:05:47 +08:00
nthu1080112244 35d45a36a4 [update] time-axis formatter 2022-07-27 18:31:16 +08:00
nthu1080112244 f1a55c3cd1 [debug] remove useless code 2022-07-27 14:09:20 +08:00
nthu1080112244 2577dcba9a [update] 1. built and use CanvasChartTable.js
2. merge real time functional amd real time display
                3. tooltip update
2022-07-27 13:41:33 +08:00
ROY 632762ce14 [update] library EliteEIS rename cause replay problem 2022-07-26 18:29:34 +08:00
ROY e4e89a414a [update] fix library rename replay nameing bug 2022-07-26 14:00:15 +08:00
ROY 921166cdc7 [update] update library name & change global chart setting 2022-07-26 11:05:50 +08:00
peterlu14 a3e7c7e2a6 Merge remote-tracking branch 'origin/dev/realTimeDisplayNew' into release/v1.2.8/realtime-tool 2022-07-26 09:53:25 +08:00
peterlu14 7469d270d0 Merge remote-tracking branch 'origin/dev/realtime-tool-fixed' into release/v1.2.8/realtime-tool 2022-07-26 09:53:21 +08:00
nthu1080112244 3c4676ec2c [update] construct new table for chart axis unit 2022-07-26 09:45:49 +08:00
48 changed files with 1483 additions and 424 deletions
+105 -16
View File
@@ -2351,6 +2351,12 @@
}
}
},
"@vue/composition-api": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@vue/composition-api/-/composition-api-1.7.0.tgz",
"integrity": "sha512-hxOgLYR+wjuPX9bkP2pAPlqUs98XxBoa9DSLyp1z6+YR92wC42PZcZKs4d+VRtcv4udOv041Kss+F6ap5nj8YA==",
"dev": true
},
"@vue/eslint-config-standard": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/@vue/eslint-config-standard/-/eslint-config-standard-5.1.2.tgz",
@@ -4754,6 +4760,11 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
"complex.js": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.1.1.tgz",
"integrity": "sha512-8njCHOTtFFLtegk6zQo0kkVX1rngygb/KQI6z1qZxlFI3scluC+LVTCFbrkWjBv4vvLlbQ9t88IPMC6k95VTTg=="
},
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@@ -5684,6 +5695,11 @@
"map-obj": "^1.0.0"
}
},
"decimal.js": {
"version": "10.3.1",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz",
"integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ=="
},
"decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
@@ -6199,11 +6215,19 @@
}
},
"echarts": {
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-4.9.0.tgz",
"integrity": "sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==",
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.3.tgz",
"integrity": "sha512-BRw2serInRwO5SIwRviZ6Xgm5Lb7irgz+sLiFMmy/HOaf4SQ+7oYqxKzRHAKp4xHQ05AuHw1xvoQWJjDQq/FGw==",
"requires": {
"zrender": "4.3.2"
"tslib": "2.3.0",
"zrender": "5.3.2"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
},
"editorconfig": {
@@ -6485,6 +6509,11 @@
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
"dev": true
},
"escape-latex": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
"integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -7747,6 +7776,11 @@
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
"dev": true
},
"fraction.js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz",
"integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA=="
},
"fragment-cache": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
@@ -9399,6 +9433,11 @@
"html-escaper": "^2.0.0"
}
},
"javascript-natural-sort": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
"integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw=="
},
"javascript-stringify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.0.1.tgz",
@@ -11225,6 +11264,32 @@
"resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"mathjs": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.0.1.tgz",
"integrity": "sha512-Kgm+GcTxwD68zupr7BPK0yrlWpTh2q8sMH6VcBcQe5+JCBqcwOrBxBF11WPah7hVv0NCLDnJnFTiXtik1Phasg==",
"requires": {
"@babel/runtime": "^7.18.9",
"complex.js": "^2.1.1",
"decimal.js": "^10.3.1",
"escape-latex": "^1.2.0",
"fraction.js": "^4.2.0",
"javascript-natural-sort": "^0.7.1",
"seedrandom": "^3.0.5",
"tiny-emitter": "^2.1.0",
"typed-function": "^3.0.0"
},
"dependencies": {
"@babel/runtime": {
"version": "7.18.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz",
"integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==",
"requires": {
"regenerator-runtime": "^0.13.4"
}
}
}
},
"mathml-tag-names": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz",
@@ -14185,9 +14250,9 @@
"dev": true
},
"resize-detector": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/resize-detector/-/resize-detector-0.1.10.tgz",
"integrity": "sha512-iLcXC8A6Fb0DfA+TRiywrK/0A22bFqkhntjMJMEzXDA4XkcEkfwpNbv7W8iewUiD0xYIaeiXOfiEehTqGKsUFw=="
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/resize-detector/-/resize-detector-0.3.0.tgz",
"integrity": "sha512-R/tCuvuOHQ8o2boRP6vgx8hXCCy87H1eY9V5imBYeVNyNVpuL9ciReSccLj2gDcax9+2weXy3bc8Vv+NRXeEvQ=="
},
"resolve": {
"version": "1.17.0",
@@ -14475,6 +14540,11 @@
}
}
},
"seedrandom": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
"integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
},
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
@@ -16544,6 +16614,11 @@
"mime-types": "~2.1.24"
}
},
"typed-function": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/typed-function/-/typed-function-3.0.0.tgz",
"integrity": "sha512-mKJKkt2xYxJUuMD7jyfgUxfn5KCsCxkEKBVjep5yYellJJ5aEDO2QUAmIGdvcZmfQnIrplkzELIaG+5b1475qg=="
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -17101,14 +17176,18 @@
"vue": "^2.6.9"
}
},
"vue-demi": {
"version": "0.13.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.13.5.tgz",
"integrity": "sha512-tO3K2bML3AwiHmVHeKCq6HLef2st4zBXIV5aEkoJl6HZ+gJWxWv2O8wLH8qrA3SX3lDoTDHNghLX1xZg83MXvw=="
},
"vue-echarts": {
"version": "5.0.0-beta.0",
"resolved": "https://registry.npmjs.org/vue-echarts/-/vue-echarts-5.0.0-beta.0.tgz",
"integrity": "sha512-QZFKGXDAYFQo+F20REpzcdLx79nsl4kOorJRpN+08aYq4YiIlmtWss1Lxadm7Fo+NYyWm8nnT+h4xHv3uqWIDQ==",
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/vue-echarts/-/vue-echarts-6.2.3.tgz",
"integrity": "sha512-xHzUvgsgk/asJTcNa8iVVwoovZU3iEUHvmBa3bzbiP3Y6OMxM1YXsoWOKVmVVaUusGs4ob4pSwjwNy2FemAz9w==",
"requires": {
"core-js": "^3.4.4",
"lodash": "^4.17.15",
"resize-detector": "^0.1.10"
"resize-detector": "^0.3.0",
"vue-demi": "^0.13.2"
}
},
"vue-epic-bus": {
@@ -18563,9 +18642,19 @@
}
},
"zrender": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-4.3.2.tgz",
"integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g=="
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.3.2.tgz",
"integrity": "sha512-8IiYdfwHj2rx0UeIGZGGU4WEVSDEdeVCaIg/fomejg1Xu6OifAL1GVzIPHg2D+MyUkbNgPWji90t0a8IDk+39w==",
"requires": {
"tslib": "2.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
}
}
}
+4 -2
View File
@@ -25,7 +25,7 @@
"chart.js": "^2.9.3",
"core-js": "3",
"detect-browser": "^4.8.0",
"echarts": "^4.9.0",
"echarts": "^5.3.3",
"element-resize-detector": "^1.1.15",
"epic-spinners": "^1.1.0",
"extend": "3.0.2",
@@ -37,6 +37,7 @@
"leaflet-map": "^0.2.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"mathjs": "^11.0.1",
"medium-editor": "^5.23.3",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
@@ -53,7 +54,7 @@
"vue-clipboard2": "^0.3.1",
"vue-color": "^2.7.0",
"vue-ctk-date-time-picker": "^2.5.0",
"vue-echarts": "^5.0.0-beta.0",
"vue-echarts": "^6.2.3",
"vue-epic-bus": "^0.1.2",
"vue-final-modal": "^2.4.1",
"vue-gtm": "^2.2.0",
@@ -77,6 +78,7 @@
"@vue/cli-plugin-pwa": "^4.0.5",
"@vue/cli-plugin-unit-jest": "^4.0.5",
"@vue/cli-service": "^4.0.5",
"@vue/composition-api": "^1.7.0",
"@vue/eslint-config-standard": "^5.0.0",
"@vue/test-utils": "^1.0.0-beta.29",
"autoprefixer": "^9.7.2",
+37 -11
View File
@@ -14,16 +14,7 @@ import YmapPlugin from 'vue-yandex-maps'
import VueClipboard from 'vue-clipboard2'
import ECharts from 'vue-echarts'
import 'echarts/lib/chart/line'
import 'echarts/lib/component/dataZoom'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/legend/ScrollableLegendModel.js'
import 'echarts/lib/component/legend/ScrollableLegendView.js'
import 'echarts/lib/component/legend/scrollableLegendAction.js'
import 'echarts/lib/component/axisPointer'
import 'echarts/lib/component/grid'
import 'echarts/lib/component/markArea'
import { use } from 'echarts/core'
import VueMqtt from 'vue-mqtt'
import global_ from '../data/global/global'
@@ -42,12 +33,47 @@ import localforage from 'localforage'
import '../metrics'
import '../registerServiceWorker'
// import ECharts modules manually to reduce bundle size
import {
CanvasRenderer,
} from 'echarts/renderers'
import {
LineChart,
PieChart,
BarChart,
} from 'echarts/charts'
import {
GridComponent,
TooltipComponent,
LegendComponent,
TitleComponent,
DataZoomComponent,
BrushComponent,
ToolboxComponent,
} from 'echarts/components'
use([
CanvasRenderer,
LineChart,
BarChart,
PieChart,
GridComponent,
TooltipComponent,
ToolboxComponent,
LegendComponent,
TitleComponent,
DataZoomComponent,
BrushComponent,
])
localforage.config({ name: 'bioprovue' })
let MqttUrl
// for developer
if (process.env.NODE_ENV === 'development') {
MqttUrl = 'ws://192.168.5.66:8083'
MqttUrl = 'ws://192.168.5.37:8083'
// MqttUrl = 'ws://192.168.5.42:8083'
// MqttUrl = 'ws://192.168.5.240:8080'
// MqttUrl = 'ws://192.168.5.57:8083'
// MqttUrl = 'ws://192.168.5.57:8080'
} else {
@@ -9,8 +9,11 @@
<span slot="header">Control Panel</span>
<div slot="body">
<div>
<top-control-panel :ref="'top_control_panel'" @refreshChart="setOption" @changeAxis="changeAxis" @changeOverviewDataZoom="changeOverviewDataZoom" @changeFunctional="changeFunctional"/>
<top-control-panel :ref="'top_control_panel'" @refreshChart="setOption" @changeAxis="changeAxis" @changeOverviewDataZoom="changeOverviewDataZoom" @changeFunctional="changeFunctional" @setBrushBoundary="setBrushBoundary"/>
</div>
<!-- <div>
{{ this.specificIntegral }}
</div> -->
</div>
</va-collapse>
</va-accordion>
@@ -21,8 +24,9 @@
<div :class="chartAreaClass">
<div class="row" >
<div class="flex sm12 xl12 md12 xs12">
<!-- <chart :style="'width: auto; height: 88vhvh;'" :option="options"></chart> -->
<elite-replay-overview-chart v-show="showOverviewChart" :ref="'chart_overview'" class="mb-1" :cardheight="'7vh'" :data="chartOverviewData" @dataZoomEvent="dataZoomEvent($event)"/>
<elite-replay-chart :ref="'chart_detail'" :cardheight="'88vh'" :chartheight="detailchartheight" :data="chartDetailData" />
<elite-replay-chart :ref="'chart_detail'" :cardheight="'88vh'" :chartheight="detailchartheight" :data="chartDetailData" @updateIntegralBoundary="updateIntegralBoundary" />
<change-channel-value-min-max :ref="'set_min_max'"/>
</div>
</div>
@@ -108,6 +112,28 @@ export default {
chartAreaClass: ['flex', 'xs12', 'sm12', 'md12', 'xl9', 'pa-0'],
xfunctional: 'Linear',
yfunctional: 'Linear',
options: {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)',
},
},
],
brush: {
},
},
specificIntegral: 0,
}
},
mqtt: {
@@ -120,10 +146,10 @@ export default {
this.$refs.chart_detail.turnOffAxisEventHandler(eventName, handler, attr)
},
showMinMaxPanel (params) {
this.$refs.set_min_max.showPanel(params)
return this.$refs.set_min_max.showPanel(params)
},
setOption (options) {
this.$refs.chart_detail.mergeOptions(options)
this.$refs.chart_detail.setOptions(options)
},
showChartLoading: function (chart) {
const loadStyle = {
@@ -174,7 +200,7 @@ export default {
const yType = setting[2] // Elite or Time
const xValue = setting[1] // 1: I, 2: V, 3: R
const yValue = setting[3] // 1: I, 2: V, 3: R
console.log(setting)
// console.log(setting)
this.registerChart({
chartAllData: this.chartData,
chartID: this.chartDetailData.chartID,
@@ -255,7 +281,7 @@ export default {
changeOverviewDataZoom () {
this.chartOverviewData.dataZoom[0].start = this.startTime * 100 / this.maxTime
this.chartOverviewData.dataZoom[0].end = this.endTime * 100 / this.maxTime
this.$refs.chart_overview.mergeOptions(this.chartOverviewData)
this.$refs.chart_overview.setOptions(this.chartOverviewData)
},
async computeResampleScale (meta, duration) {
const sampleRate = meta.parameter_set.SAMPLE_RATE / 10
@@ -345,6 +371,16 @@ export default {
this.hideChartLoading()
},
drawDetailData: async function () {
var panelInfo = this.$refs.top_control_panel.getPanelInfo()
// brush setting write at here, due to mounted won't show the brush
this.chartDetailData.brush = {
toolbox: ['rect', 'clear'],
// toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
xAxisIndex: 0,
// throttleType: 'debounce',
// throttleDelay: 5,
}
console.log('panelInfo: ', panelInfo) // TODO: update the formatter for tooltips
this.showChartLoading('detail')
const timeDur = this.endTimeCurrent - this.startTimeCurrent
let _gridNumber = 0
@@ -367,7 +403,7 @@ export default {
this.updateChartSamplingChart({ chartID: this.chartDetailData.chartID, seriesIndex: _gridNumber, method: 'lttb' })
}
if (metaInfo.device.library_name === 'EliteEIS' && metaInfo.parameter_set.MODE === 0) {
if (metaInfo.device.library_name.includes('EIS') && metaInfo.parameter_set.MODE === 0) {
this.chartDetailData.series[this.chartDetailData.series.length - 1].showSymbol = true
this.chartDetailData.series[this.chartDetailData.series.length - 1].showAllSymbol = true
this.chartDetailData.series[this.chartDetailData.series.length - 1].symbolSize = 6
@@ -543,12 +579,12 @@ export default {
this.showOverviewChart = false
this.detailchartheight = '88vh'
// this.$refs.chart_detail.updateChartHeight()
this.turnOnAxisEventHandler('click', 'xAxis.axisLabel', this.showMinMaxPanel, { axis: 'x' })
this.turnOnAxisEventHandler('click', 'xAxis', this.showMinMaxPanel, { axis: 'x' })
} else {
this.showOverviewChart = true
this.detailchartheight = '80vh'
this.turnOffAxisEventHandler('click', this.showMinMaxPanel, { axis: 'x' })
this.turnOnAxisEventHandler('click', 'yAxis.axisLabel', this.showMinMaxPanel, { axis: 'y' })
this.turnOnAxisEventHandler('click', 'yAxis', this.showMinMaxPanel, { axis: 'y' })
}
this.hideChartLoading()
@@ -578,9 +614,9 @@ export default {
if (this.axisXDataType.description === 'Time') {
xType = 'Time'
} else {
if (libName === 'EliteZM15') {
if (libName === 'EliteZM15' || libName.includes('Elite_EDC')) {
xType = 'Elite'
} else if (libName === 'EliteEIS') {
} else if (libName.includes('EIS')) {
xType = 'EliteEIS'
}
xValue = this.axisXDataType.id + 1
@@ -592,7 +628,7 @@ export default {
deviceNameX: xType,
deviceIDX: this.metaList[gridIndex].name,
channelX: xValue,
deviceNameY: libName === 'EliteEIS' ? 'EliteEIS' : 'Elite',
deviceNameY: libName.includes('EIS') ? 'EliteEIS' : 'Elite',
deviceIDY: '',
channelY: this.axisYDataType.id + 1,
})
@@ -602,6 +638,54 @@ export default {
}
this.drawDetailData() // reDraw
},
updateIntegralBoundary (boundary) {
var rawData = JSON.parse(JSON.stringify(this.chartDetailData.series[0].data))
var deltaX
var averageY
var area
var prevIndex
this.specificIntegral = 0
for (let index = 0, len = rawData.length; index < len; index++) {
prevIndex = index - 1
if (index === 0) {
if (rawData[len - 1][0] >= boundary.x_start && rawData[len - 1][0] <= boundary.x_end &&
rawData[index][0] >= boundary.x_start && rawData[index][0] <= boundary.x_end) {
prevIndex = len - 1
} else continue
}
if (rawData[prevIndex][0] >= boundary.x_start && rawData[prevIndex][0] <= boundary.x_end &&
rawData[index][0] >= boundary.x_start && rawData[index][0] <= boundary.x_end) {
deltaX = Number(rawData[index][0]) - Number(rawData[prevIndex][0])
if (rawData[index][1] > boundary.y_end) rawData[index][1] = boundary.y_end
else if (rawData[index][1] < boundary.y_start) {
continue
}
averageY = (Number(rawData[index][1]) + Number(rawData[prevIndex][1])) / 2 - boundary.y_start
area = deltaX * averageY
if (!isNaN(area)) {
this.specificIntegral += area
}
}
}
// this.specificIntegral = (this.specificIntegral * 1e-15).toFixed(4) + 'W'
this.$refs.top_control_panel.$refs.specific_integral.getSpecificIntegral(this.specificIntegral, boundary)
},
setBrushBoundary (boundary) {
this.$refs.chart_detail.$refs.chart_ref.chart.dispatchAction({
type: 'brush',
areas: [
{
xAxisIndex: 0,
brushType: 'rect',
coordRange: [
[boundary.x_start, boundary.x_end],
[boundary.y_start, boundary.y_end],
],
},
],
})
},
...mapActions('replay', [types.chart.init, types.chart.register, types.chart.clear, types.chart.updateGridList, types.chart.updateDataZoom, types.chart.setAxisDisplay]),
...mapActions('replay', [types.meta.init]),
...mapActions('replay', [types.rec.init, types.rec.intoData, types.rec.initDisplaySetting, types.rec.updateDisplaySetting]),
@@ -619,19 +703,19 @@ export default {
this.metaList = this.getAllMeta()
await this.initRec({ api: api })
this.dataInfo = this.getAllRec()
console.log(this.metaList)
console.log(this.dataInfo)
// console.log(this.metaList)
// console.log(this.dataInfo)
await this.register()
this.setOverviewDataZoomStartAndEndChart()
this.$refs.top_control_panel.init() // will call changeAxis() here
this.$refs.set_min_max.init()
this.turnOnAxisEventHandler('click', 'yAxis.axisLabel', this.showMinMaxPanel, { axis: 'y' })
this.turnOnAxisEventHandler('click', 'yAxis', this.showMinMaxPanel, { axis: 'y' })
this.updateAxisSplitNumberChart({ chartID: this.chartDetailData.chartID, axis: 'x' })
this.updateAxisSplitNumberChart({ chartID: this.chartDetailData.chartID, axis: 'y' })
this.dataZoomTimer = setInterval(this.checkDataZoom, 1000)
this.initDone = true
console.log(this.chartOverviewData)
console.log(this.chartDetailData)
// console.log(this.chartOverviewData)
// console.log(this.chartDetailData)
},
beforeDestroy () {
this.$refs.chart_overview.clear()
@@ -1,7 +1,14 @@
<template>
<div class="flex" :class="cardclass">
<va-card :style="'height: ' + cardheight + ';'">
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + chartheight + ';'" :options="data" @dataZoom="updateZoom" :auto-resize="true"></chart>
<chart
:ref="'chart_ref'"
:style="'width: '+ cardwidth + '; height: ' + chartheight + ';'"
:option="data"
:auto-resize="true"
:loading="loading"
@dataZoom="updateZoom"
></chart>
</va-card>
</div>
</template>
@@ -44,6 +51,7 @@ export default {
},
data () {
return {
loading: false,
}
},
computed: {
@@ -59,8 +67,8 @@ export default {
updateZoom: function (e) {
this.$emit('dataZoomEvent', e)
},
mergeOptions (options) {
this.$refs.chart_ref.mergeOptions(options)
setOptions (options) {
this.$refs.chart_ref.setOption(options)
},
turnOnAxisEventHandler (eventName, query, handler, attr) {
const chartID = 1
@@ -70,7 +78,7 @@ export default {
status: 'on',
})
// doc: https://echarts.apache.org/zh/api.html#echartsInstance.on
this.$refs.chart_ref.chart._zr.on(eventName, query, handler)
this.$refs.chart_ref.chart.on(eventName, query, handler)
},
turnOffAxisEventHandler (eventName, handler, attr) {
const chartID = 1
@@ -80,22 +88,42 @@ export default {
status: 'off',
})
// doc: https://echarts.apache.org/zh/api.html#echartsInstance.off
this.$refs.chart_ref.chart._zr.off(eventName, handler)
this.$refs.chart_ref.chart.off(eventName, handler)
},
showLoading (options) {
this.$refs.chart_ref.showLoading(options)
this.loading = true
},
hideLoading () {
this.$refs.chart_ref.hideLoading()
this.loading = false
},
clear () {
this.$refs.chart_ref.clear()
},
updateBoundary (boundary) {
this.$emit('updateIntegralBoundary', boundary)
},
...mapMutations('replay', [types.chart.updateAxisEventHandler]),
},
async mounted () {
this.resizeTimer = setInterval(this.resize, 1000)
// brush set at here won't work
/* this.data.brush = {
toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
xAxisIndex: 0,
throttleType: 'debounce',
throttleDelay: 5,
} */
this.$refs.chart_ref.chart.on('brushSelected', (params) => {
if (params.batch[0].areas.length !== 0) {
var boundary = {
x_start: Number(params.batch[0].areas[0].coordRange[0][0].toFixed(4)),
x_end: Number(params.batch[0].areas[0].coordRange[0][1].toFixed(4)),
y_start: Number(params.batch[0].areas[0].coordRange[1][0].toFixed(4)),
y_end: Number(params.batch[0].areas[0].coordRange[1][1].toFixed(4)),
}
this.updateBoundary(boundary)
}
})
},
destroyed () {
clearInterval(this.resizeTimer)
@@ -1,7 +1,15 @@
<template>
<div class="flex" :class="cardclass">
<va-card :style="'height: 8vh;'">
<chart :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" @dataZoom="updateZoom" :auto-resize="true"></chart>
<chart
:ref="'chart_ref'"
:style="'width: '+ cardwidth + '; height: ' + cardheight + ';'"
:option="data"
:auto-resize="true"
:loading="loading"
@dataZoom="updateZoom"
>
</chart>
</va-card>
</div>
</template>
@@ -38,6 +46,7 @@ export default {
},
data () {
return {
loading: false,
}
},
computed: {
@@ -53,14 +62,14 @@ export default {
updateZoom: function (e) {
this.$emit('dataZoomEvent', e)
},
mergeOptions (options) {
this.$refs.chart_ref.mergeOptions(options)
setOptions (options) {
this.$refs.chart_ref.setOption(options)
},
showLoading (options) {
this.$refs.chart_ref.showLoading(options)
this.loading = true
},
hideLoading () {
this.$refs.chart_ref.hideLoading()
this.loading = false
},
clear () {
this.$refs.chart_ref.clear()
@@ -54,7 +54,16 @@
<abs-toggle :ref="'abs_y'" axis="y" @changeAxis="changeAxis"/>
</div>
</div>
<!-- <va-button @click="switchCollapse"></va-button>
<va-collapse class="mb-2" :isOpenDefault="false" v-model="innerCollapse">
<span slot="header">Specific Integral</span>
<div slot="body">
<div>
<specific-integral :ref="'specific_integral'" @setBrushBoundary="setBrushBoundary" />
</div>
</div>
</va-collapse> -->
<specific-integral :ref="'specific_integral'" @setBrushBoundary="setBrushBoundary" />
<div class="flex-container mb-2">
<div class="flex sm10 xl10 md10 xs10 px-0 py-0">
<change-window-start-and-size :ref="'change_window_start_and_size'" @changeOverviewDataZoom="changeOverviewDataZoom"/>
@@ -77,6 +86,7 @@ import ChangeUnit from '@/components/analysis/replay/toolbox/ChangeUnit.vue'
import ChangeScale from '@/components/analysis/replay/toolbox/ChangeScale.vue'
import ChangeCycle from '@/components/analysis/replay/toolbox/ChangeCycle.vue'
import AbsToggle from '@/components/analysis/replay/toolbox/AbsToggle.vue'
import SpecificIntegral from '@/components/analysis/replay/toolbox/SpecificIntegral.vue'
import DownloadFile from '@/components/analysis/replay/toolbox/DownloadFile.vue'
import DeleteFile from '@/components/analysis/replay/toolbox/DeleteFile.vue'
import EditFileName from '@/components/analysis/replay/toolbox/EditFileName.vue'
@@ -94,6 +104,7 @@ export default {
ChangeScale,
ChangeCycle,
AbsToggle,
SpecificIntegral,
DownloadFile,
DeleteFile,
EditFileName,
@@ -115,6 +126,7 @@ export default {
return {
deviceName: '',
showCycle: false,
innerCollapse: false,
}
},
mqtt: {
@@ -122,10 +134,10 @@ export default {
methods: {
init () {
this.deviceName = this.metaList[0].device.library_name
this.$refs.change_axis_x.init(this.deviceName)
this.$refs.change_axis_y.init(this.deviceName)
this.$refs.change_unit_x.init(this.deviceName)
this.$refs.change_unit_y.init(this.deviceName)
this.$refs.change_axis_x.init(this.deviceName)
this.$refs.change_axis_y.init(this.deviceName)
this.$refs.change_scale_x.init(this.deviceName)
this.$refs.change_scale_y.init(this.deviceName)
this.$refs.abs_x.init(this.deviceName)
@@ -154,9 +166,28 @@ export default {
this.$refs.change_unit_y.changeUnitByAxis()
}
},
getPanelInfo () {
var panelInfo = {
axis_x: this.$refs.change_axis_x.getChannelByAxis(),
axis_y: this.$refs.change_axis_y.getChannelByAxis(),
scale_x: this.$refs.change_scale_x.getScaleByAxis(),
scale_y: this.$refs.change_scale_y.getScaleByAxis(),
unit_x: this.$refs.change_unit_x.getUnitByAxis(),
unit_y: this.$refs.change_unit_y.getUnitByAxis(),
}
// console.log('panelInfo: ', panelInfo)
return panelInfo
},
clearCycle () {
this.$refs.change_cycle.clear()
},
setBrushBoundary (boundary) {
this.$emit('setBrushBoundary', boundary)
},
/* switchCollapse () {
this.innerCollapse = this.innerCollapse ? false : true
console.log(this.innerCollapse)
}, */
},
mounted () {
},
@@ -70,7 +70,7 @@ export default {
},
performABS () {
this.absToggleStatus[this.axis] = !this.absToggleStatus[this.axis]
if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
this.calculateHelper(this.metaIndex) // [TODO] elite tmp use metaIndex for grid index
}
this.clickTime++
@@ -93,7 +93,7 @@ export default {
data: seriesData,
})
} else {
if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
this.$emit('changeAxis', this.metaIndex) // [TODO] elite tmp use metaIndex for grid index
}
}
@@ -46,7 +46,7 @@ export default {
},
computed: {
...mapFields('', [
'developer_mode',
'developerMode',
]),
...mapFields('taskContent', [
'chartData',
@@ -84,7 +84,7 @@ export default {
} else if (this.axis === 'y') {
this.axisYDataType = this.channelOptions[1]
}
} else if (this.deviceName === 'EliteZM15') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
// use state meta to decide which default unit need to be used (like check I-V mode...)
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE, this.deviceName)
const xType = setting[0]
@@ -130,7 +130,7 @@ export default {
}
this.channelFormat = this.axisYDataType
}
} else if (this.deviceName === 'EliteEIS') {
} else if (this.deviceName.includes('EIS')) {
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE, this.deviceName)
const xType = setting[0]
const xValue = setting[1]
@@ -141,7 +141,7 @@ export default {
if (this.axis === 'x') {
settingType = xType
settingValue = xValue
if (settingType === 'EliteEIS') {
if (settingType.includes('EIS')) {
this.axisXDataType = this.eisChannelOptions.find(element => element.id === parseInt(settingValue) - 1)
} else if (settingType === 'Elite') {
// 1: I, 2: V, 3: R
@@ -159,7 +159,7 @@ export default {
} else if (this.axis === 'y') {
settingType = yType
settingValue = yValue
if (settingType === 'EliteEIS') {
if (settingType.includes('EIS')) {
this.axisYDataType = this.eisChannelOptions.find(element => element.id === parseInt(settingValue) - 1)
} else if (settingType === 'Elite') {
// 1: I, 2: V, 3: R
@@ -184,7 +184,7 @@ export default {
if (this.deviceName.startsWith('Neulive')) {
// for elite now, cuz neulive now only have v-t graph, for future neulive replay need to adjust'
// console.log('(Last updated: 2021/06/19)')
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
if (this.axis === 'x') {
this.axisXDataType = this.channelFormat
} else if (this.axis === 'y') {
@@ -200,6 +200,9 @@ export default {
this.$emit('clearCycle')
}
},
getChannelByAxis () {
return this.channelFormat.description
},
},
mounted () {
},
@@ -64,13 +64,13 @@ export default {
}
},
showPanel (params) {
if (params.target !== undefined) {
if (params.target.eventData.componentType === 'xAxis' && params.target.eventData.targetType === 'axisLabel') {
this.gridIndex = params.target.eventData.xAxisIndex
if (params.targetType !== undefined) {
if (params.componentType === 'xAxis' && params.targetType === 'axisLabel') {
this.gridIndex = params.xAxisIndex
this.axis = 'x'
this.position = 'bottom'
} else if (params.target.eventData.componentType === 'yAxis' && params.target.eventData.targetType === 'axisLabel') {
this.gridIndex = params.target.eventData.yAxisIndex
} else if (params.componentType === 'yAxis' && params.targetType === 'axisLabel') {
this.gridIndex = params.yAxisIndex
this.axis = 'y'
this.position = 'left'
}
@@ -88,7 +88,7 @@ export default {
this.calculateScaleHelper(gridIndex, ch)
}
}
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
this.calculateScaleHelper(this.metaIndex, -1) // [TODO] elite tmp use metaIndex for grid index
}
},
@@ -254,6 +254,9 @@ export default {
}
}
},
getScaleByAxis () {
return this.scaleFormat.description
},
...mapActions('replay', [types.chart.setAxisDisplay]),
...mapMutations('replay', [types.chart.updateSeries]),
...mapGetters('replay', [types.rec.getCycleDict]),
@@ -65,9 +65,9 @@ export default {
return item.unit === 'uV'
})
}
} else if (this.deviceName === 'EliteZM15') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
return this.valueFormatOptions[this.dataType][0]
} else if (this.deviceName === 'EliteEIS') {
} else if (this.deviceName.includes('EIS')) {
return this.eisValueFormatOptions[this.dataType][0]
}
},
@@ -80,7 +80,7 @@ export default {
} else if (this.axis === 'y') {
this.dataType = 'voltage'
}
} else if (this.deviceName === 'EliteZM15') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
// use state meta to decide which default unit need to be used (like check I-V mode...)
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE, this.deviceName)
const xType = setting[0]
@@ -111,7 +111,7 @@ export default {
} else if (settingType === 'Time') {
this.dataType = 'time'
}
} else if (this.deviceName === 'EliteEIS') {
} else if (this.deviceName.includes('EIS')) {
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[this.metaIndex].parameter_set.MODE, this.deviceName)
const xType = setting[0]
const xValue = setting[1]
@@ -127,7 +127,7 @@ export default {
settingValue = yValue
}
if (settingType === 'EliteEIS') {
if (settingType.includes('EIS')) {
if (settingValue === 3) {
this.dataType = 'frequency'
} else if (settingValue === 5 || settingValue === 6 || settingValue === 7) {
@@ -179,7 +179,7 @@ export default {
channel: parseInt(key),
})
}
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
this.updateAxisLabelChart({
chartID: chartID,
axis: this.axis,
@@ -229,13 +229,20 @@ export default {
this.dataType = 'default'
}
}
if (this.deviceName === 'EliteZM15') {
if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
this.valueFormat = this.valueFormatOptions[this.dataType][0]
} else if (this.deviceName === 'EliteEIS') {
} else if (this.deviceName.includes('EIS')) {
this.valueFormat = this.eisValueFormatOptions[this.dataType][0]
}
this.changeUnit()
},
getUnitByAxis () {
// console.log('valueFormat: ', this.valueFormat.unit)
if (this.valueFormat.unit === undefined) {
return 'auto'
}
return this.valueFormat.unit
},
// call vuex to mutate chart label formatter by unit and axis
...mapMutations('replay', [types.chart.updateAxisLabel]),
},
@@ -378,7 +378,7 @@ export default {
this.content += ' Frequency: ' + String(1000 / period) + ' Hz' + '<br/>' // 1000 is cuz 1s = 1000ms
this.content += ' Period: ' + String(period) + ' ms' + '<br/>'
}
} else if (this.deviceName === 'EliteZM15' || this.deviceName === 'EliteEIS') {
} else if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC') || this.deviceName.includes('EIS')) {
const mode = this.mode = params.MODE
const config = paramTable.getConfig(this.deviceName)
const modeConfig = paramTable.getModeConfig(this.deviceName, mode)
@@ -0,0 +1,171 @@
<template>
<div>
<div class="flex-container mb-2">
<va-input
v-model="this.specificIntegral"
:label="$t('Specific Integral')"
/>
<div class="flex sm5 xl5 md5 xs5 px-0 py-0">
<va-button
v-if="!keyBoundary"
v-model="this.keyBoundary"
@click="switchBoundary()"
class="round-button px-1 py-1"
>
Draw
</va-button>
<va-button
v-if="keyBoundary"
v-model="this.keyBoundary"
@click="switchBoundary()"
class="round-button px-1 py-1"
>
Input
</va-button>
</div>
</div>
<div v-if="!keyBoundary">
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-input
v-model="this.boundary.x_start"
:label="$t('X Start')"
/>
<va-input
v-model="this.boundary.x_end"
:label="$t('X End')"
/>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-input
v-model="this.boundary.y_start"
:label="$t('Y Start')"
/>
<va-input
v-model="this.boundary.y_end"
:label="$t('Y End')"
/>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-button class="mb-2" @click="setBrushBoundary" small>
Set Integral Boundary
</va-button>
</div>
</div>
<div v-if="keyBoundary">
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-input
@keyup.enter="setBrushBoundary()"
@blur="setBrushBoundary()"
v-model="boundaryXstart"
:label="$t('X Start')"
/>
<va-input
@keyup.enter="setBrushBoundary()"
@blur="setBrushBoundary()"
v-model="boundaryXend"
:label="$t('X End')"
/>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-input
@keyup.enter="setBrushBoundary()"
@blur="setBrushBoundary()"
v-model="boundaryYstart"
:label="$t('Y Start')"
/>
<va-input
@keyup.enter="setBrushBoundary()"
@blur="setBrushBoundary()"
v-model="boundaryYend"
:label="$t('Y End')"
/>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<va-button class="mb-2" @click="setBrushBoundary" small>
Set Integral Boundary
</va-button>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'SpecificIntegral',
components: {
},
computed: {
displayType () {
return {
x: this.axisXLabelScale.description === 'Log' ? 'log' : 'value',
y: this.axisYLabelScale.description === 'Log' ? 'log' : 'value',
}
},
},
props: {
},
created () {
},
data () {
return {
specificIntegral: 0,
boundary: {},
boundaryXstart: 0,
boundaryXend: 0,
boundaryYstart: 0,
boundaryYend: 0,
keyBoundary: false,
}
},
mqtt: {
},
methods: {
getSpecificIntegral (specificIntegral, boundary) {
this.specificIntegral = specificIntegral
this.specificIntegral = (this.specificIntegral * 1e-12).toFixed(4) + 'mW'
// this.specificIntegral = (this.specificIntegral * 1e-15).toFixed(4) + 'W'
if (!this.keyBoundary) {
this.boundary = boundary
}
},
switchBoundary () {
this.keyBoundary = !this.keyBoundary
// if (this.boundary !== {})
this.boundaryXstart = this.boundary.x_start
this.boundaryXend = this.boundary.x_end
this.boundaryYstart = this.boundary.y_start
this.boundaryYend = this.boundary.y_end
},
setBrushBoundary () {
var boundary = {
x_start: Number(this.boundaryXstart),
x_end: Number(this.boundaryXend),
y_start: Number(this.boundaryYstart),
y_end: Number(this.boundaryYend),
}
this.$emit('setBrushBoundary', boundary)
},
},
async mounted () {
},
destroyed () {
},
watch: {
},
}
</script>
<style lang="scss">
/* .round-button {
border-radius: 12px;
} */
</style>
+60
View File
@@ -0,0 +1,60 @@
<template>
<div>
<p>aaa</p>
<chart class="chart" :option="option" />
</div>
</template>
<script>
export default {
data () {
return {
option: {
title: {
text: 'Traffic Sources',
left: 'center',
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)',
},
legend: {
orient: 'vertical',
left: 'left',
data: ['Direct', 'Email', 'Ad Networks', 'Video Ads', 'Search Engines'],
},
series: [
{
name: 'Traffic Sources',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [
{ value: 335, name: 'Direct' },
{ value: 310, name: 'Email' },
{ value: 234, name: 'Ad Networks' },
{ value: 135, name: 'Video Ads' },
{ value: 1548, name: 'Search Engines' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
},
],
brush: {
},
},
}
},
}
</script>
<style>
.chart {
height: 100vh;
}
</style>
@@ -9,7 +9,7 @@
<device-parameter-recording
:ref="'device_parameter_ref'"
:parameter="parameter"
:library="'EliteEDC1.5'"
:library="'Elite_EDC_1.5'"
@setParameter="setParameter"
@setParameterWithDebounce="setParameterWithDebounce"
/>
+24 -10
View File
@@ -1,6 +1,5 @@
<template>
<div class="task-content">
<va-modal
v-model="showShutdownModal"
size="small"
@@ -29,7 +28,7 @@
<div class="flex sm12 xl12 md12 xs12">
<task-devices-new :ref="'devices_ref'" @add="addDevice($event)" @remove="removeDevice($event)" @refreshSetting="refreshChartSetting($event)" class="pa-0" />
</div>
<div class="flex sm12 xl12 md12 xs12" v-if="developer_mode">
<div class="flex sm12 xl12 md12 xs12" v-if="developerMode">
<task-formula :ref="'formula_ref'" @add="addFormula($event)" @remove="removeFormula($event)" class="pa-0" />
</div>
</div>
@@ -129,7 +128,7 @@ export default {
'deviceListNew',
]),
...mapFields('', [
'developer_mode',
'developerMode',
]),
},
data () {
@@ -159,7 +158,7 @@ export default {
if (this.$refs.devices_ref != null) {
await this.$refs.devices_ref.loadingDone()
}
await this.taskContentChartInitCustomizedFromCache()
await this.taskContentChartInitCustomizedFromCache({ controllerID: taskInfo.getTaskInfo().controllerID })
this.getParmDone = true
},
async '+/get_device_info/+' (data, topic) {
@@ -200,7 +199,7 @@ export default {
await taskInfo.deviceInfo(String.fromCharCode.apply(null, data), this.deviceList)
if (this.$refs.devices_ref != null) {
await this.$refs.devices_ref.loadingDone()
await this.taskContentChartInitCustomizedFromCache()
await this.taskContentChartInitCustomizedFromCache({ controllerID: taskInfo.getTaskInfo().controllerID })
}
},
// listen datastream [ topic: controllerID/data_server/device_data_stream/deviceID/channel ]
@@ -365,7 +364,7 @@ export default {
continue
}
// device is running refresh chart
if (device.status === 1) {
if (device.status === 1 && this.chartData[chart].captured !== true) {
this.taskContentChartRefreshData({
chartID: chart,
deviceList: this.deviceListNew,
@@ -404,7 +403,7 @@ export default {
this.taskContentChartRefreshPanel()
// save chart config to web storage
if (!isDefault) {
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
}
this.pageToast('The chart has been added.')
@@ -458,7 +457,7 @@ export default {
}
}
if (saveCache === true) {
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
}
this.pageToast('The chart has been removed.')
},
@@ -591,6 +590,9 @@ export default {
path: '/',
})
},
switchMode: function () {
this.developerMode = !this.developerMode
},
...mapActions('taskContent', [
taskTypes.chart.initCustomizedFromCache,
@@ -609,14 +611,26 @@ export default {
async mounted () {
const devMode = this.$route.params.mode
if (devMode === 'dev') {
this.developer_mode = true
this.developerMode = true
}
await taskInfo.updateTaskInfo(this.$route.params.taskID)
this.pageMqttSub(taskInfo.getTaskInfo().controllerID)
await this.pageInit()
this.dataRefreshTimer = setInterval(this.refreshData, 100)
this.dataRefreshTimer = setInterval(this.refreshData, 1000)
var switchModeHander = function (switchMode, e) {
if (e.shiftKey && e.metaKey && e.keyCode === 83) {
switchMode()
}
if (e.shiftKey && e.ctrlKey && e.keyCode === 83) {
switchMode()
}
}
// eslint-disable-next-line no-undef
window.addEventListener('keydown', switchModeHander.bind(_, this.switchMode))
},
destroyed () {
taskInfo.destroyed(this.deviceList)
@@ -14,33 +14,14 @@
/>
</va-button>
</div>
<!-- <div>
<va-button v-if="integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph')" color="danger" class="mb-2" @click="clickIntegral" small>
To Raw Mode
<div class="flex xl10">
<canvas-chart-real-time-calculation :chartID="chartID" @refreshData="refreshData" @switchModeButton="switchModeButton" @getClicked="getClicked" ref="'cal_ref'" />
</div>
<div class="flex xl2">
<va-button :disabled="calClicked" color="#f5aa3b" @click="captureChart" small>
CAPTURE
</va-button>
<va-button v-if="!integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph')" color="primary" class="mb-2" @click="clickIntegral" small>
To Integral Mode
</va-button>
<va-button v-if="xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickXLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickXLog" small>
To log Mode (x-axis)
</va-button>
<va-button v-if="ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickYLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickYLog" small>
To log Mode (y-axis)
</va-button>
<va-button v-if="diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickDiff" small>
To Raw Mode
</va-button>
<va-button :disabled="disableDiff" v-if="!diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickDiff" small>
To Differential Mode
</va-button>
</div> -->
<canvas-chart-real-time-calculation :chartID="chartID" @refreshData="refreshData" @switchModeButton="switchModeButton"/>
</div>
</div>
</template>
<va-tabs v-model="tabValue" class="mb-3" style="width: 100%; min-width: 100px;">
@@ -56,8 +37,15 @@
<canvas-chart-real-time-display
:chartID="chartID" ref="CanvasChartRealTimeDisplay"
/>
<div class="flex" v-if="developerMode">
<div v-for="(data, device) in dataStreamBuffer.getByChartID(chartID)" :key="device">
<div v-for="(i, channel) in data" :key="channel">
{{ device }} {{ channel }} {{ i.length }} first data: {{ (i[0] !== undefined) && i[0][0] }} last data: {{ (i[i.length-1] !== undefined) && i[i.length-1][i[i.length-1].length-1]}}
</div>
</div>
</div>
<!-- chart -->
<chart :key="taskContentChartKey" :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :options="data" @dataZoom="updateZoom" :auto-resize="true" @></chart>
<chart :key="taskContentChartKey" :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :option="data" @dataZoom="updateZoom" :auto-resize="true"></chart>
</div>
</div>
<div v-else-if="tabValue == 1" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
@@ -65,15 +53,15 @@
</div>
<div v-else :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" >
</div>
<div v-if="this.$refs.chart_ref != null">
<!-- <div v-if="this.$refs.chart_ref != null">
<va-button small class="mb-3" @click="selectAllSeries">
SELECT ALL
</va-button>
<va-button small class="mb-3" @click="inverseSelectAllSeries">
INVERSE SELECT
</va-button>
</div>
<div class="row flex align--left ma-0 pa-0">
</div> -->
<div class="row flex align--left ma-0 pa-0 mt-2">
<va-input
v-if="chartData[chartID].chartXMode === 'time'"
class="mx-1"
@@ -122,7 +110,7 @@
</p>
</va-input>
</div>
<div class="row flex ma-0 pa-0" v-if="developer_mode === true">
<div class="row flex ma-0 pa-0" v-if="developerMode === true">
<canvas-chart-filter :chartID="chartID" :filterIndex="0" />
<canvas-chart-filter :chartID="chartID" :filterIndex="1" />
<canvas-chart-filter :chartID="chartID" :filterIndex="2" />
@@ -141,10 +129,8 @@ import { mapFields } from 'vuex-map-fields'
import CanvasChartRealTimeDisplay from '@/components/task/content/chart/CanvasChartRealTimeDisplay'
import { mapActions } from 'vuex'
import taskTypes from '@/store/modules/task/content/types'
// import paramTable from '@/data/param-table/index'
// import { newTooltip } from '@/factories/chart/tooltipFactory'
// import { getTimeFormatter } from '@/store/modules/task/content/actions/chartAct'
import CanvasChartRealTimeCalculation from './CanvasChartRealTimeCalculation.vue'
import { dataStreamBuffer } from '@/data/task/DataStreamBuffer'
export default {
name: 'CanvasChart',
@@ -178,17 +164,19 @@ export default {
},
computed: {
...mapFields('', [
'developer_mode',
'developerMode',
]),
...mapFields('taskContent', [
'chartData',
'taskContentChartKey',
'deviceListNew',
'taskContentChartPanelKey',
]),
},
data () {
return {
data: null,
rawData: null,
tabValue: 0,
resizeTimer: null,
mappingSelect: '',
@@ -201,11 +189,25 @@ export default {
yIntervalInput: 'auto',
dataZoomStart: 0,
dataZoomEnd: 100,
captured: false,
calClicked: false,
dataStreamBuffer: dataStreamBuffer,
}
},
methods: {
getClicked: function (clicked) {
this.calClicked = clicked
},
captureChart: function () {
const newData = Object.assign({}, this.data)
this.chartData[String(newData.chartID) + '-1'] = newData
this.chartData[String(newData.chartID) + '-1'].captured = true
this.chartData[String(newData.chartID) + '-1'].cardName = this.chartData[String(newData.chartID) + '-1'].cardName + ' - captured'
this.chartData[String(newData.chartID) + '-1'].chartID = String(newData.chartID) + '-1'
this.taskContentChartPanelKey++
// console.log(this.chartData[String(newData.chartID) + '-1'])
},
updateZoom: function (e) {
// console.log(e.batch)
this.dataZoomStart = e.batch[0].start
this.dataZoomEnd = e.batch[0].end
},
@@ -220,7 +222,7 @@ export default {
this.timeIntervalInput = 'auto'
this.chartData[this.chartID].xAxis.forEach(x => {
if (x.type === 'time') {
x.interval = 500 * 1000
x.interval = null
}
})
}
@@ -240,7 +242,7 @@ export default {
}
})
}
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
},
yIntervalChange: async function (val) {
if (!isNaN(parseInt(val))) {
@@ -258,26 +260,26 @@ export default {
maxList.push(Math.max(...this.chartData[this.chartID].series[i].data.map(p => p[1])))
minList.push(Math.min(...this.chartData[this.chartID].series[i].data.map(p => p[1])))
})
const max = Math.max(maxList)
const min = Math.min(minList)
const center = (max + min) / 2
y.max = center + (max - min)
y.min = center - (max - min)
y.max = (parseInt(y.max / y.interval) + 1) * y.interval
y.min = (parseInt(y.min / y.interval) - 1) * y.interval
// const max = Math.max(maxList)
// const min = Math.min(minList)
// const center = (max + min) / 2
// y.max = center + (max - min)
// y.min = center - (max - min)
// y.max = (parseInt(y.max / y.interval) + 1) * y.interval
// y.min = (parseInt(y.min / y.interval) - 1) * y.interval
}
})
} else {
this.timeIntervalInput = 'auto'
this.chartData[this.chartID].yAxis.forEach(y => {
if (parseInt(y.channel) <= 255) {
y.interval = null
y.max = 'dataMax'
y.min = 'dataMin'
// y.interval = null
// y.max = 'dataMax'
// y.min = 'dataMin'
}
})
}
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
},
threeAxisIntervalChange: function (val) {
if (!isNaN(parseInt(val))) {
@@ -323,6 +325,7 @@ export default {
if (this.chartData[this.chartID].mappingID !== '-1' && this.chartData[this.chartID].mappingID != null) {
taskInfo.getMappingList().forEach(item => {
if (item.id === this.chartData[this.chartID].mappingID) {
// console.log('item.name: ', item.name)
this.setChartName(item.name)
}
})
@@ -367,24 +370,27 @@ export default {
type: 'legendInverseSelect',
})
},
refreshData: function (rawData) {
this.data = rawData
refreshData: function (chartData, rawData) {
this.data = chartData
this.rawData = rawData
// save the start & end of previous dataZoom setting to avoid reset dataZoom
this.data.dataZoom[0].start = this.dataZoomStart
this.data.dataZoom[0].end = this.dataZoomEnd
this.$refs.CanvasChartRealTimeDisplay.updateData(this.data)
this.$refs.CanvasChartRealTimeDisplay.matchData(this.data)
},
switchModeButton: function (dataMode, gridIndex, channelIndex) {
// console.log('switchModeBtn')
this.$refs.CanvasChartRealTimeDisplay.matchFunctional(String(dataMode), gridIndex, channelIndex)
},
...mapActions('taskContent', [
taskTypes.chart.saveToCache,
]),
switchModeButton: function (dataMode) {
// console.log('switchModeBtn')
this.$refs.CanvasChartRealTimeDisplay.switchFunctional(String(dataMode))
},
},
async mounted () {
this.data = this.chartData[this.chartID]
// this.data = this.chartData[this.chartID]
// this.data.xAxis[0].boundaryGap = [0, '5%']
// this.data.yAxis[0].boundaryGap = ['10%', '10%']
this.resizeTimer = setInterval(this.resize, 1000)
this.nameCard = this.chartData[this.chartID].cardName
await this.refreshMappingSelect()
@@ -1,29 +1,41 @@
<template>
<div>
<va-button v-if="integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickIntegral" small>
To Raw Mode
</va-button>
<va-button :disabled="disableInt" v-if="!integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickIntegral" small>
To Integral Mode
</va-button>
<va-button v-if="xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickXLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickXLog" small>
To log Mode (x-axis)
</va-button>
<va-button v-if="ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickYLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickYLog" small>
To log Mode (y-axis)
</va-button>
<va-button v-if="diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickDiff" small>
To Raw Mode
</va-button>
<va-button :disabled="disableDiff" v-if="!diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickDiff" small>
To Differential Mode
</va-button>
<div class="row xs12 sm12 lg10 xl10 pa-2">
<va-button v-if="integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickIntegral" small>
To Raw Mode
</va-button>
<va-button :disabled="disableInt" v-if="!integralClicked && (mode_name==='Chronoamperometric' || mode_name==='I-T Graph' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickIntegral" small>
To Integral Mode
</va-button>
<va-button v-if="xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickXLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!xlogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickXLog" small>
To log Mode (x-axis)
</va-button>
<va-button v-if="ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickYLog" small>
To Raw Mode
</va-button>
<va-button :disabled="disableLog" v-if="!ylogClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickYLog" small>
To log Mode (y-axis)
</va-button>
<va-button v-if="diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="danger" class="mb-2" @click="clickDiff" small>
To Raw Mode
</va-button>
<va-button :disabled="disableDiff" v-if="!diffClicked && (mode_name==='Linear Sweep Voltammetry' || mode_name==='I-V Curve')" color="primary" class="mb-2" @click="clickDiff" small>
To Differential Mode
</va-button>
</div>
<div class="row xs12 sm12 lg6 xl6 pa-2" v-if="diffClicked">
<div>
<span>Window-size: </span>
<input class="mx-2" size="5" v-model="sgFilterArgument.windowSize" @blur="watchHandler"/>
</div>
<div>
<span>Polynomial: </span>
<input class="mx-2" size="5" v-model="sgFilterArgument.polynomial" @blur="watchHandler"/>
</div>
</div>
</div>
</template>
@@ -38,6 +50,7 @@ import taskTypes from '@/store/modules/task/content/types'
import paramTable from '@/data/config-table/index'
// import newTooltip from '@/factories/chart/tooltipFactory'
import { getTimeFormatter } from '@/store/modules/task/content/actions/chartAct'
import sgFilter from '@/data/SGFilter'
export default {
name: 'CanvasChartRealTimeCalculation',
@@ -51,7 +64,7 @@ export default {
},
computed: {
...mapFields('', [
'developer_mode',
'developerMode',
]),
...mapFields('taskContent', [
'chartData',
@@ -75,6 +88,10 @@ export default {
disableDiff: false,
disableLog: false,
disableInt: false,
sgFilterArgument: {
windowSize: 5,
polynomial: 3,
},
}
},
// watch rawData is use for detect whether the chartData is changed
@@ -98,13 +115,13 @@ export default {
this.addSource()
var curXData = 0
var curYData = 0
var prevXData = 0
// var prevXData = 0
var prevYData = 0
var deltaX = 0
var deltaTime = 0
var curTime = 0
var integralResult = 0
var diffResult = 0
// var diffResult = 0
var index = 0
var timeIndex = this.getTimeIndex()
var _data = []
@@ -201,41 +218,80 @@ export default {
}
}
} else if (this.diffClicked) {
const dataX = []
const dataY = []
const time = []
for (index = 0; index < dataLength; index++) {
if (index === 0) {
// TODO: need to change the series[deviceID]
// TODO: change the time index(dynamic changing)
curXData = parseFloat(seriesData[index][0])
curYData = parseFloat(seriesData[index][1])
deltaX = seriesData[index + 1][timeIndex] - seriesData[index][timeIndex]
curTime = seriesData[index][timeIndex]
// _data.push([curTime, 0, curTime])
} else {
curXData = parseFloat(seriesData[index][0])
curYData = parseFloat(seriesData[index][1])
prevXData = parseFloat(seriesData[index - 1][0])
prevYData = parseFloat(seriesData[index - 1][1])
curTime += deltaX
diffResult = parseFloat((curYData - prevYData) / (curXData - prevXData))
_data.push([curXData, diffResult, curTime])
}
dataX.push(seriesData[index][0])
dataY.push(seriesData[index][1])
time.push(seriesData[index][2])
}
// console.log('dataX', dataX)
// console.log('dataY', dataY)
// console.log('time', time)
const filteredData = sgFilter(dataY, this.sgFilterArgument.windowSize, this.sgFilterArgument.polynomial)
// console.log('filterdData', filteredData)
for (index = 0; index < dataLength; index++) {
_data.push([dataX[index], filteredData[index], time[index]])
}
// for (index = 0; index < dataLength; index++) {
// if (index === 0) {
// // TODO: need to change the series[deviceID]
// // TODO: change the time index(dynamic changing)
// curXData = parseFloat(seriesData[index][0])
// curYData = parseFloat(seriesData[index][1])
// deltaX = seriesData[index + 1][timeIndex] - seriesData[index][timeIndex]
// curTime = seriesData[index][timeIndex]
// // _data.push([curTime, 0, curTime])
// } else {
// curXData = parseFloat(seriesData[index][0])
// curYData = parseFloat(seriesData[index][1])
// prevXData = parseFloat(seriesData[index - 1][0])
// prevYData = parseFloat(seriesData[index - 1][1])
// curTime += deltaX
// diffResult = parseFloat((curYData - prevYData) / (curXData - prevXData))
// _data.push([curXData, diffResult, curTime])
// }
// }
}
// console.log(this.data.dataZoom[1])
// decide feed in raw data / modified one
const dataRaw = this.data.series[0].data
if (this.integralClicked || this.xlogClicked || this.ylogClicked || this.diffClicked) {
this.data.series[0].data = _data
this.$emit('getClicked', true)
// console.log(this.data.series[0].data[this.data.series[0].data.length - 1])
} else {
this.$emit('getClicked', false)
}
this.data.xAxis[0].type = 'value'
if (this.xName !== 'TIME') {
// console.log('not time')
this.data.xAxis[0].max = (value) => {
if (value.max < 0) {
return value.max - 0.1 * value.max
}
if (value.max + 0.1 * value.max > 5e6) {
return 5e6
}
return value.max + 0.1 * value.max
}
this.data.yAxis[0].max = (value) => {
if (value.max < 0) {
return value.max - 0.1 * value.max
}
return value.max + 0.1 * value.max
}
}
if (this.integralClicked) {
this.$emit('switchModeButton', 'Integral')
} else if (this.xlogClicked || this.ylogClicked) {
this.$emit('switchModeButton', 'log')
this.$emit('switchModeButton', 'integral', 0, 0)
} else if (this.diffClicked) {
this.$emit('switchModeButton', 'Differential')
this.$emit('switchModeButton', 'differential', 0, 0)
} else {
this.$emit('switchModeButton', '')
this.$emit('switchModeButton', 'default', 0, 0)
}
// TODO: modify the redundant code
if (this.xName === 'TIME') {
@@ -243,23 +299,17 @@ export default {
return getTimeFormatter(val)
}
}
this.$emit('refreshData', this.data)
// this.data.yAxis[0].boundaryGap = [String(this.yBottomBoundary) + '%', '10%']
// console.log(this.data.yAxis[0].boundaryGap)
this.$emit('refreshData', this.data, dataRaw)
},
// resetClicked: function () {
// this.integralClicked = false
// this.xlogClicked = false
// this.ylogClicked = false
// this.diffClicked = false
// this.disableDiff = false
// this.disableLog = false
// },
clickIntegral: function () {
this.integralClicked = !(this.integralClicked)
this.disableDiff = !(this.disableDiff)
this.disableLog = !(this.disableLog)
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.data.mappingID))
if (device !== undefined) {
if (device.status === 0) {
if (device.status === 0 || device.status === 1) {
this.watchHandler()
}
}
@@ -281,7 +331,7 @@ export default {
}
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.data.mappingID))
if (device !== undefined) {
if (device.status === 0) {
if (device.status === 0 || device.status === 1) {
this.watchHandler()
}
}
@@ -303,7 +353,7 @@ export default {
}
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.data.mappingID))
if (device !== undefined) {
if (device.status === 0) {
if (device.status === 0 || device.status === 1) {
this.watchHandler()
}
}
@@ -314,7 +364,7 @@ export default {
this.disableInt = !(this.disableInt)
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.data.mappingID))
if (device !== undefined) {
if (device.status === 0) {
if (device.status === 0 || device.status === 1) {
this.watchHandler()
}
}
@@ -357,6 +407,14 @@ export default {
},
async mounted () {
this.rawData = this.chartData[this.chartID]
// console.log('x', this.rawData.xAxis.length)
// if (this.mode_name === 'I-V Curve') {
// this.rawData.xAxis[0].boundaryGap = [0, '5%']
// this.rawData.yAxis[0].boundaryGap = [0, '10%']
// } else {
// this.rawData.xAxis[0].boundaryGap = [0, '5%']
// this.rawData.yAxis[0].boundaryGap = ['10%', '10%']
// }
},
}
@@ -1,5 +1,11 @@
<template>
<div>
<!-- cycle display -->
<div v-if="data !== null && data.cycle > 0" class="row flex sm12 xl12 md12 xs12 align--center my-0 py-0">
<div style="text-align: right;">
<h1 style="color: #707ee7;"> cycle <span style="color: white; background-color: #707ee7; border-radius: 40%;" class="pa-2">{{ data.cycle }}</span></h1>
</div>
</div>
<div v-for="(chart, chartIndex) in realTime" :key="'c'+chartIndex">
<div v-for="(grid, gridIndex) in chart" :key="'s'+gridIndex" class="row ma-0 pa-0">
<div class="col flex xs0 sm0 lg0 md0 xl0 xxl1"/>
@@ -48,6 +54,7 @@
<script>
import { mapFields } from 'vuex-map-fields'
import { chartRouter } from './CanvasChartTable'
import configTable from '@/data/config-table/index.js'
import newTooltip from '@/factories/chart/tooltipFactory'
@@ -69,11 +76,52 @@ export default {
return {
data: null,
configTable: configTable,
chartRouter: chartRouter,
realTime: [[]],
functional: '',
}
},
methods: {
// for user to choose wanted unit
setUnit: function (gridIndex, channelIndex) {
// construct realTime object, i.e., record the coressponding value and unit
// the formate imitates the data.gridSource
if (this.data !== undefined && this.data.gridSource !== undefined) {
const _xPhysicsQuantity = this.data.gridSource[gridIndex][channelIndex].name.split('_')[0].at(-1)
const _yPhysicsQuantity = this.data.gridSource[gridIndex][channelIndex].name.split('_')[1].at(-1)
const [_xAxis, _yAxis] = this.chartRouter.getChartTable(_xPhysicsQuantity, _yPhysicsQuantity)
const _realTime = JSON.parse(JSON.stringify(this.realTime))
const _newChannel = {}
// set name, sourceIndex in data.series
_newChannel.name = this.data.gridSource[gridIndex][channelIndex].name
_newChannel.seriesSource = this.data.series.findIndex((ele) => ele.name === _newChannel.name)
// set x-axis
_newChannel.xValue = 0
_newChannel.xUnit = _xAxis.default.defaultUnit
_newChannel.xScale = _xAxis.default.unit
_newChannel.xUnitOption = Object.keys(_xAxis.default.unit)
_newChannel.xName = _xAxis.default.name
// set y-axis
_newChannel.yValue = 0
_newChannel.yUnit = _yAxis.default.defaultUnit
_newChannel.yScale = _yAxis.default.unit
_newChannel.yUnitOption = Object.keys(_yAxis.default.unit)
_newChannel.yName = _yAxis.default.name
// set functional
_newChannel.functional = 'default'
// padding
while (gridIndex >= _realTime.length) {
_realTime.push([])
}
while (channelIndex >= _realTime[gridIndex].length) {
_realTime[gridIndex].push({})
}
// merge the additional part into original part
_realTime[gridIndex][channelIndex] = _newChannel
this.realTime = _realTime
}
},
// record the latest data as the real time value
updateValue: function () {
if ((this.realTime.length === 0)) {
@@ -88,101 +136,13 @@ export default {
// the device is active now --> update the real time value
if (this.data.series[this.realTime[gridIndex][channelIndex].seriesSource] !== undefined && this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data !== undefined && this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data.length > 0) {
this.realTime[gridIndex][channelIndex].xValue = this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data.at(-1)[0] / this.realTime[gridIndex][channelIndex].xValueScale[this.realTime[gridIndex][channelIndex].xUnit]
this.realTime[gridIndex][channelIndex].yValue = this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data.at(-1)[1] / this.realTime[gridIndex][channelIndex].yValueScale[this.realTime[gridIndex][channelIndex].yUnit]
this.realTime[gridIndex][channelIndex].xValue = (this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data.at(-1)[0] / this.realTime[gridIndex][channelIndex].xScale[this.realTime[gridIndex][channelIndex].xUnit]).toFixed(3)
this.realTime[gridIndex][channelIndex].yValue = (this.data.series[this.realTime[gridIndex][channelIndex].seriesSource].data.at(-1)[1] / this.realTime[gridIndex][channelIndex].yScale[this.realTime[gridIndex][channelIndex].yUnit]).toFixed(3)
}
}
}
},
// change the axis unit of charts
updateUnit: function (functional) {
for (let gridIndex = 0; gridIndex < this.realTime.length; gridIndex++) {
for (let channelIndex = 0; channelIndex < this.realTime[gridIndex].length; channelIndex++) {
if (channelIndex === 0) {
const _xUnit = this.realTime[gridIndex][channelIndex].xUnit
const _yUnit = this.realTime[gridIndex][channelIndex].yUnit
const _xScale = this.realTime[gridIndex][channelIndex].xValueScale[this.realTime[gridIndex][channelIndex].xUnit]
const _yScale = this.realTime[gridIndex][channelIndex].yValueScale[this.realTime[gridIndex][channelIndex].yUnit]
this.data.xAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _xScale).toFixed(2) + _xUnit
}
this.data.yAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _yScale).toFixed(2) + _yUnit
}
// update tooltip
this.data.tooltip.formatter = newTooltip(this.realTime, functional).formatter
}
}
}
},
// for user to choose wanted unit
setUnit: function (gridIndex, channelIndex) {
// find coressponding device for current chart
const device = this.deviceListNew.find(chart => {
return chart.memory_board === parseInt(this.chartData[this.chartID].mappingID)
})
if (!device) {
return
}
// construct realTime object, i.e., record the coressponding value and unit
// the formate imitates the data.gridSource
const modeTable = this.configTable.getModeConfig(device.library_name, device.configuration.MODE)
const _realTime = JSON.parse(JSON.stringify(this.realTime))
const _newChannel = {}
let xAxis = null
let yAxis = null
// find the the data of each axis coming from which channel
if (this.data.series.length > 0) {
_newChannel.name = this.data.gridSource[gridIndex][channelIndex].name
_newChannel.seriesSource = this.data.series.findIndex((ele) => ele.name === _newChannel.name)
xAxis = this.data.series[_newChannel.seriesSource].xAxisSource[1] - 1
yAxis = this.data.series[_newChannel.seriesSource].yAxisSource[1] - 1
xAxis = (xAxis === -2) ? 'time' : xAxis
yAxis = (yAxis === -2) ? 'time' : yAxis
}
// check if xAxis unit has been defined in modeTable
if (Object.prototype.hasOwnProperty.call(modeTable.channels, xAxis)) {
_newChannel.xUnit = modeTable.channels[xAxis].defaultUnit
_newChannel.xValueScale = modeTable.channels[xAxis].unit
_newChannel.xUnitOption = Object.keys(modeTable.channels[xAxis].unit)
} else {
_newChannel.xUnit = 'unvalid'
_newChannel.xValueScale = { unvalid: NaN }
_newChannel.xUnitOption = ['']
}
// check if yAxis unit has been defined in modeTable
if (Object.prototype.hasOwnProperty.call(modeTable.channels, yAxis)) {
_newChannel.yUnit = modeTable.channels[yAxis].defaultUnit
_newChannel.yValueScale = modeTable.channels[yAxis].unit
_newChannel.yUnitOption = Object.keys(modeTable.channels[yAxis].unit)
} else {
_newChannel.yUnit = 'unvalid'
_newChannel.yValueScale = { unvalid: NaN }
_newChannel.yUnitOption = ['']
}
// set real time value = 0 as default
_newChannel.xValue = 0
_newChannel.yValue = 0
// padding
while (gridIndex >= _realTime.length) {
_realTime.push([])
}
while (channelIndex >= _realTime[gridIndex].length) {
_realTime[gridIndex].push({})
}
// merge the additional part into original part
_realTime[gridIndex][channelIndex] = _newChannel
this.realTime = _realTime
},
// for each lines on the charts should have its own real time display
// match the number of real time display bar to data.gridSource
matchChart: function () {
for (let gridIndex = 0; gridIndex < this.data.gridSource.length; gridIndex++) {
if (this.data.gridSource[gridIndex] !== undefined) {
@@ -196,17 +156,91 @@ export default {
}
}
},
switchFunctional: function (newFunctional) {
this.functional = newFunctional
// console.log('functional: ', this.functional)
// match the formatter to current unit and functional
matchFormatter: function () {
for (let gridIndex = 0; gridIndex < this.realTime.length; gridIndex++) {
for (let channelIndex = 0; channelIndex < this.realTime[gridIndex].length; channelIndex++) {
if (channelIndex === 0) {
const _xUnit = this.realTime[gridIndex][channelIndex].xUnit
const _yUnit = this.realTime[gridIndex][channelIndex].yUnit
const _xScale = this.realTime[gridIndex][channelIndex].xScale[this.realTime[gridIndex][channelIndex].xUnit]
const _yScale = this.realTime[gridIndex][channelIndex].yScale[this.realTime[gridIndex][channelIndex].yUnit]
// update xAxis.formatter
if (this.realTime[gridIndex][channelIndex].xName === 'Time') {
this.data.xAxis[gridIndex].axisLabel.formatter = this.timeFormatter
} else {
this.data.xAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _xScale).toFixed(2) + _xUnit
}
}
// update yAxis.formatter
if (this.realTime[gridIndex][channelIndex].yName === 'Time') {
this.data.yAxis[gridIndex].axisLabel.formatter = this.timeFormatter
} else {
this.data.yAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _yScale).toFixed(2) + _yUnit
}
}
// update tooltip.formatter
this.data.tooltip.formatter = newTooltip(this.realTime).formatter
}
}
}
},
updateData: function (canvasChartData) {
// match the data to operated data in CanvasChart.vue
matchData: function (canvasChartData) {
this.data = canvasChartData
},
// match the functional to operated data in CanvasChart.vue
matchFunctional: function (newFunctional, gridIndex, channelIndex) {
if (this.realTime[gridIndex][channelIndex] === undefined) return
if (this.realTime[gridIndex][channelIndex].functional === newFunctional) return
const _currChannel = this.realTime[gridIndex][channelIndex]
const _xPhysicsQuantity = this.data.gridSource[gridIndex][channelIndex].name.split('_')[0].at(-1)
const _yPhysicsQuantity = this.data.gridSource[gridIndex][channelIndex].name.split('_')[1].at(-1)
const [_xAxis, _yAxis] = this.chartRouter.getChartTable(_xPhysicsQuantity, _yPhysicsQuantity)
_currChannel.functional = newFunctional
// set x-axis
_currChannel.xUnit = _xAxis.default.defaultUnit
_currChannel.xScale = _xAxis.default.unit
_currChannel.xUnitOption = Object.keys(_xAxis.default.unit)
_currChannel.xName = _xAxis.default.name
// set y-axis
_currChannel.yUnit = _yAxis[newFunctional].defaultUnit
_currChannel.yScale = _yAxis[newFunctional].unit
_currChannel.yUnitOption = Object.keys(_yAxis[newFunctional].unit)
_currChannel.yName = _yAxis[newFunctional].name
},
timeFormatter: function (val) {
let label = ''
const hour = Math.floor(val / 3.6e9)
const minute = Math.floor((val % 3.6e9) / 1000000 / 60)
const second = Math.floor((val % 6e7) / 1000000)
const millisecond = Math.floor((val % 1e6) / 1000)
const microsecond = Math.floor(val % 1e6) - 1000 * millisecond
if (hour > 0) {
label += hour + ' h '
}
if (minute > 0) {
label += minute + ' m '
}
if (second > 0) {
label += second + ' s '
}
if (millisecond > 0) {
label += millisecond + ' ms '
}
if (microsecond >= 0 && hour === 0 && minute === 0 && second === 0) {
label += microsecond + ' µs '
}
return label
},
},
mounted () {
this.data = this.chartData[this.chartID]
// this.data = this.canvasChartData
},
watch: {
data: {
@@ -218,14 +252,7 @@ export default {
},
realTime: {
handler: function () {
this.updateUnit(this.functional)
},
deep: true,
},
canvasChartData: {
handler: function () {
this.data = this.canvasChartData
console.log('HIHI', this.data)
this.matchFormatter()
},
deep: true,
},
@@ -183,7 +183,7 @@ export default {
this.channelSelectDisableX = false
} else if (deviceInfo.library_name.includes('Elite')) {
let channelSet
if (deviceInfo.library_name === 'EliteEIS' && deviceInfo.configuration.MODE === 0) {
if (deviceInfo.library_name.includes('EIS') && deviceInfo.configuration.MODE === 0) {
channelSet = ['Zimag_Raw', 'Zreal_Raw', 'Frequency', 'Cycle', 'Zimag', 'Zreal', 'Impedance', 'Phase', 'Current', 'Level gain']
} else {
channelSet = deviceInfo.configuration.CHANNEL_LABEL
@@ -251,7 +251,7 @@ export default {
this.channelSelectDisableY = false
} else if (deviceInfo.library_name.indexOf('Elite') >= 0) {
let channelSet
if (deviceInfo.library_name === 'EliteEIS' && deviceInfo.configuration.MODE === 0) {
if (deviceInfo.library_name.includes('EIS') && deviceInfo.configuration.MODE === 0) {
channelSet = ['Zimag_Raw', 'Zreal_Raw', 'Frequency', 'Cycle', 'Zimag', 'Zreal', 'Impedance', 'Phase', 'Current', 'Level gain']
} else {
channelSet = deviceInfo.configuration.CHANNEL_LABEL
@@ -310,7 +310,7 @@ export default {
if (this.deviceSelectX.name.indexOf('Neulive') >= 0) {
deviceNameX = 'Neulive'
} else if (this.deviceSelectX.name.indexOf('Elite') >= 0) {
if (deviceXInfo.library_name === 'EliteEIS') {
if (deviceXInfo.library_name.includes('EIS')) {
deviceNameX = 'EliteEIS'
} else {
deviceNameX = 'Elite'
@@ -321,7 +321,7 @@ export default {
if (this.deviceSelectY.name.indexOf('Neulive') >= 0) {
deviceNameY = 'Neulive'
} else if (this.deviceSelectY.name.indexOf('Elite') >= 0) {
if (deviceYInfo.library_name === 'EliteEIS') {
if (deviceYInfo.library_name.includes('EIS')) {
deviceNameY = 'EliteEIS'
} else {
deviceNameY = 'Elite'
@@ -350,7 +350,7 @@ export default {
}
this.sourceAddStatus = true
this.clearSelectOptions()
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
this.$emit('addSource')
},
async addGrid () {
@@ -359,7 +359,7 @@ export default {
length: this.chartData[this.chartID].grid.length + 1,
})
this.updateGridOptions()
await this.taskContentChartSaveToCache()
await this.taskContentChartSaveToCache({ controllerID: taskInfo.getTaskInfo().controllerID })
},
checkSourceAddStatus () {
if (this.sourceList.indexOf([this.deviceSelectX.name, this.deviceSelectX.id, this.channelSelectX.id].toString()) >= 0) {
@@ -0,0 +1,191 @@
const chartTable = {
// split 'A-B' by '-',
// then A-B[0] is about 'A' and A-B[1] is about 'B'
T_V: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
],
T_I: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
downloadUnit: 'mA',
},
// Q = ∫ I dt
integral: {
name: 'Charge',
unit: {
nC: 1e6,
uC: 1e9,
mC: 1e12,
C: 1e15,
},
defaultUnit: 'mC',
downloadUnit: 'mC',
},
},
],
T_R: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 's',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Resistor',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
],
V_I: [
// 0
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
// 𝜡 = dV/dI
differential: {
name: 'Impedance',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
// Power = ∫ V di
integral: {
name: 'Power',
unit: {
mW: 1e12,
W: 1e15,
kW: 1e18,
},
defaultUnit: 'W',
downloadUnit: 'W',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
downloadUnit: 'mA',
},
// Gm = dI/dV
differential: {
name: 'Transconductance',
unit: {
'mA/V': 1,
'A/V': 1e3,
'kA/V': 1e6,
},
defaultUnit: 'A/V',
downloadUnit: 'A/V',
},
// Power = ∫ I dv
integral: {
name: 'Power',
unit: {
mW: 1e12,
W: 1e15,
kW: 1e18,
},
defaultUnit: 'W',
downloadUnit: 'W',
},
},
],
}
export const chartRouter = {
getChartTable: (xAxis, yAxis) => {
const name1 = xAxis + '_' + yAxis
const name2 = yAxis + '_' + xAxis
if (chartTable[name1] !== undefined) return [chartTable[name1][0], chartTable[name1][1]]
else if (chartTable[name2] !== undefined) return [chartTable[name2][1], chartTable[name2][0]]
else return 'idiot'
},
}
@@ -36,16 +36,19 @@
<va-button @click.stop="start(device)" v-if="device.library_name.includes('Elite') && device.status !== 1" class="px-2 py-0 mr-0" color="success" small>START</va-button>
<va-button @click.stop="stop(device)" v-if="device.library_name.includes('Elite') && device.status === 1" class="px-2 py-0 mr-0" color="danger" small>STOP</va-button>
<va-button id="detectButton" @click.stop="detect(device)" v-if="device.library_name.includes('Elite')" color="primary" class="px-2 py-0 mr-0" small>DETECT</va-button>
<va-button @click.stop="show($event, device)" v-if="developerMode" color="warning" class="px-2 py-0 mr-0" small>Show</va-button>
</va-item-label>
</va-item-section>
</va-item>
</span>
<div slot="body">
<div>
<file-control-window :ref="'fcwindow_ref'" :device="device" class="pl-0 pr-0" />
</div>
<div>
<device-parameter-window :ref="'epwindow_ref'" :device="device" class="pl-0 pr-0" />
<div class="mt-0 mb-0" style="height: 60vh; overflow-y: scroll; overflow-x: hidden;" :key="'detail' + device.id">
<div>
<file-control-window :ref="`fcwindow_ref_${device.memory_board}`" :device="device" class="pl-0 pr-0" />
</div>
<div>
<device-parameter-window :device="device" class="pl-0 pr-0" />
</div>
</div>
</div>
</va-collapse>
@@ -63,6 +66,7 @@ import types from '@/store/modules/task/content/types'
import { taskInfo } from '../../../../data/task/TaskInfo'
import api from '@/data/api'
// import CanvasChart from '../chart/CanvasChart'
import { mapFields } from 'vuex-map-fields'
export default {
name: 'TaskDeviceList',
@@ -86,6 +90,9 @@ export default {
}
},
computed: {
...mapFields('', [
'developerMode',
]),
},
methods: {
mqttPub: function (topic, mes) {
@@ -93,7 +100,7 @@ export default {
},
start: async function (device) {
if (device.status === 0) {
await this.setArchiveSettings()
await this.setArchiveSettings(device.memory_board)
const isDPVMode = device.configuration.MODE === 15
if (isDPVMode) {
@@ -130,8 +137,8 @@ export default {
this.$emit('stop', device)
this.pageToast('The device ' + device.name + ' has been stopped.')
},
setArchiveSettings: async function () {
await this.$refs.fcwindow_ref[0].setArchiveSettings()
setArchiveSettings: async function (deviceID) {
await this.$refs[`fcwindow_ref_${deviceID}`][0].setArchiveSettings()
},
refresh: function () {
},
@@ -149,6 +156,12 @@ export default {
this.$emit('detect', device)
this.pageToast('The device ' + device.name + ' has been detect.')
},
show: function (event, device) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'show_device_data/0',
device: device.memory_board,
}))
},
recoverDetectButton () {
document.getElementById('detectButton').className += ' no-dark-style-va-button'
},
@@ -93,7 +93,7 @@
<!-- guide picture button -->
<div>
<vue-final-modal
v-if="library.includes('ZM15')"
v-if="library.includes('Elite_EDC')"
v-model="showModal"
classes="modal-container"
content-class="modal-content"
@@ -150,7 +150,7 @@ export default {
type: String,
},
serialNumber: {
type: String,
type: [String, Array],
},
device: {
type: Object,
@@ -197,7 +197,7 @@ export default {
}
},
...mapFields('', [
'developer_mode',
'developerMode',
]),
...mapFields('taskContent', [
'deviceListNew',
@@ -262,7 +262,7 @@ export default {
},
mounted () {
// dev mode
// this.developer_mode === true
// this.developerMode === true
// ? this.workingModeOptions = this.workingModeDevOptions
// : this.workingModeOptions = this.workingModeNoDevOptions
this.workingModeOptions = this.parameterTable.MODE_OPTIONS
@@ -168,7 +168,7 @@ export default {
}
},
...mapFields('', [
'developer_mode',
'developerMode',
]),
...mapFields('taskContent', [
'deviceListNew',
@@ -233,7 +233,7 @@ export default {
},
mounted () {
// dev mode
// this.developer_mode === true
// this.developerMode === true
// ? this.workingModeOptions = this.workingModeDevOptions
// : this.workingModeOptions = this.workingModeNoDevOptions
this.workingModeOptions = this.parameterTable.MODE_OPTIONS
+128
View File
@@ -0,0 +1,128 @@
import { matrix, inv, multiply, transpose, row, range } from 'mathjs'
// eslint-disable-next-line no-unused-vars
function sgFilter (data, windowSize, k) {
// self
const arr = []
const m = parseInt((windowSize - 1) / 2)
console.log('m', m)
for (const i of range(0, windowSize)) {
console.log('windowSize', i)
const a = []
for (const j of range(0, k)) {
console.log('k', j)
const yVal = Math.pow(-m + i.value, j.value)
a.push(yVal)
}
arr.push(a)
}
console.log(arr)
const X = matrix(arr)
console.log(X, transpose(X), multiply(transpose(X), X))
const B = multiply(multiply(X, inv(multiply(transpose(X), X))), transpose(X))
// B = X * (X.T * X).I * X.T
console.log('B', B)
const a = row(B, m)._data[0]
console.log(a)
// a = a.reshape(windowSize)
// for (const )
const start = []
const end = []
const list = []
for (const i of range(0, m)) {
console.log('i', i)
start.push(data[0])
end.push(data[data.length - 1])
}
console.log('start, end', start, end)
const _data = [...start, ...data, ...end]
console.log('m,', m, _data.length)
for (const i of range(m, _data.length - m)) {
const arra = []
for (const j of range(-m, m + 1)) {
arra.push(_data[i.value + j.value])
}
console.log('arr', arra)
let sum = 0
console.log('aaa', arra, a)
for (const index in arra) {
console.log('index', index)
sum += (arra[index] * a[index])
}
// const b = np.sum(np.array(arra) * a)
list.push(sum)
}
return list
// data = np.insert(data, 0, [data[0] for i in range(m)])
// data = np.append(data, [data[-1] for i in range(m)])
// list = []
// for i in range(m, data.shape[0] - m){
// arra = []
// for j in range(-m, m+1)
// arra.append(data[i +j])
// b = np.sum(np.array(arra) * a)
// list.append(b)
// }
// return list
}
function sgFilterGetDifferential (data, windowSize, polynomial) {
// self
const arr = []
const m = parseInt((windowSize - 1) / 2)
// create polynomial matrix
for (const i of range(0, windowSize)) {
const a = []
for (const j of range(0, polynomial)) {
const yVal = Math.pow(-m + i.value, j.value)
a.push(yVal)
}
arr.push(a)
}
const X = matrix(arr)
// B = (X.T * X).I * X.T
const B = multiply(inv(multiply(transpose(X), X)), transpose(X))
// use index 1 row in matrix
const rowOneInB = row(B, 1)._data[0]
const start = []
const end = []
const list = []
// eslint-disable-next-line no-unused-vars
for (const _ of range(0, m)) {
start.push(data[0])
end.push(data[data.length - 1])
}
const _data = [...start, ...data, ...end]
// m ... data_length - m - 1
for (const i of range(m, _data.length - m)) {
const arra = []
// -m ... 0 ... m
for (const j of range(-m, m + 1)) {
arra.push(_data[i.value + j.value])
}
let sum = 0
for (const index in arra) {
sum += (arra[index] * rowOneInB[index])
}
list.push(sum)
}
return list
}
export default sgFilterGetDifferential
@@ -1,8 +1,8 @@
export default {
name: 'Chronoamperometric',
name: 'Chronoamperometry',
parameter: ['VOLT_VSCAN', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'VOLT_VSCAN', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['VOLT_VSCAN', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // 有要秀給user看的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'VOLT_VSCAN', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['VOLT_VSCAN', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 有要秀給user看的參數
valScales: {
linear: {
func: (val) => {
@@ -1,8 +1,8 @@
export default {
name: 'Chronopotentiometry',
parameter: ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'Charge', 'Const_Current_value', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN'], // 有要秀給user看的參數
headerParameter: () => ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // 有要秀給user看的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'Charge', 'Const_Current_value', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 有要秀給user看的參數
valScales: {
linear: {
func: (val) => {
@@ -56,6 +56,7 @@ export default {
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
charts: {
@@ -1,8 +1,8 @@
export default {
name: 'Constant Current',
parameter: ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'Charge', 'Const_Current_value', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN'], // 有要秀給user看的參數
headerParameter: () => ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // 有要秀給user看的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'Charge', 'Const_Current_value', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['Charge', 'Const_Current_value', 'SAMPLE_RATE', 'VOLTSTOP_MAX', 'VOLTSTOP_MIN', 'CC_CP_SPEED', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 有要秀給user看的參數
valScales: {
linear: {
func: (val) => {
@@ -1,8 +1,8 @@
export default {
name: 'Function Generator',
parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // export header的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數
valScales: {
linear: {
func: (val) => {
+2 -2
View File
@@ -1,8 +1,8 @@
export default {
name: 'I-T Graph',
parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // export header的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數
valScales: {
linear: {
func: (val) => {
+2 -2
View File
@@ -1,8 +1,8 @@
export default {
name: 'Open Circuit Potential',
parameter: ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // export header的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數
valScales: {
linear: {
func: (val) => {
+2 -2
View File
@@ -1,8 +1,8 @@
export default {
name: 'R-T Graph',
parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // export header的參數
showParameter: ['CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數
valScales: {
linear: {
func: (val) => {
+2 -2
View File
@@ -1,8 +1,8 @@
export default {
name: 'V-T Graph',
parameter: ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE'], // 有要秀給user看的參數
headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15'], // export header的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數
valScales: {
linear: {
func: (val) => {
+7 -7
View File
@@ -218,7 +218,7 @@ const EliteZM15 = {
componentType: 'input-range',
range: Object.freeze({ min: 1, max: 1000 }),
defaultValue: 1000,
defaultUnit: 'V',
defaultUnit: 'mV',
downloadUnit: 'mV',
unit: {
mV: 1,
@@ -305,18 +305,18 @@ const EliteZM15 = {
showName: 'Charge',
componentType: 'input-button-toggle',
options: [
{ value: 0, label: 'Charge' },
{ value: 1, label: 'Discharge' },
{ value: 1, label: 'Charge' },
{ value: 0, label: 'Discharge' },
],
range: ['Charge', 'Discharge'],
defaultValue: 1,
outputRawData: (val) => {
const chargeArr = ['Charge', 'Discharge']
const chargeArr = ['DisCharge', 'Charge']
return chargeArr.indexOf(val.toString())
},
outputReadabilityData: (val) => {
const chargeArr = ['Charge', 'Discharge']
return chargeArr[(parseInt(val) + 1) % 2]
const chargeArr = ['DisCharge', 'Charge']
return chargeArr[parseInt(val)]
},
},
Const_Current_value: {
@@ -947,7 +947,7 @@ const EliteZM15 = {
},
{
id: 9,
description: 'Chronoamperometric',
description: 'Chronoamperometry',
img_src: 'CG-Wire',
highz: 1,
},
@@ -0,0 +1,97 @@
export default {
name: 'Chronoamperometry',
parameter: ['VOLT_VSCAN', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數
showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'VOLT_VSCAN', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數
headerParameter: () => ['VOLT_VSCAN', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 有要秀給user看的參數
valScales: {
linear: {
func: (val) => {
return val
},
},
log: {
func: (val) => {
return Math.log10(Math.abs(val))
},
},
},
channels: {
time: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
minute: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 'ms',
downloadUnit: 'ms',
},
0: {
name: 'I_in',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
},
defaultUnit: 'mA',
downloadUnit: 'mA',
},
1: {
name: 'Potential',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
2: {
name: 'V_out',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
charts: {
default: [
{
name: 'Chronoamperometric',
description: '',
subplot: [
{
x1: {
type: 'time',
valScale: 'linear',
min: 'dataMin',
max: 'dataMax',
},
y1: {
type: 'value',
valScale: 'linear',
min: 'dataMin',
max: 'dataMax',
},
data: [
{
legend: 'chrono',
x1: {
channel: 'time',
},
y1: {
channel: 0,
},
},
],
},
],
},
],
},
}
+7 -1
View File
@@ -1,6 +1,7 @@
import PotentiostaticEIS from './PotentiostaticEIS'
import CyclicVoltammetry from './CyclicVoltammetry'
import DevMode from './DevMode'
import Chronoamperometry from './Chronoamperometry'
const EliteEIS = {
ADC_VALUE_I: {
@@ -361,13 +362,18 @@ const EliteEIS = {
},
{
id: 2,
description: 'Chronoamperometry',
},
{
id: 3,
description: 'Dev Tools',
},
],
MODE: {
0: PotentiostaticEIS,
1: CyclicVoltammetry,
2: DevMode,
2: Chronoamperometry,
3: DevMode,
},
}
+16 -14
View File
@@ -4,16 +4,16 @@ import EliteEIS from './EliteEIS/index'
// object saving library name mapping table
const libraryNameMappingTable = {
EliteZM15: EliteEDC,
'EliteEDC1.4': null,
'EliteEDC1.5': EliteEDC,
'EliteEDC1.5re': EliteEDC,
'EliteEDC1.5r2': EliteEDC,
'BAT1.0': null,
'EIS1.0': EliteEIS,
'EIS1.1': EliteEIS,
'EIS1.1_MINI': EliteEIS,
'TRIG0.1': null,
'MEGAFLY0.1': null,
'Elite_EDC_1.4': null,
'Elite_EDC_1.5': EliteEDC,
'Elite_EDC_1.5re': EliteEDC,
'Elite_EDC_1.5r2': EliteEDC,
'Elite_BAT_1.0': EliteEDC,
'Elite_EIS_1.0': EliteEIS,
'Elite_EIS_1.1': EliteEIS,
'Elite_EIS_MINI_1.0': EliteEIS,
'Elite_TRIG_0.1': null,
'Elite_MEGAFLY_0.1': null,
}
// object saving serial number mapping table
@@ -29,13 +29,15 @@ const serialNumberMappingTable = {
},
3: {
1: {
0: null, // BAT1.0
0: EliteEDC, // BAT1.0
},
},
4: {
0: EliteEIS, // EIS1.0
1: EliteEIS, // EIS1.1
2: EliteEIS, // EIS1.1_MINI
1: {
0: EliteEIS, // EIS1.0
1: EliteEIS, // EIS1.1
2: EliteEIS, // EIS1.1mini
},
},
5: {
1: {
+2 -2
View File
@@ -24,7 +24,7 @@ const hasCycleMode = (mode, lib) => {
}
const getDefaultChartTypeByMode = (mode, lib) => {
if (lib === 'EliteZM15') {
if (lib === 'EliteZM15' || lib.includes('Elite_EDC')) {
const settings = {}
settings[0] = ['Elite', 2, 'Elite', 1]
settings[1] = ['Elite', 2, 'Elite', 1]
@@ -43,7 +43,7 @@ const getDefaultChartTypeByMode = (mode, lib) => {
settings[15] = ['Elite', 2, 'Elite', 1]
settings[16] = ['Time', 2, 'Elite', 2]
return settings[mode]
} else if (lib === 'EliteEIS') {
} else if (lib.includes('EIS') || lib.includes('Elite_EIS')) {
const settings = {}
settings[0] = ['EliteEIS', 6, 'EliteEIS', 5]
settings[1] = ['Elite', 2, 'Elite', 1]
+4 -1
View File
@@ -84,7 +84,7 @@ export const dataStreamBuffer = {
// console.log(dataBatch)
// }
for (const chart in _dataStreamBuffer) {
if (_dataStreamBuffer[chart][currentDeviceID] != null && _dataStreamBuffer[chart][currentDeviceID][currentChannel] != null) {
if (_dataStreamBuffer[chart][currentDeviceID] != null) {
// const samplingDataBatch = {}
// let lastTime = -1
// dataBatch.forEach(data => {
@@ -95,6 +95,9 @@ export const dataStreamBuffer = {
// lastTime = samplingTime
// })
const _dataBatch = Array.from(dataBatch)
if (_dataStreamBuffer[chart][currentDeviceID][currentChannel] === undefined) {
_dataStreamBuffer[chart][currentDeviceID][currentChannel] = []
}
_dataStreamBuffer[chart][currentDeviceID][currentChannel].push(_dataBatch)
if (_dataStreamBuffer[chart][currentDeviceID][currentChannel].length > _dataStreamBufferSize) {
_dataStreamBuffer[chart][currentDeviceID][currentChannel].shift()
+8 -2
View File
@@ -18,8 +18,9 @@ function newChart (chartID, numOfCharts) {
legend: {
type: 'scroll',
data: [],
x: 'center',
y: '92%',
// x: 'center',
// y: '-10%',
bottom: '0%',
textStyle: {
color: '#34495e',
},
@@ -35,6 +36,11 @@ function newChart (chartID, numOfCharts) {
yAxis: [],
dataZoom: null,
series: [],
cycle: 0,
// brush: {
// /* toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
// xAxisIndex: 0, */
// },
}
}
+2 -1
View File
@@ -5,7 +5,8 @@ function newDataZoom () {
// top: '0%',
height: '10px',
// realtime: false,
bottom: '8%',
bottom: '6%',
brushSelect: false,
zoomLock: false,
handleStyle: {
shadowColor: 'rgba(0, 0, 0, 0)',
-3
View File
@@ -55,14 +55,11 @@ function newSeries (type, legendName, xAxisIndex, yAxisIndex, xAxisSource, yAxis
xAxisSource: xAxisSource,
yAxisSource: yAxisSource,
animation: false,
hoverAnimation: false,
dataXMax: null,
dataXMin: null,
dataYMax: null,
dataYMin: null,
itemStyle: {
normal: {
},
},
lineStyle: {
width: 1.5,
+8 -27
View File
@@ -5,6 +5,7 @@ function getTime (val) {
const second = Math.floor((val % 6e7) / 1000000)
const millisecond = Math.floor((val % 1e6) / 1000)
const microsecond = Math.floor(val % 1e6) - 1000 * millisecond
if (hour > 0) {
label += hour + ' h '
}
@@ -17,30 +18,12 @@ function getTime (val) {
if (millisecond > 0) {
label += millisecond + ' ms '
}
if (microsecond > 0 && hour === 0 && minute === 0 && second === 0) {
if (microsecond >= 0 && hour === 0 && minute === 0 && second === 0) {
label += microsecond + ' µs '
}
return label
}
function getPhysicsQunatity (name, dataMode) {
// console.log('getPhysicsQunatity', name, dataMode)
const label = []
name = name.split('_')
for (let i = 0; i < name.length; i++) {
if (name[i].includes('T')) {
label.push('Time')
} else if (name[i].includes('V')) {
label.push('Voltage')
} else if (name[i].includes('I')) {
label.push('Current')
} else if (name[i].includes('R')) {
label.push('Impedance')
}
}
return label
}
function newTooltip (realTime, dataMode) {
return {
hideDelay: 5000,
@@ -58,7 +41,6 @@ function newTooltip (realTime, dataMode) {
let tip = ''
let param // find coressonding parameter to the channel
let unitTable // unit is store in this object
let physicsQunatity // type is store here
let style // color
let value // value on cursor
const timeIndex = params[0].seriesName.split('_').findIndex(title => title === 'T')
@@ -77,16 +59,15 @@ function newTooltip (realTime, dataMode) {
unitTable = realTime[gridIndex][channelIndex]
style = 'color: ' + param.color
physicsQunatity = getPhysicsQunatity(param.seriesName, dataMode)
tip += '<span style="' + style + '">' + param.seriesName + ':<ul style = "list-style-type: disc; list-style-position: inside">'
if (physicsQunatity[0] !== 'Time') {
value = parseFloat(param.value[0] / unitTable.xValueScale[unitTable.xUnit]).toFixed(3) + unitTable.xUnit
tip += '<li>' + physicsQunatity[0] + ' = ' + value + '</li>'
if (unitTable.xName !== 'Time') {
value = parseFloat(param.value[0] / unitTable.xScale[unitTable.xUnit]).toFixed(3) + unitTable.xUnit
tip += '<li>' + unitTable.xName + ' = ' + value + '</li>'
}
if (physicsQunatity[1] !== 'Time') {
value = parseFloat(param.value[1] / unitTable.yValueScale[unitTable.yUnit]).toFixed(3) + unitTable.yUnit
tip += '<li>' + physicsQunatity[1] + ' = ' + value + '</li>'
if (unitTable.yName !== 'Time') {
value = parseFloat(param.value[1] / unitTable.yScale[unitTable.yUnit]).toFixed(3) + unitTable.yUnit
tip += '<li>' + unitTable.yName + ' = ' + value + '</li>'
}
tip += '</ul></span>'
}
+1 -1
View File
@@ -20,7 +20,7 @@ function newState () {
},
isLoading: true,
licenseCheck: true,
developer_mode: false,
developerMode: false,
controller: null,
}
}
+5
View File
@@ -91,6 +91,11 @@ export default new Router({
path: '/admin/:mode?',
component: AppLayout,
children: [
{
name: 'test',
path: 'test',
component: () => import('../components/dashboard/test.vue'),
},
{
name: 'dashboard',
path: 'dashboard',
@@ -18,7 +18,8 @@ const chartActs = {
*
**/
[typePath.initCustomizedFromCache]: async ({ state, getters, commit, dispatch }, payload) => {
const cacheData = await localforage.getItem('chart_data')
const { controllerID } = payload
const cacheData = await localforage.getItem('chart_data_' + controllerID)
if (cacheData !== null) {
// use ID to create new chart by cache
for (const _chart of Object.values(cacheData)) {
@@ -46,6 +47,7 @@ const chartActs = {
*
*/
[typePath.saveToCache]: async ({ state, getters, commit, dispatch }, payload) => {
const { controllerID } = payload
const _chartData = {}
for (const [_id, _chart] of Object.entries(state.chartData)) {
// manual chart clear series data
@@ -54,7 +56,7 @@ const chartActs = {
_chartData[_id].series.map((ele) => { ele.data.length = 0 })
}
}
await localforage.setItem('chart_data', _chartData)
await localforage.setItem('chart_data_' + controllerID, _chartData)
},
/*
* add chartID to chartData
@@ -229,13 +231,17 @@ const chartActs = {
state.chartData[chartID].xAxis[_xAxisIndex].seriesIndex.push(_seriesIndex)
state.chartData[chartID].yAxis[_yAxisIndex].seriesIndex.push(_seriesIndex)
// state.chartData[chartID].xAxis[_xAxisIndex].boundaryGap = [0, '5%']
// state.chartData[chartID].yAxis[_yAxisIndex].boundaryGap = [0, '10%']
// console.log(state.chartData[chartID])
// set xAxis format
// TODO: need to get the time unit for the CanvasChart
if (sourceList[0].name === 'Time') {
state.chartData[chartID].xAxis[_xAxisIndex].axisLabel.formatter = function (val) {
return getTimeFormatter(val)
}
state.chartData[chartID].xAxis[_xAxisIndex].interval = 500 * 1000
// state.chartData[chartID].xAxis[_xAxisIndex].interval = 500 * 1000
} else if (sourceList[0].name === 'Elite') {
// state.chartData[chartID].series[state.chartData[chartID].series.length - 1].sampling = false
switch (sourceList[0].channel) {
@@ -260,7 +266,7 @@ const chartActs = {
default:
break
}
} else if (sourceList[0].name === 'EliteEIS') {
} else if (sourceList[0].name.includes('EIS')) {
switch (sourceList[0].channel) {
case 3:
state.chartData[chartID].xAxis[_xAxisIndex].axisLabel.formatter = function (val) {
@@ -356,7 +362,7 @@ const chartActs = {
default:
break
}
} else if (sourceList[1].name === 'EliteEIS') {
} else if (sourceList[1].name.includes('EIS')) {
switch (sourceList[1].channel) {
case 3:
state.chartData[chartID].yAxis[_yAxisIndex].axisLabel.formatter = function (val) {
@@ -740,7 +746,6 @@ const chartActs = {
// }
return false
}
// get data from buffer
const popDataX = dataStreamBuffer.pop(chartID, rawDeviceIDX, series.xAxisSource[1])
const popDataY = dataStreamBuffer.pop(chartID, rawDeviceIDY, series.yAxisSource[1])
@@ -834,6 +839,11 @@ const chartActs = {
}
}
})
const popCycle = dataStreamBuffer.pop(chartID, state.chartData[chartID].mappingID, 4)
if (popCycle.length) {
state.chartData[chartID].cycle = popCycle.at(-1).data
}
},
/**
* generate default chart
@@ -1147,7 +1157,7 @@ function makeXAxis (gridIndex, type, channel) {
showMaxLabel: false,
color: '#34495e',
// rotate: 45,
margin: 12,
// margin: 12,
},
splitLine: { show: true, lineStyle: { color: '#aaa' } },
// minorSplitLine: {
@@ -1202,8 +1212,8 @@ function makeYAxis (gridIndex, type, channel) {
// generate grid
function makeGrid (index, length) {
const _height = (85 / length) + '%'
const _top = index * (85 / length) + 1 + '%'
const _height = (80 / length) + '%'
const _top = index * (80 / length) + 5 + '%'
return {
index: index,
top: _top,