Skip to content

Commit

Permalink
fix: tickFormat called on mark value (opensearch-project#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme authored Apr 24, 2020
1 parent 830534b commit 7b84e7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Tooltip formatting', () => {
showOverlappingTicks: false,
tickPadding: 0,
tickSize: 0,
tickFormat: (d) => `${d}`,
tickFormat: jest.fn((d) => `${d}`),
};
const seriesStyle = {
rect: {
Expand Down Expand Up @@ -125,6 +125,7 @@ describe('Tooltip formatting', () => {
expect(tooltipValue.isHighlighted).toBe(false);
expect(tooltipValue.color).toBe('blue');
expect(tooltipValue.value).toBe('10');
expect(YAXIS_SPEC.tickFormat).not.toBeCalledWith(null, undefined);
});
it('should set name as spec name when provided', () => {
const name = 'test - spec';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,13 @@ export function formatTooltip(

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

return {
seriesIdentifier,
valueAccessor: accessor,
label,
value: axisSpec ? axisSpec.tickFormat(value, tickFormatOptions) : emptyFormatter(value),
markValue: isHeader || mark === null ? null : markValue,
markValue: isHeader || mark === null ? null : mark,
color,
isHighlighted: isHeader ? false : isHighlighted,
isVisible,
Expand Down

0 comments on commit 7b84e7f

Please sign in to comment.