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/04/15 04:00:05 UTC

[GitHub] [echarts] pissang edited a comment on issue #14675: No way to set global style for chart series

pissang edited a comment on issue #14675:
URL: https://github.com/apache/echarts/issues/14675#issuecomment-820067637


   Hi, @Bilge. That's a feature we have been discussed for a while internally. But the option design is still not settled.  There are three potential solutions:
   
   1. The simplest will be like what theme did:
   ```ts
   {
     line: { itemStyle: {} }
     bar: { itemStyle: {} }
   }
   ```
   But it's too rough and easy to have namespace conflicts.
   
   2. Use a CSS like className:
   ```ts
   {
     styles: { lineStyle1: {}, lineStyle2: {}, barStyle: {} },
     series: [{  
          type: 'line',
          lineStyle: 'lineStyle1'
      }]
   }
   ```
   It's much more flexible. But it's not as easy as the first solution in simple cases. Also, it's not type-friendly. It's hard to detect the types of style property. We can't know what properties `lineStyle1`, `lineStyle2` may have since we don't known which series they will be used. 
   
   3.   Use mixins
   ```ts
   {
     seriesMixins: { lineMixin: {
       type: 'line'  // Add series type so we can have right type again.
     }, barMixin: {} },
     series: [{ type: 'line', mixin: 'lineMixin' }]
   }
   ```
   
   It's even more flexible than the second solution because there is no limit on the mixin. But I'm not sure if things will get messed up because of its flexibility. Perhaps type-friendly may help it a lot.
   
   Perhaps we need to combine one or two of these three solutions so we can balance the flexibility and usability. We will pick up the discussion in the later versions when the current developing features are all stable.


-- 
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