地图数据颜色
This commit is contained in:
@@ -18,7 +18,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chart: null,
|
chart: null,
|
||||||
geo: null
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
@@ -52,15 +51,6 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.$load(this.$refs.dvMap).then(() => this.initChart())
|
this.$load(this.$refs.dvMap).then(() => this.initChart())
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
data: {
|
|
||||||
deep: true, handler(v) {
|
|
||||||
this.chart.setOption({
|
|
||||||
geo: [{data: v}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
onDomResize() {
|
onDomResize() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -74,12 +64,9 @@ export default {
|
|||||||
text: "数据加载中...", textColor: "#fff",
|
text: "数据加载中...", textColor: "#fff",
|
||||||
maskColor: 'rgba(0, 0, 0, 0.2)'
|
maskColor: 'rgba(0, 0, 0, 0.2)'
|
||||||
})
|
})
|
||||||
Promise.all([
|
this.getData(this.geoJson).then(res => {
|
||||||
this.getData(this.geoJson).then(res => this.geo = res?.data),
|
if (!!res?.data) {
|
||||||
// waitFor(this.data)
|
echarts.registerMap('customMap', res.data)
|
||||||
]).then(() => {
|
|
||||||
if (!!this.geo) {
|
|
||||||
echarts.registerMap('customMap', this.geo)
|
|
||||||
const option = {
|
const option = {
|
||||||
geo: [
|
geo: [
|
||||||
// 重影
|
// 重影
|
||||||
@@ -107,7 +94,9 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
{
|
],
|
||||||
|
series: {
|
||||||
|
type: "map",
|
||||||
map: "customMap",
|
map: "customMap",
|
||||||
aspectScale: 1,
|
aspectScale: 1,
|
||||||
zoom: 0.65,
|
zoom: 0.65,
|
||||||
@@ -148,7 +137,6 @@ export default {
|
|||||||
},
|
},
|
||||||
data: this.data
|
data: this.data
|
||||||
},
|
},
|
||||||
],
|
|
||||||
...this.ops
|
...this.ops
|
||||||
// geo3D: {
|
// geo3D: {
|
||||||
// map: "customMap",
|
// map: "customMap",
|
||||||
@@ -179,7 +167,7 @@ export default {
|
|||||||
// },
|
// },
|
||||||
}
|
}
|
||||||
this.chart.setOption(option)
|
this.chart.setOption(option)
|
||||||
this.chart.on('click', evt => this.$emit("click", {...evt, info: this.geo.features.find(e => e.properties?.name == evt.name)?.properties}))
|
this.chart.on('click', evt => this.$emit("click", {...evt, info: res.data.features.find(e => e.properties?.name == evt.name)?.properties}))
|
||||||
this.chart.on('globalout', () => this.$emit("globalout"))
|
this.chart.on('globalout', () => this.$emit("globalout"))
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -19,18 +19,26 @@ export default {
|
|||||||
type: "piecewise",
|
type: "piecewise",
|
||||||
splitNumber: 8,
|
splitNumber: 8,
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 800,
|
max: 8000,
|
||||||
|
maxOpen: true,
|
||||||
inRange: {
|
inRange: {
|
||||||
color: ["#0CDEE9", "#0BD0DA", "#0BC1D5", "#0BACC1", "#0993AE", "#076C88", "#064E6B", "#054261"].reverse()
|
color: [
|
||||||
},
|
"#25EDF4",
|
||||||
outOfRange: {
|
"rgba(12,222,233,0.9)",
|
||||||
color: "#25EDF4"
|
"rgba(11,208,218,0.81)",
|
||||||
|
"rgba(11,193,213,0.72)",
|
||||||
|
"rgba(11,172,193,0.63)",
|
||||||
|
"rgba(9,147,174,0.54)",
|
||||||
|
"rgba(7,108,136,0.45)",
|
||||||
|
"rgba(6,78,107,0.36)",
|
||||||
|
"rgba(5,66,97,0.27)"].reverse()
|
||||||
},
|
},
|
||||||
|
outOfRange: {color: "#25EDF4"},
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: "#fff"
|
color: "#fff"
|
||||||
},
|
},
|
||||||
calculable: true
|
calculable: true
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
dialog: false,
|
dialog: false,
|
||||||
detail: [],
|
detail: [],
|
||||||
@@ -54,7 +62,11 @@ export default {
|
|||||||
getData(type = "530300000000") {
|
getData(type = "530300000000") {
|
||||||
return this.compData.getData({type}).then(res => {
|
return this.compData.getData({type}).then(res => {
|
||||||
const json = JSON.parse(res.param)
|
const json = JSON.parse(res.param)
|
||||||
|
if (type == "530300000000") {
|
||||||
this.geoData = json.map
|
this.geoData = json.map
|
||||||
|
this.$refs.map.chart?.setOption({series: {data: this.mapData}})
|
||||||
|
console.log(this.$refs.map.chart?.getOption()?.series)
|
||||||
|
}
|
||||||
this.config.summaryConfigs = json.sta?.map((e, i) => ({pos: ["rt", "lb", 'lt', 'rb'][i % 4], display: "summary20", ...e})) || []
|
this.config.summaryConfigs = json.sta?.map((e, i) => ({pos: ["rt", "lb", 'lt', 'rb'][i % 4], display: "summary20", ...e})) || []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user