NEZ-2564 fix:dashboard图表最大化功能无法正常显示

This commit is contained in:
zyh
2023-02-14 18:14:08 +08:00
parent 0b940fd2ba
commit 8517bc1adf
4 changed files with 43 additions and 61 deletions

View File

@@ -325,7 +325,16 @@ export default {
}]
if (this.chartInfo.param.sparklineMode === 'area') {
chartOption.series[0].areaStyle = {
color
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: this.hexToRgb(color, 0.1)
},
{
offset: 1,
color: this.hexToRgb(color, 1)
}
])
}
}
chartOption.yAxis.max = this.maxValue

View File

@@ -43,47 +43,6 @@
<div v-for="(statistics, index) in item.statistics" :key="index" :class="{'legend-item--inactive': isGrey[index]}" class="legend--table-cell">{{(keepTwoDecimalFull(statistics.value))}}</div>
</div>
</div>
</template>
<!-- placement=bottom -->
<template v-else-if="chartInfo.param.legend.placement=='bottom'">
<div class="legend-box">
<div style="display:flex">
<!-- 左y轴legend -->
<ul>
<li
v-for="(item, index) in legends"
:key="index"
v-show="!isTimeSeries||series[index].yAxisIndex!=1"
:class="{'legend-item--inactive': isGrey[index]}"
:title="item.alias ? item.alias : item.name"
class="legend-item"
@click="clickLegend(item.name, index)"
>
<i v-if="isTimeSeries&&series[index].yAxisIndex==0" :style="{color: item.color}" class="yAxis-icon nz-icon nz-icon-zuozongzhou"></i>
<span v-else :style="{background: item.color}" class="legend-shape"></span>
<span>{{item.alias ? item.alias : item.name.split('-')[0]}}</span>
</li>
</ul>
</div>
<!-- 右y轴legend -->
<div class="rightYAxis-legend">
<ul>
<li
v-for="(item, index) in legends"
:key="index+'right'"
v-show="isTimeSeries&&series[index].yAxisIndex==1"
:class="{'legend-item--inactive': isGrey[index]}"
:title="item.alias ? item.alias : item.name"
class="legend-item"
@click="clickLegend(item.name, index)"
>
<i v-if="isTimeSeries&&series[index].yAxisIndex==1" :style="{color: item.color}" class="yAxis-icon nz-icon nz-icon-youzongzhou"></i>
<span v-else :style="{background: item.color}" class="legend-shape"></span>
<span>{{item.alias ? item.alias : item.name.split('-')[0]}}</span>
</li>
</ul>
</div>
</div>
</template>
<!-- 否则是普通形式 -->
<template v-else>

View File

@@ -44,6 +44,7 @@
@container-resized="containerResizedEvent"
>
<panel-chart
:variablesInit="variablesInit"
:ref="'chart' + item.id"
@edit-chart="$emit('edit-chart', item)"
:chart-info="item"
@@ -79,7 +80,6 @@
<panel-chart
:ref="'chart-fullscreen' + fullscreen.chartInfo.id"
:chart-info="fullscreen.chartInfo"
:variablesInit="variablesInit"
:from="from"
:filter="filter"
:is-fullscreen="true"

View File

@@ -296,13 +296,26 @@ export default {
query: encodeURIComponent(query)
}
this.$get(url, params).then(res => {
if (res.status === 'error') {
if (res.status === 'error' || !res.data.result.length) {
resolve([])
return
}
const isObject = Object.prototype.toString.call(res.data.result[0]).toLowerCase() === '[object object]'
if (!isObject) {
resolve([
{
label: res.data.result[0],
value: res.data.result[0],
expandable: true
}
])
} else {
const arr = res.data.result.map((metricData) => {
let text = metricData.metric.__name__ || ''
let text = ''
if (metricData.metric) {
text = metricData.metric.__name__ || ''
delete metricData.metric.__name__
}
text += '{'
const arr = []
Object.keys(metricData.metric).forEach(key => {
@@ -318,6 +331,7 @@ export default {
}
})
resolve(arr)
}
})
})
},