修复世界地图不显示的问题
- 将地图配置从 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,44 +575,42 @@ 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: {
|
|
||||||
map: 'world',
|
|
||||||
roam: true,
|
|
||||||
zoom: 1.2,
|
|
||||||
nameMap: worldNameMap,
|
|
||||||
label: {
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
color: dark ? '#f8fafc' : '#0f172a',
|
|
||||||
fontSize: 11,
|
|
||||||
fontWeight: 600,
|
|
||||||
},
|
|
||||||
itemStyle: {
|
|
||||||
areaColor: dark ? '#334155' : '#f1f5f9',
|
|
||||||
borderColor: dark ? '#475569' : '#94a3b8',
|
|
||||||
borderWidth: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
itemStyle: {
|
|
||||||
areaColor: dark ? '#1e293b' : '#e2e8f0',
|
|
||||||
borderColor: dark ? '#334155' : '#cbd5e1',
|
|
||||||
borderWidth: 0.5,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: t('admin.userDistribution'),
|
name: t('admin.userDistribution'),
|
||||||
type: 'map',
|
type: 'map',
|
||||||
geoIndex: 0,
|
map: 'world',
|
||||||
|
roam: true,
|
||||||
|
zoom: 1.2,
|
||||||
|
nameMap: worldNameMap,
|
||||||
|
label: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
color: dark ? '#f8fafc' : '#0f172a',
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: 600,
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
areaColor: dark ? '#334155' : '#f1f5f9',
|
||||||
|
borderColor: dark ? '#475569' : '#94a3b8',
|
||||||
|
borderWidth: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
areaColor: dark ? '#1e293b' : '#e2e8f0',
|
||||||
|
borderColor: dark ? '#334155' : '#cbd5e1',
|
||||||
|
borderWidth: 0.5,
|
||||||
|
},
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user