注意选择series中的type必须是pictorialBar,以及symbol必须是triangle.
const option = {
dataset:{
source:[
{name:'冰淇淋0',count:111,percent:'20%'},
{name:'冰淇淋1',count:211,percent:'20%'},
{name:'冰淇淋2',count:311,percent:'20%'},
{name:'冰淇淋3',count:411,percent:'20%'},
{name:'冰淇淋4',count:511,percent:'20%'}
]},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'none'
},
formatter: function (params) {
console.log(params,'params......')
return JSON.stringify(params[0].name+":"+params[0].value.count);
// return params[0].name + ': ' + params[0].count;
}
},
xAxis: {
type:'category',
axisTick: {show: false},
axisLine: {show: false},
axisLabel: {
textStyle: {
color: 'blue'
}
}
},
yAxis: {
type:'value',
splitLine: {show: false},
axisTick: {show: false},
axisLine: {show: false},
axisLabel: {show: false}
},
series: [{
name: 'hill',
type: 'pictorialBar',
barCategoryGap: '40%',
symbol: 'triangle',
itemStyle: {
normal: {
opacity: 0.5,
color:'green'
},
emphasis: {
opacity: 1
}
}
}]
};