mxxlrfu commented on issue #19498:
URL: https://github.com/apache/echarts/issues/19498#issuecomment-1888028739

   Here's the code snippet I ended up with ftw
   
   ```ts
     highlightPortfolio(event: ECElementEvent & { batch: 
LabelLayoutOptionCallbackParams[]}) {
       const { seriesIndex = 0, dataIndex = 0 } = event.batch[0];
       const height = this.chartInstance.getHeight();
       const options = this.chartInstance.getOption();
       const { value } = (options['series'] as 
any)[seriesIndex].data[dataIndex];
       const pixels = this.chartInstance.convertToPixel({ seriesIndex }, value 
as number[]);
   
       const isLow = pixels[1] > height / 2;
   
       this.chartInstance.setOption({
         series: {
           emphasis: {
             label: {
               position: isLow ? 'top' : 'bottom',
               offset: isLow ? [0, -5] : [0, 5],
             },
           },
         },
       });
     }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to