源码如下:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ECharts</title> <script src="http://echarts.baidu.com/dist/echarts.min.js"></script> </head> <body> <!-- 为ECharts准备一个具备大小(宽高)的Dom --> <div id="bar" style="width: 600px;height:400px;"></div> <div id="pie" style="width: 600px;height:400px;"></div> </body> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myBarChart = echarts.init(document.getElementById('bar')); var n1 = Math.floor(Math.random()*500+1); var n2 = Math.floor(Math.random()*500+1); var n3 = Math.floor(Math.random()*500+1); var n4 = Math.floor(Math.random()*500+1); var n5 = Math.floor(Math.random()*500+1); var n6 = Math.floor(Math.random()*500+1); // 指定图表的配置项和数据 var option = { title: { text: 'ECharts 入门示例' }, tooltip: { triggerEvent:true}, legend: { data:['销量',"趋势"] }, xAxis: { data: ["衬衫","羊毛衫",