-
-
+
@@ -19,7 +29,12 @@ import {
BASE_TREEMAP,
BASE_MIX
} from '../chart/chart'
-import { baseBarOption, stackBarOption, horizontalBarOption, horizontalStackBarOption } from '../chart/bar/bar'
+import {
+ baseBarOption,
+ stackBarOption,
+ horizontalBarOption,
+ horizontalStackBarOption
+} from '../chart/bar/bar'
import { baseLineOption, stackLineOption } from '../chart/line/line'
import { basePieOption, rosePieOption } from '../chart/pie/pie'
import { baseMapOption } from '../chart/map/map'
@@ -101,22 +116,30 @@ export default {
// 基于准备好的dom,初始化echarts实例
// 渲染echart等待dom加载完毕,渲染之前先尝试销毁具有相同id的echart 放置多次切换仪表板有重复id情况
const that = this
- new Promise((resolve) => { resolve() }).then(() => {
+ new Promise((resolve) => {
+ resolve()
+ }).then(() => {
// 此dom为echarts图标展示dom
- this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
+ this.myChart = this.$echarts.getInstanceByDom(
+ document.getElementById(this.chartId)
+ )
if (!this.myChart) {
- this.myChart = this.$echarts.init(document.getElementById(this.chartId))
+ this.myChart = this.$echarts.init(
+ document.getElementById(this.chartId)
+ )
}
this.drawEcharts()
this.myChart.off('click')
this.myChart.on('click', function(param) {
that.pointParam = param
- if (that.trackMenu.length < 2) { // 只有一个事件直接调用
+ if (that.trackMenu.length < 2) {
+ // 只有一个事件直接调用
that.trackClick(that.trackMenu[0])
- } else { // 视图关联多个事件
+ } else {
+ // 视图关联多个事件
that.trackBarStyle.left = param.event.offsetX + 'px'
- that.trackBarStyle.top = (param.event.offsetY - 15) + 'px'
+ that.trackBarStyle.top = param.event.offsetY - 15 + 'px'
that.$refs.viewTrack.trackButtonClick()
}
})
@@ -127,33 +150,75 @@ export default {
let chart_option = {}
// type
if (chart.type === 'bar') {
- chart_option = baseBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
+ chart_option = baseBarOption(
+ JSON.parse(JSON.stringify(BASE_BAR)),
+ chart
+ )
} else if (chart.type === 'bar-stack') {
- chart_option = stackBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
+ chart_option = stackBarOption(
+ JSON.parse(JSON.stringify(BASE_BAR)),
+ chart
+ )
} else if (chart.type === 'bar-horizontal') {
- chart_option = horizontalBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
+ chart_option = horizontalBarOption(
+ JSON.parse(JSON.stringify(HORIZONTAL_BAR)),
+ chart
+ )
} else if (chart.type === 'bar-stack-horizontal') {
- chart_option = horizontalStackBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
+ chart_option = horizontalStackBarOption(
+ JSON.parse(JSON.stringify(HORIZONTAL_BAR)),
+ chart
+ )
} else if (chart.type === 'line') {
- chart_option = baseLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart)
+ chart_option = baseLineOption(
+ JSON.parse(JSON.stringify(BASE_LINE)),
+ chart
+ )
} else if (chart.type === 'line-stack') {
- chart_option = stackLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart)
+ chart_option = stackLineOption(
+ JSON.parse(JSON.stringify(BASE_LINE)),
+ chart
+ )
} else if (chart.type === 'pie') {
- chart_option = basePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart)
+ chart_option = basePieOption(
+ JSON.parse(JSON.stringify(BASE_PIE)),
+ chart
+ )
} else if (chart.type === 'pie-rose') {
- chart_option = rosePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart)
+ chart_option = rosePieOption(
+ JSON.parse(JSON.stringify(BASE_PIE)),
+ chart
+ )
} else if (chart.type === 'funnel') {
- chart_option = baseFunnelOption(JSON.parse(JSON.stringify(BASE_FUNNEL)), chart)
+ chart_option = baseFunnelOption(
+ JSON.parse(JSON.stringify(BASE_FUNNEL)),
+ chart
+ )
} else if (chart.type === 'radar') {
- chart_option = baseRadarOption(JSON.parse(JSON.stringify(BASE_RADAR)), chart)
+ chart_option = baseRadarOption(
+ JSON.parse(JSON.stringify(BASE_RADAR)),
+ chart
+ )
} else if (chart.type === 'gauge') {
- chart_option = baseGaugeOption(JSON.parse(JSON.stringify(BASE_GAUGE)), chart)
+ chart_option = baseGaugeOption(
+ JSON.parse(JSON.stringify(BASE_GAUGE)),
+ chart
+ )
} else if (chart.type === 'scatter') {
- chart_option = baseScatterOption(JSON.parse(JSON.stringify(BASE_SCATTER)), chart)
+ chart_option = baseScatterOption(
+ JSON.parse(JSON.stringify(BASE_SCATTER)),
+ chart
+ )
} else if (chart.type === 'treemap') {
- chart_option = baseTreemapOption(JSON.parse(JSON.stringify(BASE_TREEMAP)), chart)
+ chart_option = baseTreemapOption(
+ JSON.parse(JSON.stringify(BASE_TREEMAP)),
+ chart
+ )
} else if (chart.type === 'chart-mix') {
- chart_option = baseMixOption(JSON.parse(JSON.stringify(BASE_MIX)), chart)
+ chart_option = baseMixOption(
+ JSON.parse(JSON.stringify(BASE_MIX)),
+ chart
+ )
}
// console.log(JSON.stringify(chart_option))
@@ -167,13 +232,15 @@ export default {
return
}
- geoJson(cCode).then(res => {
- this.$store.dispatch('map/setGeo', {
- key: cCode,
- value: res
- }).then(() => {
- this.initMapChart(res, chart)
- })
+ geoJson(cCode).then((res) => {
+ this.$store
+ .dispatch('map/setGeo', {
+ key: cCode,
+ value: res
+ })
+ .then(() => {
+ this.initMapChart(res, chart)
+ })
})
return
}
@@ -181,25 +248,25 @@ export default {
},
registerDynamicMap(areaCode) {
this.dynamicAreaCode = areaCode
- // if (this.$store.getters.geoMap[areaCode]) {
- // const json = this.$store.getters.geoMap[areaCode]
- // this.myChart.dispose()
- // this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
- // this.$echarts.registerMap('MAP', json)
- // return
- // }
- // geoJson(areaCode).then(res => {
- // this.$store.dispatch('map/setGeo', {
- // key: areaCode,
- // value: res
- // }).then(() => {
- // this.myChart.dispose()
- // this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
- // this.$echarts.registerMap('MAP', res)
- // })
- // }).catch(() => {
- // this.downOrUp = true
- // })
+ // if (this.$store.getters.geoMap[areaCode]) {
+ // const json = this.$store.getters.geoMap[areaCode]
+ // this.myChart.dispose()
+ // this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
+ // this.$echarts.registerMap('MAP', json)
+ // return
+ // }
+ // geoJson(areaCode).then(res => {
+ // this.$store.dispatch('map/setGeo', {
+ // key: areaCode,
+ // value: res
+ // }).then(() => {
+ // this.myChart.dispose()
+ // this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
+ // this.$echarts.registerMap('MAP', res)
+ // })
+ // }).catch(() => {
+ // this.downOrUp = true
+ // })
},
initMapChart(geoJson, chart) {
@@ -213,6 +280,16 @@ export default {
// 指定图表的配置项和数据
const chart = this.myChart
this.setBackGroundBorder()
+ if (
+ option.series &&
+ option.series.length > 0 &&
+ option.series[0].type === 'gauge'
+ ) {
+ if (option.series[0].data && option.series[0].data.length > 0) {
+ option.series[0].max = option.series[0].data[0].value
+ }
+ }
+ console.log('哈哈哈', option)
setTimeout(chart.setOption(option, true), 500)
window.onresize = function() {
chart.resize()
@@ -267,6 +344,4 @@ export default {
}
-
+
diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue
index 089b33a..24027f0 100644
--- a/frontend/src/views/chart/components/ChartComponentG2.vue
+++ b/frontend/src/views/chart/components/ChartComponentG2.vue
@@ -1,7 +1,17 @@
-
-
-
+
@@ -74,7 +84,9 @@ export default {
preDraw() {
// 基于准备好的dom,初始化echarts实例
// 渲染echart等待dom加载完毕,渲染之前先尝试销毁具有相同id的echart 放置多次切换仪表板有重复id情况
- new Promise((resolve) => { resolve() }).then(() => {
+ new Promise((resolve) => {
+ resolve()
+ }).then(() => {
// 此dom为echarts图标展示dom
// this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
// if (!this.myChart) {
@@ -157,6 +169,4 @@ export default {
}
-
+
diff --git a/frontend/src/views/chart/components/table/TableNormal.vue b/frontend/src/views/chart/components/table/TableNormal.vue
index b721640..e7e4463 100644
--- a/frontend/src/views/chart/components/table/TableNormal.vue
+++ b/frontend/src/views/chart/components/table/TableNormal.vue
@@ -38,11 +38,11 @@
- {{ $t("chart.total") }}
+ {{ $t('chart.total') }}
{{
chart.data && chart.data.tableRow ? chart.data.tableRow.length : 0
}}
- {{ $t("chart.items") }}
+ {{ $t('chart.items') }}