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]
      ]
    }
  ]
}

如图:

相关推荐
im_AMBER1 小时前
Leetcode 147 零钱兑换 | 单词拆分
javascript·学习·算法·leetcode·动态规划
arvin_xiaoting2 小时前
OpenClaw学习总结_II_频道系统_5:Signal集成详解
java·前端·学习·signal·ai agent·openclaw·signal-cli
x-cmd2 小时前
[260326] x-cmd v0.8.10:跨 Shell 统一配置命令短名;自动装好依赖运行 WhisperLiveKit 实时语音转写
linux·人工智能·ai·whisper·shortcut·x-cmd
哆啦A梦15882 小时前
统一返回包装类 Result和异常处理
java·前端·后端·springboot
zhuyan1082 小时前
【AI编程】aider安装记录
linux·运维·ai编程
saadiya~2 小时前
从插件冗余到极致流畅:我的 Vue 3 开发环境“瘦身”实录
前端·javascript·vue.js
书山有鹿2 小时前
MaxKB v2.7.0 Rocky Linux 9 部署手册
linux·运维·maxkb·rockylinux 9
Mapleay2 小时前
ALSA PCM 数据搬运模式
linux
Timer@3 小时前
LangChain 教程 03|快速开始:10 分钟创建第一个 Agent
前端·javascript·langchain