fix:修改chart group切换时分组显示的不对的问题

This commit is contained in:
zhangyu
2021-04-09 17:04:30 +08:00
parent 57b8d2d4a8
commit 47c8119eaa
5 changed files with 2161 additions and 2125 deletions

View File

@@ -294,7 +294,6 @@ export default {
// 设置数据, filter区分 // 设置数据, filter区分
setData (chartItem, seriesItem, panelId, filter, legend, area, errorMsg) { setData (chartItem, seriesItem, panelId, filter, legend, area, errorMsg) {
this.data = chartItem this.data = chartItem
const self = this
if (chartItem.type === 'bar') { if (chartItem.type === 'bar') {
this.option.xAxis = { this.option.xAxis = {
type: 'category', type: 'category',
@@ -366,6 +365,24 @@ export default {
obj.name = legend[index].name obj.name = legend[index].name
obj.data = [[legendShow, item.value]] obj.data = [[legendShow, item.value]]
obj.stack = true obj.stack = true
obj.markLine = {
silent: true,
symbol: ['circle', 'circle'],
label: {
distance: this.computeDistance(chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(chartItem.param.threshold)),
formatter: function (params) {
return chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(params.value)
}
},
lineStyle: {
color: '#d64f40',
width: 2,
type: 'dotted',
},
data: [{
yAxis: Number(chartItem.param.threshold)
}]
}
nweSeriesItem.push(obj) nweSeriesItem.push(obj)
}) })
seriesItem = nweSeriesItem seriesItem = nweSeriesItem
@@ -417,6 +434,12 @@ export default {
this.endLoading() this.endLoading()
} }
}, },
computeDistance: function (str) {
const span = document.querySelector('.temp-dom')
span.textContent = str
const txtWidth = parseFloat(window.getComputedStyle(span).width)
return Number('-' + (txtWidth + 5))
},
formatLegend (chartWidth, name) { formatLegend (chartWidth, name) {
if (!name) { if (!name) {
return '' return ''

View File

@@ -2211,7 +2211,8 @@ export default {
} }
} }
</style> </style>
<style scoped> <style lang="scss" scoped>
.project-box{
@keyframes model-error-animation { @keyframes model-error-animation {
0% { 0% {
transform: scale(0.7); transform: scale(0.7);
@@ -2480,9 +2481,7 @@ export default {
.align--center{ .align--center{
text-align: center; text-align: center;
} }
}
</style>
<style lang="scss" scoped>
.project-topology-tool { .project-topology-tool {
display: inline-flex; display: inline-flex;
height: 30px; height: 30px;

View File

@@ -1164,7 +1164,7 @@ export default {
}, },
onMessage (event, data, e) { onMessage (event, data, e) {
console.log('onMessage', event, data) // console.log('onMessage', event, data)
// console.log(getTopology(this.topologyIndex)) // console.log(getTopology(this.topologyIndex))
// this.notModuleIDArr=[]; // this.notModuleIDArr=[];
this.toolShow.attr = false this.toolShow.attr = false
@@ -2211,7 +2211,8 @@ export default {
} }
} }
</style> </style>
<style scoped> <style lang="scss" scoped>
.project-box{
@keyframes model-error-animation { @keyframes model-error-animation {
0% { 0% {
transform: scale(0.7); transform: scale(0.7);
@@ -2480,9 +2481,7 @@ export default {
.align--center{ .align--center{
text-align: center; text-align: center;
} }
}
</style>
<style lang="scss" scoped>
.project-topology-tool { .project-topology-tool {
display: inline-flex; display: inline-flex;
height: 30px; height: 30px;

View File

@@ -627,6 +627,17 @@ export default {
selectPanel (panel) { selectPanel (panel) {
this.panelName = panel.name this.panelName = panel.name
this.panelId = panel.id this.panelId = panel.id
this.editChart.groupId = ''
this.$get('visual/panel/chart?panelId=' + this.panelId).then(response => {
if (response.code === 200) {
this.groupArr = []
response.data.list.forEach((item, index) => {
if (item.type === 'group') {
this.groupArr.push({ id: item.id, name: item.name })
}
})
}
})
}, },
toAddPanel () { toAddPanel () {
this.$refs.panelBox2.show(true) this.$refs.panelBox2.show(true)
@@ -1261,6 +1272,7 @@ export default {
this.editChart.param.threshold = data.param.threshold this.editChart.param.threshold = data.param.threshold
this.editChart.param.statistics = this.statistics = data.param.statistics this.editChart.param.statistics = this.statistics = data.param.statistics
if (this.editChart.type === 'bar') { if (this.editChart.type === 'bar') {
this.statisticsList = JSON.parse(JSON.stringify(this.$CONSTANTS.statisticsList))
this.statisticsList.push({ value: 'null', label: i18n.t('dashboard.panel.chartForm.statisticsVal.null') }) this.statisticsList.push({ value: 'null', label: i18n.t('dashboard.panel.chartForm.statisticsVal.null') })
} }
} else { } else {

View File

@@ -790,6 +790,8 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.panel { .panel {
height: 100%; height: 100%;
display: flex;
flex-direction:column;
} }
.panel .el-table { .panel .el-table {
@@ -855,6 +857,7 @@ export default {
margin-top: 0px; margin-top: 0px;
overflow-y: auto; overflow-y: auto;
height: calc(100% - 50px); height: calc(100% - 50px);
flex: 1;
} }
.box-content { .box-content {