Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Cell Bars does not work on the Percentage Metrics in Table Chart #24495

Closed
3 tasks done
yousoph opened this issue Jun 23, 2023 · 1 comment · Fixed by #25707
Closed
3 tasks done

Show Cell Bars does not work on the Percentage Metrics in Table Chart #24495

yousoph opened this issue Jun 23, 2023 · 1 comment · Fixed by #25707
Labels

Comments

@yousoph
Copy link
Member

yousoph commented Jun 23, 2023

The Cell Bars option was not shown correctly in the Percentage Metrics column.

How to reproduce the bug

  1. Create a Table chart.
  2. Add a column into the Dimensions, Metrics, and Percentage Metrics fields.
  3. Go to the Customize tab and enable the CELL BARS option.
    Alternatively, on the CUSTOMIZE COLUMNS field, ensure that the SHOW CELL BARS option is enabled for the column.

Expected results

The Cell Bars visual cue will be shown in the Percentage Metrics column.

Actual results

No Cell Bars visual cue is shown on the Percentage Metrics column.

Screenshots

image

Environment

(please complete the following information):

  • browser type and version: Chrome
  • superset version: master
  • python version: python --version
  • node.js version: node -v
  • any feature flags active:

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.
@SA-Ark
Copy link
Contributor

SA-Ark commented Oct 11, 2023

The issue here is that the “isMetric” key for percentage metric is coming up as False from the columns when it is being imported from props.

image

As we follow the data into the line where we are creating “const valueRange”, we can see that we are calling the getValueRange function only when either “isMetric” is True or “isRawRecords” is true. “isRawRecords” is false for both, and “isMetric” is only true for regular metrics and not percentage metrics. So the "getValueRange" function is not even being called for percentage metrics which is why it is not calculated for these metrics.

image

When we follow the data further, we can see in the “” component where we are returning the Cell Bars we have a condition of “valueRange” to not be null in order to display the cell bars. We can verify with console.logs that the valueRange is never calculated in the case of percentage metrics and it is null. This is why the cell bars are not showing up for only the percentage metrics because the css class for it is not being added since “valueRange” is null.

image

Proposed solution:

A solution that fixed the cell bars for me is adding a separate key[0] == “%” in the conditional where we are checking (isMetric || isRawRecords) while creating the const “valueRange” variable. This ensures none of the other code is messed with and the cell bars still show up.

image

Alternatively, we can also make the isMetric variable true from the file where the percentage metric props are being created, but I am not sure if that might break other parts of the code, so this seemed to be the least intrusive way to fix it.

End result:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants