ECharts2.0柱狀圖橫向顯示
阿新 • • 發佈:2019-02-20
option = {
tooltip : {
trigger: 'axis',
axisPointer : { // 座標軸指示器,座標軸觸發有效
type : 'shadow' // 預設為直線,可選為:'line' | 'shadow'
},
formatter:function(v){return Math.abs(v[0].data)}
},
legend: {
data:['直接訪問']
},
xAxis : [
{
type : 'value',
axisLabel:{
formatter:function(v){ return Math.abs(v)}
}
}
],
yAxis : [
{
type : 'category',
position:'right',
data : ['週一','週二','週三','週四','週五','週六','週日']
}
],
series : [
{
name:'直接訪問',
type:'bar',
stack: '總量',
itemStyle : { normal: {label : {show: true, position: 'left',formatter:function(v){return Math.abs(v.data)}}}},
data:[-320,- 302, -301, -334, -390,- 330, -320]
},
]
tooltip : {
trigger: 'axis',
axisPointer : { // 座標軸指示器,座標軸觸發有效
type : 'shadow' // 預設為直線,可選為:'line' | 'shadow'
},
formatter:function(v){return Math.abs(v[0].data)}
},
legend: {
data:['直接訪問']
},
xAxis : [
{
type : 'value',
axisLabel:{
formatter:function(v){ return Math.abs(v)}
}
}
],
yAxis : [
{
type : 'category',
position:'right',
data : ['週一','週二','週三','週四','週五','週六','週日']
}
],
series : [
{
name:'直接訪問',
type:'bar',
stack: '總量',
itemStyle : { normal: {label : {show: true, position: 'left',formatter:function(v){return Math.abs(v.data)}}}},
data:[-320,- 302, -301, -334, -390,- 330, -320]
},
]
};