如图,设置成第二种格式的

解决方案 »

  1.   

    series 里面设置 。属性名 lineStyle
    http://echarts.baidu.com/option.html#series-sankey.lineStyle
      

  2.   

    你没仔细看这个lineStyle 是一组数据可以设置一次的。也就是series  里面的多个data对应的lineStyle是可以设置多个的 series: [
                {
                    type: 'sankey',
                    layout: 'none',
                    data: data.nodes,
                    links: data.links,
                    itemStyle: {
                        normal: {
                            borderWidth: 1,
                            borderColor: '#aaa'
                        }
                    },
                    lineStyle: {
                        normal: {
                            color: 'source',
                            curveness: 0.5
                        }
                    }
                },
                {
                    type: 'sankey',
                    layout: 'none',
                    data: data.nodes,
                    links: data.links,
                    itemStyle: {
                        normal: {
                            borderWidth: 1,
                            borderColor: '#aaa'
                        }
                    },
                    lineStyle: {
                        normal: {
                            color: 'source',
                            curveness: 0.5
                        }
                    }
                }
            ]
      

  3.   

    https://blog.csdn.net/wusefengye/article/details/79110195
      

  4.   

    https://blog.csdn.net/wusefengye/article/details/79110195
      

  5.   


    myChart.showLoading();
    $.get('data/asset/data/flare.json', function (data) {
        myChart.hideLoading();    echarts.util.each(data.children, function (datum, index) {
            index % 2 === 0 && (datum.collapsed = true);
        });    data.children[0].itemStyle = {
            color : '#0000ff',
            borderColor:'#0000ff'
        };
        data.children[0].lineStyle = {
            color : '#0000ff',
            borderColor:'#0000ff'
        }
        let data2 = data.children[1];    myChart.setOption(option = {
            tooltip: {
                trigger: 'item',
                triggerOn: 'mousemove'
            },
            series: [
                {
                    type: 'tree',                data: [data],                top: '1%',
                    left: '7%',
                    bottom: '1%',
                    right: '20%',                symbolSize: 7,                label: {
                        normal: {
                            position: 'left',
                            verticalAlign: 'middle',
                            align: 'right',
                            fontSize: 9
                        }
                    },                leaves: {
                        label: {
                            normal: {
                                position: 'right',
                                verticalAlign: 'middle',
                                align: 'left'
                            }
                        }
                    },                expandAndCollapse: true,
                    animationDuration: 550,
                    animationDurationUpdate: 750
                },
                {
                    type: 'tree',                data: [data2],                top: '1%',
                    left: '7%',
                    bottom: '1%',
                    right: '20%',                symbolSize: 7,                label: {
                        normal: {
                            position: 'left',
                            verticalAlign: 'middle',
                            align: 'right',
                            fontSize: 9
                        }
                    },
                    
                    lineStyle:{
                        color:'#ff0000'
                    },                leaves: {
                        label: {
                            normal: {
                                position: 'right',
                                verticalAlign: 'middle',
                                align: 'left'
                            }
                        }
                    },                expandAndCollapse: true,
                    animationDuration: 550,
                    animationDurationUpdate: 750
                }
            ]
        });
    });
    在data中设置lineStyle是边的样式,itemStyle是节点样式