解決echarts的多個折現(xiàn)數(shù)據(jù)出現(xiàn)坐標和值對不上的問題
更新時間:2018年12月28日 11:15:41 作者:小小胖嘟
這篇文章主要介紹了解決echarts的多個折現(xiàn)數(shù)據(jù)出現(xiàn)坐標和值對不上的問題,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
當出現(xiàn)多個折現(xiàn)數(shù)據(jù),echarts可以配置stack值使用堆積值還是單個值

option = {
noDataLoadingOption: {
text: '暫無數(shù)據(jù)',
effect: 'bubble',
effectOption: {effect: {n: 0}}, textStyle: {fontSize: 24}
},
symbolList: ['circle'],
tooltip: {
trigger: 'axis', textStyle: {align: 'left'},
axisPointer: {lineStyle: {color: '#E3E3E3', width: 1, type: 'solid'},}
},
// grid: {x: '60px', x2: '60px', borderWidth: 0},
legend: {data: ['最大響應時長', '平均響應時長', '最小響應時長']},
toolbox: {show: true},
// calculable: true,
xAxis: [{
type: 'category',
boundaryGap: false,
data: ['00:00-02:00', '02:00-04:00', '04:00-06:00', '06:00-08:00', '08:00-10:00', '10:00-12:00'],
splitLine: {lineStyle: {width: 0}},
axisLabel: {interval: 0,/*橫軸信息全部顯示*/ rotate: 20,/*20度角傾斜顯示*/}
}],
yAxis: [{
type: 'value',
axisLine: {lineStyle: {color: '#333', width: 0, type: 'solid'}},
splitLine: {lineStyle: {color: '#e3e3e3', width: 1, type: 'dashed'}},
}],
series: [
{
name: '最大響應時長',
smooth: true,
type: 'line',
stack: '總量', // 重要的點 這個參數(shù)會使用堆積值作為縱坐標的刻量值。
data:[........],
itemStyle: {normal: {color: '#D06E17', lineStyle: {width: 1, color: '#D06E17'}}}
},{
name: '平均響應時長',
smooth: true,
type: 'line',
stack: '總量', // 重要的點 這個參數(shù)會使用堆積值作為縱坐標的刻量值。
data:[........],
itemStyle: {normal: {color: '#C35AD9', lineStyle: {width: 1, color: '#C35AD9'}}}
},{
name: '最小響應時長',
smooth: true,
type: 'line',
stack: '總量', // 重要的點 這個參數(shù)會使用堆積值作為縱坐標的刻量值。
data:[........],
itemStyle: {normal: {color: '#1FD5CE', lineStyle: {width: 1, color: '#1FD5CE'}}}
},
]
去掉stack值后

option3 = {
noDataLoadingOption: {
text: '暫無數(shù)據(jù)',
effect: 'bubble',
effectOption: {effect: {n: 0}}, textStyle: {fontSize: 24}
},
symbolList: ['circle'],
tooltip: {
trigger: 'axis', textStyle: {align: 'left'},
axisPointer: {lineStyle: {color: '#E3E3E3', width: 1, type: 'solid'},}
},
// grid: {x: '60px', x2: '60px', borderWidth: 0},
legend: {data: ['最大響應時長', '平均響應時長', '最小響應時長']},
toolbox: {show: true},
// calculable: true,
xAxis: [{
type: 'category',
boundaryGap: false,
data: ['00:00-02:00', '02:00-04:00', '04:00-06:00', '06:00-08:00', '08:00-10:00', '10:00-12:00'],
splitLine: {lineStyle: {width: 0}},
axisLabel: {interval: 0,/*橫軸信息全部顯示*/ rotate: 20,/*20度角傾斜顯示*/}
}],
yAxis: [{
type: 'value',
axisLine: {lineStyle: {color: '#333', width: 0, type: 'solid'}},
splitLine: {lineStyle: {color: '#e3e3e3', width: 1, type: 'dashed'}},
}],
series: [
{
name: '最大響應時長',
smooth: true,
type: 'line',
// stack: '總量', // 去除stack這個參數(shù)
itemStyle: {normal: {color: '#D06E17', lineStyle: {width: 1, color: '#D06E17'}}}
},{
name: '平均響應時長',
smooth: true,
type: 'line',
// stack: '總量', // 去除stack這個參數(shù)
itemStyle: {normal: {color: '#C35AD9', lineStyle: {width: 1, color: '#C35AD9'}}}
},{
name: '最小響應時長',
smooth: true,
type: 'line',
// stack: '總量', // 去除stack這個參數(shù)
itemStyle: {normal: {color: '#1FD5CE', lineStyle: {width: 1, color: '#1FD5CE'}}}
},
]
};
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
js中async函數(shù)結合promise的小案例淺析
這篇文章主要介紹了js中async函數(shù)結合promise的小案例淺析,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-04-04
對存在JavaScript隱式類型轉換的四種情況的總結(必看篇)
下面小編就為大家?guī)硪黄獙Υ嬖贘avaScript隱式類型轉換的四種情況的總結(必看篇)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-08-08
JavaScript函數(shù)式編程(Functional Programming)聲明式與命令式實例分析
這篇文章主要介紹了JavaScript函數(shù)式編程(Functional Programming)聲明式與命令式,結合實例形式分析了JS聲明式與命令式相關概念、原理、定義及使用方法,需要的朋友可以參考下2019-05-05

