Skip to content

Commit ec95d50

Browse files
authored
fix(axis): always render tickLine unless visible is false (#2194)
BREAKING CHANGE: Now respects `tickLine.padding` whenever `tickLine.visible` is `true`
1 parent 132327d commit ec95d50

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

packages/charts/src/chart_types/xy_chart/annotations/rect/dimensions.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,8 @@ function maxOf(base: number, value: number | string | null | undefined): number
243243
return typeof value === 'number' ? Math.max(value, base) : typeof value === 'string' ? value : base;
244244
}
245245

246-
function getOutsideDimension(style: AxisStyle): number {
247-
const { visible, size, strokeWidth } = style.tickLine;
248-
249-
return visible && size > 0 && strokeWidth > 0 ? size : 0;
246+
function getOutsideDimension({ tickLine: { visible, size } }: AxisStyle): number {
247+
return visible ? size : 0;
250248
}
251249

252250
/**

packages/charts/src/chart_types/xy_chart/utils/axis_utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { Range } from '../../../utils/domain';
2424
import { AxisId } from '../../../utils/ids';
2525
import { Point } from '../../../utils/point';
2626
import { AxisStyle, TextAlignment, TextOffset, Theme } from '../../../utils/themes/theme';
27-
import { MIN_STROKE_WIDTH } from '../renderer/canvas/primitives/line';
2827
import { Projection } from '../state/selectors/visible_ticks';
2928
import { SeriesDomainsAndData } from '../state/utils/types';
3029

@@ -291,8 +290,8 @@ export function getPosition(
291290
}
292291

293292
/** @internal */
294-
export function shouldShowTicks({ visible, strokeWidth, size }: AxisStyle['tickLine'], axisHidden: boolean): boolean {
295-
return !axisHidden && visible && size > 0 && strokeWidth >= MIN_STROKE_WIDTH;
293+
export function shouldShowTicks({ visible }: AxisStyle['tickLine'], axisHidden: boolean): boolean {
294+
return !axisHidden && visible;
296295
}
297296

298297
/** @internal */

0 commit comments

Comments
 (0)