当前位置: 首页 > 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.jsqmd.com/news/37744/

相关文章:

  • pg_hba.conf配置里peer,indent和md5的区别
  • 基于Simulink的双电机PID控制仿真实现方案
  • 锡林郭勒西林瓶灌装清洗耗材月成本分析?查行情享优惠
  • AI Agent OS 探索有价值的论文分析(1):Sleep-time Compute
  • Linux内核架构浅谈26-Linux实时进程调度:优先级反转与解决实用的方案
  • 宏定义的高级应用
  • 被问性能后,我封装了这个 PHP 错误上报工具
  • 公众号中的贴纸素材有什么作用?在哪里找?
  • 国标GB28181算法算力平台EasyGBS:深度解析全场景视频调阅功能与行业实战应用
  • 2025出国留学机构综合实力榜:排名前十的留学中介特色分析
  • 公众号怎么起爆款标题?有什么好用的工具?
  • 邢台西林瓶灌装机优选指南:聚焦资质、案例与售后
  • 基于SpringBoot+Vue的个人理财系统管理系统设计与建立【Java+MySQL+MyBatis完整源码】
  • python使用PyInstaller打包成exe
  • 2025年机械磨优质厂家权威推荐榜单:冲击磨/小型机械磨/超微机械磨源头厂家精选
  • jQuery custom content scroller滚动条控件代码 - 教程
  • 【APIE出版 | EI检索快速稳定】2025年机电一体化与轨道、交通国际学术会议(MRT 2025)
  • 搭建第一个MCP服务
  • React-router v7 配置 Suspense+lazy fallback第二次不显示
  • spark read mongodb拉取的数据行数和源库不一致
  • PV 与 PVC 的“绑定”动作真正发生的时间点
  • 2025日本留学中介推荐:留学申请与语言学习一站式解决
  • 2025年11月高温老化房及环境试验设备推荐厂家:步入式恒温试验室/步入式高低温湿热试验室/大型高低温湿热试验室/汽车零部件、逆变器、电子元器件等场景适用
  • 【ACM出版 | 最快会后4个月检索 | 往届均已成功见刊并被EI检索】第三届人工智能、系统与网络安全国际学术会议 (AISNS 2025)
  • it的尽头是炒股
  • Windows 电脑 FTP 服务器配置
  • [量化01 线形 ]
  • 护栏碰撞报警系统工作原理是什么?传感器+数据传输全解析
  • 2025抗老面霜爆款推荐:功效全面升级,从 “成分堆砌” 到 “体系抗老”
  • AI 在数据库操作中的各类应用场景、方案与实践指南 - 指南