mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
HeatmapPanel: Fix typo in variable naming (#57326)
This commit is contained in:
parent
ca3c4bb50f
commit
5d6bdc60b1
@ -264,10 +264,10 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
const yAxisReverse = Boolean(yAxisConfig.reverse);
|
const yAxisReverse = Boolean(yAxisConfig.reverse);
|
||||||
const isSparseHeatmap = heatmapType === DataFrameType.HeatmapCells && !isHeatmapCellsDense(dataRef.current?.heatmap!);
|
const isSparseHeatmap = heatmapType === DataFrameType.HeatmapCells && !isHeatmapCellsDense(dataRef.current?.heatmap!);
|
||||||
const shouldUseLogScale = yScale.type !== ScaleDistribution.Linear || isSparseHeatmap;
|
const shouldUseLogScale = yScale.type !== ScaleDistribution.Linear || isSparseHeatmap;
|
||||||
const isOrdianalY = readHeatmapRowsCustomMeta(dataRef.current?.heatmap).yOrdinalDisplay != null;
|
const isOrdinalY = readHeatmapRowsCustomMeta(dataRef.current?.heatmap).yOrdinalDisplay != null;
|
||||||
|
|
||||||
// random to prevent syncing y in other heatmaps
|
// random to prevent syncing y in other heatmaps
|
||||||
// TODO: try to match TimeSeries y keygen algo to sync with TimeSeries panels (when not isOrdianalY)
|
// TODO: try to match TimeSeries y keygen algo to sync with TimeSeries panels (when not isOrdinalY)
|
||||||
const yScaleKey = 'y_' + (Math.random() + 1).toString(36).substring(7);
|
const yScaleKey = 'y_' + (Math.random() + 1).toString(36).substring(7);
|
||||||
|
|
||||||
builder.addScale({
|
builder.addScale({
|
||||||
@ -289,7 +289,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
? uPlot.rangeLog(dataMin, dataMax, (yScale.log ?? 2) as unknown as uPlot.Scale.LogBase, true)
|
? uPlot.rangeLog(dataMin, dataMax, (yScale.log ?? 2) as unknown as uPlot.Scale.LogBase, true)
|
||||||
: [dataMin, dataMax];
|
: [dataMin, dataMax];
|
||||||
|
|
||||||
if (shouldUseLogScale && !isOrdianalY) {
|
if (shouldUseLogScale && !isOrdinalY) {
|
||||||
let yExp = u.scales[yScaleKey].log!;
|
let yExp = u.scales[yScaleKey].log!;
|
||||||
let log = yExp === 2 ? Math.log2 : Math.log10;
|
let log = yExp === 2 ? Math.log2 : Math.log10;
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
scaleMax *= yExp / 2;
|
scaleMax *= yExp / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOrdianalY) {
|
if (!isOrdinalY) {
|
||||||
// guard against <= 0
|
// guard against <= 0
|
||||||
if (explicitMin != null && explicitMin > 0) {
|
if (explicitMin != null && explicitMin > 0) {
|
||||||
// snap down to magnitude
|
// snap down to magnitude
|
||||||
@ -389,7 +389,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
// how to expand scale range if inferred non-regular or log buckets?
|
// how to expand scale range if inferred non-regular or log buckets?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOrdianalY) {
|
if (!isOrdinalY) {
|
||||||
scaleMin = explicitMin ?? scaleMin;
|
scaleMin = explicitMin ?? scaleMin;
|
||||||
scaleMax = explicitMax ?? scaleMax;
|
scaleMax = explicitMax ?? scaleMax;
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
label: yAxisConfig.axisLabel,
|
label: yAxisConfig.axisLabel,
|
||||||
theme: theme,
|
theme: theme,
|
||||||
formatValue: (v, decimals) => formattedValueToString(dispY(v, decimals)),
|
formatValue: (v, decimals) => formattedValueToString(dispY(v, decimals)),
|
||||||
splits: isOrdianalY
|
splits: isOrdinalY
|
||||||
? (self: uPlot) => {
|
? (self: uPlot) => {
|
||||||
const meta = readHeatmapRowsCustomMeta(dataRef.current?.heatmap);
|
const meta = readHeatmapRowsCustomMeta(dataRef.current?.heatmap);
|
||||||
if (!meta.yOrdinalDisplay) {
|
if (!meta.yOrdinalDisplay) {
|
||||||
@ -437,7 +437,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
|||||||
return splits;
|
return splits;
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
values: isOrdianalY
|
values: isOrdinalY
|
||||||
? (self: uPlot, splits) => {
|
? (self: uPlot, splits) => {
|
||||||
const meta = readHeatmapRowsCustomMeta(dataRef.current?.heatmap);
|
const meta = readHeatmapRowsCustomMeta(dataRef.current?.heatmap);
|
||||||
if (meta.yOrdinalDisplay) {
|
if (meta.yOrdinalDisplay) {
|
||||||
|
Loading…
Reference in New Issue
Block a user