ECharts tree圖

var myChart = echarts.init(document.getElementById('main'));

myChart.showLoading();

$.getJSON('data.json', function (data) {

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',

data: [data],

top: '1%',

left: '7%',

bottom: '1%',

right: '20%',

symbolSize: 7,

label: {

normal: {

position: 'left',

verticalAlign: 'middle',

align: 'right',

fontSize: 11

}

},

leaves: {

label: {

normal: {

position: 'right',

verticalAlign: 'middle',

align: 'left'

}

}

},

expandAndCollapse: true,

animationDuration: 550,

animationDurationUpdate: 750

}

]

});

});

ECharts tree圖


分享到:


相關文章: