jQuery插件echarts去掉垂直網(wǎng)格線用法示例
本文實例講述了jQuery插件echarts去掉垂直網(wǎng)格線用法。分享給大家供大家參考,具體如下:
1、問題背景
設(shè)計一條統(tǒng)計人數(shù)的折線,其中網(wǎng)格線沒有垂直線
2、實現(xiàn)源碼
(1)有垂直網(wǎng)格線
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>echarts-有垂直網(wǎng)格線</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:['人數(shù)']
},
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:'人數(shù)',
type:'line',
stack: '人數(shù)',
data:[1220, 4132, 6101, 3134, 1890, 6230, 3210]
}
]
};
echart.setOption(option);
});
</script>
</head>
<body>
<div id="chart"></div>
</body>
</html>
(2)無垂直網(wǎng)格線
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>echarts-去掉垂直網(wǎng)格線</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:['人數(shù)']
},
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:'人數(shù)',
type:'line',
stack: '人數(shù)',
data:[1220, 4132, 6101, 3134, 1890, 6230, 3210]
}
]
};
echart.setOption(option);
});
</script>
</head>
<body>
<div id="chart"></div>
</body>
</html>
3、實現(xiàn)結(jié)果
(1)有垂直網(wǎng)格線

(2)無垂直網(wǎng)格線

4、問題說明
去掉網(wǎng)格中的垂直線,只需在xAxis中加入splitLine屬性的設(shè)置show:false
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
- jQuery插件echarts設(shè)置折線圖中折線線條顏色和折線點顏色的方法
- 如何使用PHP+jQuery+MySQL實現(xiàn)異步加載ECharts地圖數(shù)據(jù)(附源碼下載)
- jQuery插件Echarts實現(xiàn)的漸變色柱狀圖
- jQuery插件echarts實現(xiàn)的多柱子柱狀圖效果示例【附demo源碼下載】
- jQuery插件echarts實現(xiàn)的多折線圖效果示例【附demo源碼下載】
- jQuery插件echarts實現(xiàn)的單折線圖效果示例【附demo源碼下載】
- jQuery插件echarts實現(xiàn)的去掉X軸、Y軸和網(wǎng)格線效果示例【附demo源碼下載】
- jQuery插件echarts實現(xiàn)的循環(huán)生成圖效果示例【附demo源碼下載】
- HTML5+JS+JQuery+ECharts實現(xiàn)異步加載問題
- jQuery插件Echarts實現(xiàn)的雙軸圖效果示例【附demo源碼下載】
- jquery使用echarts實現(xiàn)有向圖可視化功能示例
相關(guān)文章
jQuery Selectors(選擇器)的使用(六、屬性篇)
本系列文章主要講述jQuery框架的選擇器(Selectors)使用方法,我將以實例方式進(jìn)行講述,以簡單,全面為基礎(chǔ),不會涉及很深,我的學(xué)習(xí)方法:先入門,后進(jìn)階!2009-12-12
jquery 與NVelocity 產(chǎn)生沖突的解決方法
有時候使用jquery 與NVelocity的時候,會產(chǎn)生沖突,下面是具體的解決方法,需要的朋友可以參考下。2011-06-06
JQuery入門——移除綁定事件unbind方法概述及應(yīng)用
在DOM對象的實踐操作中,存在用于綁定事件的bind方法,也會有相應(yīng)的移除綁定事件unbind方法,接下來將介紹unbind方法的使用,感興趣的朋友可以不要錯過了啊,或許本文對你有所幫助2013-02-02
jquery ui 實現(xiàn) tab標(biāo)簽功能示例【測試可用】
這篇文章主要介紹了jquery ui 實現(xiàn) tab標(biāo)簽功能,結(jié)合完整實例形式分析了jquery ui 實現(xiàn) tab標(biāo)簽切換功能的相關(guān)操作技巧,需要的朋友可以參考下2019-07-07

