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/14 03:18:06 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #17212: fix(axis):fix Axis.nameTextStyle overflow option. close #17180

Ovilia commented on code in PR #17212:
URL: https://github.com/apache/echarts/pull/17212#discussion_r896334831


##########
src/coord/axisCommonTypes.ts:
##########
@@ -162,7 +163,7 @@ export interface TimeAxisBaseOption extends NumericAxisBaseOptionCommon {
     type?: 'time';
     axisLabel?: AxisLabelOption<'time'>;
 }
-interface AxisNameTextStyleOption extends TextCommonOption {
+interface AxisNameTextStyleOption extends TextCommonOption, Pick<TextStyleProps, 'overflow'| 'ellipsis'> {

Review Comment:
   This should probably be `Partial<Pick<...>>` because `overflow` and `ellipsis` is optional. There should be a space before the `|`.



##########
src/component/axis/AxisBuilder.ts:
##########
@@ -421,9 +421,11 @@ const builders: Record<'axisLine' | 'axisTickLabel' | 'axisName', AxisElementsBu
         const textFont = textStyleModel.getFont();
 
         const truncateOpt = axisModel.get('nameTruncate', true) || {};
-        const ellipsis = truncateOpt.ellipsis;
+        const ellipsis = textStyleModel.get('ellipsis') || truncateOpt.ellipsis;
+        const overflow = textStyleModel.get('overflow') || 'none';
         const maxWidth = retrieve(
-            opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth
+            opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth,
+            Math.abs(extent[1] - extent[0]) // Current axis length.

Review Comment:
   This seems to be a good idea. Can we also have a test case on the polar system?



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