diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 57c8883d7..ceb6430d6 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -174,7 +174,7 @@ const en = { lastSevenDay:'Last 7 days', lastThirtyDay:'Last 30 days', refreshInterval:{ - never:'OFF', //'从不' + never:'Off', //'从不' oneMinute:'1 minute', // 1 minute threeMinutes:'3 minutes', //'3分钟' fiveMinutes:'5 minutes', //'5分钟' diff --git a/nezha-fronted/src/components/common/pickTime.vue b/nezha-fronted/src/components/common/pickTime.vue index 3e70e9ea8..37aae55c9 100644 --- a/nezha-fronted/src/components/common/pickTime.vue +++ b/nezha-fronted/src/components/common/pickTime.vue @@ -171,7 +171,7 @@ selectInterval(val) { this.visible = false; clearInterval(this.intervalTimer); - if (val) { + if (val && val.value != -1) { this.interval = val; const start = new Date(this.searchTime[1]); const now = new Date(); diff --git a/nezha-fronted/src/components/page/dashboard/explore/explore.vue b/nezha-fronted/src/components/page/dashboard/explore/explore.vue index 6881d7255..d98c451c3 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/explore.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/explore.vue @@ -22,7 +22,7 @@ -
+
@@ -292,6 +292,7 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c } }) this.$refs.exploreChart.setLegend(legend); + this.$refs.exploreChart.setRandomColors(series.length) this.$refs.exploreChart.setSeries(series) } this.defaultChartVisible = true; @@ -511,7 +512,7 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c .explore .chart-room { width: 100%; - height: 500px + height: 400px } .explore .chart-view, .table-view { diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index d01ee6e3e..ba6057c88 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -20,10 +20,10 @@ import echarts from 'echarts'; import chartDataFormat from "../../../charts/chartDataFormat"; import loading from "../../../common/loading"; - import uuidv1 from "uuid/v1"; import chartConfig from './chartConfig' import bus from "../../../../libs/bus"; import EleResize from "../../../common/js/divResize"; + import {randomcolor} from "../../../common/js/radomcolor/randomcolor"; export default { name: "chart", components:{ @@ -41,9 +41,10 @@ data(){ return { chart:null, - option:{}, - chartId: this.name + new uuidv1()+'-'+new Date().getTime(), + option:null, + chartId: this.name + '-'+this.guid()+'-'+new Date().getTime(), legend:[], + colors:chartConfig.getBgColorList(), } }, created() { @@ -86,7 +87,7 @@ if (this.tooltipFormatter) { this.modifyOption('tooltip', 'formatter', this.tooltipFormatter) } else { - //this.modifyOption('tooltip', 'formatter', this.defaultTooltipFormatter) + this.modifyOption('tooltip', 'formatter', this.defaultTooltipFormatter) } if(this.chartType == 'line'){ @@ -140,7 +141,7 @@ } }, getBgColor:function(index){ - let color=chartConfig.getBgColorList()[index]; + let color=this.colors[index]; return color; }, clickLegend(legendName,index){ @@ -245,12 +246,27 @@ let unit=chartDataFormat.getUnit(5); return unit.compute(value,index); }, + setRandomColors:function(num){ + let colors=[]; + for(let i=0;i