Skip to content

Commit

Permalink
fix(axis): always render tickLine unless visible is false (#2194)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Now respects `tickLine.padding` whenever `tickLine.visible` is `true`
  • Loading branch information
nickofthyme authored Oct 10, 2023
1 parent 132327d commit ec95d50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,8 @@ function maxOf(base: number, value: number | string | null | undefined): number
return typeof value === 'number' ? Math.max(value, base) : typeof value === 'string' ? value : base;
}

function getOutsideDimension(style: AxisStyle): number {
const { visible, size, strokeWidth } = style.tickLine;

return visible && size > 0 && strokeWidth > 0 ? size : 0;
function getOutsideDimension({ tickLine: { visible, size } }: AxisStyle): number {
return visible ? size : 0;
}

/**
Expand Down
5 changes: 2 additions & 3 deletions packages/charts/src/chart_types/xy_chart/utils/axis_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { Range } from '../../../utils/domain';
import { AxisId } from '../../../utils/ids';
import { Point } from '../../../utils/point';
import { AxisStyle, TextAlignment, TextOffset, Theme } from '../../../utils/themes/theme';
import { MIN_STROKE_WIDTH } from '../renderer/canvas/primitives/line';
import { Projection } from '../state/selectors/visible_ticks';
import { SeriesDomainsAndData } from '../state/utils/types';

Expand Down Expand Up @@ -291,8 +290,8 @@ export function getPosition(
}

/** @internal */
export function shouldShowTicks({ visible, strokeWidth, size }: AxisStyle['tickLine'], axisHidden: boolean): boolean {
return !axisHidden && visible && size > 0 && strokeWidth >= MIN_STROKE_WIDTH;
export function shouldShowTicks({ visible }: AxisStyle['tickLine'], axisHidden: boolean): boolean {
return !axisHidden && visible;
}

/** @internal */
Expand Down

0 comments on commit ec95d50

Please sign in to comment.