mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +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:
@@ -20,7 +20,7 @@
|
||||
import { validateNumber } from '@superset-ui/core';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function parseYAxisBound(
|
||||
export function parseAxisBound(
|
||||
bound?: string | number | null,
|
||||
): number | undefined {
|
||||
if (bound === undefined || bound === null || Number.isNaN(Number(bound))) {
|
||||
|
||||
@@ -543,3 +543,17 @@ export function calculateLowerLogTick(minPositiveValue: number) {
|
||||
const logBase10 = Math.floor(Math.log10(minPositiveValue));
|
||||
return Math.pow(10, logBase10);
|
||||
}
|
||||
|
||||
export function getMinAndMaxFromBounds(
|
||||
axisType: AxisType,
|
||||
truncateAxis: boolean,
|
||||
min?: number,
|
||||
max?: number,
|
||||
): { min: number | 'dataMin'; max: number | 'dataMax' } | {} {
|
||||
return truncateAxis && axisType === AxisType.value
|
||||
? {
|
||||
min: min === undefined ? 'dataMin' : min,
|
||||
max: max === undefined ? 'dataMax' : max,
|
||||
}
|
||||
: {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user