echarts tree默认展开_Echarts树形图展开和收缩

一、实现效果

收缩效果:

展开效果:

二、实现代码

展开/收缩

切换

var dom = document.getElementById("container");

var myChart = echarts.init(dom);

var app = {};

option = null;

myChart.showLoading();

$.get("{% url 'project_chart_json' %}" + "?pro_id={ { pro_id }}" , function (data) {

myChart.hideLoading();

echarts.util.each(data.children, function (datum, index) {

datum.collapsed = false;

});

myChart.setOption(option = {

tooltip: {

trigger: 'item',

triggerOn: 'mousemove'

},

series: [

{

type: 'tree',

data: [d

你可能感兴趣的:(echarts,tree默认展开)