You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Ovilia (via GitHub)" <gi...@apache.org> on 2023/02/02 06:30:23 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #18222: 修复:Sankey桑基图Label Value总是undefined的问题。

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


##########
src/label/labelStyle.ts:
##########
@@ -135,17 +136,25 @@ function getLabelText<TLabelDataIndex>(
     const labelFetcher = opt.labelFetcher;
     const labelDataIndex = opt.labelDataIndex;
     const labelDimIndex = opt.labelDimIndex;
+    const labelValue = opt.labelValue;
     const normalModel = stateModels.normal;
     let baseText;
+    let extendParams = null;
     if (labelFetcher) {
+        if (labelValue != undefined && labelValue != null) {
+            extendParams = {
+                interpolatedValue: labelValue
+            };
+        }
+
         baseText = labelFetcher.getFormattedLabel(
             labelDataIndex, 'normal',
             null,
             labelDimIndex,
             normalModel && normalModel.get('formatter'),
             interpolatedValue != null ? {
                 interpolatedValue: interpolatedValue
-            } : null
+            } : extendParams

Review Comment:
   This can be simplified to be `{interpolatedValue: retrive2(interpolatedValue, labelValue}`. `retrive2` is from `import { retrieve2 } from 'zrender/src/core/util';`.



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