echart绘制天顶图

这两个配置是 极坐标系 / 饼图类图表(雷达图、极坐标柱状图、环形图、南丁格尔玫瑰图) 的核心配置,专门用来控制极坐标的「半径方向」和「角度方向」

  • radiusAxis(半径轴)从圆心向外辐射的轴(上下 / 内外方向)
  • angleAxis(角度轴)绕圆心旋转的轴(一圈 360° 方向)
  • 极坐标系 = 半径轴 + 角度轴

话不多说,上代码

javascript 复制代码
option = {
  backgroundColor: '#1E1F2B',
  polar: {
    show: true,
    center: ['50%', '50%']
  },
  tooltip: {

  },
  angleAxis: {
    type: 'value',
    splitNumber: 12,
    min: -180,
    max: 180,
    splitLine: {
      show: true,
      lineStyle: {
        color: '#96D4FF',
        type: 'dashed'
      }
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#96D4FF'
      }
    },
    axisTick: { show: true },
    minorTick: { show: true },
    axisLabel: {
      show: true,
      textStyle: {
        color: '#96D4FF'
      }
    }
  },
  radiusAxis: {
    min: 0,
    max: 90,
    type: 'value',
    inverse: true,   
    splitLine: {
      show: true,
      lineStyle: {
        color: '#96D4FF'
      }
    },
    axisLine: { show: false },
    axisTick: { show: false },
    axisLabel: { show: false }
  },
  series: [
    {
      id: '11',
      type: 'scatter',
      coordinateSystem: 'polar',
      symbol: 'circle', // 先用简单图形测试
      symbolSize: 10,
      itemStyle: {
        color: '#409eff',
        opacity: 1 // 先固定,调试成功再恢复逻辑
      },
      cursor: 'pointer',
      data: [[120, 10],[70, 10],[0, 150],[50, -10]], // <-- 修复格式
   
    },
    {
      type: 'line',
      coordinateSystem: 'polar',
      smooth: true, // 曲线
      symbol: 'none',
      lineStyle: {
        color: '#96D4FF',
        width: 2
      },
      data: [
        [45, 10],
        [90, 30],
        [135, 60],
        [180, 40],
        [225, 20]
      ]
    }
  ]
}

如图:

相关推荐
fthux3 小时前
RenoPit 能为普通业主做什么?看懂图纸、审查合同,提前发现装修坑
javascript·人工智能·ai·开源·github·chrome扩展·open source·edge扩展·firefox扩展
仿生狮子4 小时前
✂️ Nuxt 最简单的字体裁剪工具:Fontize
javascript·vue.js·nuxt.js
Better Bench6 小时前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
实心儿儿6 小时前
Linux —— 进程间关系和守护进程
linux·运维·服务器
石小石Orz7 小时前
我发现了开发者AI产品营收的新方向
前端·虚拟现实
老马识途2.07 小时前
关于跨域问题的总结
java·前端
魔力女仆8 小时前
分享一个 JS 鼠标跟随贪吃蛇背景库
开发语言·javascript·计算机外设
Dawn-bit8 小时前
Linux磁盘管理详解
linux·运维·服务器·计算机网络·云计算
RisunJan8 小时前
Linux命令-sftp(SSH 文件传输协议客户端)
linux·运维
别惊醒渔人9 小时前
Vue3 Diff 优化:最长递增子序列 LIS
前端·javascript·vue.js