1 <html> 2 <head> 3 <meta name="viewport" content="width=device-width" /> 4 <title>折线图</title> 5 @*echarts画图必须要引用的*@ 6 <script src="~/Scripts/echarts.min.js"></script> 7 </head> 8 <body> 9 @* 画图要用的空间 *@ 10 <div id="divEcharts" style="800px;height:600px;"></div> 11 </body> 12 </html> 13 <script type="text/javascript"> 14 option = { 15 xAxis: { 16 type: 'category', 17 data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] 18 }, 19 yAxis: { 20 type: 'value' 21 }, 22 series: [{ 23 data: [820, 932, 901, 934, 1290, 1330, 1320], 24 type: 'line' 25 }] 26 }; 27 28 29 //初始化echarts实例 30 var myChart = echarts.init(document.getElementById('divEcharts')); 31 //使用制定的配置项和数据显示图表 32 myChart.setOption(option); 33 34 </script>