柱狀圖
let option = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐標(biāo)軸指示器票唆,坐標(biāo)軸觸發(fā)有效
type: 'none' // 默認(rèn)為直線犯戏,可選為:'line' | 'shadow'
},
formatter(p) {
return p[0].data.showText
}
},
grid: {
left: '3%',
right: '3%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['該車型', '同價位車型'],
axisTick: {
alignWithLabel: true,
lineStyle: {
color: ['#ffffff']
}
},
axisLine:{
lineStyle:{
color: '#eeeeee'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#666666'
}
}
}
],
yAxis: [
{
max,
// 值展示的類型特纤,value直接展示value,category可以展示自定義
type: 'value',
show: false,
interval,
// 軸線上凸出來的點線
axisTick: {
show: false
},
// 坐標(biāo)軸軸線相關(guān)設(shè)置
axisLine: {
// 是否顯示坐標(biāo)軸軸線
show: false,
},
// 軸線文本
axisLabel: {
show: true,
textStyle: {
color: '#666666'
}
},
/// 影響網(wǎng)格線
splitLine: {
show: true,
lineStyle:{
color: ['#eeeeee'],
width: 1,
type: 'solid'
}
}
}
],
series: [
{
type: 'bar',
ccc: '60%',
// 內(nèi)部或者頂部可以展示文本
label: {
show: true,
position: 'insideRight'
},
data: [{
showText: '經(jīng)銷商報價:20-15萬\n經(jīng)銷商數(shù)量:8家',
name: 'hello',
value: 20
}, 15, 30, 1, 5, 8, 12],
show: true, //開啟顯示
position: 'top', //在上方顯示
textStyle: { //數(shù)值樣式
color: '#333',
fontSize: 14,
fontWeight: 500
}
},
/// 軸風(fēng)格配置
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0.5, 0, 0.5, 1, [{
offset: 0,
color: '#00B8B0'
}, {
offset: 1,
color: '#0C98E7'
}]),
barBorderRadius: [3, 3, 0, 0]
}
}
}
],
};