基于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)都會(huì)在兩個(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)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
javascript基礎(chǔ)知識(shí)之html5輪播圖實(shí)例講解(44)
這篇文章主要為大家詳細(xì)介紹了javascript基礎(chǔ)知識(shí)之html5輪播圖,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-02-02
JavaScript使用localStorage存儲(chǔ)數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了JavaScript使用localStorage存儲(chǔ)數(shù)據(jù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-09-09
js(JavaScript)實(shí)現(xiàn)TAB標(biāo)簽切換效果的簡(jiǎn)單實(shí)例
本篇文章主要是對(duì)js(JavaScript)實(shí)現(xiàn)TAB標(biāo)簽切換效果的簡(jiǎn)單實(shí)例進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-02-02
JS的鼠標(biāo)監(jiān)聽(tīng)mouseup鼠標(biāo)抬起失效原因及解決
這篇文章主要為大家介紹了JS的鼠標(biāo)監(jiān)聽(tīng)mouseup鼠標(biāo)抬起失效原因及解決示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05
用js來(lái)刷新當(dāng)前頁(yè)面保留參數(shù)的具體實(shí)現(xiàn)
本文為大家詳細(xì)介紹下如何使用js來(lái)刷新當(dāng)前頁(yè)面保留參數(shù),下面有個(gè)不錯(cuò)的實(shí)現(xiàn)大家可以看看2013-12-12
Bootstrap整體框架之JavaScript插件架構(gòu)
這篇文章主要介紹了Bootstrap整體框架之JavaScript插件架構(gòu)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
實(shí)例詳解BootStrap的動(dòng)態(tài)模態(tài)框及靜態(tài)模態(tài)框
要用bootStrap這個(gè)框架就必須要重載它的class類,也就是說(shuō)class要一樣。接下來(lái)通過(guò)實(shí)例代碼給大家介紹BootStrap的動(dòng)態(tài)模態(tài)框及靜態(tài)模態(tài)框,需要的朋友可以參考下2018-08-08
微信小程序?qū)崿F(xiàn)運(yùn)動(dòng)步數(shù)排行功能(可刪除)
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)運(yùn)動(dòng)步數(shù)排行功能(可刪除),實(shí)現(xiàn)代碼也很簡(jiǎn)單,需要的朋友可以參考下2018-07-07

