diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index ee0082122..90a01c17e 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -757,7 +757,7 @@ export default { // 循环处理每个elements下获取的数据列 if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) } diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index db9a91123..42542caad 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -946,7 +946,7 @@ export default { // 循环处理每个elements下获取的数据列 if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) } diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index c0fb98fbf..b28eed9c3 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -367,7 +367,7 @@ export default { } this.data = chartItem this.unit = chartDataFormat.getUnit(this.data.unit) - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' seriesItem = this.getStatisticsResult(statistics, seriesItem) seriesItem && (seriesItem = seriesItem.map(item => { if (chartItem.param && chartItem.param.valueMapping && chartItem.param.valueMapping.type) { @@ -584,6 +584,17 @@ export default { break } + default : { + copy.sort((x, y) => { return parseFloat(y.data[0]) - parseFloat(x.data[0]) }) + result = copy.map(item => { + return { + element: item.element, + time: bus.timeFormate(new Date(item.data[0]), 'yyyy-MM-dd hh:mm:ss'), + value: item.data[1] + } + }) + break + } } return result }, diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index 8a0abe8c5..a2dfdff70 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -470,7 +470,7 @@ export default { if (response.data.result) { if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) this.noData = false