Trend: Add support for a logarithmic x axis (#101433)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Kristina
2025-08-29 00:02:49 -05:00
committed by GitHub
co-authored by Leon Sorokin
parent c62ba51d68
commit c1edba6d8f
3 changed files with 79 additions and 23 deletions
@@ -22,6 +22,8 @@ export interface ScaleProps {
centeredZero?: boolean;
decimals?: DecimalCount;
stackingMode?: StackingMode;
padMinBy?: number;
padMaxBy?: number;
}
export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
@@ -45,6 +47,8 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
centeredZero,
decimals,
stackingMode,
padMinBy = 0.1,
padMaxBy = 0.1,
} = this.props;
if (stackingMode === StackingMode.Percent) {
@@ -144,13 +148,13 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
const rangeConfig: Range.Config = {
min: {
pad: 0.1,
pad: padMinBy,
hard: hardMin ?? -Infinity,
soft: softMin || 0,
mode: softMinMode,
},
max: {
pad: 0.1,
pad: padMaxBy,
hard: hardMax ?? Infinity,
soft: softMax || 0,
mode: softMaxMode,