in src/helper/template.ts [48:134]
function run() {
clearTimeoutHandlers();
if (chart) {
chart.dispose();
}
chart = echarts.init(document.getElementById('chart'));
var option = {
xAxis: {
type: 'value',
max: 'dataMax'
},
yAxis: {
type: 'category',
data: data[0].slice(1),
inverse: true,
animationDuration: sortDuration,
animationDurationUpdate: sortDuration,
max: maxDataCnt ? maxDataCnt - 1 : null
},
series: [{
id: 'bar',
type: 'bar',
data: getDataLine(0),
seriesLayoutBy: 'row',
realtimeSort: true,
label: {
show: true,
position: 'right'
},
itemStyle: {
color: function (param) {
return data[1][param.dataIndex + 1] || colorAll[param.dataIndex % colorAll.length];
}
}
}],
grid: {
right: 60,
bottom: 30,
left: 110
},
title: [{
text: data[headerLength][0],
right: 20,
bottom: 15,
textStyle: {
color: '#ccc',
opacity: 0.3,
fontSize: 70
}
}, {
text: title,
left: 10,
top: 10
}],
animationDuration: 0,
animationDurationUpdate: animationDuration,
animationEasing: 'linear',
animationEasingUpdate: 'linear'
};
chart.setOption(option, true);
var dataCnt = data.length - headerLength - 1;
for (var i = 0; i < dataCnt; ++i) {
(function (i) {
var timeout;
var timeoutCb = function () {
chart.setOption({
series: [{
type: 'bar',
id: 'bar',
data: getDataLine(i + 1),
label: {
valueAnimation: true
}
}],
title: [{
text: data[headerLength + i + 1][0]
}]
});
removeTimeoutHandlers(timeout);
};
timeout = window.setTimeout(timeoutCb, i * animationDuration);
timeoutHandlers.push(timeout);
})(i);
}
}