Compare commits

...

3 Commits

Author SHA1 Message Date
nthu1080112244 3fce79d6c9 [update] replay control panel & real time layout 2022-08-12 18:57:42 +08:00
nthu1080112244 fc5c222dc7 [update] unit and functional can works 2022-08-10 18:09:38 +08:00
nthu1080112244 868577de7d [update] new comtrol panel block 2022-08-10 12:06:35 +08:00
15 changed files with 856 additions and 212 deletions
+1 -3
View File
@@ -71,9 +71,7 @@ localforage.config({ name: 'bioprovue' })
let MqttUrl
// for developer
if (process.env.NODE_ENV === 'development') {
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.42:8083'
// MqttUrl = 'ws://192.168.5.57:8083'
// MqttUrl = 'ws://192.168.5.57:8080'
} else {
@@ -79,6 +79,7 @@ export default {
'startTimeCurrent',
'endTimeCurrent',
'sampleMethod',
'controlPanel',
]),
},
props: {
@@ -371,7 +372,6 @@ 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'],
@@ -380,7 +380,6 @@ export default {
// 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
@@ -393,7 +392,7 @@ export default {
})
let scale = '1'
if (this.axisXDataType.description === 'Time') {
if (this.controlPanel.x.type === 'Time') {
scale = await this.computeResampleScale(metaInfo, timeDur)
}
// elite的sample rate不像neulive這麼高,因此試試scale = 100 or 1000時不要再sampling一次了,不然有些形狀(e.g. peak)會不一樣
@@ -412,11 +411,11 @@ export default {
this.currentScale = scale
this.chartDetailData.series[_gridNumber].data.length = 0
let dataListX
const channelX = parseInt(this.axisXDataType.id)
if (this.axisXDataType.description !== 'Time') {
const channelX = parseInt(this.controlPanel.x.channel)
if (this.controlPanel.x.type !== 'Time') {
dataListX = this.dataInfo[meta][channelX][scale]
}
const channelY = parseInt(this.axisYDataType.id)
const channelY = parseInt(this.controlPanel.y.channel)
const dataListY = this.dataInfo[meta][channelY][scale]
const isThisModeHasCycle = this.GLOBAL.hasCycleMode(metaInfo.parameter_set.MODE, metaInfo.device.library_name)
@@ -463,7 +462,7 @@ export default {
for (let i = startIndex; i <= endIndex; i++) {
const data = await this.getData(parseInt(scale), this.sampleMethod, dataListY[i].id, channelY, metaInfo)
let dataX
if (this.axisXDataType.description !== 'Time') {
if (this.controlPanel.x.type !== 'Time') {
dataX = await this.getData(parseInt(scale), this.sampleMethod, dataListX[i].id, channelX, metaInfo)
}
var deltaX = 0
@@ -565,7 +564,7 @@ export default {
}
}
if (this.axisXDataType.description === 'Time') {
if (this.controlPanel.x.type === 'Time') {
this.chartDetailData.xAxis[_gridNumber].min = _startTime
this.chartDetailData.xAxis[_gridNumber].max = _endTime
} else {
@@ -575,7 +574,7 @@ export default {
_gridNumber += 1
}
if (this.axisXDataType.description !== 'Time') {
if (this.controlPanel.x.type !== 'Time') {
this.showOverviewChart = false
this.detailchartheight = '88vh'
// this.$refs.chart_detail.updateChartHeight()
@@ -607,33 +606,65 @@ export default {
}
},
changeAxis (gridIndex) {
// if (this.initDone) {
// const libName = this.metaList[gridIndex].device.library_name
// let xType
// let xValue
// if (this.axisXDataType.description === 'Time') {
// xType = 'Time'
// } else {
// if (libName === 'EliteZM15' || libName.includes('Elite_EDC')) {
// xType = 'Elite'
// } else if (libName.includes('EIS')) {
// xType = 'EliteEIS'
// }
// xValue = this.axisXDataType.id + 1
// }
// this.updateRegisteredChart({
// chartAllData: this.chartData,
// chartID: this.chartDetailData.chartID,
// gridIndex: gridIndex,
// deviceNameX: xType,
// deviceIDX: this.metaList[gridIndex].name,
// channelX: xValue,
// deviceNameY: libName.includes('EIS') ? 'EliteEIS' : 'Elite',
// deviceIDY: '',
// channelY: this.axisYDataType.id + 1,
// })
// console.log({
// chartAllData: this.chartData,
// chartID: this.chartDetailData.chartID,
// gridIndex: gridIndex,
// deviceNameX: xType,
// deviceIDX: this.metaList[gridIndex].name,
// channelX: xValue,
// deviceNameY: libName.includes('EIS') ? 'EliteEIS' : 'Elite',
// deviceIDY: '',
// channelY: this.axisYDataType.id + 1,
// })
// }
// if (this.axisXDataType.description === 'Time') {
// this.drawOverviewData()
// }
// this.drawDetailData() // reDraw
// tang
if (this.initDone) {
const libName = this.metaList[gridIndex].device.library_name
let xType
let xValue
if (this.axisXDataType.description === 'Time') {
xType = 'Time'
} else {
if (libName === 'EliteZM15' || libName.includes('Elite_EDC')) {
xType = 'Elite'
} else if (libName.includes('EIS')) {
xType = 'EliteEIS'
}
xValue = this.axisXDataType.id + 1
}
const xType = (this.controlPanel.x.type === 'Time') ? 'Time' : ((libName === 'EliteZM15' || libName.includes('Elite_EDC') ? 'Elite' : 'EliteEIS'))
const xChannel = (this.controlPanel.x.channel === -1) ? undefined : this.controlPanel.x.channel + 1
this.updateRegisteredChart({
chartAllData: this.chartData,
chartID: this.chartDetailData.chartID,
gridIndex: gridIndex,
deviceNameX: xType,
deviceIDX: this.metaList[gridIndex].name,
channelX: xValue,
channelX: xChannel,
deviceNameY: libName.includes('EIS') ? 'EliteEIS' : 'Elite',
deviceIDY: '',
channelY: this.axisYDataType.id + 1,
channelY: this.controlPanel.y.channel + 1,
})
}
if (this.axisXDataType.description === 'Time') {
if (this.controlPanel.x.type === 'Time') {
this.drawOverviewData()
}
this.drawDetailData() // reDraw
@@ -656,7 +687,7 @@ export default {
}
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])
deltaX = Math.abs(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
@@ -63,7 +63,53 @@
</div>
</div>
</va-collapse> -->
<specific-integral :ref="'specific_integral'" @setBrushBoundary="setBrushBoundary" />
<!-- tang -->
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
<p class="display-6"> X-test </p>
</div>
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-axis-b :ref="'axis_x'" axis="x" @changeAxis="changeAxis"/>
</div>
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-unit-b
:ref="'unit_x'"
axis="x"
@changeUnit="refreshFormatter"
/>
</div>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-funct-b :ref="'funct_x'" axis="x" @changeFunct="changeFunct"/>
</div>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0">
<p class="display-6"> Y-test </p>
</div>
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-axis-b
:ref="'axis_y'"
axis="y"
@changeAxis="changeAxis"
/>
</div>
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-unit-b
:ref="'unit_y'"
axis="y"
@changeUnit="refreshFormatter"/>
</div>
</div>
<div class="flex-container mb-2">
<div class="flex sm2 xl2 md2 xs2 px-0 py-0" />
<div class="flex sm5 xl5 md5 xs5 pl-1 pr-0 py-0">
<change-funct-b :ref="'funct_y'" axis="y" @changeFunct="changeFunct"/>
</div>
</div>
<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"/>
@@ -82,8 +128,11 @@
<script>
import ShowResampleRate from '@/components/analysis/replay/toolbox/ShowResampleRate.vue'
import ChangeAxis from '@/components/analysis/replay/toolbox/ChangeAxis.vue'
import ChangeAxisB from '@/components/analysis/replay/toolbox/ChangeAxisB.vue'
import ChangeUnit from '@/components/analysis/replay/toolbox/ChangeUnit.vue'
import ChangeUnitB from '@/components/analysis/replay/toolbox/ChangeUnitB.vue'
import ChangeScale from '@/components/analysis/replay/toolbox/ChangeScale.vue'
import ChangeFunctB from '@/components/analysis/replay/toolbox/ChangeFunctB.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'
@@ -93,15 +142,21 @@ import EditFileName from '@/components/analysis/replay/toolbox/EditFileName.vue'
import ShowParameter from '@/components/analysis/replay/toolbox/ShowParameter.vue'
import LockDataZoom from '@/components/analysis/replay/toolbox/LockDataZoom.vue'
import ChangeWindowStartAndSize from '@/components/analysis/replay/toolbox/ChangeWindowStartAndSize.vue'
import { mapMutations } from 'vuex'
import { mapFields } from 'vuex-map-fields'
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
import types from '@/store/modules/analysis/replay/types'
export default {
name: 'top-control-panel',
components: {
ShowResampleRate,
ChangeAxis,
ChangeAxisB,
ChangeUnit,
ChangeUnitB,
ChangeScale,
ChangeFunctB,
ChangeCycle,
AbsToggle,
SpecificIntegral,
@@ -114,8 +169,10 @@ export default {
},
computed: {
...mapFields('replay', [
'chartData',
'metaList',
'showCyclePanel',
'controlPanel',
]),
},
props: {
@@ -127,13 +184,57 @@ export default {
deviceName: '',
showCycle: false,
innerCollapse: false,
tableRouter,
}
},
mqtt: {
},
methods: {
...mapMutations('replay', [types.chart.updateAxisLabel]),
refreshFormatter (axis) {
this.updateAxisLabelChart({
chartID: 1,
axis: axis,
axisIndex: 0,
channel: -1,
})
this.refreshChart(this.chartData[1])
},
changeFunct (axis) {
this.refreshUnit()
this.refreshFormatter(axis)
this.$emit('changeFunctional', axis, this.controlPanel[axis].funct)
this.$emit('changeAxis', 0)
},
refreshAxis () {
const xType = this.controlPanel.x.type
const yType = this.controlPanel.y.type
const xFunct = this.controlPanel.x.funct
const yFunct = this.controlPanel.y.funct
this.$refs.axis_x.refreshAxis(xType, xFunct, yType, yFunct)
this.$refs.axis_y.refreshAxis(xType, xFunct, yType, yFunct)
},
refreshUnit (axis) {
const xType = this.controlPanel.x.type
const yType = this.controlPanel.y.type
const xFunct = this.controlPanel.x.funct
const yFunct = this.controlPanel.y.funct
if (axis === 'x') {
this.$refs.unit_x.refreshUnit(xType, xFunct, yType, yFunct)
} else {
this.$refs.unit_y.refreshUnit(xType, xFunct, yType, yFunct)
}
},
init () {
//
this.deviceName = this.metaList[0].device.library_name
// tang
this.initDefaultControlPanel()
this.$refs.axis_x.init()
this.$refs.funct_x.init()
this.$refs.unit_x.init(this.controlPanel.x.type)
this.$refs.axis_y.init()
this.$refs.funct_y.init()
this.$refs.unit_y.init(this.controlPanel.y.type)
//
this.$refs.change_unit_x.init(this.deviceName)
this.$refs.change_unit_y.init(this.deviceName)
this.$refs.change_axis_x.init(this.deviceName)
@@ -157,7 +258,15 @@ export default {
this.$emit('changeFunctional', axis, functional)
},
changeAxis (gridIndex) {
this.$refs.funct_x.init()
this.$refs.funct_y.init()
this.$refs.unit_x.init(this.controlPanel.x.type)
this.$refs.unit_y.init(this.controlPanel.y.type)
this.refreshFormatter('x')
this.refreshFormatter('y')
this.$emit('changeAxis', gridIndex)
this.$emit('changeFunctional', 'x', 'Linear')
this.$emit('changeFunctional', 'y', 'Linear')
},
changeUnit (axis) {
if (axis === 'x') {
@@ -175,7 +284,6 @@ export default {
unit_x: this.$refs.change_unit_x.getUnitByAxis(),
unit_y: this.$refs.change_unit_y.getUnitByAxis(),
}
// console.log('panelInfo: ', panelInfo)
return panelInfo
},
clearCycle () {
@@ -188,6 +296,112 @@ export default {
this.innerCollapse = this.innerCollapse ? false : true
console.log(this.innerCollapse)
}, */
initDefaultControlPanel () {
// use state meta to decide which default unit need to be used (like check I-V mode...)
const setting = this.GLOBAL.getDefaultChartTypeByMode(this.metaList[0].parameter_set.MODE, this.deviceName)
// x-axis
let settingType = setting[0]
let settingValue = setting[1]
if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
if (settingType === 'Elite') {
// 1: I, 2: V, 3: R, 4: cycle
if (settingValue === 1) {
this.controlPanel.x.type = 'Current'
this.controlPanel.x.channel = 0
} else if (settingValue === 2) {
this.controlPanel.x.type = 'Voltage'
this.controlPanel.x.channel = 1
} else if (settingValue === 3) {
this.controlPanel.x.type = 'Resistance'
this.controlPanel.x.channel = 2
} else if (settingValue === 4) {
this.controlPanel.x.type = 'Cycle'
this.controlPanel.x.channel = 3
}
} else if (settingType === 'Time') {
this.controlPanel.x.type = 'Time'
this.controlPanel.x.channel = undefined
}
} else if (this.deviceName.includes('EIS')) {
if (settingType.includes('EIS')) {
if (settingValue === 3) {
this.controlPanel.x.type = 'Frequency'
} else if (settingValue === 5 || settingValue === 6 || settingValue === 7) {
this.controlPanel.x.type = 'Impedance'
} else if (settingValue === 8) {
this.controlPanel.x.type = 'Phase'
} else if (settingValue === 9) {
this.controlPanel.x.type = 'Current'
} else if (settingValue === 10) {
this.controlPanel.x.type = 'Default'
}
} else if (settingType === 'Elite') {
// 1: I, 2: V, 3: R
if (settingValue === 1) {
this.controlPanel.x.type = 'Current'
} else if (settingValue === 2) {
this.dataTcontrolPanel.xype = 'Voltage'
} else if (settingValue === 3) {
this.controlPanel.x.type = 'Resistance'
}
} else if (settingType === 'Time') {
this.controlPanel.x.type = 'Time'
}
}
// y-axis
settingType = setting[2]
settingValue = setting[3]
if (this.deviceName === 'EliteZM15' || this.deviceName.includes('Elite_EDC')) {
if (settingType === 'Elite') {
// 1: I, 2: V, 3: R, 4: cycle
if (settingValue === 1) {
this.controlPanel.y.type = 'Current'
this.controlPanel.y.channel = 0
} else if (settingValue === 2) {
this.controlPanel.y.type = 'Voltage'
this.controlPanel.y.channel = 1
} else if (settingValue === 3) {
this.controlPanel.y.type = 'Resistance'
this.controlPanel.y.channel = 2
} else if (settingValue === 4) {
this.controlPanel.y.type = 'Cycle'
this.controlPanel.y.channel = 3
}
} else if (settingType === 'Time') {
this.controlPanel.y.type = 'Time'
this.controlPanel.y.channel = undefined
}
} else if (this.deviceName.includes('EIS')) {
if (settingType.includes('EIS')) {
if (settingValue === 3) {
this.controlPanel.y.type = 'Frequency'
} else if (settingValue === 5 || settingValue === 6 || settingValue === 7) {
this.controlPanel.y.type = 'Impedance'
} else if (settingValue === 8) {
this.controlPanel.y.type = 'Phase'
} else if (settingValue === 9) {
this.controlPanel.y.type = 'Current'
} else if (settingValue === 10) {
this.controlPanel.y.type = 'Default'
}
} else if (settingType === 'Elite') {
// 1: I, 2: V, 3: R
if (settingValue === 1) {
this.controlPanel.y.type = 'Current'
} else if (settingValue === 2) {
this.dataTcontrolPanel.xype = 'Voltage'
} else if (settingValue === 3) {
this.controlPanel.y.type = 'Resistance'
}
} else if (settingType === 'Time') {
this.controlPanel.y.type = 'Time'
}
}
},
},
mounted () {
},
@@ -0,0 +1,79 @@
<template>
<div>
<va-select
v-model="controlPanel[axis].type"
testBy="name"
class="va-select-without-margin"
:options="typeOption"
:noClear='true'
@input="changeAxis()"
/>
</div>
</template>
<script>
import { mapFields } from 'vuex-map-fields'
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
export default {
name: 'change-axis-b',
props: {
axis: {
type: String, // x or y
},
},
data () {
return {
typeOption: [],
tableRouter,
}
},
computed: {
...mapFields('replay', [
'controlPanel',
]),
},
methods: {
init (type) {
if (this.axis === 'x') {
this.typeOption = [
'Time',
'Cycle',
'Current',
'Voltage',
'Resistance',
]
} else {
this.typeOption = [
'Current',
'Voltage',
'Resistance',
]
}
},
refreshAxis (xType, xFunct, yType, yFunct) {
const [xTable, yTable] = this.tableRouter.getTable(xType, xFunct, yType, yFunct)
if (this.axis === 'x') {
this.controlPanel[this.axis].type = xTable.name
this.controlPanel[this.axis].channel = xTable.channel
} else {
this.controlPanel[this.axis].type = yTable.name
this.controlPanel[this.axis].channel = yTable.channel
}
},
changeAxis () {
this.controlPanel[this.axis].channel = tableRouter.getChannel(this.controlPanel[this.axis].type)
this.$emit('changeAxis', 0)
this.$emit('changeUnit', this.axis)
},
},
}
</script>
<style lang="scss">
.va-select-without-margin {
.va-select {
margin-bottom: 0;
}
}
</style>
@@ -0,0 +1,55 @@
<template>
<div>
<va-radio-button
v-for="(funct, index) in functOption"
:key="index"
v-model="controlPanel[axis].funct"
:option="funct"
@input="changeFunct()"
/>
</div>
</template>
<script>
import { mapFields } from 'vuex-map-fields'
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
export default {
name: 'change-funct-b',
props: {
axis: {
type: String, // x or y
},
},
data () {
return {
funct: '',
functOption: [],
tableRouter,
}
},
computed: {
...mapFields('replay', [
'controlPanel',
]),
},
methods: {
init () {
this.controlPanel[this.axis].funct = 'Linear'
this.functOption = this.tableRouter.getFunct(this.axis)
},
changeFunct () {
this.$emit('changeFunct', this.axis)
},
},
}
</script>
<style lang="scss">
.va-select-without-margin {
.va-select {
margin-bottom: 0;
}
}
</style>
@@ -0,0 +1,65 @@
<template>
<div>
<va-select
@input="changeUnit()"
v-model="controlPanel[axis].unit"
class="va-select-without-margin"
:options="unitOption"
:noClear='true'
/>
</div>
</template>
<script>
import { mapFields } from 'vuex-map-fields'
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
export default {
name: 'change-unit-b',
props: {
axis: {
type: String, // x or y
},
},
data () {
return {
unit: '',
unitOption: [],
tableRouter,
}
},
computed: {
...mapFields('replay', [
'controlPanel',
]),
},
methods: {
init (type) {
this.controlPanel[this.axis].unit = this.tableRouter.getDefaultUnit(type)
this.unitOption = Object.keys(this.tableRouter.getOption(type))
},
refreshUnit (xType, xFunct, yType, yFunct) {
const [xTable, yTable] = this.tableRouter.getTable(xType, xFunct, yType, yFunct)
if (this.axis === 'x') {
this.controlPanel[this.axis].unit = xTable.defaultUnit
this.unitOption = Object.keys(xTable.option)
} else {
this.controlPanel[this.axis].unit = yTable.defaultUnit
this.unitOption = Object.keys(yTable.option)
}
},
changeUnit () {
this.$emit('changeUnit', this.axis)
},
},
}
</script>
<style lang="scss">
.va-select-without-margin {
.va-select {
margin-bottom: 0;
}
}
</style>
@@ -0,0 +1,163 @@
const chartTable = {
// axis type
Time: {
name: 'Time',
channel: -1,
option: {
auto: 1,
},
defaultUnit: 'auto',
downloadUnit: 'auto',
},
Current: {
name: 'Current',
channel: 0,
option: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: 'A',
downloadUnit: 'A',
},
Voltage: {
name: 'Voltage',
channel: 1,
option: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'V',
downloadUnit: 'V',
},
Resistance: {
name: 'Resistance',
channel: 2,
option: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
Cycle: {
name: 'Cycle',
channel: 3,
option: {
cycle: 1,
},
defaultUnit: 'cycle',
downloadUnit: 'cycle',
},
Charge: {
name: 'Charge',
channel: -1,
option: {
nC: 1e6,
uC: 1e9,
mC: 1e12,
C: 1e15,
},
defaultUnit: 'C',
downloadUnit: 'C',
},
Power: {
name: 'Power',
channel: -1,
option: {
mW: 1e12,
W: 1e15,
kW: 1e18,
},
defaultUnit: 'W',
downloadUnit: 'W',
},
Transconductance: {
name: 'Transconductance',
channel: -1,
option: {
'mA/V': 1,
'A/V': 1e3,
'kA/V': 1e6,
},
defaultUnit: 'A/V',
downloadUnit: 'A/V',
},
Idiot: {
name: 'Idiot',
channel: -1,
option: {
idiot: 1,
},
defaultUnit: 'idiot',
downloadUnit: 'idiot',
},
}
export const tableRouter = {
getChannel: (axis) => {
return chartTable[axis].channel
},
getDefaultUnit: (axis) => {
return chartTable[axis].defaultUnit
},
getOption: (axis) => {
return chartTable[axis].option
},
getTable: (xAxis, xFunct, yAxis, yFunct) => {
var xTable = chartTable[xAxis]
var yTable = chartTable.Idiot
if (yFunct === 'Linear' || yFunct === 'Log') {
yTable = chartTable[yAxis]
} else if (yFunct === 'Integral') {
if (xAxis === 'Time' && yAxis === 'Current') {
yTable = chartTable.Charge
} else if (xAxis === 'Current' && yAxis === 'Voltage') {
yTable = chartTable.Power
} else if (xAxis === 'Voltage' && yAxis === 'Current') {
yTable = chartTable.Power
}
} else if (yFunct === 'Differential') {
if (xAxis === 'Current' && yAxis === 'Voltage') {
yTable = chartTable.Resistance
} else if (xAxis === 'Voltage' && yAxis === 'Current') {
yTable = chartTable.Transconductance
}
}
return [xTable, yTable]
},
getFunct (axis) {
if (axis === 'x') {
return ['Linear', 'Log']
} else {
return ['Linear', 'Log', 'Integral', 'Differential']
}
},
// axisLabel formatter
autoTimeFormatter (val) {
let label = ''
const hour = parseInt(val / 3.6e9)
const minute = parseInt((val % 3.6e9) / 1000000 / 60)
const second = parseInt((val % 6e7) / 1000000)
const millisecond = parseInt((val % 1e6) / 1000)
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 (hour === 0 && minute === 0 && second === 0 && millisecond === 0) {
label += ' 0 ms '
}
return label
},
}
@@ -37,6 +37,60 @@
<canvas-chart-real-time-display
:chartID="chartID" ref="CanvasChartRealTimeDisplay"
/>
<div class="row flex align--left ma-0 pa-0">
<va-input
v-if="chartData[chartID].chartXMode === 'time'"
class="mx-1"
@keyup.enter="timeIntervalChange(timeIntervalInput)"
@blur="timeIntervalChange(timeIntervalInput)"
v-model="timeIntervalInput"
:label="'time-grid'"
>
<p slot="append" style="margin-right: 0;" small>
ms
</p>
</va-input>
<va-input
v-if="chartData[chartID].chartXMode === 'value'"
class="mx-1"
@keyup.enter="xIntervalChange(xIntervalInput)"
@blur="xIntervalChange(xIntervalInput)"
v-model="xIntervalInput"
:label="'x-grid'"
>
<p slot="append" style="margin-right: 0;" small>
{{chartData[chartID].chartXUnit}}
</p>
</va-input>
<va-input
class="mx-1"
@keyup.enter="yIntervalChange(yIntervalInput)"
@blur="yIntervalChange(yIntervalInput)"
v-model="yIntervalInput"
:label="'y-grid'"
>
<p slot="append" style="margin-right: 0;" small>
{{chartData[chartID].chartYUnit}}
</p>
</va-input>
<va-input
v-if="chartData[chartID].chartDevice === 'neulive'"
class="mx-1"
@keyup.enter="threeAxisIntervalChange(threeAxisIntervalInput)"
@blur="threeAxisIntervalChange(threeAxisIntervalInput)"
v-model="threeAxisIntervalInput"
:label="'3axis-grid'"
>
<p slot="append" style="margin-right: 0;" small>
g
</p>
</va-input>
</div>
<div class="row flex ma-0 pa-0" v-if="developer_mode === true">
<canvas-chart-filter :chartID="chartID" :filterIndex="0" />
<canvas-chart-filter :chartID="chartID" :filterIndex="1" />
<canvas-chart-filter :chartID="chartID" :filterIndex="2" />
</div>
<!-- chart -->
<chart :key="taskContentChartKey" :ref="'chart_ref'" :style="'width: '+ cardwidth + '; height: ' + cardheight + ';'" :option="data" @dataZoom="updateZoom" :auto-resize="true"></chart>
</div>
@@ -1,16 +1,17 @@
<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"/>
<div class="col flex xs2 sm2 lg2 md2 xl2 xxl1" pa-0 ma-0>
<p color="primary" style="text-align: right;">{{ grid.name }}</p>
<!-- cycle -->
<div class="col flex sm2 xl2 md2 xs2"
v-show="data !== null && data.cycle > 0"
>
<va-input
label="cycle no."
v-model="data.cycle"
:options="grid.xUnitOption"
noClear
/>
</div>
<!-- value (y-axis) -->
<div class="col flex sm2 xl2 md2 xs2">
@@ -29,7 +30,6 @@
noClear
/>
</div>
<div class="col flex sm1 xl1 md1 xs1"></div>
<!-- value (x-axis) -->
<div class="col flex sm2 xl2 md2 xs2">
<va-input
@@ -171,7 +171,7 @@ export default {
this.data.xAxis[gridIndex].axisLabel.formatter = this.timeFormatter
} else {
this.data.xAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _xScale).toFixed(2) + _xUnit
return parseFloat(val / _xScale).toFixed(3) + _xUnit
}
}
// update yAxis.formatter
@@ -179,7 +179,7 @@ export default {
this.data.yAxis[gridIndex].axisLabel.formatter = this.timeFormatter
} else {
this.data.yAxis[gridIndex].axisLabel.formatter = function (val) {
return parseFloat(val / _yScale).toFixed(2) + _yUnit
return parseFloat(val / _yScale).toFixed(3) + _yUnit
}
}
// update tooltip.formatter
@@ -252,6 +252,7 @@ export default {
},
realTime: {
handler: function () {
this.updateValue()
this.matchFormatter()
},
deep: true,
@@ -93,7 +93,7 @@ const chartTable = {
// 1
{
default: {
name: 'Resistor',
name: 'Resistance',
unit: {
: 1,
Ω: 1e3,
+32 -85
View File
@@ -1,3 +1,5 @@
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
function getTime (val) {
let label = ''
const hour = Math.floor(val / 3.6e9)
@@ -23,7 +25,7 @@ function getTime (val) {
return label
}
function newTooltip (chartID) {
function newTooltip (controlPanel) {
return {
hideDelay: 5000,
trigger: 'axis',
@@ -32,92 +34,37 @@ function newTooltip (chartID) {
borderWidth: 1,
borderRadius: 0,
padding: 10,
// axisPointer: {
// type: 'cross',
// animation: false,
// label: {
// backgroundColor: '#505765',
// },
// },
formatter: function (params) {
if (params.length) {
if (params[0].seriesName.split('_')[0] === 'T' && params[0].seriesName.split('_')[1] !== 'T') {
params.unshift({ seriesName: 'Time', value: [null, getTime(parseFloat(params[0].value[0]))], color: '#5193f2' })
} else if (params[0].seriesName.split('_')[0] !== 'T' && params[0].seriesName.split('_')[1] === 'T') {
params.unshift({ seriesName: 'Time', value: [null, getTime(parseFloat(params[0].value[1]))], color: '#5193f2' })
} else {
params.unshift({ seriesName: 'Time', value: [null, getTime(parseFloat(params[0].value[2]))], color: '#5193f2' })
}
let tip = ''
for (var i = 0; i < params.length; i++) {
const param = params[i]
const style = 'color: ' + param.color
let value
// console.log(param.value)
if (param.seriesName === 'Time') {
value = param.value[1]
} else if (param.seriesName.split('_')[1] === 'T' && param.seriesName.split('_')[0] !== 'T') {
const physicalQuantity = param.seriesName.split('_')[0][param.seriesName.split('_')[0].length - 1]
if (physicalQuantity === 'V') {
value = parseFloat(param.value[0]).toFixed(3) + ' μV'
} else if (physicalQuantity === 'I') {
value = parseFloat(param.value[0]).toFixed(3) + ' nA'
} else if (physicalQuantity === 'R') {
value = parseFloat(param.value[0]).toFixed(3) + ' mΩ'
} else if (physicalQuantity === 'X' || physicalQuantity === 'Y' || physicalQuantity === 'Z' || physicalQuantity === 'M') {
value = (parseFloat(param.value[0]) / 100).toFixed(3) + ' (g)'
} else if (!isNaN(physicalQuantity)) {
value = (parseFloat(param.value[0]) / 1000).toFixed(3) + ' (mV)'
} else {
value = parseFloat(param.value[0]).toFixed(3)
}
} else if (param.seriesName.split('_')[1] !== 'T' && param.seriesName.split('_')[0] === 'T') {
const physicalQuantity = param.seriesName.split('_')[1][param.seriesName.split('_')[1].length - 1]
if (physicalQuantity === 'V') {
value = parseFloat(param.value[1]).toFixed(3) + ' μV'
} else if (physicalQuantity === 'I') {
value = parseFloat(param.value[1]).toFixed(3) + ' nA'
} else if (physicalQuantity === 'R') {
value = parseFloat(param.value[1]).toFixed(3) + ' mΩ'
} else if (physicalQuantity === 'X' || physicalQuantity === 'Y' || physicalQuantity === 'Z' || physicalQuantity === 'M') {
value = (parseFloat(param.value[1]) / 100).toFixed(3) + ' (g)'
} else if (!isNaN(physicalQuantity)) {
value = (parseFloat(param.value[1]) / 1000).toFixed(3) + ' (mV)'
} else {
value = parseFloat(param.value[1]).toFixed(3)
}
} else {
let value1
let value2
if (param.seriesName.split('_')[0][param.seriesName.split('_')[0].length - 1] === 'V') {
value1 = parseFloat(param.value[0]).toFixed(3) + ' μV'
} else if (param.seriesName.split('_')[0][param.seriesName.split('_')[0].length - 1] === 'I') {
value1 = parseFloat(param.value[0]).toFixed(3) + ' nA'
} else if (param.seriesName.split('_')[0][param.seriesName.split('_')[0].length - 1] === 'R') {
value1 = parseFloat(param.value[0]).toFixed(3) + ' mΩ'
} else {
value1 = parseFloat(param.value[0]).toFixed(3)
}
if (param.seriesName.split('_')[1][param.seriesName.split('_')[1].length - 1] === 'V') {
value2 = parseFloat(param.value[1]).toFixed(3) + ' μV'
} else if (param.seriesName.split('_')[1][param.seriesName.split('_')[1].length - 1] === 'I') {
value2 = parseFloat(param.value[1]).toFixed(3) + ' nA'
} else if (param.seriesName.split('_')[1][param.seriesName.split('_')[1].length - 1] === 'R') {
value2 = parseFloat(param.value[1]).toFixed(3) + ' mΩ'
} else {
value2 = parseFloat(param.value[1]).toFixed(3)
}
value = value1 + ', ' + value2
}
tip += '<span style="' + style + '">' +
param.seriesName +
'</span><span style="' +
style + '">' + value + '</span><br>'
}
return tip
// params is empty
if (!params.length) return params
// else return params
// params is unempty
let tip = ''
let value // value on cursor
const param = params[0]// find coressonding parameter to the channel
const style = 'color: ' + param.color
const [xTable, yTable] = tableRouter.getTable(controlPanel.x.type, controlPanel.x.funct, controlPanel.y.type, controlPanel.y.funct) // unit is store in this object
// (Default) Time
if (controlPanel.x.type === 'Time') {
value = getTime(parseFloat(param.value[0]))
} else {
value = getTime(parseFloat(param.value[2]))
}
tip += '<span style="color: #000000">' + 'Time: ' + value + '</span><br>'
// (Manual) Voltage, Current, Resistance
tip += '<span style="' + style + '">' + param.seriesName + ':<ul style = "list-style-type: disc; list-style-position: inside">'
if (controlPanel.x.type !== 'Time') {
value = parseFloat(param.value[0] / xTable.option[controlPanel.x.unit]).toFixed(3) + ' ' + controlPanel.x.unit
tip += '<li>' + xTable.name + ' = ' + value + '</li>'
}
if (controlPanel.y.type !== 'Time') {
value = parseFloat(param.value[1] / yTable.option[controlPanel.y.unit]).toFixed(3) + ' ' + controlPanel.y.unit
tip += '<li>' + yTable.name + ' = ' + value + '</li>'
}
tip += '</ul></span>'
return tip
},
}
}
+2 -2
View File
@@ -50,7 +50,7 @@ function newTooltip (realTime, dataMode) {
} else {
value = getTime(parseFloat(params[0].value[timeIndex]))
}
tip += '<span style="color: #5193f2">' + 'Time: ' + value + '</span><br>'
tip += '<span style="color: #000000">' + 'Time: ' + value + '</span><br>'
// (Manual) Voltage, Current, Impedance
for (let gridIndex = 0; gridIndex < realTime.length; gridIndex++) {
for (let channelIndex = 0; channelIndex < realTime[gridIndex].length; channelIndex++) {
@@ -60,7 +60,7 @@ function newTooltip (realTime, dataMode) {
unitTable = realTime[gridIndex][channelIndex]
style = 'color: ' + param.color
tip += '<span style="' + style + '">' + param.seriesName + ':<ul style = "list-style-type: disc; list-style-position: inside">'
tip += '<span style="' + style + '">' + param.seriesName + ':<ul style = "list-style-type: disc; list-style-position: inside">'
if (unitTable.xName !== 'Time') {
value = parseFloat(param.value[0] / unitTable.xScale[unitTable.xUnit]).toFixed(3) + unitTable.xUnit
tip += '<li>' + unitTable.xName + ' = ' + value + '</li>'
@@ -113,16 +113,16 @@ function getLegendName (sourceList) {
case 'Elite':
switch (source.channel) {
case 1:
legendName += '' + source.id + '-I'
legendName += '' + source.id + 'I'
break
case 2:
legendName += '' + source.id + '-V'
legendName += '' + source.id + 'V'
break
case 3:
legendName += '' + source.id + '-R'
legendName += '' + source.id + 'R'
break
case 4:
legendName += '' + source.id + '-Cycle'
legendName += '' + source.id + 'Cycle'
break
default:
legendName += '' + source.id + 'CH' + source.channel
@@ -132,28 +132,28 @@ function getLegendName (sourceList) {
case 'EliteEIS':
switch (source.channel) {
case 3:
legendName += '' + source.id + '-Frequency'
legendName += '' + source.id + 'Frequency'
break
case 4:
legendName += '' + source.id + '-Cycle'
legendName += '' + source.id + 'Cycle'
break
case 5:
legendName += '' + source.id + '-Z_imag'
legendName += '' + source.id + 'Z-imag'
break
case 6:
legendName += '' + source.id + '-Z_real'
legendName += '' + source.id + 'Z-real'
break
case 7:
legendName += '' + source.id + '-Impedance'
legendName += '' + source.id + 'Impedance'
break
case 8:
legendName += '' + source.id + '-Phase'
legendName += '' + source.id + 'Phase'
break
case 9:
legendName += '' + source.id + '-Current'
legendName += '' + source.id + 'Current'
break
case 10:
legendName += '' + source.id + '-Gain Level'
legendName += '' + source.id + 'Gain Level'
break
default:
legendName += '' + source.id + 'CH' + source.channel
@@ -210,7 +210,7 @@ const actions = {
if (payload.chartAllData[payload.chartID] == null) {
payload.chartAllData[payload.chartID] = newChart(payload.chartID)
if (payload.type !== 'overview') {
payload.chartAllData[payload.chartID].tooltip = newTooltip()
payload.chartAllData[payload.chartID].tooltip = newTooltip(state.controlPanel)
}
payload.chartAllData[payload.chartID].chartType = payload.type
payload.chartAllData[payload.chartID].chartDevice = payload.device
@@ -1,4 +1,5 @@
import types from '@/store/modules/analysis/replay/types'
import { tableRouter } from '@/components/analysis/replay/toolbox/EliteReplayTable'
const typePath = types.chart
@@ -33,16 +34,16 @@ function getLegendName (sourceList) {
case 'Elite':
switch (source.channel) {
case 1:
legendName += '' + source.id + '-I'
legendName += '' + source.id + 'I'
break
case 2:
legendName += '' + source.id + '-V'
legendName += '' + source.id + 'V'
break
case 3:
legendName += '' + source.id + '-R'
legendName += '' + source.id + 'R'
break
case 4:
legendName += '' + source.id + '-Cycle'
legendName += '' + source.id + 'Cycle'
break
default:
legendName += '' + source.id + 'CH' + source.channel
@@ -52,28 +53,28 @@ function getLegendName (sourceList) {
case 'EliteEIS':
switch (source.channel) {
case 3:
legendName += '' + source.id + '-Frequency'
legendName += '' + source.id + 'Frequency'
break
case 4:
legendName += '' + source.id + '-Cycle'
legendName += '' + source.id + 'Cycle'
break
case 5:
legendName += '' + source.id + '-Z_imag'
legendName += '' + source.id + 'Z-imag'
break
case 6:
legendName += '' + source.id + '-Z_real'
legendName += '' + source.id + 'Z-real'
break
case 7:
legendName += '' + source.id + '-Impedance'
legendName += '' + source.id + 'Impedance'
break
case 8:
legendName += '' + source.id + '-Phase'
legendName += '' + source.id + 'Phase'
break
case 9:
legendName += '' + source.id + '-Current'
legendName += '' + source.id + 'Current'
break
case 10:
legendName += '' + source.id + '-Gain Level'
legendName += '' + source.id + 'Gain-Level'
break
default:
legendName += '' + source.id + 'CH' + source.channel
@@ -99,68 +100,90 @@ const chartMutations = {
* @param {int} axisIndex
* @param {int} channel // use for checking whether it is 3-axis
*/
// [typePath.updateAxisLabel]: (state, payload) => {
// let unit // string
// let unitScale // int
// let axisLabel
// if (payload.axis === 'x') {
// unit = state.valueFormatX.unit
// unitScale = state.valueFormatX.unitScale
// axisLabel = state.chartData[payload.chartID].xAxis[payload.axisIndex].axisLabel
// } else if (payload.axis === 'y') {
// unit = state.valueFormatY.unit
// unitScale = state.valueFormatY.unitScale
// axisLabel = state.chartData[payload.chartID].yAxis[payload.axisIndex].axisLabel
// }
// if (payload.channel < 256) {
// axisLabel.formatter = function (val) {
// let label = ''
// if (unit === 'auto') { // time
// const hour = parseInt(val / 3.6e9)
// const minute = parseInt((val % 3.6e9) / 1000000 / 60)
// const second = parseInt((val % 6e7) / 1000000)
// const millisecond = parseInt((val % 1e6) / 1000)
// if (hour > 0) {
// label += hour + ' h '
// }
// if (minute > 0) {
// label += minute + ' m '
// }
// if (second > 0) {
// label += second + ' s '
// }
// if (millisecond > 0) {
// label += millisecond + ' ms '
// }
// } else { // not time, e.g. I, V, R
// const num = String(val / unitScale)
// label = num + unit
// }
// return label
// }
// } else { // 256: x, 257: y, 258: z, 259: mag
// axisLabel.formatter = function (val) {
// let label = ''
// if (unit === 'auto') { // time
// const hour = parseInt(val / 3.6e9)
// const minute = parseInt((val % 3.6e9) / 1000000 / 60)
// const second = parseInt((val % 6e7) / 1000000)
// const millisecond = parseInt((val % 1e6) / 1000)
// if (hour > 0) {
// label += hour + ' h '
// }
// if (minute > 0) {
// label += minute + ' m '
// }
// if (second > 0) {
// label += second + ' s '
// }
// if (millisecond > 0) {
// label += millisecond + ' ms '
// }
// } else {
// label = val.toFixed(3)
// }
// return label
// }
// }
// tang: try here
[typePath.updateAxisLabel]: (state, payload) => {
let unit // string
let unitScale // int
let axisLabel
let unitScale
const unit = state.controlPanel[payload.axis].unit
const [xTable, yTable] = tableRouter.getTable(state.controlPanel.x.type, state.controlPanel.x.funct, state.controlPanel.y.type, state.controlPanel.y.funct)
if (payload.axis === 'x') {
unit = state.valueFormatX.unit
unitScale = state.valueFormatX.unitScale
axisLabel = state.chartData[payload.chartID].xAxis[payload.axisIndex].axisLabel
} else if (payload.axis === 'y') {
unit = state.valueFormatY.unit
unitScale = state.valueFormatY.unitScale
unitScale = xTable.option[unit]
} else {
axisLabel = state.chartData[payload.chartID].yAxis[payload.axisIndex].axisLabel
unitScale = yTable.option[unit]
}
if (payload.channel < 256) {
if (unit === 'auto') {
axisLabel.formatter = tableRouter.autoTimeFormatter
} else {
axisLabel.formatter = function (val) {
let label = ''
if (unit === 'auto') { // time
const hour = parseInt(val / 3.6e9)
const minute = parseInt((val % 3.6e9) / 1000000 / 60)
const second = parseInt((val % 6e7) / 1000000)
const millisecond = parseInt((val % 1e6) / 1000)
if (hour > 0) {
label += hour + ' h '
}
if (minute > 0) {
label += minute + ' m '
}
if (second > 0) {
label += second + ' s '
}
if (millisecond > 0) {
label += millisecond + ' ms '
}
} else { // not time, e.g. I, V, R
const num = String(val / unitScale)
label = num + unit
}
return label
}
} else { // 256: x, 257: y, 258: z, 259: mag
axisLabel.formatter = function (val) {
let label = ''
if (unit === 'auto') { // time
const hour = parseInt(val / 3.6e9)
const minute = parseInt((val % 3.6e9) / 1000000 / 60)
const second = parseInt((val % 6e7) / 1000000)
const millisecond = parseInt((val % 1e6) / 1000)
if (hour > 0) {
label += hour + ' h '
}
if (minute > 0) {
label += minute + ' m '
}
if (second > 0) {
label += second + ' s '
}
if (millisecond > 0) {
label += millisecond + ' ms '
}
} else {
label = val.toFixed(3)
}
const label = (val / unitScale).toFixed(3) + unit
return label
}
}
@@ -35,6 +35,20 @@ function newState () {
showWhichCycles: '1',
useSdCardData: false,
isLockDataZoom: false,
controlPanel: {
x: {
type: null,
channel: null,
unit: null,
funct: null,
},
y: {
type: null,
channel: null,
unit: null,
funct: null,
},
},
}
}