Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f05581dcf9 | |||
| b12332eaac | |||
| 8267dbd302 |
Generated
+1
@@ -4175,6 +4175,7 @@
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
|
||||
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"is-extglob": "^2.1.1"
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ export default {
|
||||
|
||||
// this.chartNumber = taskInfo.getTaskInfo().chartNumber
|
||||
|
||||
this.dataRefreshTimer = setInterval(this.refreshData, 500)
|
||||
this.dataRefreshTimer = setInterval(this.refreshData, 100)
|
||||
|
||||
// const _this = this
|
||||
// window.onresize = function () { // define the event of window size changing
|
||||
|
||||
@@ -390,7 +390,10 @@ export const chartData = {
|
||||
const _popTime = data.time
|
||||
// series data is empty or popdata time > last series data time
|
||||
if (series.xAxisSource[0] === -1) {
|
||||
if (series.data.length === 0 || _popTime > series.data[series.data.length - 1][0]) {
|
||||
// if (series.data.length === 0 || _popTime > series.data[series.data.length - 1][0]) {
|
||||
if (_popTime < 0) {
|
||||
series.data.push([])
|
||||
} else {
|
||||
series.data.push([_popTime, _popData])
|
||||
// get max/min value
|
||||
if (series.dataYMax < _popData || series.dataYMax == null) {
|
||||
@@ -400,8 +403,12 @@ export const chartData = {
|
||||
series.dataYMin = _popData
|
||||
}
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
if (series.data.length === 0 || _popTime > series.data[series.data.length - 1][1]) {
|
||||
// if (series.data.length === 0 || _popTime > series.data[series.data.length - 1][1]) {
|
||||
if (_popTime < 0) {
|
||||
series.data.push([])
|
||||
} else {
|
||||
series.data.push([_popData, _popTime])
|
||||
// get max/min value
|
||||
if (series.dataXMax < _popData || series.dataXMax == null) {
|
||||
@@ -411,9 +418,11 @@ export const chartData = {
|
||||
series.dataXMin = _popData
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
})
|
||||
|
||||
// console.log(series.data)
|
||||
// series data list shift by points
|
||||
if (series.data.length > _chartData[chartID].maxDots) {
|
||||
series.data.splice(0, series.data.length - _chartData[chartID].maxDots)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// import { taskInfo } from './TaskInfo'
|
||||
|
||||
const _dataStreamBuffer = {}
|
||||
const _dataStreamBufferSize = 10
|
||||
const _dataStreamBufferSize = 1000
|
||||
|
||||
export const dataStreamBuffer = {
|
||||
|
||||
@@ -62,22 +62,26 @@ export const dataStreamBuffer = {
|
||||
|
||||
into: (currentDataByChannel, currentDeviceID, currentChannel) => {
|
||||
// currentData = [ timeStart, d1, d2..... , timeEnd ]
|
||||
const currentData = JSON.parse(currentDataByChannel).binary.split(' ')
|
||||
// const timeStart = parseInt(currentData[0])
|
||||
// const timeEnd = parseInt(currentData[currentData.length - 1])
|
||||
// const currentData = JSON.parse(currentDataByChannel).binary.split(' ')
|
||||
const currentData = currentDataByChannel.split(' ')
|
||||
// console.log(currentData)
|
||||
const timeStart = parseInt(currentData[0])
|
||||
const timeEnd = parseInt(currentData[currentData.length - 1])
|
||||
// // d1, d2..., d100, timeStart=0, timeEnd=100, currentData = [ 0, d1, d2....., 100 ] (100-0)/(102-2)
|
||||
// const timeSpare = parseInt((timeEnd - timeStart) / (currentData.length - 2))
|
||||
const timeSpare = parseInt((timeEnd - timeStart) / (currentData.length - 2))
|
||||
// // add time to each data in a data batch
|
||||
const dataBatch = []
|
||||
for (let i = 0; i < currentData.length - 1; i += 2) {
|
||||
// const dataSplit = currentData[i].split(' ')
|
||||
for (let i = 1; i < currentData.length - 1; i++) {
|
||||
const tmpData = {
|
||||
time: parseInt(currentData[i]),
|
||||
data: currentData[i + 1],
|
||||
// time: parseInt(currentData[i]),
|
||||
time: timeStart + ((i - 1) * timeSpare),
|
||||
data: currentData[i],
|
||||
}
|
||||
// const tmpData = [parseInt(dataSplit[0]), dataSplit[1]]
|
||||
dataBatch.push(tmpData)
|
||||
// const dataSplit = currentData[i].split(' ')
|
||||
}
|
||||
// console.log(dataBatch)
|
||||
// add the datastream to buffer if chart listen the device and channel
|
||||
// if (currentChannel === 8) {
|
||||
// console.log(dataBatch)
|
||||
@@ -98,6 +102,7 @@ export const dataStreamBuffer = {
|
||||
if (_dataStreamBuffer[chart][currentDeviceID][currentChannel].length > _dataStreamBufferSize) {
|
||||
_dataStreamBuffer[chart][currentDeviceID][currentChannel].shift()
|
||||
}
|
||||
// console.log(_dataStreamBuffer[chart][currentDeviceID][currentChannel].length)
|
||||
}
|
||||
}
|
||||
// console.log(_dataStreamBuffer)
|
||||
|
||||
@@ -2,18 +2,19 @@ function newSeries (type, legendName, xAxisIndex, yAxisIndex, xAxisSource, yAxis
|
||||
return {
|
||||
name: legendName,
|
||||
type: type,
|
||||
symbol: 'circle',
|
||||
// symbol: 'circle',
|
||||
showSymbol: false,
|
||||
showAllSymbol: false,
|
||||
symbolSize: 2,
|
||||
// sampling: 'average',
|
||||
sampling: function (frame) {
|
||||
return frame[0]
|
||||
},
|
||||
sampling: 'average',
|
||||
// sampling: function (frame) {
|
||||
// return frame[0]
|
||||
// },
|
||||
// clip the overflow on the coordinate system
|
||||
// clip: true,
|
||||
// ignore mouse events
|
||||
// formula
|
||||
// connectNulls: false,
|
||||
formula: formula,
|
||||
formulaSource: formulaSource,
|
||||
silent: true,
|
||||
|
||||
Reference in New Issue
Block a user