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/06/15 15:40:16 UTC

[GitHub] [echarts] DavidMarquezF commented on issue #17210: [Feature] Bar marker line

DavidMarquezF commented on issue #17210:
URL: https://github.com/apache/echarts/issues/17210#issuecomment-1156631773

   I found a workaround but it is a **VERY DIRTY WORKAROUND**. It is prone to break in the future and it just hurts my eyes to look at it in my code, but it works 😁
   
   I found it looking at the source code:
   https://github.com/apache/echarts/blob/1047e897b90fe250f89a369e3646a7fbbfdc2b35/src/chart/bar/BarView.ts#L1119-L1123
   
   So basically I do the same they do to calculate the barWidth. Maybe there is better way of getting the bar width, but for now I just found this.
   
   After calling `setOption` or `resize`:
   
   ```js
   const barSize = this.echart["_chartsViews"][0]["_model"].getData().getLayout("size");
   
       const sizeOption: ECOption = {
         series: [
           {
             id: this.MAIN_SERIES_ID,
             markPoint: {
               symbolSize: [barSize, 3]
             }
           }
         ]
       };
   this.echart.setOption(sizeOption);
   ```
   
   I'm accessing at the chartsView index 0 because I know I have my BarChartView, but you should put the index of your bar dataset I guess.
   
   Again, this is just dirty and not a good fix, but I guess it will just work until echarts provides a proper solution


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