Showing
1 changed file
with
26 additions
and
4 deletions
... | ... | @@ -14307,14 +14307,13 @@ class HandleDataSource { |
14307 | 14307 | const realDataList = data[attr] || [] |
14308 | 14308 | |
14309 | 14309 | const action = agg === 'NONE' ? 'unshift' : 'push' |
14310 | - | |
14310 | + console.log({ message, record }) | |
14311 | 14311 | // chart insstance 是否已经接受过一次消息推送 |
14312 | 14312 | const isActive = instance.isActive |
14313 | 14313 | if (!isActive) { |
14314 | 14314 | instance.isActive = true |
14315 | 14315 | const chartOption = this.getChartComponentOption(chartInstanceType, { chartType: chartInstanceType, attr, dataList: realDataList, action, nodeId: node.id, additional }) |
14316 | 14316 | instance.setOption(chartOption) |
14317 | - | |
14318 | 14317 | } else { |
14319 | 14318 | const oldOptions = instance.getOption() |
14320 | 14319 | const options = this.getRealTimeUpdateChartOption(chartInstanceType, { oldOptions, dataList: realDataList, additional }) |
... | ... | @@ -14541,6 +14540,7 @@ class HandleDataSource { |
14541 | 14540 | const { additional: { unit = '°C' } = {} } = dataSource |
14542 | 14541 | |
14543 | 14542 | const [timespan, value] = dataList[0] || [] |
14543 | + const { min, max } = this.getRange(value) | |
14544 | 14544 | return { |
14545 | 14545 | title: { |
14546 | 14546 | text: slaveDeviceName || deviceName |
... | ... | @@ -14552,8 +14552,8 @@ class HandleDataSource { |
14552 | 14552 | radius: '100%', |
14553 | 14553 | startAngle: 200, |
14554 | 14554 | endAngle: -20, |
14555 | - min: 0, | |
14556 | - max: 100, | |
14555 | + min, | |
14556 | + max, | |
14557 | 14557 | splitNumber: 10, |
14558 | 14558 | itemStyle: { |
14559 | 14559 | color: '#5479c6' |
... | ... | @@ -14627,9 +14627,12 @@ class HandleDataSource { |
14627 | 14627 | const { dataList = [], oldOptions, additional } = params |
14628 | 14628 | const { attrName } = additional |
14629 | 14629 | const [timespan, value] = dataList[0] || [] |
14630 | + const { min, max } = this.getRange(value) | |
14630 | 14631 | return { |
14631 | 14632 | series: [ |
14632 | 14633 | { |
14634 | + min, | |
14635 | + max, | |
14633 | 14636 | name: attrName, |
14634 | 14637 | data: [ |
14635 | 14638 | { |
... | ... | @@ -14641,6 +14644,25 @@ class HandleDataSource { |
14641 | 14644 | } |
14642 | 14645 | } |
14643 | 14646 | |
14647 | + getRange(value) { | |
14648 | + if (isNaN(value)) return { min: 0, max: 100 } | |
14649 | + | |
14650 | + const numberValue = Number(value) | |
14651 | + | |
14652 | + let newMax = Number('1'.padEnd(value.toString().length + 1, 0)) | |
14653 | + | |
14654 | + newMax = newMax < 100 ? 100 : newMax | |
14655 | + | |
14656 | + let max | |
14657 | + if (numberValue < newMax / 2) { | |
14658 | + max = newMax / 2 | |
14659 | + } else { | |
14660 | + max = newMax | |
14661 | + } | |
14662 | + | |
14663 | + return { min: 0, max } | |
14664 | + } | |
14665 | + | |
14644 | 14666 | /** |
14645 | 14667 | * @description 获取绑定的数据 |
14646 | 14668 | * @param subscriptionId | ... | ... |