diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index d88df07e9..c412211e0 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -16,13 +16,15 @@ import loading from "../../../common/loading"; import uuidv1 from "uuid/v1"; import chartConfig from './chartConfig' + import json from "./geoJson"; export default { name: "chart", components:{ 'loading':loading, }, props:{ - chartTitle:{type:String} + chartTitle:{type:String}, + chartType:{type:String,default:'line'}, }, data(){ return { @@ -32,11 +34,13 @@ } }, created() { - chartConfig.setSeries(this.series); - chartConfig.setTooltipFormatter(this.tooltipFormatter); - chartConfig.setTooltipPostion(this.tooltipPosition); - chartConfig.setYAxisLabelFormatter(this.yAxisFormatter); - this.option=chartConfig.getCommonOption(); + this.option=chartConfig.getOption(this.chartType); + this.$set(this.option,'series',this.series); + if(this.chartType == 'line'){ + this.$set(this.option.tooltip,'formatter',this.tooltipFormatter); + this.$set(this.option.tooltip,'position',this.tooltipPosition); + this.$set(this.option.yAxis,'formatter',this.yAxisFormatter); + } }, methods:{ tooltipPosition:function(point,params,dom,rect,size){ @@ -108,6 +112,11 @@ if(!this.chart){ this.chart=echarts.init(document.getElementById(this.chartId)); } + if(this.chartType == 'map'){ + console.log(json) + console.log(this.option) + echarts.registerMap('map',json); + } this.chart.clear(); this.chart.setOption(this.option) }, @@ -120,7 +129,6 @@ }, mounted() { this.chart=echarts.init(document.getElementById(this.chartId)); - this.chart.setOption(this.option); }, watch:{ diff --git a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue index 0ca93bfe4..5ad821d49 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue @@ -1,5 +1,6 @@ diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview.scss b/nezha-fronted/src/components/page/dashboard/overview/overview.scss index 0081ddd7e..0d6dcb9fa 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview.scss @@ -63,7 +63,7 @@ width: 100%; } .overview-content .content-row-box{ - width: 99%; + width: 100%; display: flex; justify-content: space-between; align-content: flex-start; @@ -118,7 +118,6 @@ display: flex; align-items: center; justify-content: space-between; - padding: 5px; } .sub-title{ display: inline-block; diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview.vue b/nezha-fronted/src/components/page/dashboard/overview/overview.vue index 30bb3e4d0..7ab90ffa1 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview.vue @@ -46,7 +46,9 @@