Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

关于echarts堆叠放置一些问题

比如X轴中A1浮窗里面除了AA和AAA之外的数据不需要显示请问该怎么实现呢

`option = {

tooltip: {
    trigger: 'axis',
    axisPointer: {            // 坐标轴指示器,坐标轴触发有效
        type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
    }
},
legend: {
    data: ['AA','AAA','BB','BBB','CC','CCC']
},
grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
},
xAxis: [
    {
        type: 'category',
        data: ['A1','B1','C1']
    }
],
yAxis: [
    {
        type: 'value'
    }
],
series: [
    {
        name: 'AA',
        type: 'bar',
        stack: 'text',
        data: [33,0,0],
    },
    {
        name: 'AAA',
        type: 'bar',
        stack: 'text',
        data: [-50,0,0],
    },
    {
        name: 'BB',
        type: 'bar',
        stack: 'text',
        data: [0,50,0],
    },
    {
        name: 'BBB',
        type: 'bar',
        stack: 'text',
        data: [0,60,0],
    },
    {
        name: 'CC',
        type: 'bar',
        stack: 'text',
        data: [0,0,18],
    },
    {
        name: 'CCC',
        type: 'bar',
        stack: 'text',
        data: [0,0,-20],
    },
]

};`

HM.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

都是在tooltip里面的formatter设置,判断值为0就不渲染


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...