Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/compile/axis/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {isBinned, isBinning} from '../../bin.js';
import {PositionScaleChannel, X} from '../../channel.js';
import {
DatumDef,
isDiscrete,
isFieldDef,
PositionDatumDef,
PositionFieldDef,
Expand Down Expand Up @@ -367,8 +366,10 @@ export function values(axis: AxisInternal, fieldOrDatumDef: TypedFieldDef<string
return undefined;
}

// Signature kept for API consistency; second arg unused after fix for #9514.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function defaultZindex(mark: Mark, fieldDef: TypedFieldDef<string> | DatumDef) {
if (mark === 'rect' && isDiscrete(fieldDef)) {
if (mark === 'rect') {
return 1;
}
return 0;
Expand Down
8 changes: 8 additions & 0 deletions test/compile/axis/properties.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,13 @@ describe('compile/axis/properties', () => {
it('returns 1 for discrete axes of rect marks', () => {
expect(properties.defaultZindex('rect', {field: 'a', type: 'nominal'})).toBe(1);
});

it('returns 1 for quantitative axes of rect marks (horizontal bar charts)', () => {
expect(properties.defaultZindex('rect', {field: 'x', type: 'quantitative'})).toBe(1);
});

it('returns 0 for non-rect marks', () => {
expect(properties.defaultZindex('point', {field: 'a', type: 'nominal'})).toBe(0);
});
});
});