您当前的位置: 首页 >  ar

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

漏刻有时数据可视化Echarts组件开发(19):树图tree构建环绕圆的解决方案

漏刻有时 发布时间:2021-09-14 17:15:59 ,浏览量:0

在这里插入图片描述

var colors=[
	"#00ADD0",
	"#FFA12F",
	"#B62AFF",
	"#604BFF",
	"#6E35FF",
	"#002AFF",
	"#20C0F4",
	"#95F300",
	"#04FDB8",
	"#AF5AFF"
]
var getdata=function getData() {
      let data = {
        name: "35",
        value: 0,
        children: []
      };
      for (let i = 1; i {
     //计算出颜色
    if(index==1){
      color = colors.find((item, eq) => eq == index2 % 10);
    }
    // 设置节点大小
    if(index===0 || index===1){
        item.label= {
          position: "inside",
        //   rotate: 0,
        //   borderRadius: "50%",
        }
    }
    // 设置label大小
    switch(index){
      case 0:
        item.symbolSize=70
        break;
      case 1:
        item.symbolSize=50
        break;
      default:
        item.symbolSize=10
        break;
    }
    // 设置线条颜色
    item.lineStyle= { color: color }
   
    if (item.children) {//存在子节点
      item.itemStyle = {
        borderColor: color,
        color:color
      };
      item.children=handle(item.children,index+1,color)
    } else {//不存在
      item.itemStyle = {
        color:'transparent',
        borderColor: color
      };
    }
    return item
  })
}

var option = {
    type: "tree",
    backgroundColor: "#000",
    toolbox: { //工具栏
      show: true,
      iconStyle: {
        borderColor: "#03ceda"
      },
      feature: {
        restore: {}
      }
    },
    tooltip: {//提示框
      trigger: "item",
      triggerOn: "mousemove",
      backgroundColor: "rgba(1,70,86,1)",
      borderColor: "rgba(0,246,255,1)",
      borderWidth: 0.5,
      textStyle: {
        fontSize: 10
      }
    },
    series: [
      {
        type: "tree",
        hoverAnimation: true, //hover样式
		data:getdata(),
		top: 0,
		bottom: 0,
        left: 0,
        right: 0,
        layout: "radial",
        symbol: "circle",
        symbolSize: 10,
					nodePadding: 20,
        animationDurationUpdate: 750,
        expandAndCollapse: true, //子树折叠和展开的交互,默认打开
        initialTreeDepth: 2,
        roam: true, //是否开启鼠标缩放和平移漫游。scale/move/true
        focusNodeAdjacency: true,
        itemStyle: {
          borderWidth: 1,
        },
        label: { //标签样式
          color: "#fff",
          fontSize: 10,
          fontFamily: "SourceHanSansCN",
           position: "inside",
          rotate: 0,
        },
        lineStyle: {
          width: 0,
						curveness:0.5,
        }
      }
    ]
  };

lockdatav Done!

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0418s