Commit f74c8e57 by 韩艳丽

float

parent 7f442311
...@@ -29,7 +29,7 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) { ...@@ -29,7 +29,7 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) {
// pitch: size.mapPitch, // pitch: size.mapPitch,
style: mapStyle, style: mapStyle,
// style: 'dark', // style: 'dark',
center: [104.58631, 30.71882], // 成阿中心经纬度 // center: [104.58631, 30.71882], // 成阿中心经纬度
zoom: 6.2, zoom: 6.2,
maxZoom: 10 maxZoom: 10
}), }),
...@@ -42,31 +42,31 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) { ...@@ -42,31 +42,31 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) {
chartDom.setMapStyle(mapStyle) chartDom.setMapStyle(mapStyle)
} }
} }
// if (xAxis?.length < 3) { if (xAxis?.length < 3) {
// chartDom.removeAllLayer() chartDom.removeAllLayer()
// return chartDom return chartDom
// } }
const texts = [] const texts = []
const newTableRow = chart.data.tableRow.map((item, index) => { const newTableRow = chart.data.tableRow.map((item, index) => {
const name = item[xAxis[0].dataeaseName] const name = item[xAxis[0].dataeaseName]
const center = item[xAxis[1].dataeaseName] const center = JSON.parse(item[xAxis[1].dataeaseName])
const [lng, lat] = center const [lng, lat] = center
texts.push({ name, lng, lat }) texts.push({ name, lng, lat })
return { return {
type: 'Feature', type: 'Feature',
geometry: { geometry: {
type: 'MultiPolygon', type: 'MultiPolygon',
coordinates: item[xAxis[2].dataeaseName] coordinates: JSON.parse(item[xAxis[2].dataeaseName])
}, },
properties: { properties: {
name: item[xAxis[0].dataeaseName], name: item[xAxis[0].dataeaseName],
center: item[xAxis[1].dataeaseName] center: JSON.parse(item[xAxis[1].dataeaseName])
} }
} }
}) })
const mapData = { type: 'FeatureCollection', features: newTableRow } const mapData = { type: 'FeatureCollection', features: newTableRow }
const proData = { type: 'FeatureCollection', features: [newTableRow[0]] } const proData = { type: 'FeatureCollection', features: [newTableRow[0]] }
console.log(mapData, proData) console.log(mapData, proData, texts)
chartDom.removeAllLayer() chartDom.removeAllLayer()
.then(() => { .then(() => {
const textLayer = new PointLayer({ zIndex: 2 }) const textLayer = new PointLayer({ zIndex: 2 })
...@@ -116,7 +116,6 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) { ...@@ -116,7 +116,6 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) {
sourceColor: '#0DCCFF', sourceColor: '#0DCCFF',
targetColor: 'rbga(255,255,255, 0)' targetColor: 'rbga(255,255,255, 0)'
}) })
chartDom.addLayer(lineLayer)// 底部地图上的线
const provincelayer = new PolygonLayer({}) const provincelayer = new PolygonLayer({})
.source(proData) .source(proData)
...@@ -132,7 +131,6 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) { ...@@ -132,7 +131,6 @@ export function baseFloatMapOption(chartDom, chartId, chart, action) {
raisingHeight: 200000, raisingHeight: 200000,
opacity: 0.8 opacity: 0.8
}) })
chartDom.addLayer(provincelayer)// 省份
provincelayer.on('mousemove', () => { provincelayer.on('mousemove', () => {
provincelayer.style({ provincelayer.style({
raisingHeight: 200000 + 100000 raisingHeight: 200000 + 100000
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论