Skip to content

Commit daf6a82

Browse files
authored
fix: tickFormat called on mark value (#649)
1 parent cafcb9c commit daf6a82

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/chart_types/xy_chart/tooltip/tooltip.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('Tooltip formatting', () => {
5555
showOverlappingTicks: false,
5656
tickPadding: 0,
5757
tickSize: 0,
58-
tickFormat: (d) => `${d}`,
58+
tickFormat: jest.fn((d) => `${d}`),
5959
};
6060
const seriesStyle = {
6161
rect: {
@@ -125,6 +125,7 @@ describe('Tooltip formatting', () => {
125125
expect(tooltipValue.isHighlighted).toBe(false);
126126
expect(tooltipValue.color).toBe('blue');
127127
expect(tooltipValue.value).toBe('10');
128+
expect(YAXIS_SPEC.tickFormat).not.toBeCalledWith(null, undefined);
128129
});
129130
it('should set name as spec name when provided', () => {
130131
const name = 'test - spec';

src/chart_types/xy_chart/tooltip/tooltip.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ export function formatTooltip(
8282

8383
const value = isHeader ? x : y;
8484
const tickFormatOptions: TickFormatterOptions | undefined = spec.timeZone ? { timeZone: spec.timeZone } : undefined;
85-
const markValue = axisSpec ? axisSpec.tickFormat(mark, tickFormatOptions) : emptyFormatter(mark);
8685

8786
return {
8887
seriesIdentifier,
8988
valueAccessor: accessor,
9089
label,
9190
value: axisSpec ? axisSpec.tickFormat(value, tickFormatOptions) : emptyFormatter(value),
92-
markValue: isHeader || mark === null ? null : markValue,
91+
markValue: isHeader || mark === null ? null : mark,
9392
color,
9493
isHighlighted: isHeader ? false : isHighlighted,
9594
isVisible,

0 commit comments

Comments
 (0)