Skip to content

Commit

Permalink
style: auto-formatting [CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed May 9, 2024
1 parent fdeec4a commit 280b605
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions site/docs/invaliddata.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ title: Modes for Handling Invalid Data
permalink: /docs/invalid-data.html
---

This page discusses modes in Vega-Lite for handling invalid data
(`null` and `NaN` in continuous scales).
This page discusses modes in Vega-Lite for handling invalid data (`null` and `NaN` in continuous scales).

Note: Vega-Lite does _not_ consider `null` and `NaN` in categorical scales and text encodings as invalid data:

Note: Vega-Lite does *not* consider `null` and `NaN` in categorical scales and text encodings as invalid data:
- Categorical scales can treat nulls and NaNs as separate categories
- Similarly, text encodings can directly display nulls and NaNs.

Expand All @@ -29,7 +29,6 @@ You can set the invalid data mode via `mark.invalid` (or `config.mark.invalid`)

{% include table.html props="invalid" source="MarkDef" %}


### Examples

To understand how these modes affect common marks, see these examples below, which visualize this dataset:
Expand All @@ -53,46 +52,38 @@ by assigning `"a"` to x-axis (as quantitative and ordinal fields) and `"b"` to y

#### `"filter"`

The `"filter"` invalid mode *excludes* all invalid values from the visualization's *marks* and *scales*.
The `"filter"` invalid mode _excludes_ all invalid values from the visualization's _marks_ and _scales_.

For path marks (for line, area, trail), this option will create paths that connect valid points, as if the points with invalid values do not exist.



<div class="vl-example example-only" data-name="test_invalid_filter"></div>


### `"break-paths"`

Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `"filter"`.
All *scale* domains will *exclude* these filtered data points.
Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `"filter"`. All _scale_ domains will _exclude_ these filtered data points.

<div class="vl-example example-only" data-name="test_invalid_break_paths"></div>


### `"break-paths-keep-domains"`

This option is like `"break-paths"`, except that all *scale* domains will instead *include* these filtered data points.
This option is like `"break-paths"`, except that all _scale_ domains will instead _include_ these filtered data points.

<div class="vl-example example-only" data-name="test_invalid_break_paths_keep_domains"></div>

### `include`

Include all data points in the marks and scale domains.
By default, invalid values will output the same visual values as min values in the scales.
Include all data points in the marks and scale domains. By default, invalid values will output the same visual values as min values in the scales.

<div class="vl-example example-only" data-name="test_invalid_include"></div>

### `break-paths-and-keep-path-domains` (Default)

For historical reasons, Vega-Lite currently uses `"break-paths-and-keep-path-domains"` as the default invalid data mode.
This is equivalent to `"break-path-keep-domains"` for path-based marks (line/area/trail) and `"filter"` for other marks.
For historical reasons, Vega-Lite currently uses `"break-paths-and-keep-path-domains"` as the default invalid data mode. This is equivalent to `"break-path-keep-domains"` for path-based marks (line/area/trail) and `"filter"` for other marks.

...

<div class="vl-example example-only" data-name="test_invalid_break_paths_and_keep_path_domains"></div>


## Scale Output for Invalid Values

{:#scale}
Expand All @@ -101,7 +92,6 @@ You can use `config.scale.invalid` to defines scale outputs per channel for inva

{% include table.html props="invalid" source="ScaleConfig" %}


### Example: Output Color and Size

A visualization with `"filter"` invalid data mode will not filter (not exclude) color and size encoding if `config.scale.invalid.color` and `config.scale.invalid.size` are specified.
Expand All @@ -111,5 +101,3 @@ A visualization with `"filter"` invalid data mode will not filter (not exclude)
Compare this with a similar spec, but without `config.scale.invalid`.

<div class="vl-example" data-name="test_config_scale_invalid_baseline_filter_only"></div>


0 comments on commit 280b605

Please sign in to comment.