You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "minhnhat44 (via GitHub)" <gi...@apache.org> on 2024/04/19 01:01:56 UTC

Re: [I] Legend is not displayed when name repeats [echarts]

minhnhat44 commented on issue #18242:
URL: https://github.com/apache/echarts/issues/18242#issuecomment-2065562723

   > Thank you! This workaround I will use like last option because:
   > 
   > 1. it add spaces to legend and it will be not symmetrical
   > 2. amount of names are dynamic (can be more than 10) and I need to create additional method which handle all this workaround
   
   @Mykhaylo12 : Have a better workaround using legend's formatter. Adding suffix for `name`, then using formatter to cut the suffix by delimiter
   ```option = {
     legend: {
       formatter: function (name) {
           return name.split('-')[0];
       }
     },
     tooltip: {},
     dataset: {},
     xAxis: { type: 'category' },
     yAxis: {
       name: 'Test label',
       nameLocation: 'middle',
       nameGap: 100
     },
     series: [{ type: 'bar',
       name: "Apple-id1",
       data: [1,2,3,4,5,6,7,8,9,10,11,12]
     },
     { type: 'bar',
       name: "Apple-id2",
       data: [1,2,3,4,5,6,7,8,9,10,11,12]
     },
     ]
   };


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org