Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#globe #map #tooltip 关于地球仪与2D地图的结合时的提示框组件问题 #539

Open
darkwithlight opened this issue Oct 26, 2024 · 0 comments

Comments

@darkwithlight
Copy link

最近我正在尝试在地球仪上按国家显示热度信息,尝试之后发现在2D显示时能够正常使用的提示框组件在地球仪上无法使用。
My tooltip on globe is gone!!!

这是2D时的正常使用:
图片

这是作为地球仪的基础纹理时的效果:
图片

附上我的配置项代码:

const canvas = ref<HTMLCanvasElement>(document.createElement('canvas'))
const mapChart = echarts.init(canvas.value, null, {
  width: '2048',
  height: '1024'
})
const mapOption = ref<ECOption>({
  tooltip:{
    show: true,
    trigger: 'item',
    triggerOn:'mousemove|click',
    formatter: '{b}: {c}'
  },
  series: [
    {
      type:'map',
      map: 'world',
      data: [
          {name: '中国', value: 1392},
      ],
      zoom: 1,
      zlevel: 1,
      z: 2
    }
  ],
  backgroundColor: '#6060ff',
  visualMap: {
    min: 0,
    max: 100,
    rangeText: ['High', 'Low'],
  },
  nameMap: {
    'China': '中国'
  }
})
const chart = ref<HTMLDivElement>()
const option = ref<ECOption>({
  globe: {
    globeRadius: 100,
    globeOuterRadius: 110,
    baseTexture: mapChart,
    shading: 'color',
    viewControl: {
      projection: 'perspective',
      alpha: 15,
      beta: 175,
      autoRotate: false,
      autoRotateSpeed: 5,
      autoRotateAfterStill: 2,
      distance: 160,
    }
  }
})

const drawMap = () => {
  mapChart.setOption(mapOption.value)
}

const loadMap = () => {
  axios.get('/json/world.json').then(({data, status}) => {
    if (status !== 200) return
    echarts.registerMap('world', data)
    drawMap()
  })
}

onBeforeMount(() => {
  loadMap()
})

onMounted(() => {
  echarts.init(chart.value).setOption(option.value, true)
})

如果目前地球仪上使用2D地图存在能够正常使用提示框组件的方法,烦请指教。
If has the way to show tooltip, teach me please.

如果目前地球仪上并没有实现2D地图的提示框组件,烦请告知。
If has no way to show, please tell me.

谢谢。
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant