How to sort echarts negative/positive stack bar by two seriees data sum total

Viewed 216

I want to sort by two series data Absolutely in desc, like
[320, 302, 341, 374, 390, 450, 420] add [-120, -132, -101, -134, -190, -230, -210] result in desc sort [440, 434, 442, 508, 580, 680, 630] How to do this, Is echats has some parameter or config to quick achieve this result?Thk~

option = {
  legend: {
    data: [ 'neg', 'pos']
  },
  xAxis: [
    {
      type: 'value'
    }
  ],
  yAxis: [
    {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    }
  ],
  series: [
    {
      name: 'pos',
      type: 'bar',
      stack: 'Total',
      label: {
        show: true
      },
      data: [320, 302, 341, 374, 390, 450, 420]
    },
    {
      name: 'neg',
      type: 'bar',
      stack: 'Total',
      label: {
        show: true,
        position: 'left'
      },
      data: [-120, -132, -101, -134, -190, -230, -210]
    }
  ]
};

enter image description here

0 Answers
Related