fix(charts): Hide Values greater than Max Y Axis Bound on Mixed Time Series with Bar series (#21015)

* Mixed TimeSeries:

- When Bar chart is used as serie type, we need to hide values that are greater than the max Y Axis Bound.

* Mixed Time Series:

- Simplify logic for getOverMaxHiddenFormatter

* Mixed Time Series:

- Add tests for new getOverMaxHiddenFormatter util func
This commit is contained in:
Antonio Rivero Martinez
2022-08-22 11:55:09 -03:00
committed by GitHub
parent d44202f03c
commit bdcc0a9bcf
4 changed files with 97 additions and 46 deletions

View File

@@ -26,6 +26,7 @@ import {
getLegendProps,
sanitizeHtml,
extractShowValueIndexes,
getOverMaxHiddenFormatter,
} from '../../src/utils/series';
import { LegendOrientation, LegendType } from '../../src/types';
import { defaultLegendPadding } from '../../src/defaults';
@@ -536,4 +537,16 @@ describe('formatSeriesName', () => {
expect(sanitizeHtml(NULL_STRING)).toEqual('<NULL>');
});
});
describe('getOverMaxHiddenFormatter', () => {
it('should hide value if greater than max', () => {
const formatter = getOverMaxHiddenFormatter({ max: 81000 });
expect(formatter.format(84500)).toEqual('');
});
it('should show value if less or equal than max', () => {
const formatter = getOverMaxHiddenFormatter({ max: 81000 });
expect(formatter.format(81000)).toEqual('81000');
expect(formatter.format(50000)).toEqual('50000');
});
});
});