网站首页
百度ECharts
ECharts实例
ECharts入门
地图大全
ECharts官网
源代码:
点击运行 》
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ECharts 实例</title> <script src="/js/jquery-1.9.0.min.js"></script> <!-- 引入 echarts.js --> <script src="/js/echarts.min.js"></script> </head> <body> <div id="main" style="width: 100%;height:380px;"></div> <script type="text/javascript"> var option = { xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value', }, series: [{ data: [100, 200, 300, 320, 270, 160, 330], type: 'line', lineStyle: { color: 'red' //折线图线条颜色 } }] }; var myChart = echarts.init(document.getElementById('main')); myChart.setOption(option); window.addEventListener("resize", function() { myChart.resize(); }) </script> </body> </html>
运行结果: