[v11.3.x] Timeseries: Utilize min/max on stacking percentage (#95793)
Timeseries: Utilize min/max on stacking percentage (#95581)
* Bring in defined min/max into stacking range
* simplify logic
* different approach
---------
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
(cherry picked from commit 68aefc73b6)
Co-authored-by: Kristina <kristina.durivage@grafana.com>
This commit is contained in:
co-authored by
Kristina
parent
e31c4fc59b
commit
9bb7d77cdb
@@ -1,7 +1,7 @@
|
||||
import uPlot, { Scale, Range } from 'uplot';
|
||||
|
||||
import { DecimalCount, incrRoundDn, incrRoundUp, isBooleanUnit } from '@grafana/data';
|
||||
import { ScaleOrientation, ScaleDirection, ScaleDistribution } from '@grafana/schema';
|
||||
import { ScaleOrientation, ScaleDirection, ScaleDistribution, StackingMode } from '@grafana/schema';
|
||||
|
||||
import { PlotConfigBuilder } from '../types';
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface ScaleProps {
|
||||
linearThreshold?: number;
|
||||
centeredZero?: boolean;
|
||||
decimals?: DecimalCount;
|
||||
stackingMode?: StackingMode;
|
||||
}
|
||||
|
||||
export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
|
||||
@@ -41,8 +42,19 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
|
||||
orientation,
|
||||
centeredZero,
|
||||
decimals,
|
||||
stackingMode,
|
||||
} = this.props;
|
||||
|
||||
if (stackingMode === StackingMode.Percent) {
|
||||
if (hardMin == null && softMin == null) {
|
||||
softMin = 0;
|
||||
}
|
||||
|
||||
if (hardMax == null && softMax == null) {
|
||||
softMax = 1;
|
||||
}
|
||||
}
|
||||
|
||||
const distr = this.props.distribution;
|
||||
|
||||
const distribution = !isTime
|
||||
|
||||
Reference in New Issue
Block a user