当前位置: 首页 > news >正文

echarts 树形结构图实例

<html>
<head><meta charset="UTF-8">
<title>用户关系图</title><style>
</style><script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script></head><body><!-- 为ECharts准备一个具备大小(宽高)的Dom --><div style="padding:20px;width:100%;height:100%;"> <div id="main" style="width: 1104px;height:464px;"></div></div><script type="text/javascript">//定义echarts容器var myChart = echarts.init(document.getElementById('main'), 'macarons');option = {title : {text: '用户关系图',<!-- subtext: '树形图' -->},series : [{name:'树图',type:'tree',orient: 'vertical',  // vertical(竖向显示) horizontal(横向显示)rootLocation: {x: 'center', y: '60%'}, // 根节点位置  {x: 'center',y: 10}nodePadding: 20,symbol: 'circle',symbolSize: 40,itemStyle: {normal: {label: {show: true,position: 'bottom',textStyle: {color: 'black',fontSize: 15,fontWeight:  'bolder',borderColor: '#06c',padding: [5, 0, 20, 0], // 上、右、下、左的行间距
                        },formatter: function (params) {let name = params.name;let children = params.data.children;let childrenCount = children ? children.length : 0;return name + '(' + childrenCount + ')';}},//连接线样式
                    lineStyle: {color: 'red',width: 2,type: 'curve' // 'curve'|'broken'|'solid'|'dotted'|'dashed'
                    }},emphasis: {label: {show: true}}},data: [{name: '根节点\n第一行第二行',value: 6,symbolSize: [90, 70],symbol: "image://http://wjs.yujian.com//up//p//tg//2025//11//43_1761980685bdw_s.jpg",itemStyle: {normal: {label: {show: false,textStyle: {color: 'red',fontSize: 333,fontWeight:  'bolder',borderColor: '#06c',}}}},children: [{name: '小米',value: 4,symbol: 'image://http://pic.58pic.com/58pic/12/36/51/66d58PICMUV.jpg',itemStyle: {normal: {label: {show: false}}},symbolSize: [60, 60],children: [{name: '小米1',symbol: 'circle',symbolSize: 20,value: 4,itemStyle: {normal: {color: '#fa6900',label: {show: true,position: 'right'},},emphasis: {label: {show: false},borderWidth: 0}},children: [{name: '小米1',symbol: 'circle',symbolSize: 20,value: 4,itemStyle: {normal: {color: '#fa6900',label: {show: true,position: 'right'},},emphasis: {label: {show: false},borderWidth: 0}}},{name: '小米2',value: 4,symbol: 'circle',symbolSize: 20,itemStyle: {normal: {label: {show: true,position: 'right',formatter: "{b}"},color: '#fa6900',borderWidth: 2,borderColor: '#cc66ff'},emphasis: {borderWidth: 0}}},{name: '小米3',value: 2,symbol: 'circle',symbolSize: 20,itemStyle: {normal: {label: {position: 'right'},color: '#fa6900',brushType: 'stroke',borderWidth: 1,borderColor: '#999966',},emphasis: {borderWidth: 0}}}]},{name: '小米2',value: 4,symbol: 'circle',symbolSize: 20,itemStyle: {normal: {label: {show: true,position: 'right',formatter: "{b}"},color: '#fa6900',borderWidth: 2,borderColor: '#cc66ff'},emphasis: {borderWidth: 0}}},{name: '小米3',value: 2,symbol: 'circle',symbolSize: 20,itemStyle: {normal: {label: {position: 'right'},color: '#fa6900',brushType: 'stroke',borderWidth: 1,borderColor: '#999966',},emphasis: {borderWidth: 0}}}]},{name: '苹果',symbol: 'image://http://www.viastreaming.com/images/apple_logo2.png',symbolSize: [60, 60],itemStyle: {normal: {label: {show: false}}},value: 4},{name: '华为',symbol: 'image://http://market.huawei.com/hwgg/logo_cn/download/logo.jpg',symbolSize: [60, 60],itemStyle: {normal: {label: {show: false}}},value: 2},{name: '联想',symbol: 'image://http://www.lenovo.com.cn/HomeUpload/Home001/6d94ee9a20140714.jpg',symbolSize: [100, 40],itemStyle: {normal: {label: {show: false}}},value: 2}]}]}]
};             myChart.setOption(option);</script>      </body>
</html>

 

http://www.gsyq.cn/news/46708.html

相关文章:

  • 国标GB28181算法算力平台EasyGBS:深度解析全场景视频调阅功能与行业实战应用
  • 2025出国留学机构综合实力榜:排名前十的留学中介特色分析
  • 基于SpringBoot+Vue的个人理财系统管理系统设计与建立【Java+MySQL+MyBatis完整源码】
  • python使用PyInstaller打包成exe
  • 【APIE出版 | EI检索快速稳定】2025年机电一体化与轨道、交通国际学术会议(MRT 2025)
  • spark read mongodb拉取的数据行数和源库不一致
  • PV 与 PVC 的“绑定”动作真正发生的时间点
  • 【ACM出版 | 最快会后4个月检索 | 往届均已成功见刊并被EI检索】第三届人工智能、系统与网络安全国际学术会议 (AISNS 2025)
  • it的尽头是炒股
  • [量化01 线形 ]
  • 护栏碰撞报警系统工作原理是什么?传感器+数据传输全解析
  • AI 在数据库操作中的各类应用场景、方案与实践指南 - 指南
  • 2025年11月德语学习课程推荐:德企定制化培训,高性价比职场首选
  • 金风科技通过校企合作、职业培训和数字化平台的多元化培养体系培养新一代风电行业人才
  • 为什么我们很难“举一反三”?
  • charles问题排查
  • 2025年11月深圳近视手术医生榜单:五强对比与权威数据解读
  • 吹风机激光测距感应温度调节方案
  • 2025年11月上海老房翻新公司推荐榜:十强资质与用户评价对比
  • 2025年11月活性氧化铝产品排行:五家主流企业对比评价
  • win10 win11安装openssh客户端的命令
  • 详细介绍:单片机开发工具篇:(二)主流调试器之间的区别
  • py cx_oracle 中文乱码问题分析
  • 【图像处理基石】遥感图像高度信息提取:Python实战全流程+常用库汇总 - 教程
  • P11802 【MX-X9-T6】『GROI-R3』Graph
  • 2025年一代天骄青少年训练营最新推荐:一代天骄寒假班/一代天骄课程/一代天骄成长课程/一代天骄暑假班,专注青少年成长训练,树立个性化教育新标准
  • 实用指南:React组件生命周期节点触发时机(组件加载Mount、组件更新Update、组件卸载Unmount)组件挂载
  • 2025年11月酒店加盟品牌推荐:主流选择对比与高性价比解决方案
  • iOS申请备案号时需要提供Bundle ID、公钥和证书SHA-1指纹
  • 2025年11月连锁酒店推荐:主流品牌对比高性价比选择指南