Skip to content

Commit

Permalink
refactor: rename keep -> show, for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kanitw committed May 16, 2024
1 parent d736c58 commit 4a00fc2
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
]
},
"config": {
"mark": {"invalid": "break-paths-and-keep-path-domains", "tooltip": true}
"mark": {"invalid": "break-paths-and-show-path-domains", "tooltip": true}
},
"vconcat": [
{
Expand Down Expand Up @@ -122,4 +122,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{"a": 10, "b": null}
]
},
"config": {"mark": {"invalid": "break-paths-keep-domains", "tooltip": true}},
"config": {"mark": {"invalid": "break-paths-show-domains", "tooltip": true}},
"vconcat": [
{
"title": "Quantitative X",
Expand Down Expand Up @@ -120,4 +120,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
]
},
"config": {
"mark": {"invalid": "break-paths-and-keep-path-domains", "tooltip": true}
"mark": {"invalid": "break-paths-and-show-path-domains", "tooltip": true}
},
"vconcat": [{
"title": "Quantitative X",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
]
},
"config": {
"mark": {"invalid": "break-paths-keep-domains", "tooltip": true}
"mark": {"invalid": "break-paths-show-domains", "tooltip": true}
},
"vconcat": [{
"title": "Quantitative X",
Expand Down
6 changes: 3 additions & 3 deletions site/docs/invaliddata.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Break path marks (for line, area, trail) at invalid values. For non-path marks,

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

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

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

Expand All @@ -78,9 +78,9 @@ Include all data points in the marks and scale domains. Each scale will use the

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

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

For historical reasons, Vega-Lite 5 currently uses `"break-paths-and-keep-path-domains"` as the default invalid data mode (to avoid breaking changes). 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 5 currently uses `"break-paths-and-show-path-domains"` as the default invalid data mode (to avoid breaking changes). 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>

Expand Down
6 changes: 3 additions & 3 deletions src/compile/invalid/ScaleInvalidDataMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {getMarkPropOrConfig} from '../common';
import {normalizeInvalidDataMode} from './normalizeInvalidDataMode';

export type ScaleInvalidDataMode =
// remove 'break-paths-and-keep-path-domains' from MarkInvalidDataMode
// remove 'break-paths-and-show-path-domains' from MarkInvalidDataMode
// because it is a macro for '"filter"' or `"break-path-keep-domains`
| Omit<MarkInvalidDataMode, 'break-paths-and-keep-path-domains'>
| Omit<MarkInvalidDataMode, 'break-paths-and-show-path-domains'>

// Add always-valid because at scale level, categorical scales can handle any values and thus is always valid.
| 'always-valid';
Expand Down Expand Up @@ -47,5 +47,5 @@ export function getScaleInvalidDataMode<C extends ScaleChannel>({
return invalidMode;
}
export function shouldBreakPath(mode: ScaleInvalidDataMode): boolean {
return mode === 'break-paths-filter-domains' || mode === 'break-paths-keep-domains';
return mode === 'break-paths-filter-domains' || mode === 'break-paths-show-domains';
}
4 changes: 2 additions & 2 deletions src/compile/invalid/datasources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function getDataSourcesForHandlingInvalidValues({
marks: 'exclude-invalid-values',
scales: 'exclude-invalid-values'
};
case 'break-paths-keep-domains':
case 'break-paths-show-domains':
return {
// Path-based marks use pre-filter data so we know to skip these invalid points in the path.
// For non-path based marks, we skip by not showing them at all.
Expand All @@ -39,7 +39,7 @@ export function getDataSourcesForHandlingInvalidValues({
// For non-path marks, we can use the filtered data for both marks and scales.
return {
marks: isPath ? 'include-invalid-values' : 'exclude-invalid-values',
// Unlike 'break-paths-keep-domains', 'break-paths-filter-domains' uses post-filter data to feed scale.
// Unlike 'break-paths-show-domains', 'break-paths-filter-domains' uses post-filter data to feed scale.
scales: 'exclude-invalid-values'
};
case 'show':
Expand Down
6 changes: 3 additions & 3 deletions src/compile/invalid/normalizeInvalidDataMode.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {MarkInvalidDataMode} from '../../invalid';

type NormalizedMarkInvalidDataMode = Exclude<MarkInvalidDataMode, 'break-paths-and-keep-path-domains'>;
type NormalizedMarkInvalidDataMode = Exclude<MarkInvalidDataMode, 'break-paths-and-show-path-domains'>;

export function normalizeInvalidDataMode(
mode: MarkInvalidDataMode | null | undefined,
{isPath}: {isPath: boolean}
): NormalizedMarkInvalidDataMode {
if (mode === undefined || mode === 'break-paths-and-keep-path-domains') {
return isPath ? 'break-paths-keep-domains' : 'filter';
if (mode === undefined || mode === 'break-paths-and-show-path-domains') {
return isPath ? 'break-paths-show-domains' : 'filter';
} else if (mode === null) {
return 'show';
}
Expand Down
8 changes: 4 additions & 4 deletions src/invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export interface MarkInvalidMixins {
* 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-paths-keep-domains"` —
* - `"break-paths-show-domains"` —
* Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks.
* All *scale* domains will *include* these filtered data points.
*
* - `"show"` or `null` —
* Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid`
* or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).
*
* - `"break-paths-and-keep-path-domains"` (default) —
* - `"break-paths-and-show-path-domains"` (default) —
* This is equivalent to `"break-path-keep-domains"` for path-based marks (line/area/trail)
* and `"filter"` for other marks.
*
Expand All @@ -39,8 +39,8 @@ export interface MarkInvalidMixins {
export type MarkInvalidDataMode =
| 'filter'
| 'break-paths-filter-domains'
| 'break-paths-keep-domains'
| 'break-paths-and-keep-path-domains'
| 'break-paths-show-domains'
| 'break-paths-and-show-path-domains'
| 'show';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: {

export const defaultMarkConfig: MarkConfig<SignalRef> = {
color: '#4c78a8',
invalid: 'break-paths-and-keep-path-domains',
invalid: 'break-paths-and-show-path-domains',
timeUnitBandSize: 1
};

Expand Down
14 changes: 7 additions & 7 deletions test/compile/invalid/ChannelInvalidDataMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
const ALL_MARK_INVALID_MODE: MarkInvalidDataMode[] = [
'filter',
'break-paths-filter-domains',
'break-paths-keep-domains',
'break-paths-show-domains',
'show',
'break-paths-and-keep-path-domains'
'break-paths-and-show-path-domains'
];

describe.each([...PRIMITIVE_MARKS])('For all marks (%s)', mark => {
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
});

describe.each(SCALE_CHANNELS)('for all scale channel (%s)', channel => {
const OTHER_MODES: MarkInvalidDataMode[] = ['break-paths-filter-domains', 'break-paths-keep-domains', 'filter'];
const OTHER_MODES: MarkInvalidDataMode[] = ['break-paths-filter-domains', 'break-paths-show-domains', 'filter'];

it.each(OTHER_MODES)('should return the mode (%s)', mode => {
expect(
Expand All @@ -160,7 +160,7 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
it('should return the mode (%s)', () => {
expect(
getScaleInvalidDataMode({
markDef: {type: mark, invalid: 'break-paths-and-keep-path-domains'},
markDef: {type: mark, invalid: 'break-paths-and-show-path-domains'},
scaleChannel: channel,
scaleType: 'linear',
isCountAggregate: false,
Expand All @@ -172,7 +172,7 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
}
}
})
).toBe('break-paths-keep-domains');
).toBe('break-paths-show-domains');
});
});
});
Expand All @@ -182,7 +182,7 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
it('should return the mode (%s)', () => {
expect(
getScaleInvalidDataMode({
markDef: {type: mark, invalid: 'break-paths-and-keep-path-domains'},
markDef: {type: mark, invalid: 'break-paths-and-show-path-domains'},
scaleChannel: channel,
scaleType: 'linear',
isCountAggregate: false,
Expand All @@ -194,7 +194,7 @@ describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode
}
}
})
).toBe('break-paths-keep-domains');
).toBe('break-paths-show-domains');
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/compile/mark/text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('Mark: Text', () => {
},
data: {url: 'data/cars.json'},
config: {
mark: {invalid: 'break-paths-keep-domains'}
mark: {invalid: 'break-paths-show-domains'}
}
};
const model = parseModelWithScale(spec);
Expand Down
2 changes: 1 addition & 1 deletion test/compile/selection/layers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Layered Selections', () => {
}
}
],
config: {mark: {tooltip: null, invalid: 'break-paths-keep-domains'}}
config: {mark: {tooltip: null, invalid: 'break-paths-show-domains'}}
});

layers.parse();
Expand Down
2 changes: 1 addition & 1 deletion test/compile/selection/timeunit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('Selection time unit', () => {
y: {field: 'price', type: 'quantitative'}
}
},
{mark: {invalid: 'break-paths-keep-domains'}}
{mark: {invalid: 'break-paths-show-domains'}}
);
const data0 = getData(model).filter(d => d.name === 'data_0')[0].transform;
const data1 = getData(model).filter(d => d.name === 'data_1')[0].transform;
Expand Down

0 comments on commit 4a00fc2

Please sign in to comment.