Merge pull request #574 from dataease/pr@dev@feat_视图返回字段构建

feat: 视图返回字段构建
This commit is contained in:
XiaJunjie2020 2021-08-10 18:28:01 +08:00 committed by GitHub
commit d57ef618b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View File

@ -625,7 +625,7 @@ export const BASE_MAP = {
{
name: '',
type: 'map',
map: 'HK',
map: 'MAP',
roam: true,
// label: {
// show: true

View File

@ -33,16 +33,22 @@ export function baseMapOption(chart_option, chart) {
}
// visualMap
const valueArr = chart.data.series[0].data
chart_option.visualMap.min = Math.min(...valueArr)
chart_option.visualMap.max = Math.max(...valueArr)
const values = []
valueArr.forEach(function(ele) {
values.push(ele.value)
})
chart_option.visualMap.min = Math.min(...values)
chart_option.visualMap.max = Math.max(...values)
if (customAttr.color && customAttr.color.colors) {
chart_option.visualMap.inRange.color = customAttr.color.colors
}
for (let i = 0; i < valueArr.length; i++) {
const y = {
name: chart.data.x[i],
value: valueArr[i]
}
// const y = {
// name: chart.data.x[i],
// value: valueArr[i]
// }
const y = valueArr[i]
y.name = chart.data.x[i]
// color
// y.itemStyle = {
// color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),

View File

@ -152,7 +152,7 @@ export default {
},
initMapChart(geoJson, chart) {
// this.$echarts.registerMap('HK', geoJson)
this.$echarts.getMap('HK') || this.$echarts.registerMap('HK', geoJson)
this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
const chart_option = baseMapOption(base_json, chart)
this.myEcharts(chart_option)

View File

@ -37,7 +37,7 @@ export default {
series: [
{
type: 'map',
map: 'HK', //
map: 'MAP', //
roam: true,
label: {
show: false