You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/01/07 22:24:50 UTC

[GitHub] MohammadYounes opened a new issue #9700: Pie chart with radial gradient

MohammadYounes opened a new issue #9700: Pie chart with radial gradient
URL: https://github.com/apache/incubator-echarts/issues/9700
 
 
   Applying a radial gradient to a pie chart does not adhere to sector size/rotation, for example:
   
   ```js
   option = {
     "color": [
       "rgb(65, 140, 240)",
       "rgb(252, 180, 65)",
       "rgb(224, 64, 10)",
       "rgb(5, 100, 146)",
     ],
     "dataset": [
       {
         "source": [
           {
             "name": "A",
             "value": 25,
           },
           {
             "name": "B",
             "value": 25,
           },
           {
             "name": "C",
             "value": 25
           },
           {
             "name": "D",
             "value": "25"
           }
         ],
       }
     ],
     "series": [
       {
         "type": "pie",
         "startAngle": 0,
         "itemStyle": {
             color: function (args) {
               var c = option.color[args.dataIndex],
                   c2 = c.replace(')', ',.8)'),
                   c3 = c.replace(')', ',.9)')
               return {
                 globalCoord:false,
                 type: 'radial',
                 x: 0, // calculate x
                 y: 0, // calculate y
                 r: .9,
                 colorStops: [
                   { offset: .75, color: c3 },
                   { offset: .95, color: c2 },
                   { offset: 1, color: c }
                 ]
               }
             }            
         },
       }
     ]
   }
   ```
   Produces this:
   
   ![image](https://user-images.githubusercontent.com/4712046/50796671-0145cc00-12db-11e9-840a-4d0f9b225b2e.png)
   
   While I want to have this:
   
   ![image](https://user-images.githubusercontent.com/4712046/50796876-b4aec080-12db-11e9-8712-f7f841d29ecd.png)
   
   
   Is there something builtin to help calculate `x`,`y` of the radial gradient for each sector ?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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