<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>五分钟上手之折线图</title> <!-- 引入 echarts.js --> <script src="https://cdn.bootcss.com/echarts/4.2.1-rc1/echarts.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> </head> <body> <!-- 为ECharts准备一个具备大小(宽高)的Dom --> <div id="main" style="width: 600px;height:400px;"></div> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据 myChart.setOption({ title: { text: '近七日收益' }, tooltip: { trigger: 'axis' }, legend: { data: ['近七日收益'] }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { splitLine: { show: false }, type: 'category', boundaryGap: false, data: ["1", "2", "3", "4", "5"] }, yAxis: { splitLine: { show: false }, type: 'value' }, series: [{ name: '近七日收益', type: 'line', symbol: 'circle', //折线点设置为实心点 symbolSize: 6, //折线点的大小 itemStyle: { normal: { color: "#1bdaf8", //折线点的颜色 lineStyle: { color: "#0d427e" //折线的颜色 } } }, stack: '总量', data: ["1", "2", "3", "4", "5"] }] }); </script> </body> </html>