You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 lines
3.9 KiB

<html>
<head>
<meta charset="utf-8">
<script src="esl.js"></script>
<script src="config.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<style>
html, body, #main {
width: 100%;
height: 100%;
margin: 0;
}
#main {
background: #fff;
}
</style>
<div id="main"></div>
<script>
require([
'echarts',
'echarts/chart/bar',
'echarts/chart/line',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/tooltip',
'echarts/component/title',
'echarts/component/toolbox'
], function (echarts) {
var chart = echarts.init(document.getElementById('main'));
var xAxisData = [];
var data1 = [];
var data2 = [];
var data3 = [];
var data4 = [];
for (var i = 0; i < 100; i++) {
xAxisData.push('类目' + i);
data1.push((Math.random() * 5).toFixed(2));
data2.push(Math.random().toFixed(2));
data3.push((Math.random() + 0.5).toFixed(2));
data4.push((Math.random() + 0.3).toFixed(2));
}
chart.setOption({
legend: {
data: ['bar', 'bar2', 'bar3', 'bar4'],
align: 'left'
},
toolbox: {
// y: 'bottom',
feature: {
magicType: {
type: ['line', 'bar', 'stack', 'tiled']
},
dataView: {},
saveAsImage: {
pixelRatio: 2
}
}
},
tooltip: {},
xAxis: {
data: xAxisData,
silent: false,
splitLine: {
show: false
},
splitArea: {
show: false
}
},
yAxis: {
splitArea: {
show: false
}
},
series: [{
name: 'bar',
type: 'bar',
stack: 'one',
data: data1
}, {
show: false,
name: 'bar2',
type: 'bar',
stack: 'one',
data: data2
}, {
name: 'bar3',
type: 'bar',
stack: 'two',
data: data3
}, {
name: 'bar4',
type: 'bar',
stack: 'two',
data: data4,
silent: true
}],
animationDelay: function (idx) {
return idx * 5;
},
animationDelayUpdate: function (idx) {
return idx * 5;
}
});
chart.on('click', function (params) {
console.log(params);
});
window.onresize = chart.resize;
});
</script>
</body>
</html>