I'm using a stacked bar chart where each segment displays its own value
with `label.show: true`. I'd also like to display the total value at the
top of each stacked bar (Mon, Tue, Wed, etc.), while keeping the individual
segment labels visible.

Is there a recommended or best-practice way to achieve this in ECharts?

Example EchartsOptions:

> option = {
>   tooltip: {
>     trigger: 'axis',
>   },
>   xAxis: {
>
>      type: 'category',
>     data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
>   },
>   yAxis: {
>      type: 'value'
>   },
>   series: [
>     {
>       name: 'Direct',
>       type: 'bar',
>       stack: 'total',
>       label: {
>         show: true
>       },
>       emphasis: {
>         focus: 'series'
>       },
>       data: [320, 302, 301, 334, 390, 330, 320]
>     },
>     {
>       name: 'Mail Ad',
>       type: 'bar',
>       stack: 'total',
>       label: {
>         show: true
>       },
>       emphasis: {
>         focus: 'series'
>       },
>       data: [120, 132, 101, 134, 90, 230, 210]
>     },
>     {
>       name: 'Affiliate Ad',
>       type: 'bar',
>       stack: 'total',
>       label: {
>         show: true
>       },
>       emphasis: {
>         focus: 'series'
>       },
>       data: [220, 182, 191, 234, 290, 330, 310]
>     },
>     {
>       name: 'Video Ad',
>       type: 'bar',
>       stack: 'total',
>       label: {
>         show: true
>       },
>       emphasis: {
>         focus: 'series'
>       },
>       data: [150, 212, 201, 154, 190, 330, 410]
>     },
>     {
>       name: 'Search Engine',
>       type: 'bar',
>       stack: 'total',
>       label: {
>         show: true
>       },
>       emphasis: {
>         focus: 'series'
>       },
>       data: [820, 832, 901, 934, 1290, 1330, 1320]
>     }
>   ]
> };

Reply via email to