100pah edited a comment on issue #164:
URL: https://github.com/apache/echarts-doc/issues/164#issuecomment-773899439


   @Clarkkkk 
   
   Since v5, in `custom series`, it is recommended to set graphic element style 
directly rather than in `itemStyle`.
   For example:
   ```js
   
   var option = {
       xAxis: {
           max: 200
       },
       yAxis: {
           min: 0,
           max: 200
       },
       series: {
           type: 'custom',
           selectedMode: true,
           renderItem: function (params, api) {
               return {
                   type: 'circle',
                   x: 100,
                   y: 100,
                   shape: {
                       cx: 0, cy: 0, r: 50
                   },
                   style: {
                       fill: 'orange'
                   },
                   textContent: {
                       style: {
                           text: 'this is a label'
                       }
                   },
                   textConfig: {
                       // label position
                       position: 'top'
                   },
                   // style for the "selected" state
                   select: {
                       style: {
                           fill: 'blue'
                       }
                   },
                   // style for the "hover" state.
                   emphasis: {
                       style: {
                         fill: 'red'
                       }
                   }
               }
           },
           data: [[1]]
       }
   
   };
   ```
   
   In fact, the final style of a graphic element is always determined by the 
`style: { ... }` declaration.
   The settings in `series.itemStyle` are only read by `api.style()` and works 
only if assigning the return of `api.style()` to `style: ...`.
   
   Because it's not easy to keep completely backward compatibility of 
`api.style()` if some of the properties in `itemStyle`, `label` changed in 
future, and `style` can not cover all of the features of `itemStyle`, `label` 
since `v5`, we decorated `api.style()` and keep thinking about is there any 
better way for applying label layout.
   
   
   


----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to