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 2022/08/14 16:14:07 UTC

[GitHub] [echarts] ike-yu-byte opened a new issue, #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

ike-yu-byte opened a new issue, #17512:
URL: https://github.com/apache/echarts/issues/17512

   ### What problem does this feature solve?
   
   [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置] 
   
   ### What does the proposed API look like?
   
   [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置] 


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

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


[GitHub] [echarts] plainheart closed issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
plainheart closed issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置] 
URL: https://github.com/apache/echarts/issues/17512


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] ike-yu-byte commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
ike-yu-byte commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1218102387

   `renderItem(params, api) {
               // api.value: 得到给定维度数据值
               // api.coord:将数据映射到坐标系上
   
   
               let categoryIndex = api.value(0)
               let start = api.coord([categoryIndex, api.value(1)])
               let end = api.coord([categoryIndex, api.value(2)])
               let width = api.size([0, api.value(2)])[0] * 0.8
       
               const num = api.value(4) // 每个系列柱子数
               const currentIndex = api.value(3)
               const isOdd = num % 2 === 0
               const midN = isOdd ? num / 2 : (num + 1) / 2
       
               let rect = ''
       
               // width = width / num
               width = this.barWidth ? this.barWidth : (width / num)
       
               let rectX = start[0] - width / 2
           
               const FIXED_WIDTH = 5 // 柱子间距
       
               // 数据处理,结构为 { itemStyle: { normal: { color: 'lightgreen' } }, name: '2011', value: [0, 0, 150, 2, 5] }
               // 其中value 分为五个维度,分别为{系列项}(从0开始)、y轴起始值(均为0)、实际值、同系列中索引值(从1开始)、同系列数据项总数
       
               if (num > 1) {
                   if (isOdd) {
                       if (currentIndex <= midN) {
                           // 中位数左侧
                           rectX = start[0] - width / 2 - width / 2 + (currentIndex - midN) * width - FIXED_WIDTH * (midN + 1 - currentIndex)
                       } else {
                           // 中位数右侧
                           rectX = start[0] - width / 2 + width / 2 + (currentIndex - midN - 1) * width + FIXED_WIDTH * (currentIndex - midN)
                       }
                   } else {
                       rectX = start[0] - width / 2 + (currentIndex - midN) * (width + FIXED_WIDTH)
                   }
               }
       
               rect = {
                   type: 'rect',
                   transition: ['shape'],
                   shape: echarts.graphic.clipRectByRect(
                       { x: rectX, y: end[1], width: width, height: start[1] - end[1] },
                       {
                           x: params.coordSys.x,
                           y: params.coordSys.y,
                           width: params.coordSys.width,
                           height: params.coordSys.height
                       }
                   ),
                   style: api.style()
               }
               return rect
           }


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] plainheart commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
plainheart commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1214529269

   可以用 `rect` shape 中的 [`r`](https://echarts.apache.org/option.html#series-custom.renderItem.return_rect.shape.r) 属性来设置圆角。


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] echarts-bot[bot] commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1214408475

   @ike-yu-byte It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
   <details><summary><b>TRANSLATED</b></summary><br>
   
   **TITLE**
   
   [When the type of series is custom, the drawn histogram has no borderRadius property in itemStyle to configure]
   
   **BODY**
   
   ### What problem does this feature solve?
   
   [When the type of series is custom, the drawn histogram has no borderRadius property in itemStyle to configure]
   
   ### What does the proposed API look like?
   
   [When the type of series is custom, the drawn histogram has no borderRadius property in itemStyle to configure]
   </details>


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] CoderFXJ commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
CoderFXJ commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1214552853

   基本的提问方式都不对, 这样别人怎么帮你解决 ,至少配个代码/echart效果图啊


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] ike-yu-byte commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
ike-yu-byte commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1218103414

   > 设置
   
   不行啊


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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


[GitHub] [echarts] ike-yu-byte commented on issue #17512: [当series的类型为custom时,绘制的柱状图没有itemStyle中没有borderRadius属性可配置]

Posted by GitBox <gi...@apache.org>.
ike-yu-byte commented on issue #17512:
URL: https://github.com/apache/echarts/issues/17512#issuecomment-1218137619

   > 可以用 `rect` shape 中的 [`r`](https://echarts.apache.org/option.html#series-custom.renderItem.return_rect.shape.r) 属性来设置圆角。
   
   非常感谢,终于解决了这个难题


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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