

const getTreeChart = (treeData) => {
  const option = {
    series: [{
      type: 'tree',
      layout: 'orthogonal', // 从上到下布局
      orient: 'TB', // Top to Bottom
      data: treeData,
      top: '10%',
      bottom: '5%',
      left: '10%',
      right: '10%',
      symbol: 'circle',
      symbolSize: 40,
      label: {
        position: 'bottom',
        verticalAlign: 'middle',
        align: 'center'
      },
      leaves: {
        label: {
          position: 'top',
          verticalAlign: 'middle',
          align: 'center'
        }
      },
      lineStyle: {
        color: '#ccc',
        width: 2,
        type: 'dashed' // 虚线
      },
      emphasis: {
        focus: 'descendant'
      },
      expandAndCollapse: false,
      initialTreeDepth: 3
    }]
  };

  return option
}

export default getTreeChart