echarts Tree

var data ={

    "name": "flare",
        {
            "name": "flex",
        },
        
        {
            "name": "scale",
        },
        {
            "name": "display",
        }
    ]
};
var myChart = echarts.init(document.getElementById('test'))

myChart.showLoading();

myChart.hideLoading();

    echarts.util.each(data.children, function (datum, index) {
    
        index % 2 === 0 && (datum.collapsed = true);
        
    });

    myChart.setOption(option = {
    
        tooltip: {
        
            trigger: 'item',
            
            triggerOn: 'mousemove'
            
        },

        series: [
            {
                type: 'tree',
                symbol:'rect',
                data: [data],
                top: '1%',
                left: '70%',
                bottom: '1%',
                right: '40%',
                symbolSize:7,
                lineStyle:{
                    curveness:1
                },
                itemStyle:{
                    borderColor:'#fff',
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#fff' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#fff' // 100% 处的颜色
                        }],
                        globalCoord: false // 缺省为 false
                    },
                },
                label: {
                    normal: {
                        position: 'left',
                        verticalAlign: 'middle',
                        align: 'right',
                        borderWidth:2,
                        borderColor:'#000',
                        padding: [10, 80],
                        fontSize: 15
                    }
                },

                leaves: {
                    label: {
                        normal: {
                            position: 'right',
                            verticalAlign: 'middle',
                            align: 'left'
                        }
                    }
                },

                expandAndCollapse: true,
                animationDuration: 550,
                animationDurationUpdate: 750
            }
        ]
    });
    
    //html
    <div id="test" style="width:1000px;height:700px;"></div>
复制代码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值