You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/02/05 09:09:08 UTC

[GitHub] [echarts-doc] 100pah edited a comment on issue #164: Some features are not available in custom series

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



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