You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/04/06 06:15:41 UTC

[GitHub] [superset] villebro commented on a diff in pull request #23396: fix(Gauge echart): displaying column label

villebro commented on code in PR #23396:
URL: https://github.com/apache/superset/pull/23396#discussion_r1159319953


##########
superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts:
##########
@@ -100,10 +100,11 @@ export default function transformProps(
     filterState,
     theme,
     emitCrossFilters,
+    datasource,
   } = chartProps;
 
   const gaugeSeriesOptions = defaultGaugeSeriesOption(theme);
-
+  const { verboseMap } = datasource;

Review Comment:
   This is needed for the proposed code change below:
   ```suggestion
     const { verboseMap = {} } = datasource;
   ```



##########
superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts:
##########
@@ -146,7 +147,12 @@ export default function transformProps(
   const transformedData: GaugeDataItemOption[] = data.map(
     (data_point, index) => {
       const name = groupbyLabels
-        .map(column => `${column}: ${data_point[column]}`)
+        .map(
+          column =>
+            `${verboseMap ? verboseMap[column] : column}: ${
+              data_point[column]
+            }`,
+        )

Review Comment:
   I don't believe this will work if you have a column that doesn't have a verbose name defined for it. I believe you need to do something like this:
   ```suggestion
           .map(
             column =>
               `${verboseMap[column] || column}: ${data_point[column]}`,
           )
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org