本文主要介紹了jQuery插件echarts去掉垂直網格線用法,結合實例形式對比分析了jQuery圖標插件echarts針對垂直網格線的相關設置操作技巧,需要的朋友可以參考下,希望能幫助到大家。
1、問題背景
設計一條統計人數的折線,其中網格線沒有垂直線
2、實作原始碼
(1)有垂直網格線
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>echarts-有垂直网格线</title> <link rel="shortcut icon" href="../js/echarts-2.2.7/doc/asset/ico/favicon.png" rel="external nofollow" rel="external nofollow" > <script type="text/javascript" src="../js/echarts-2.2.7/doc/asset/js/jquery.min.js" ></script> <script type="text/javascript" src="../js/echarts-2.2.7/doc/example/www2/js/echarts-all.js" ></script> <style> body,html{ width: 99%; height: 99%; font-family: "微软雅黑"; font-size: 12px; } #chart{ width: 100%; height: 100%; } </style> <script> $(function(){ var chart = document.getElementById('chart'); var echart = echarts.init(chart); var option = { title: { text: '' }, tooltip: { trigger: 'axis' }, legend: { data:['人数'] }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, splitLine:{ show:true }, data: ['周一','周二','周三','周四','周五','周六','周日'] }, yAxis: { type: 'value' }, series: [ { name:'人数', type:'line', stack: '人数', data:[1220, 4132, 6101, 3134, 1890, 6230, 3210] } ] }; echart.setOption(option); }); </script> </head> <body> <p id="chart"></p> </body> </html>
(2)無垂直網格線
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>echarts-去掉垂直网格线</title> <link rel="shortcut icon" href="../js/echarts-2.2.7/doc/asset/ico/favicon.png" rel="external nofollow" rel="external nofollow" > <script type="text/javascript" src="../js/echarts-2.2.7/doc/asset/js/jquery.min.js" ></script> <script type="text/javascript" src="../js/echarts-2.2.7/doc/example/www2/js/echarts-all.js" ></script> <style> body,html{ width: 99%; height: 99%; font-family: "微软雅黑"; font-size: 12px; } #chart{ width: 100%; height: 100%; } </style> <script> $(function(){ var chart = document.getElementById('chart'); var echart = echarts.init(chart); var option = { title: { text: '' }, tooltip: { trigger: 'axis' }, legend: { data:['人数'] }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, splitLine:{ show:false }, data: ['周一','周二','周三','周四','周五','周六','周日'] }, yAxis: { type: 'value' }, series: [ { name:'人数', type:'line', stack: '人数', data:[1220, 4132, 6101, 3134, 1890, 6230, 3210] } ] }; echart.setOption(option); }); </script> </head> <body> <p id="chart"></p> </body> </html>
3、實作結果
(1)有垂直網格線
(2)無垂直網格線
#4、問題說明
#去掉網格中的垂直線,只要在xAxis中加入splitLine
屬性的設定show:false
以上是jQuery插件echarts去掉垂直網格線用法詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!