Skip to content

Commit

Permalink
fix: 地图模式为map时,不做城市校验
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoluoboding committed Mar 26, 2019
1 parent 831254a commit da0c178
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 74 deletions.
35 changes: 1 addition & 34 deletions src/packages/geo/chartHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { MAP_URL_PREFIX } from '../../base-options'

import cityGeo from './map-data/cityGeo.json'
import cityGeo2 from './map-data/cityGeo2.json'
import mapProvinceId from './map-data/mapProvinceId.json'
import mapCityId from './map-data/mapCityId.json'

function convertCityData(data, options) {
Expand Down Expand Up @@ -45,36 +44,6 @@ function convertCityData(data, options) {
return res
}

function convertProvinceData(data, options) {
const { connect } = options
const dataIndex = connect ? connect.dataIndex : -1
const normalShadowBlur = connect ? connect.normalShadowBlur : 0

const convertData = isNaN(data[0].name * 1) ? data : data.map((v, i) => {
const provinceIndex = mapProvinceId.findIndex(province => province.id === v.name)

return {
...v,
name: provinceIndex !== -1 ? mapProvinceId[provinceIndex].name : v.name,
pattern: data[i].name
}
})

if (dataIndex !== -1) {
convertData[dataIndex] = {
...convertData[dataIndex],
selected: true,
itemStyle: {
normal: {
shadowBlur: normalShadowBlur
}
}
}
}

return convertData
}

function getGeoData(args) {
const { data, settings } = args
const { measures } = data
Expand All @@ -100,9 +69,7 @@ function getGeoData(args) {
}).reduce((a, b) => a + b)

measures && measures.forEach(({ name, data }, index) => {
const mapData = isMapMode
? convertProvinceData(data, { connect })
: convertCityData(data, { index, connect })
const mapData = isMapMode ? data : convertCityData(data, { index, connect })

const unShowLabel = { normal: { show: false }, emphasis: { show: false } }

Expand Down
40 changes: 0 additions & 40 deletions src/packages/geo/map-data/mapProvinceId.json

This file was deleted.

0 comments on commit da0c178

Please sign in to comment.