基于Echart實(shí)現(xiàn)折線圖的繪制詳解
效果圖
不顯示折線圖上的拐點(diǎn)方法 ,3個(gè)都可以使用,代碼中有顯示在什么位置使用。
symbolSize:0,
symbol:“none”,
showSymbol:false,
代碼:
var mess = ["00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00", "24:00"]; var mess3 = preData; var mess4 = curData; var option = { legend: { show: true, itemWidth: 20, itemHeight: 10, itemGap: 10, textStyle: { fontSize: 10, color: "#ccc", }, }, tooltip: { trigger: "axis", axisPointer: { lineStyle: { color: { type: "linear", x: 0, y: 0, x2: 0, y2: 1, colorStops: [ { offset: 0, color: "rgba(0, 255, 233,0)", }, { offset: 0.5, color: "rgba(255, 255, 255,1)", }, { offset: 1, color: "rgba(0, 255, 233,0)", }, ], global: false, }, }, }, }, grid: { top: "25%", left: "10%", right: "5%", bottom: "25%", }, xAxis: { data: mess, axisTick: { show: false,//是否顯示坐標(biāo)軸刻度。 }, boundaryGap: false,//x軸留白,默認(rèn)是true,這時(shí)候刻度只是作為分隔線,標(biāo)簽和數(shù)據(jù)點(diǎn)都會在兩個(gè)刻度之間的帶(band)中間 axisLine: { show: true, lineStyle: { color: "#414965", }, }, axisLabel: { interval: 1, textStyle: { color: "#7089ba", fontSize: 12, }, margin: 10, //刻度標(biāo)簽與軸線之間的距離。 }, }, yAxis: { name:unit, nameTextStyle: { color: "#fff", }, splitLine: { //是否顯示分隔線 show: true, lineStyle: { color: "#414965", opacity: 0.3, }, }, axisTick: { show: false, }, axisLine: { show: false, }, axisLabel: { textStyle: { color: "#7089ba", fontSize: 12, }, }, splitNumber: 3//坐標(biāo)軸的分割段數(shù) }, series: [ { name: "今日", type: "line", smooth: true, //是否平滑 showAllSymbol: false,//不顯示折線圖的拐點(diǎn) symbol: "circle", symbolSize: 2, lineStyle: { normal: { color: "#44b6fe", }, }, itemStyle: { color: "#44b6fe", }, tooltip: { show: true, }, areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgba(53,194,246,0.7)", }, { offset: 1, color: "rgba(53,194,246,0.1)", }, ], false ), shadowBlur: 20, }, }, data: mess4, markPoint: { symbolSize: 30, data: [ { type: "max", name: "最大值" }, { type: "min", name: "最小值" }, ], }, }, { name: "昨日", type: "line", smooth: true, //是否平滑 showAllSymbol: false, symbol: "circle", symbolSize: 2, lineStyle: { normal: { color: "#ad16ff", }, }, itemStyle: { color: "#ad16ff", }, tooltip: { show: true, }, areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgba(179,64,242,0.7)", }, { offset: 1, color: "rgba(179,64,242,0.1)", }, ], false ), shadowColor: "rgba(179,64,242, 0)", shadowBlur: 20, }, }, data: mess3, markPoint: { symbolSize: 30, data: [ { type: "max", name: "最大值" }, { type: "min", name: "最小值" }, ], }, }, ], };
到此這篇關(guān)于基于Echart實(shí)現(xiàn)折線圖的繪制詳解的文章就介紹到這了,更多相關(guān)Echart折線圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
javascript基礎(chǔ)知識之html5輪播圖實(shí)例講解(44)
這篇文章主要為大家詳細(xì)介紹了javascript基礎(chǔ)知識之html5輪播圖,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-02-02JavaScript使用localStorage存儲數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了JavaScript使用localStorage存儲數(shù)據(jù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-09-09js(JavaScript)實(shí)現(xiàn)TAB標(biāo)簽切換效果的簡單實(shí)例
本篇文章主要是對js(JavaScript)實(shí)現(xiàn)TAB標(biāo)簽切換效果的簡單實(shí)例進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-02-02JS的鼠標(biāo)監(jiān)聽mouseup鼠標(biāo)抬起失效原因及解決
這篇文章主要為大家介紹了JS的鼠標(biāo)監(jiān)聽mouseup鼠標(biāo)抬起失效原因及解決示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05用js來刷新當(dāng)前頁面保留參數(shù)的具體實(shí)現(xiàn)
本文為大家詳細(xì)介紹下如何使用js來刷新當(dāng)前頁面保留參數(shù),下面有個(gè)不錯(cuò)的實(shí)現(xiàn)大家可以看看2013-12-12Bootstrap整體框架之JavaScript插件架構(gòu)
這篇文章主要介紹了Bootstrap整體框架之JavaScript插件架構(gòu)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12實(shí)例詳解BootStrap的動態(tài)模態(tài)框及靜態(tài)模態(tài)框
要用bootStrap這個(gè)框架就必須要重載它的class類,也就是說class要一樣。接下來通過實(shí)例代碼給大家介紹BootStrap的動態(tài)模態(tài)框及靜態(tài)模態(tài)框,需要的朋友可以參考下2018-08-08微信小程序?qū)崿F(xiàn)運(yùn)動步數(shù)排行功能(可刪除)
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)運(yùn)動步數(shù)排行功能(可刪除),實(shí)現(xiàn)代碼也很簡單,需要的朋友可以參考下2018-07-07