mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(plugin-chart-echarts): support truncated numeric x-axis (#26215)
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
getChartPadding,
|
||||
getLegendProps,
|
||||
getOverMaxHiddenFormatter,
|
||||
getMinAndMaxFromBounds,
|
||||
sanitizeHtml,
|
||||
sortAndFilterSeries,
|
||||
sortRows,
|
||||
@@ -879,3 +880,30 @@ test('getAxisType', () => {
|
||||
expect(getAxisType(GenericDataType.BOOLEAN)).toEqual(AxisType.category);
|
||||
expect(getAxisType(GenericDataType.STRING)).toEqual(AxisType.category);
|
||||
});
|
||||
|
||||
test('getMinAndMaxFromBounds returns empty object when not truncating', () => {
|
||||
expect(getMinAndMaxFromBounds(AxisType.value, false, 10, 100)).toEqual({});
|
||||
});
|
||||
|
||||
test('getMinAndMaxFromBounds returns automatic bounds when truncating', () => {
|
||||
expect(
|
||||
getMinAndMaxFromBounds(AxisType.value, true, undefined, undefined),
|
||||
).toEqual({
|
||||
min: 'dataMin',
|
||||
max: 'dataMax',
|
||||
});
|
||||
});
|
||||
|
||||
test('getMinAndMaxFromBounds returns automatic upper bound when truncating', () => {
|
||||
expect(getMinAndMaxFromBounds(AxisType.value, true, 10, undefined)).toEqual({
|
||||
min: 10,
|
||||
max: 'dataMax',
|
||||
});
|
||||
});
|
||||
|
||||
test('getMinAndMaxFromBounds returns automatic lower bound when truncating', () => {
|
||||
expect(getMinAndMaxFromBounds(AxisType.value, true, undefined, 100)).toEqual({
|
||||
min: 'dataMin',
|
||||
max: 100,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user