diff --git a/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeries.vue index f3dbfef98..1119cd84f 100644 --- a/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeries.vue @@ -484,7 +484,7 @@ export default { } else { u.axes[2].grid.show = false } - u.redraw(false, true) + u.redraw(false, true) } }, mounted () { diff --git a/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeriesMixin.js b/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeriesMixin.js index 3c84375b9..bd7dc6ad5 100644 --- a/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeriesMixin.js +++ b/nezha-fronted/src/components/chart/chart/uplot/chartTimeSeriesMixin.js @@ -33,6 +33,7 @@ export default { initSeriesData (chartData) { // 处理数据 以及 series let time = [] this.legends = [] + const nullValueMode = this.chartInfo.param.nullType const seriesData = [] // 返回的数据 const seriesAll = [ // 返回的 series @@ -66,7 +67,15 @@ export default { } item.statistics = statistics item.values.forEach(value => { - seriesObjTime[value[0]] = value[1] + let itemValue = value[1] + if (itemValue === null && nullValueMode !== 'null') { + if (nullValueMode === 'zero') { + itemValue = 0 + } else { + itemValue = undefined + } + } + seriesObjTime[value[0]] = itemValue }) // 处理统计数据 statistics seriesObjTime = { @@ -111,7 +120,7 @@ export default { values: (u, v) => series.elements.name + JSON.stringify(series.metric), stroke: this.seriesColor[chartIndex], width: 1 / devicePixelRatio, - expressionIndex: series.expressionIndex, + expressionIndex: series.expressionIndex } if (chartType === 'area') { obj.fill = this.seriesColor[chartIndex] + '20' // 面积图使用