公司层级

描述:当前是关于Echarts图表中的 关系图 示例。
 
            option = {
    title: {
        text: '公司层级',
        link: 'www.baidu.com'
    },
    tooltip: {},
    animationDurationUpdate: 1500,
    animationEasingUpdate: 'quinticInOut',
    label: {
        normal: {
            show: true,
            textStyle: {
                fontSize: 18
            },
        }
    },
    legend: {
        x: "center",
        data: ["总经理", "秘书处", '传达者', '基层']
    },
    series: [

        {
            type: 'graph',
            layout: 'force',
            symbolSize: 60,
            focusNodeAdjacency: true,
            roam: true,
            categories: [{
                name: '总经理'
            }, {
                name: '秘书处'
            }, {
                name: '传达者'
            }, {
                name: '基层'
            }],
            label: {
                normal: {
                    show: true,
                    textStyle: {
                        fontSize: 18
                    },
                }
            },
            force: {
                repulsion: 2000
            },
            edgeLabel: {
                normal: {
                    show: true,
                    textStyle: {
                        fontSize: 18
                    },
                    formatter: "{c}"
                }
            },
            data: [{
                    name: '总经理',
                    category: 0,
                },

                {
                    name: '秘书长',
                    category: 1,
                    draggable: true,
                }, {
                    name: '副秘书长',
                    category: 1,
                    draggable: true,
                }, {
                    name: '传达丙',
                    category: 2,
                    draggable: true,
                }, {
                    name: '传达甲',
                    category: 2,
                    draggable: true,
                }, {
                    name: '传达乙',
                    category: 2,
                    draggable: true,
                }, {
                    name: '基层乙',
                    category: 3,
                    draggable: true,
                }, {
                    name: '基层丙',
                    category: 3,
                    draggable: true,
                },

                {
                    name: '传达丁',
                    category: 2,
                    draggable: true,
                }, {
                    name: '基层甲',
                    category: 3,
                    draggable: true,
                }, {
                    name: '基层丁',
                    category: 3,
                    draggable: true,
                },


            ],
            links: [{
                source: '总经理',
                target: '秘书长',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                    }
                }

            }, {
                source: '总经理',
                target: '副秘书长',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                    }
                }

            }, {
                source: '秘书长',
                target: '传达丙',
                value: '上级'
            }, {
                source: '副秘书长',
                target: '传达丁',
                value: '上级'
            }, {
                source: '秘书长',
                target: '夏桀',
                value: '上级'
            }, {
                source: '副秘书长',
                target: '传达甲',
                value: '上级'
            }, {
                source: '副秘书长',
                target: '传达乙',
                value: '上级'
            }, {
                source: '基层甲',
                target: '传达丁',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                        type: 'dotted'
                    }
                }

            }, {
                source: '基层丁',
                target: '传达丁',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                        type: 'dotted'
                    }
                }

            }, {
                source: '基层丁',
                target: '传达丙',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                        type: 'dotted'
                    }
                }

            }, {
                source: '基层乙',
                target: '传达丙',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                        type: 'dotted'
                    }
                }
            }, {
                source: '基层丙',
                target: '传达丙',
                value: '上级',
                lineStyle: {
                    normal: {
                        color: 'red',
                        type: 'dotted'
                    }
                }
            }, ],
            lineStyle: {
                normal: {
                    opacity: 0.7,
                    width: 1,
                    curveness: 0.1
                }
            }
        }
    ]
};