Commit ac8721b5 by 呼呼啦啦

修改

parent f9e4feaa
import {
getPadding,
getTheme,
getTooltip
} from '@/views/chart/chart/common/common_antv'
import { Scene, HeatmapLayer } from '@antv/l7' import { Scene, HeatmapLayer } from '@antv/l7'
import { GaodeMap } from '@antv/l7-maps' import { GaodeMap } from '@antv/l7-maps'
import { getLanguage } from '@/lang' import { getLanguage } from '@/lang'
export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) { export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) {
console.log('baseHeatMapOptionAntV', chartDom) console.log('baseHeatMapOptionAntV', chart)
const xAxis = JSON.parse(chart.xaxis) const xAxis = JSON.parse(chart.xaxis)
const xAxisExt = JSON.parse(chart.xaxisExt) const yAxis = JSON.parse(chart.yaxis)
let customAttr let customAttr
if (chart.customAttr) { if (chart.customAttr) {
customAttr = JSON.parse(chart.customAttr) customAttr = JSON.parse(chart.customAttr)
...@@ -31,7 +26,8 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) { ...@@ -31,7 +26,8 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) {
map: new GaodeMap({ map: new GaodeMap({
lang: lang, lang: lang,
pitch: size.mapPitch, pitch: size.mapPitch,
style: mapStyle style: mapStyle,
zoom: 3
}), }),
logoVisible: false logoVisible: false
}) })
...@@ -42,7 +38,7 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) { ...@@ -42,7 +38,7 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) {
chartDom.setMapStyle(mapStyle) chartDom.setMapStyle(mapStyle)
} }
} }
if (xAxis?.length < 2 || xAxisExt?.length < 2) { if (xAxis?.length < 1 || yAxis?.length < 1) {
chartDom.removeAllLayer() chartDom.removeAllLayer()
return chartDom return chartDom
} }
...@@ -53,19 +49,11 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) { ...@@ -53,19 +49,11 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) {
parser: { parser: {
type: 'json', type: 'json',
x: xAxis[0].dataeaseName, x: xAxis[0].dataeaseName,
y: xAxis[1].dataeaseName, y: xAxis[1].dataeaseName
x1: xAxisExt[0].dataeaseName,
y1: xAxisExt[1].dataeaseName
} }
}) })
.size(size.mapLineWidth)
.shape('heatmap') .shape('heatmap')
.animate({ .style({
enable: size.mapLineAnimate,
duration: size.mapLineAnimateDuration,
interval: 1,
trailLength: 1
}).style({
intensity: 2, intensity: 2,
radius: 20, radius: 20,
rampColors: { rampColors: {
...@@ -76,22 +64,15 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) { ...@@ -76,22 +64,15 @@ export function baseHeatMapOptionAntV(chartDom, chartId, chart, action) {
'#FFF598', '#FFF598',
'#F7B74A', '#F7B74A',
'#FF4818' '#FF4818'
].reverse(), ],
positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0] positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0]
} }
}) })
if (color.mapLineGradient) { .size('mag', [1, 80])
layer.style({ .scale('mag', {
sourceColor: color.mapLineSourceColor, type: 'linear',
targetColor: color.mapLineTargetColor, domain: [1, 50]
opacity: color.alpha / 100
}) })
} else {
layer.style({
opacity: color.alpha / 100
})
.color(color.mapLineSourceColor)
}
if (!init) { if (!init) {
chartDom.addLayer(layer) chartDom.addLayer(layer)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论