mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Colors: rename getThresholdRange() -> getGradientRange() (#38688)
* Colors: use visible y scale range for non-threshold gradients schemes * rename instead
This commit is contained in:
parent
a0108a1e5b
commit
05e5b67a99
@ -1,6 +1,6 @@
|
||||
import { GrafanaTheme2, ThresholdsConfig, ThresholdsMode } from '@grafana/data';
|
||||
import { GraphThresholdsStyleConfig, GraphTresholdsStyleMode } from '@grafana/schema';
|
||||
import { getThresholdRange, GradientDirection, scaleGradient } from './gradientFills';
|
||||
import { getGradientRange, GradientDirection, scaleGradient } from './gradientFills';
|
||||
import tinycolor from 'tinycolor2';
|
||||
|
||||
export interface UPlotThresholdOptions {
|
||||
@ -28,7 +28,7 @@ export function getThresholdsDrawHook(options: UPlotThresholdOptions) {
|
||||
let { steps, mode } = thresholds;
|
||||
|
||||
if (mode === ThresholdsMode.Percentage) {
|
||||
let [min, max] = getThresholdRange(u, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
let [min, max] = getGradientRange(u, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
let range = max - min;
|
||||
|
||||
steps = steps.map((step) => ({
|
||||
|
@ -172,7 +172,7 @@ export function getDataRange(plot: uPlot, scaleKey: string) {
|
||||
return [min, max];
|
||||
}
|
||||
|
||||
export function getThresholdRange(
|
||||
export function getGradientRange(
|
||||
u: uPlot,
|
||||
scaleKey: string,
|
||||
hardMin?: number | null,
|
||||
@ -224,7 +224,7 @@ export function getScaleGradientFn(
|
||||
);
|
||||
gradient = scaleGradient(plot, scaleKey, GradientDirection.Up, valueStops, true);
|
||||
} else {
|
||||
const [min, max] = getThresholdRange(plot, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
const [min, max] = getGradientRange(plot, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
const range = max - min;
|
||||
const valueStops = thresholds.steps.map(
|
||||
(step) =>
|
||||
@ -237,7 +237,7 @@ export function getScaleGradientFn(
|
||||
}
|
||||
} else if (colorMode.getColors) {
|
||||
const colors = colorMode.getColors(theme);
|
||||
const [min, max] = getThresholdRange(plot, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
const [min, max] = getGradientRange(plot, scaleKey, hardMin, hardMax, softMin, softMax);
|
||||
const range = max - min;
|
||||
const valueStops = colors.map(
|
||||
(color, i) =>
|
||||
|
Loading…
Reference in New Issue
Block a user