plainheart commented on a change in pull request #14214:
URL: https://github.com/apache/echarts/pull/14214#discussion_r570666053



##########
File path: src/util/types.ts
##########
@@ -1345,6 +1345,8 @@ export interface CommonTooltipOption<FormatterParams> {
 
         // Available when renderMode is html
         decoration?: string
+        overflow?: 'none' | 'truncate' | 'break' | 'breakAll'
+        ellipsis?: string

Review comment:
       The type definitions for `overflow` and `ellipsis` here are 
inappropriate and seems redundant. We can pick the `overflow` property from 
`LabelOption`. As for the `ellipsis` and `lineOverflow`, they can also be 
picked from the `TextStyleProps` in zrender. I think they are just missing in 
`LabelOption`. We should add them.
   
   ```ts
   export interface LabelOption extends TextCommonOption {
       overflow?: TextStyleProps['overflow']
       ellipsis?: TextStyleProps['ellipsis']
       lineOverflow?: TextStyleProps['lineOverflow']
   }
   ```
   
   Then add support for `ellipsis` after 
https://github.com/apache/echarts/blob/master/src/label/labelStyle.ts#L416-L419
   ```ts
   const ellipsis = textStyleModel.get('ellipsis');
   if (ellipsis) {
       textStyle.ellipsis = ellipsis;
   }
   const lineOverflow = textStyleModel.get('lineOverflow');
   if (lineOverflow) {
       textStyle.lineOverflow = lineOverflow;
   }
   ```
   
   But there is a TODO 
   
https://github.com/ecomfe/zrender/blob/master/src/graphic/helper/parseText.ts#L206-L213
   
   So `lineOverflow: truncate` won't be truncated by `ellipsis` characters. We 
can fix it later.
   Besides, `lineOverflow` may not be working in HTML rendering mode. Though 
there is a CSS property `line-clamp`, it is an unsupported WebKit property and 
it may have poor compatibility in some browsers.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to