var myChart = echarts.init(document.getElementById('treeChart'));
myChart.showLoading();
var data =[[${treeChart}]];
data= JSON.parse(data);
console.log(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: 12,
label: {
position: 'left',
verticalAlign: 'middle',
align: 'right',
fontSize: 16
},
leaves: {
label: {
position: 'right',
verticalAlign: 'middle',
align: 'left'
}
},
expandAndCollapse: true,
animationDuration: 550,
animationDurationUpdate: 750
}
]
});
1