ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# 综合应用 ****** * 实现灵活应用 * [在线演示](http://demo.sgfoot.com/ECharts/mix.html) >[info] 完整代码 ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>综合</title> <script type="text/javascript" src="../asset/js/echarts.common.min.js"></script> <style> div{ display: inline-block; } </style> </head> <body> <div id="bar" style="width: 2000px;height:400px;"></div> <script> bar(); function bar() { var myChart = echarts.init(document.getElementById("bar")); // 指定图表的配置项和数据 var data = new Array(); var data1 = new Array(); var data2 = new Array(); var num = new Array(); for(var i = 1;i < 1000; i++) { data.push(Math.ceil(Math.random()*100)); data1.push(Math.ceil(Math.random()*90)); data2.push(Math.ceil(Math.random()*80)); num.push(i); } var option = { title: { text: 'ECharts 矩形图', subtext: '来自时光演示网', sublink: 'http://demo.sgfoot.com', left: 'center', textStyle: { color: '#2E3299' } }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, dataZoom: [ { type: 'slider', show: true, start: 94, end: 100, handleSize: 40 }, { type: 'inside', start: 94, end: 100 }, { type: 'slider', show: true, yAxisIndex: 0, filterMode: 'empty', width: 12, height: '70%', handleSize: 8, showDataShadow: false, left: '93%' } ], legend: { orient: 'vertical', left:'right', data:['浏览量', '销量', 'view'], textStyle: { color: '#000' } }, xAxis: { data: num }, yAxis: {}, series: [{ name: '浏览量', type: 'line', data: data, label: { normal: { show: true, position: 'top' } } },{ name: '销量', type: 'bar', data: data1, markPoint: { data: [ {type: 'max', name: '最大值'}, {type: 'min', name: '最小值'} ] } },{ name: 'view', type: 'bar', data: data2, markPoint: { data: [ {type: 'max', name: '最大值'}, {type: 'min', name: '最小值'} ] } }] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); } </script> </body> </html> ~~~ ![](https://box.kancloud.cn/4ec3d927330b1bb447657af2c07c71ff_1838x420.png)