echarts多条折线图和柱状图实现
2018-03-07 10:12
519 查看
参考链接:echarts官网:http://echarts.baidu.com/
原型图(效果图):
图片.png代码:
图片.png
原文链接:https://www.jianshu.com/u/05f416aefbe1
创作不易,转载请告知
90后前端妹子,爱编程,爱运营,爱折腾。
坚持总结工作中遇到的技术问题,坚持记录工作中所所思所见,欢迎大家一起探讨交流。
有个很难涨粉的的公众号叫:【编程微刊】
原型图(效果图):
图片.png代码:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <!-- 折线统计图 --> <div class="row"> <div id="main" style="width: 900px; height: 350px; margin-top:80px;"></div> </div> </body> <script src="js/echarts/echarts.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据 myChart.setOption({ title: { text: '堆叠区域图' }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } } }, legend: { data: ['SA服务', '等号', '机修', '钣金', '喷漆', '总检', '洗车', '滞留'] }, toolbox: { feature: { saveAsImage: {} } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [{ type: 'category', boundaryGap: false, data: ['10.1', '10.2', '10.3', '10.4', '10.5', '10.6', '10.7'] }], yAxis: [{ type: 'value' }], series: [{ name: 'SA服务', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [120, 132, 101, 134, 90, 230, 210] }, { name: '等号', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [220, 182, 191, 234, 290, 330, 310] }, { name: '机修', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [150, 232, 101, 154, 190, 330, 410] }, { name: '钣金', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [320, 332, 301, 334, 190, 330, 320] }, { name: '喷漆', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [310, 312, 301, 334, 390, 330, 320] }, { name: '总检', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [320, 332, 311, 334, 390, 330, 320] }, { name: '洗车', type: 'line', stack: '总量', areaStyle: { normal: {} }, data: [320, 332, 101, 334, 390, 310, 320] }, { name: '滞留', type: 'line', stack: '总量', label: { normal: { show: true, position: 'top' } }, areaStyle: { normal: {} }, data: [820, 932, 901, 934, 1290, 1330, 1320] } ] }); /* // 异步加载数据 $.get('data.json').done(function (data) { // 填入数据 myChart.setOption({ xAxis: { data: data.categories }, series: [{ // 根据名字对应到相应的系列 name: '销量', data: data.data }] });});*/ </script> </html>横向柱状图:
图片.png
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <!-- 柱状统计图 --> <div class="row"> <div id="main" style="width: 900px; height: 350px; margin-top:80px;"></div> </div> </body> <script src="../../js/echarts/echarts.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据 myChart.setOption({ title: { text: '平均耗时(分钟)', }, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, legend: { /* data: [ '2012年']*/ }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'value', boundaryGap: [0, 0.01] }, yAxis: { type: 'category', data: ['SA服务', '洗车', '总检', '喷漆', '钣金', '机修', '等号'] }, series: [ { name: '2012年', type: 'bar', itemStyle: { normal: { color: '#a8bcd4' } }, data: [10, 20, 31, 14, 11, 67] } ] }); </script> </html>原文作者:祈澈姑娘
原文链接:https://www.jianshu.com/u/05f416aefbe1
创作不易,转载请告知
90后前端妹子,爱编程,爱运营,爱折腾。
坚持总结工作中遇到的技术问题,坚持记录工作中所所思所见,欢迎大家一起探讨交流。
有个很难涨粉的的公众号叫:【编程微刊】
相关文章推荐
- Echarts3.0+JavaWeb+Mysql实现饼图,折线图,柱状图
- servlet创建增删该查和servlet实现echarts多条折线图
- 分组折线图、柱状图实现(多条折线图、柱状图同时显示)实现方式
- 基于SpringMVC框架使用ECharts3.0实现折线图,柱状图,饼状图,的绘制(上篇)
- 基于SpringMVC框架使用ECharts3.0实现折线图,柱状图,饼状图,的绘制(上篇)
- 基于SpringMVC框架使用ECharts3.0实现折线图,柱状图,饼状图,的绘制(上篇)
- 【前端统计图】echarts实现简单柱状图
- ECharts之柱状图 饼状图 折线图
- ASP.NET+JQuery+.Ashx实现+百度Echarts 实现动态柱状图数据图形报表的统计
- Echarts实现柱状图、雷达图、时间轴联动
- echarts折线图柱状图的坐标轴的颜色及样式的设置
- Echarts折线图 炫酷实现y轴自定义色阶
- 在echarts中,柱状图、折线图来回切换以及保存为图片的属性
- ECharts图表使用实例(多条折线图)--JAVA
- Echarts柱状图,饼状图,折线图案例
- echarts地图上实现柱状图
- echarts柱状图、折线图横坐标添加滚动条方法
- jsp+vml 实现柱状图、饼图、折线图
- 原生js和canvas实现的 柱状图、饼状图、折线图
- echarts 折线图/柱状图 tooltip格式定制