AkenClub opened a new issue #16009:
URL: https://github.com/apache/echarts/issues/16009


   
![image](https://user-images.githubusercontent.com/52781316/140269003-dc76edb8-6abe-4174-8523-0916da70ee88.png)
   如上这个效果,求助,代码设置如下:
   `
   const customSeries = []
         this.chartData.seriesData.forEach(item => {
           customSeries.push({
             name: item.name,
             type: 'bar',
             data: item.data,
             animationDuration,
             barWidth: 30,
             emphasis: {
               focus: 'series'
             }
           })
         })
   
         this.chart = echarts.init(this.$el, 'macarons')
         this.chart.setOption({
           title: {
             text: this.title
           },
           tooltip: {
             trigger: 'axis',
             showDelay: 10,
             axisPointer: { // 坐标轴指示器,坐标轴触发有效
               type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
             },
             textStyle: {
               color: '#fff'
             },
             formatter: (params) => {
               let sum = 0
               let mainTip = ''
               params.forEach((data, index) => {
                 sum += data.value
                 mainTip += (data.marker) + (data.seriesName + ':' + data.value)
                 if (index !== params.length - 1) {
                   mainTip += '<br />'
                 }
               })
               return `${params[0].axisValue}<br />总计:${sum}<br />${mainTip}`
             }
           },
           grid: {
             left: '0%',
             right: '1%',
             bottom: '2%',
             containLabel: true
           },
           xAxis: [{
             type: 'category',
             data: this.chartData.xAxisData,
             axisTick: {
               alignWithLabel: true
             }
           }],
           yAxis: [{
             type: 'value',
             axisTick: {
               show: false
             }
           }],
           legend: {
             left: 'right',
             top: '0%'
           },
           series: customSeries
         })
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to