Skip to content

fix: make default vega format null as "null"#3926

Merged
kanitw merged 5 commits intomainfrom
kw/format-null
May 23, 2024
Merged

fix: make default vega format null as "null"#3926
kanitw merged 5 commits intomainfrom
kw/format-null

Conversation

@kanitw
Copy link
Copy Markdown
Member

@kanitw kanitw commented May 20, 2024

Make default vega format null as "null".

Context: I was trying to fix this in Vega-Lite, but then realize that it seems instead of add conditional expression everywhere in Vega-Lite. Better fix at the Vega level.

Number Format

Before (spec):

image

After:

image

Time Format

Before (spec):

image

After:

image

@kanitw kanitw requested a review from a team as a code owner May 20, 2024 23:34
Copy link
Copy Markdown
Member

@lsh lsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No complaints

const wrap = method => function(value, spec) {
const locale = this.context.dataflow.locale();
return locale[method](spec)(value);
return value === null ? 'null' : locale[method](spec)(value);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little bit hacky, but is also the most minimal amount of code to make this work.

@kanitw kanitw requested a review from domoritz May 20, 2024 23:45
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't include this in the pull request. This will be done on release. Same for other files here.

kanitw and others added 4 commits May 23, 2024 15:04
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
@kanitw kanitw enabled auto-merge (squash) May 23, 2024 22:04
@kanitw kanitw merged commit ff98519 into main May 23, 2024
@kanitw kanitw deleted the kw/format-null branch May 23, 2024 22:06
@lsh lsh mentioned this pull request Jun 13, 2024
lsh pushed a commit that referenced this pull request Jun 14, 2024
Changes since v5.29.0

**vega-functions**
- make default vega format null as "null" (via #3926). (Thanks @kanitw &
@domoritz )!

**docs**
- Add 4 new examples (via #3851). (Thanks @avatorl & @domoritz!)

**monorepo**
- Deploy editor preview (via #3925, #3931). (Thanks @hydrosquall!)
- Bump all `vega-*` deps in topological order to eliminate version
mismatches within the monorepo (via #3932). (Thanks @lsh!)

Signed-off-by: Lukas Hermann <lukas.hermann@databricks.com>
michaelherger pushed a commit to LMS-Community/lms-community.github.io that referenced this pull request May 30, 2025
@michaelherger
Copy link
Copy Markdown

I have an issue with this change where a world map now would add a shade to countries with no data. As previously no data was interpreted as 0, I got no shade. But now with "null" they'd be shaded. How would I tell Vega to interpret missing data as zero now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format of null data in tooltips.

4 participants