100pah edited a comment on issue #11889: 当环形图偏移时,graphic自定义文字无法居中的问题
URL: 
https://github.com/apache/incubator-echarts/issues/11889#issuecomment-568558396
 
 
   That is not a bug. `left` means the distance between the left boundary of 
the element to the left boundary of the echarts.
   
   There is a workaround for this issue:
   
   ```js
   option = {
       graphic: [
           {
               type: 'group',
               left: '35%',
               top: 'center',
               bounding: 'raw', // Notice that this prop is necessary.
               children: [{
                   type: 'text',
                   style: {
                       text: 'ASDFASDF',
                       fontSize: 50,
                       textVerticalAlign: 'middle',
                       textAlign: 'center'
                   }
               }]
           }
       ],
       ...
   }
   ```
   
   But indeed it is not easy to know the workaround of locating an element 
aligning with a component located via `center` (like `pie`, `polar`, 
`sunburst`).
   Perhaps we might provide some new approaches to locate. For example, provide 
an `center` prop:
   ```js
   graphic: [{
         type: 'text',
         center: ['35%', null], // null means only set x center but leave y 
center not set
         style: {
             text: 'asdfasdfasd'
         } 
   }]
   ``` 
   But this idea seams not good enough.
   
   Or another option is just do nothing but use the workaround above to handle 
this kind of scenario.
   That is, make the tutorial of "custom layout by `group`" in doc.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to