NEZ-3241 feat:Data,Data rate 支持选择 IEC标准或SI标准 换算方式
This commit is contained in:
@@ -191,7 +191,7 @@ export default {
|
|||||||
|
|
||||||
this.legends = []
|
this.legends = []
|
||||||
this.series = chartOption.series = this.handleTimeSeries(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
this.series = chartOption.series = this.handleTimeSeries(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
||||||
|
console.log(this.$lodash.cloneDeep( this.chartData), ' this.chartData')
|
||||||
chartOption.series.forEach(item => {
|
chartOption.series.forEach(item => {
|
||||||
if (item.lineStyle) {
|
if (item.lineStyle) {
|
||||||
item.lineStyle.width = this.lineOption.lineWidth
|
item.lineStyle.width = this.lineOption.lineWidth
|
||||||
@@ -238,6 +238,7 @@ export default {
|
|||||||
delete chartOption.tooltip.position
|
delete chartOption.tooltip.position
|
||||||
}
|
}
|
||||||
const option = this.renderYAxis(this.chartData, this.chartInfo)
|
const option = this.renderYAxis(this.chartData, this.chartInfo)
|
||||||
|
console.log(option)
|
||||||
chartOption.yAxis[0] = { ...chartOption.yAxis[0], ...option.yAxis[0] }
|
chartOption.yAxis[0] = { ...chartOption.yAxis[0], ...option.yAxis[0] }
|
||||||
chartOption.yAxis[1] = { ...chartOption.yAxis[1], ...option.yAxis[1] }
|
chartOption.yAxis[1] = { ...chartOption.yAxis[1], ...option.yAxis[1] }
|
||||||
if (chartOption.toolbox.feature) {
|
if (chartOption.toolbox.feature) {
|
||||||
@@ -611,7 +612,11 @@ export default {
|
|||||||
yAxisLabelFormatter (minValue, maxValue, copies, unit, dot) {
|
yAxisLabelFormatter (minValue, maxValue, copies, unit, dot) {
|
||||||
const self = this
|
const self = this
|
||||||
return function (val, index) {
|
return function (val, index) {
|
||||||
const value = formatScientificNotation(val, 6)
|
console.log(val)
|
||||||
|
let value = formatScientificNotation(val, 6)
|
||||||
|
if (!val) {
|
||||||
|
value = 0
|
||||||
|
}
|
||||||
return unit.compute(value, index, -1, dot)
|
return unit.compute(value, index, -1, dot)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ export default {
|
|||||||
maxValue = Math.abs(minValue)
|
maxValue = Math.abs(minValue)
|
||||||
}
|
}
|
||||||
maxValue = maxValue - minValue
|
maxValue = maxValue - minValue
|
||||||
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii)
|
maxValue = chartDataFormat.formatDatas(maxValue, unit, 'ceil', unit.ascii)
|
||||||
let oldValue = maxValue
|
let oldValue = maxValue
|
||||||
if (maxValue < 0) {
|
if (maxValue < 0) {
|
||||||
oldValue = Math.abs(maxValue)
|
oldValue = Math.abs(maxValue)
|
||||||
|
|||||||
@@ -2083,7 +2083,7 @@ export default {
|
|||||||
maxValue = Math.abs(minValue)
|
maxValue = Math.abs(minValue)
|
||||||
}
|
}
|
||||||
maxValue = maxValue - minValue
|
maxValue = maxValue - minValue
|
||||||
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii)
|
maxValue = chartDataFormat.formatDatas(maxValue, unit, 'ceil', unit.ascii)
|
||||||
let oldValue = maxValue
|
let oldValue = maxValue
|
||||||
let dot = 0
|
let dot = 0
|
||||||
if (maxValue == 1) {
|
if (maxValue == 1) {
|
||||||
|
|||||||
@@ -73,6 +73,22 @@ function bits (value, index, type = 1, dot = 0) {
|
|||||||
return asciiCompute(num, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(num, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function bitsSI (value, index, type = 1, dot = 0) {
|
||||||
|
const num = value / 8
|
||||||
|
if (value < 8) {
|
||||||
|
return value + 'b'
|
||||||
|
}
|
||||||
|
if (num < 1000) {
|
||||||
|
return num + 'B'
|
||||||
|
}
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(num, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(num, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(num, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function bytes (value, index, type = 1, dot) {
|
function bytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -82,6 +98,15 @@ function bytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function bytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function kilobytes (value, index, type = 1, dot) {
|
function kilobytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -91,6 +116,15 @@ function kilobytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function kilobytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1000, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1000, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1000, ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function megabytes (value, index, type = 1, dot) {
|
function megabytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -100,6 +134,15 @@ function megabytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function megabytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1000, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1000, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1000, ['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function gigabytes (value, index, type = 1, dot) {
|
function gigabytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -109,6 +152,15 @@ function gigabytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function gigabytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1000, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1000, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1000, ['GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function terabytes (value, index, type = 1, dot) {
|
function terabytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -118,6 +170,15 @@ function terabytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function terabytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1000, ['TB', 'PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1000, ['TB', 'PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1000, ['TB', 'PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function petabytes (value, index, type = 1, dot) {
|
function petabytes (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 0)
|
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
@@ -127,6 +188,15 @@ function petabytes (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 2)
|
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function petabytesSI (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 0)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['PB', 'EB', 'ZB', 'YB'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
function packetsSec (value, index, type = 1, dot) {
|
function packetsSec (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['pps', 'Kpps', 'Mpps', 'Gpps', 'Tpps', 'Ppps', 'Epps', 'Zpps', 'Ypps'], 1)
|
return asciiCompute(value, 1000, ['pps', 'Kpps', 'Mpps', 'Gpps', 'Tpps', 'Ppps', 'Epps', 'Zpps', 'Ypps'], 1)
|
||||||
@@ -137,6 +207,128 @@ function packetsSec (value, index, type = 1, dot) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function bitsSec (value, index, type = 1, dot) {
|
function bitsSec (value, index, type = 1, dot) {
|
||||||
|
const num = value / 8
|
||||||
|
if (value < 8) {
|
||||||
|
return value + 'b'
|
||||||
|
}
|
||||||
|
if (num < 1024) {
|
||||||
|
return num + 'B'
|
||||||
|
}
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function bytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function kilobytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function kilobitsSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function megabytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function megabitsSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function gigabytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function gigabitsSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function terabytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function terabitsSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function petabytesSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['PBs', 'EBs', 'ZBs', 'YBs'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function petabitsSec (value, index, type = 1, dot) {
|
||||||
|
if (type == 1) {
|
||||||
|
return asciiCompute(value, 1024, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
|
} else if (type == -1) {
|
||||||
|
return asciiCompute(value, 1024, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], dot)
|
||||||
|
} else {
|
||||||
|
return asciiCompute(value, 1024, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function bitsSecSI (value, index, type = 1, dot) {
|
||||||
|
const num = value / 8
|
||||||
|
if (value < 8) {
|
||||||
|
return value + 'b'
|
||||||
|
}
|
||||||
|
if (num < 1000) {
|
||||||
|
return num + 'B'
|
||||||
|
}
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 1)
|
return asciiCompute(value, 1000, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -145,7 +337,7 @@ function bitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 2)
|
return asciiCompute(value, 1000, ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Epps', 'Zpps', 'Ypps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function bytesSec (value, index, type = 1, dot) {
|
function bytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -154,7 +346,7 @@ function bytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
return asciiCompute(value, 1000, ['Bs', 'KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function kilobytesSec (value, index, type = 1, dot) {
|
function kilobytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -163,7 +355,7 @@ function kilobytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['KBs', 'MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function kilobitsSec (value, index, type = 1, dot) {
|
function kilobitsSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
return asciiCompute(value, 1000, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -172,7 +364,7 @@ function kilobitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
return asciiCompute(value, 1000, ['Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function megabytesSec (value, index, type = 1, dot) {
|
function megabytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -181,7 +373,7 @@ function megabytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
return asciiCompute(value, 1000, ['MBs', 'GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function megabitsSec (value, index, type = 1, dot) {
|
function megabitsSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
return asciiCompute(value, 1000, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -190,7 +382,7 @@ function megabitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
return asciiCompute(value, 1000, ['Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function gigabytesSec (value, index, type = 1, dot) {
|
function gigabytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -199,7 +391,7 @@ function gigabytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
return asciiCompute(value, 1000, ['GBs', 'TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function gigabitsSec (value, index, type = 1, dot) {
|
function gigabitsSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
return asciiCompute(value, 1000, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -208,7 +400,7 @@ function gigabitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
return asciiCompute(value, 1000, ['Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function terabytesSec (value, index, type = 1, dot) {
|
function terabytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -217,7 +409,7 @@ function terabytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
return asciiCompute(value, 1000, ['TBs', 'PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function terabitsSec (value, index, type = 1, dot) {
|
function terabitsSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
return asciiCompute(value, 1000, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -226,7 +418,7 @@ function terabitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
return asciiCompute(value, 1000, ['Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function petabytesSec (value, index, type = 1, dot) {
|
function petabytesSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
return asciiCompute(value, 1000, ['PBs', 'EBs', 'ZBs', 'YBs'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -235,7 +427,7 @@ function petabytesSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
return asciiCompute(value, 1000, ['PBs', 'EBs', 'ZBs', 'YBs'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function petabitsSec (value, index, type = 1, dot) {
|
function petabitsSecSI (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
return asciiCompute(value, 1000, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 1)
|
||||||
} else if (type == -1) {
|
} else if (type == -1) {
|
||||||
@@ -244,6 +436,7 @@ function petabitsSec (value, index, type = 1, dot) {
|
|||||||
return asciiCompute(value, 1000, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
return asciiCompute(value, 1000, ['Pbps', 'Ebps', 'Zbps', 'Ybps'], 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Hertz (value, index, type = 1, dot) {
|
function Hertz (value, index, type = 1, dot) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return asciiCompute(value, 1000, ['Hz', 'KHz', 'MHz', 'GHz', 'THz', 'PHz', 'EHz', 'ZHz', 'YHz'], 1)
|
return asciiCompute(value, 1000, ['Hz', 'KHz', 'MHz', 'GHz', 'THz', 'PHz', 'EHz', 'ZHz', 'YHz'], 1)
|
||||||
@@ -549,37 +742,86 @@ const unitOptions = [
|
|||||||
{
|
{
|
||||||
value: 6,
|
value: 6,
|
||||||
compute: bits,
|
compute: bits,
|
||||||
label: 'bits'
|
label: 'bits(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 36,
|
||||||
|
compute: bitsSI,
|
||||||
|
label: 'bits(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 7,
|
value: 7,
|
||||||
compute: bytes,
|
compute: bytes,
|
||||||
label: 'bytes'
|
label: 'bytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 37,
|
||||||
|
compute: bytesSI,
|
||||||
|
label: 'bytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 8,
|
value: 8,
|
||||||
compute: kilobytes,
|
compute: kilobytes,
|
||||||
label: 'kilobytes'
|
label: 'kilobytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 38,
|
||||||
|
compute: kilobytesSI,
|
||||||
|
label: 'kilobytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 9,
|
value: 9,
|
||||||
compute: megabytes,
|
compute: megabytes,
|
||||||
label: 'megabytes'
|
label: 'megabytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 39,
|
||||||
|
compute: megabytesSI,
|
||||||
|
label: 'megabytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 10,
|
value: 10,
|
||||||
compute: gigabytes,
|
compute: gigabytes,
|
||||||
label: 'gigabytes'
|
label: 'gigabytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 40,
|
||||||
|
compute: gigabytesSI,
|
||||||
|
label: 'gigabytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 11,
|
value: 11,
|
||||||
compute: terabytes,
|
compute: terabytes,
|
||||||
label: 'terabytes'
|
label: 'terabytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 41,
|
||||||
|
compute: terabytesSI,
|
||||||
|
label: 'terabytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 12,
|
value: 12,
|
||||||
compute: petabytes,
|
compute: petabytes,
|
||||||
label: 'petabytes'
|
label: 'petabytes(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 42,
|
||||||
|
compute: petabytesSI,
|
||||||
|
label: 'petabytes(SI)',
|
||||||
|
ascii: 1000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, // Data end
|
}, // Data end
|
||||||
@@ -590,67 +832,152 @@ const unitOptions = [
|
|||||||
{
|
{
|
||||||
value: 13,
|
value: 13,
|
||||||
compute: packetsSec,
|
compute: packetsSec,
|
||||||
label: 'packets/sec'
|
label: 'packets/sec',
|
||||||
|
ascii: 1024
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 14,
|
value: 14,
|
||||||
compute: bitsSec,
|
compute: bitsSec,
|
||||||
label: 'bits/sec'
|
label: 'bits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 43,
|
||||||
|
compute: bitsSecSI,
|
||||||
|
label: 'bits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 15,
|
value: 15,
|
||||||
compute: bytesSec,
|
compute: bytesSec,
|
||||||
label: 'bytes/sec'
|
label: 'bytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 44,
|
||||||
|
compute: bytesSecSI,
|
||||||
|
label: 'bytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 16,
|
value: 16,
|
||||||
compute: kilobytesSec,
|
compute: kilobytesSec,
|
||||||
label: 'kilobytes/sec'
|
label: 'kilobytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 45,
|
||||||
|
compute: kilobytesSecSI,
|
||||||
|
label: 'kilobytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 17,
|
value: 17,
|
||||||
compute: kilobitsSec,
|
compute: kilobitsSec,
|
||||||
label: 'kilobits/sec'
|
label: 'kilobits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 46,
|
||||||
|
compute: kilobitsSecSI,
|
||||||
|
label: 'kilobits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 18,
|
value: 18,
|
||||||
compute: megabytesSec,
|
compute: megabytesSec,
|
||||||
label: 'megabytes/sec'
|
label: 'megabytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 47,
|
||||||
|
compute: megabytesSecSI,
|
||||||
|
label: 'megabytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 19,
|
value: 19,
|
||||||
compute: megabitsSec,
|
compute: megabitsSec,
|
||||||
label: 'megabits/sec'
|
label: 'megabits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 48,
|
||||||
|
compute: megabitsSecSI,
|
||||||
|
label: 'megabits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 20,
|
value: 20,
|
||||||
compute: gigabytesSec,
|
compute: gigabytesSec,
|
||||||
label: 'gigabytes/sec'
|
label: 'gigabytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 49,
|
||||||
|
compute: gigabytesSecSI,
|
||||||
|
label: 'gigabytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 21,
|
value: 21,
|
||||||
compute: gigabitsSec,
|
compute: gigabitsSec,
|
||||||
label: 'gigabits/sec'
|
label: 'gigabits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 50,
|
||||||
|
compute: gigabitsSec,
|
||||||
|
label: 'gigabits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 22,
|
value: 22,
|
||||||
compute: terabytesSec,
|
compute: terabytesSec,
|
||||||
label: 'terabytes/sec'
|
label: 'terabytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 51,
|
||||||
|
compute: terabytesSecSI,
|
||||||
|
label: 'terabytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 23,
|
value: 23,
|
||||||
compute: terabitsSec,
|
compute: terabitsSec,
|
||||||
label: 'terabits/sec'
|
label: 'terabits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 52,
|
||||||
|
compute: terabitsSecSI,
|
||||||
|
label: 'terabits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 24,
|
value: 24,
|
||||||
compute: petabytesSec,
|
compute: petabytesSec,
|
||||||
label: 'petabytes/sec'
|
label: 'petabytes/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 53,
|
||||||
|
compute: petabytesSecSI,
|
||||||
|
label: 'petabytes/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 25,
|
value: 25,
|
||||||
compute: petabitsSec,
|
compute: petabitsSec,
|
||||||
label: 'petabits/sec'
|
label: 'petabits/sec(IEC)',
|
||||||
|
ascii: 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 54,
|
||||||
|
compute: petabitsSecSI,
|
||||||
|
label: 'petabits/sec(SI)',
|
||||||
|
ascii: 1000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, // DataRate end
|
}, // DataRate end
|
||||||
@@ -739,7 +1066,7 @@ export default {
|
|||||||
unitOptions: function () {
|
unitOptions: function () {
|
||||||
return unitOptions
|
return unitOptions
|
||||||
},
|
},
|
||||||
getUnit: function (index) {
|
getUnit: function (value) {
|
||||||
if (units.length < 1) {
|
if (units.length < 1) {
|
||||||
unitOptions.forEach((item, index) => {
|
unitOptions.forEach((item, index) => {
|
||||||
item.children.forEach((n, i) => {
|
item.children.forEach((n, i) => {
|
||||||
@@ -747,13 +1074,15 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return units[index - 1]
|
return units.find(item => item.value === value)
|
||||||
},
|
},
|
||||||
formatData: function (value, unit) {
|
formatData: function (value, unit) {
|
||||||
return this.getUnit(unit).compute(value, null, 2)
|
return this.getUnit(unit).compute(value, null, 2)
|
||||||
},
|
},
|
||||||
formatDatas: function (value, type, flow = 'ceil', ascii) {
|
formatDatas: function (value, unit, flow = 'ceil') {
|
||||||
let pow = 0
|
let pow = 0
|
||||||
|
const ascii = unit.ascii || 1000
|
||||||
|
const type = unit.type
|
||||||
if (value < 1 && value != 0) {
|
if (value < 1 && value != 0) {
|
||||||
while (value < 1) {
|
while (value < 1) {
|
||||||
pow++
|
pow++
|
||||||
@@ -767,19 +1096,19 @@ export default {
|
|||||||
|
|
||||||
if (type === 'Data') {
|
if (type === 'Data') {
|
||||||
if (value > 1) {
|
if (value > 1) {
|
||||||
while (value > 1024) {
|
while (value > ascii) {
|
||||||
pow++
|
pow++
|
||||||
value = value / 1024
|
value = value / ascii
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow === 'ceil') {
|
if (flow === 'ceil') {
|
||||||
const length = JSON.stringify(Math.ceil(value)).length
|
const length = JSON.stringify(Math.ceil(value)).length
|
||||||
value = value / Math.pow(10, length - 1)
|
value = value / Math.pow(10, length - 1)
|
||||||
return Math.ceil(value) * Math.pow(1024, pow) * Math.pow(10, length - 1)
|
return Math.ceil(value) * Math.pow(ascii, pow) * Math.pow(10, length - 1)
|
||||||
} else if (flow === 'floor') {
|
} else if (flow === 'floor') {
|
||||||
const length = JSON.stringify(Math.floor(value)).length
|
const length = JSON.stringify(Math.floor(value)).length
|
||||||
value = value / Math.pow(10, length - 1)
|
value = value / Math.pow(10, length - 1)
|
||||||
return Math.floor(value) * Math.pow(1024, pow) * Math.pow(10, length - 1)
|
return Math.floor(value) * Math.pow(ascii, pow) * Math.pow(10, length - 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return value
|
return value
|
||||||
@@ -788,19 +1117,19 @@ export default {
|
|||||||
|
|
||||||
if (type === 'Misc' || type === 'DataRate') {
|
if (type === 'Misc' || type === 'DataRate') {
|
||||||
if (value > 1) {
|
if (value > 1) {
|
||||||
while (value > 1000) {
|
while (value > ascii) {
|
||||||
pow++
|
pow++
|
||||||
value = value / 1000
|
value = value / ascii
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow === 'ceil') {
|
if (flow === 'ceil') {
|
||||||
const length = JSON.stringify(Math.ceil(value)).length
|
const length = JSON.stringify(Math.ceil(value)).length
|
||||||
value = value / Math.pow(10, length - 1)
|
value = value / Math.pow(10, length - 1)
|
||||||
return Math.ceil(value) * Math.pow(1000, pow) * Math.pow(10, length - 1)
|
return Math.ceil(value) * Math.pow(ascii, pow) * Math.pow(10, length - 1)
|
||||||
} else if (flow === 'floor') {
|
} else if (flow === 'floor') {
|
||||||
const length = JSON.stringify(Math.floor(value)).length
|
const length = JSON.stringify(Math.floor(value)).length
|
||||||
value = value / Math.pow(10, length - 1)
|
value = value / Math.pow(10, length - 1)
|
||||||
return Math.floor(value) * Math.pow(1000, pow) * Math.pow(10, length - 1)
|
return Math.floor(value) * Math.pow(ascii, pow) * Math.pow(10, length - 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return value
|
return value
|
||||||
@@ -823,7 +1152,10 @@ export default {
|
|||||||
case 10: return 5
|
case 10: return 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Interval: function (value, copies, type, interValType) {
|
Interval: function (value, copies, unit, interValType) {
|
||||||
|
console.log(unit)
|
||||||
|
const type = unit.type
|
||||||
|
const ascii = unit.ascii || 1000
|
||||||
if (!copies) {
|
if (!copies) {
|
||||||
copies = 1
|
copies = 1
|
||||||
}
|
}
|
||||||
@@ -834,12 +1166,12 @@ export default {
|
|||||||
return value || 1
|
return value || 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value < 1024 && type === 'Data') {
|
if (value < ascii && type === 'Data') {
|
||||||
let interVal = value / copies
|
let interVal = value / copies
|
||||||
interVal = !isNaN(interVal) ? interVal : 1
|
interVal = !isNaN(interVal) ? interVal : 1
|
||||||
return interVal
|
return interVal
|
||||||
}
|
}
|
||||||
if (value < 1000 && (type === 'DataRate' || type === 'Misc')) {
|
if (value < ascii && (type === 'DataRate' || type === 'Misc')) {
|
||||||
let interVal = value / copies
|
let interVal = value / copies
|
||||||
interVal = !isNaN(interVal) ? interVal : 1
|
interVal = !isNaN(interVal) ? interVal : 1
|
||||||
return interVal
|
return interVal
|
||||||
@@ -848,17 +1180,17 @@ export default {
|
|||||||
let interVal = value / copies
|
let interVal = value / copies
|
||||||
let pow = 0
|
let pow = 0
|
||||||
if (interVal) {
|
if (interVal) {
|
||||||
while (interVal > 1024) {
|
while (interVal > ascii) {
|
||||||
pow++
|
pow++
|
||||||
interVal = interVal / 1024
|
interVal = interVal / ascii
|
||||||
}
|
}
|
||||||
interVal = Math.ceil(interVal) * Math.pow(1024, pow)
|
interVal = Math.ceil(interVal) * Math.pow(ascii, pow)
|
||||||
}
|
}
|
||||||
interVal = !isNaN(interVal) ? interVal : 1
|
interVal = !isNaN(interVal) ? interVal : 1
|
||||||
if (interVal >= 1 && interVal <= 512) {
|
if (interVal >= 1 && interVal <= ascii / 2) {
|
||||||
interVal = 512
|
interVal = ascii / 2
|
||||||
} else if (interVal > 512 && interVal <= 1024) {
|
} else if (interVal > 512 && interVal <= ascii) {
|
||||||
interVal = 1024
|
interVal = ascii
|
||||||
}
|
}
|
||||||
return interVal
|
return interVal
|
||||||
}
|
}
|
||||||
@@ -866,11 +1198,11 @@ export default {
|
|||||||
let interVal = value / copies
|
let interVal = value / copies
|
||||||
let pow = 0
|
let pow = 0
|
||||||
if (interVal) {
|
if (interVal) {
|
||||||
while (interVal > 1000) {
|
while (interVal > ascii) {
|
||||||
pow++
|
pow++
|
||||||
interVal = interVal / 1000
|
interVal = interVal / ascii
|
||||||
}
|
}
|
||||||
interVal = Math.ceil(interVal) * Math.pow(1000, pow)
|
interVal = Math.ceil(interVal) * Math.pow(ascii, pow)
|
||||||
}
|
}
|
||||||
interVal = !isNaN(interVal) ? interVal : 1
|
interVal = !isNaN(interVal) ? interVal : 1
|
||||||
return interVal
|
return interVal
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ export default {
|
|||||||
maxValue = Math.abs(minValue)
|
maxValue = Math.abs(minValue)
|
||||||
}
|
}
|
||||||
maxValue = maxValue - minValue
|
maxValue = maxValue - minValue
|
||||||
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii)
|
maxValue = chartDataFormat.formatDatas(maxValue, unit, 'ceil', unit.ascii)
|
||||||
let oldValue = maxValue
|
let oldValue = maxValue
|
||||||
if (maxValue < 0) {
|
if (maxValue < 0) {
|
||||||
oldValue = Math.abs(maxValue)
|
oldValue = Math.abs(maxValue)
|
||||||
|
|||||||
@@ -436,6 +436,7 @@ export default {
|
|||||||
if (this.chartInfo.type === 'log') {
|
if (this.chartInfo.type === 'log') {
|
||||||
this.logChartDataFormat()
|
this.logChartDataFormat()
|
||||||
}
|
}
|
||||||
|
console.log(this.$lodash.cloneDeep(this.chartData), '123123')
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
// console.info(res)
|
// console.info(res)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { formatScientificNotation } from '@/components/common/js/tools'
|
|||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
renderYAxis (chartDatas, chartInfo, type) {
|
renderYAxis (chartDatas, chartInfo, type) {
|
||||||
|
console.log(chartDatas, '1')
|
||||||
let chartData = lodash.cloneDeep(chartDatas)
|
let chartData = lodash.cloneDeep(chartDatas)
|
||||||
if (type === 'legend') {
|
if (type === 'legend') {
|
||||||
chartData.forEach(item => {
|
chartData.forEach(item => {
|
||||||
@@ -12,6 +13,7 @@ export default {
|
|||||||
})
|
})
|
||||||
chartData = chartData.map(item => [item])
|
chartData = chartData.map(item => [item])
|
||||||
}
|
}
|
||||||
|
console.log(chartDatas, '2')
|
||||||
const decimals = chartInfo.param.decimals || 2
|
const decimals = chartInfo.param.decimals || 2
|
||||||
const chartOption = {
|
const chartOption = {
|
||||||
yAxis: [
|
yAxis: [
|
||||||
@@ -30,9 +32,10 @@ export default {
|
|||||||
}
|
}
|
||||||
// 左y轴
|
// 左y轴
|
||||||
const leftData = chartData.filter(item => item[0] && !item[0].yAxisIndex)
|
const leftData = chartData.filter(item => item[0] && !item[0].yAxisIndex)
|
||||||
|
console.log(chartDatas, '3')
|
||||||
const leftInfo = this.getMinMaxFromData(leftData, chartInfo.unit, chartInfo.param) //
|
const leftInfo = this.getMinMaxFromData(leftData, chartInfo.unit, chartInfo.param) //
|
||||||
chartOption.yAxis[0].minInterval = chartDataFormat.Interval(leftInfo.maxValue, leftInfo.copies, leftInfo.unit.type, 'min')
|
chartOption.yAxis[0].minInterval = chartDataFormat.Interval(leftInfo.maxValue, leftInfo.copies, leftInfo.unit, 'min')
|
||||||
chartOption.yAxis[0].maxInterval = chartDataFormat.Interval(leftInfo.maxValue, leftInfo.copies, leftInfo.unit.type, 'max') * Math.ceil(this.series.length / 5)
|
chartOption.yAxis[0].maxInterval = chartDataFormat.Interval(leftInfo.maxValue, leftInfo.copies, leftInfo.unit, 'max') * Math.ceil(this.series.length / 5)
|
||||||
if (chartInfo.param.stack) {
|
if (chartInfo.param.stack) {
|
||||||
chartOption.yAxis[0].maxInterval = chartOption.yAxis[0].maxInterval * (Math.ceil(leftData.length / 5) + 1)
|
chartOption.yAxis[0].maxInterval = chartOption.yAxis[0].maxInterval * (Math.ceil(leftData.length / 5) + 1)
|
||||||
}
|
}
|
||||||
@@ -61,11 +64,16 @@ export default {
|
|||||||
// 如果全都为右y轴数据 则右y轴显示网格
|
// 如果全都为右y轴数据 则右y轴显示网格
|
||||||
const unit = chartDataFormat.getUnit(lodash.get(chartInfo, 'param.rightYAxis.unit', 2))
|
const unit = chartDataFormat.getUnit(lodash.get(chartInfo, 'param.rightYAxis.unit', 2))
|
||||||
const allRight = this.series.every(item => item.yAxisIndex == 1)
|
const allRight = this.series.every(item => item.yAxisIndex == 1)
|
||||||
|
console.log(allRight)
|
||||||
chartOption.yAxis[1].splitLine.show = allRight
|
chartOption.yAxis[1].splitLine.show = allRight
|
||||||
|
console.log(chartDatas, '4')
|
||||||
const rightData = chartData.filter(item => item[0] && item[0].yAxisIndex)
|
const rightData = chartData.filter(item => item[0] && item[0].yAxisIndex)
|
||||||
|
console.log(chartDatas, '5')
|
||||||
|
console.log(rightData)
|
||||||
const rightInfo = this.getMinMaxFromData(rightData, lodash.get(chartInfo, 'param.rightYAxis.unit', 2), lodash.get(chartInfo, 'param.rightYAxis', {}))//
|
const rightInfo = this.getMinMaxFromData(rightData, lodash.get(chartInfo, 'param.rightYAxis.unit', 2), lodash.get(chartInfo, 'param.rightYAxis', {}))//
|
||||||
chartOption.yAxis[1].minInterval = chartDataFormat.Interval(rightInfo.maxValue, rightInfo.copies, rightInfo.unit.type, 'min')
|
console.log(rightInfo)
|
||||||
chartOption.yAxis[1].maxInterval = chartDataFormat.Interval(rightInfo.maxValue, rightInfo.copies, rightInfo.unit.type, 'max') * Math.ceil(this.series.length / 5)
|
chartOption.yAxis[1].minInterval = chartDataFormat.Interval(rightInfo.maxValue, rightInfo.copies, rightInfo.unit, 'min')
|
||||||
|
chartOption.yAxis[1].maxInterval = chartDataFormat.Interval(rightInfo.maxValue, rightInfo.copies, rightInfo.unit, 'max') * Math.ceil(this.series.length / 5)
|
||||||
if (chartInfo.param.stack) {
|
if (chartInfo.param.stack) {
|
||||||
chartOption.yAxis[1].maxInterval = chartOption.yAxis[1].maxInterval * (Math.ceil(rightData.length / 5) + 1)
|
chartOption.yAxis[1].maxInterval = chartOption.yAxis[1].maxInterval * (Math.ceil(rightData.length / 5) + 1)
|
||||||
}
|
}
|
||||||
@@ -158,7 +166,7 @@ export default {
|
|||||||
maxValue = Math.abs(minValue)
|
maxValue = Math.abs(minValue)
|
||||||
}
|
}
|
||||||
maxValue = maxValue - minValue
|
maxValue = maxValue - minValue
|
||||||
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii) // 取最大值后 需要对其进行取整
|
maxValue = chartDataFormat.formatDatas(maxValue, unit, 'ceil', unit.ascii) // 取最大值后 需要对其进行取整
|
||||||
let oldValue = maxValue
|
let oldValue = maxValue
|
||||||
let dot = 0
|
let dot = 0
|
||||||
if (oldValue == 1) {
|
if (oldValue == 1) {
|
||||||
|
|||||||
@@ -267,7 +267,9 @@ export default {
|
|||||||
this.object.paramObj.push({ key: '', value: [] })
|
this.object.paramObj.push({ key: '', value: [] })
|
||||||
}
|
}
|
||||||
this.object.assetName = this.object.asset ? this.object.asset.name : ''
|
this.object.assetName = this.object.asset ? this.object.asset.name : ''
|
||||||
|
this.object.softwareAssetName = this.object.softwareAsset ? this.object.softwareAsset.name : ''
|
||||||
this.object.assetId = this.object.asset ? this.object.asset.id + '' : ''
|
this.object.assetId = this.object.asset ? this.object.asset.id + '' : ''
|
||||||
|
this.object.softwareAssetId = this.object.softwareAsset ? this.object.softwareAsset.id + '' : ''
|
||||||
this.object.projectId = this.object.project.id
|
this.object.projectId = this.object.project.id
|
||||||
this.object.moduleId = this.object.module.id
|
this.object.moduleId = this.object.module.id
|
||||||
this.object.type = this.object.module.type
|
this.object.type = this.object.module.type
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ export default {
|
|||||||
async handler (n) {
|
async handler (n) {
|
||||||
if (n) {
|
if (n) {
|
||||||
this.searchLabel = {}
|
this.searchLabel = {}
|
||||||
|
this.tableData = []
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,6 +153,9 @@ export default {
|
|||||||
this.toTopBtnHandler(this.scrollbarWrap)
|
this.toTopBtnHandler(this.scrollbarWrap)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log(response)
|
||||||
|
this.$message.error(response.msg || response.error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ export default {
|
|||||||
tableTitle: [ // 原始table列
|
tableTitle: [ // 原始table列
|
||||||
{
|
{
|
||||||
label: this.$t('licenseMange.product'),
|
label: this.$t('licenseMange.product'),
|
||||||
prop: 'typename',
|
prop: 'name',
|
||||||
show: true,
|
show: true,
|
||||||
width: 350
|
width: 350
|
||||||
// sortable: 'custom'
|
// sortable: 'custom'
|
||||||
}, {
|
}, {
|
||||||
label: this.$t('licenseMange.keyType'),
|
label: this.$t('licenseMange.keyType'),
|
||||||
prop: 'name',
|
prop: 'typename',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
show: true
|
show: true
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -684,7 +684,7 @@ export default {
|
|||||||
maxValue = Math.abs(minValue)
|
maxValue = Math.abs(minValue)
|
||||||
}
|
}
|
||||||
maxValue = maxValue - minValue
|
maxValue = maxValue - minValue
|
||||||
maxValue = chartDataFormat.formatDatas(maxValue, unit.type, 'ceil', unit.ascii)
|
maxValue = chartDataFormat.formatDatas(maxValue, unit, 'ceil', unit.ascii)
|
||||||
let oldValue = maxValue
|
let oldValue = maxValue
|
||||||
let dot = 0
|
let dot = 0
|
||||||
if (maxValue == 1) {
|
if (maxValue == 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user