Skip to content
New issue

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

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

Already on GitHub? # to your account

Table chart: Conditional formatting assigns color to N/A values #21341

Closed
2 tasks done
goto-loop opened this issue Sep 6, 2022 · 2 comments · Fixed by #21501
Closed
2 tasks done

Table chart: Conditional formatting assigns color to N/A values #21341

goto-loop opened this issue Sep 6, 2022 · 2 comments · Fixed by #21501
Labels
#bug Bug report

Comments

@goto-loop
Copy link
Contributor

When using the Table chart, it is possible to define conditional color formatting. Currently, the formatting is applied also to N/A values if a left-open interval with positive target value is used.

How to reproduce the bug

  1. Create a new Table chart from the new_members_daily example dataset
  2. Set chart to RAW RECORDS and under COLUMNS add new_members, then hit CREATE CHART
  3. Under CUSTOMIZE tab, CONDITIONAL FORMATTING, add new formatter with arbitrary color for values < 1
  4. Click APPLY and see the first row with N/A value be marked as red

Expected results

N/A values should be excluded from conditional formatting, i.e. they should have no color because their value is undefined.

Actual results

N/A values get color formatted.

Screenshots

Screenshot_20220906_121559

Environment

  • browser type and version: Firefox 104.0.1
  • superset version: 2.0.0

Checklist

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

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

Additional context

A possible workaround is to split up the left-open interval, e.g. instead of one conditional formatter for x < 1 you use three formatters with the ranges 0 < x < 1, x = 0 and x < 0. It seems that N/A gets treated as zero value, but it does not satisfy a comparison with the actual number 0.

@goto-loop goto-loop added the #bug Bug report label Sep 6, 2022
@yuxinhua123
Copy link

A workaround is add css for dt-is-null class to override the background color.

@goto-loop
Copy link
Contributor Author

That's a pretty good workaround, thanks for the suggestion!

For the record, this is what I've added to the dashboard's CSS (I believe you can't add CSS to a chart?):

.dt-is-null {
  background-color: #ffffff;
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
#bug Bug report
Projects
None yet
2 participants