blob: 17e23dc2c3e2d6f6f352d7337684d91b8240681e [file] [log] [blame]
/*
title: Transition between Treemap and Sunburst
category: treemap, sunburst
titleCN: 矩形树图和旭日图的动画过渡
difficulty: 4
*/
$.getJSON(ROOT_PATH + '/data/asset/data/echarts-package-size.json', function (data) {
var treemapOption = {
series: [{
type: 'treemap',
id: 'echarts-package-size',
animationDurationUpdate: 1000,
roam: false,
nodeClick: undefined,
data: data.children,
universalTransition: true,
label: {
show: true
},
breadcrumb: {
show: false
}
}]
};
var sunburstOption = {
series: [{
type: 'sunburst',
id: 'echarts-package-size',
radius: ['20%', '90%'],
animationDurationUpdate: 1000,
nodeClick: undefined,
data: data.children,
universalTransition: true,
itemStyle: {
borderWidth: 1,
borderColor: 'rgba(255,255,255,.5)'
},
label: {
show: false
}
}]
};
var currentOption = treemapOption;
myChart.setOption(currentOption);
setInterval(function () {
currentOption = currentOption === treemapOption ? sunburstOption : treemapOption;
myChart.setOption(currentOption);
}, 3000);
});