修复世界地图不显示的问题
- 将地图配置从 geo + geoIndex 改为直接在 series 中使用 map: 'world' - nameMap 放在 series 中,避免 geo.nameMap 导致的名称匹配失败 - 工具提示中动态翻译国家名称显示中文
This commit is contained in:
@@ -558,8 +558,9 @@ function updateMapOption() {
|
|||||||
},
|
},
|
||||||
formatter: (params: any) => {
|
formatter: (params: any) => {
|
||||||
if (params.data && params.data.count > 0) {
|
if (params.data && params.data.count > 0) {
|
||||||
|
const displayName = worldNameMap[params.name] || params.name
|
||||||
return `<div style="padding: 4px;">
|
return `<div style="padding: 4px;">
|
||||||
<div style="font-weight: 600; margin-bottom: 6px; font-size: 13px;">${params.name}</div>
|
<div style="font-weight: 600; margin-bottom: 6px; font-size: 13px;">${displayName}</div>
|
||||||
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 3px;">
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 3px;">
|
||||||
<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:#22c55e;"></span>
|
<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:#22c55e;"></span>
|
||||||
<span>${t('admin.online')}: ${params.data.online}</span>
|
<span>${t('admin.online')}: ${params.data.online}</span>
|
||||||
@@ -574,13 +575,17 @@ function updateMapOption() {
|
|||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
}
|
}
|
||||||
|
const displayName = worldNameMap[params.name] || params.name
|
||||||
return `<div style="padding: 4px;">
|
return `<div style="padding: 4px;">
|
||||||
<div style="font-weight: 600; margin-bottom: 4px; font-size: 13px;">${params.name}</div>
|
<div style="font-weight: 600; margin-bottom: 4px; font-size: 13px;">${displayName}</div>
|
||||||
<div style="color: ${dark ? '#94a3b8' : '#64748b'};">${t('admin.noUserData')}</div>
|
<div style="color: ${dark ? '#94a3b8' : '#64748b'};">${t('admin.noUserData')}</div>
|
||||||
</div>`
|
</div>`
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
geo: {
|
series: [
|
||||||
|
{
|
||||||
|
name: t('admin.userDistribution'),
|
||||||
|
type: 'map',
|
||||||
map: 'world',
|
map: 'world',
|
||||||
roam: true,
|
roam: true,
|
||||||
zoom: 1.2,
|
zoom: 1.2,
|
||||||
@@ -606,12 +611,6 @@ function updateMapOption() {
|
|||||||
borderColor: dark ? '#334155' : '#cbd5e1',
|
borderColor: dark ? '#334155' : '#cbd5e1',
|
||||||
borderWidth: 0.5,
|
borderWidth: 0.5,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: t('admin.userDistribution'),
|
|
||||||
type: 'map',
|
|
||||||
geoIndex: 0,
|
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user