mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
HeatmapNG: explicitly pass scales for cursor sync config (#51389)
This commit is contained in:
parent
0689c5839a
commit
7e1667ce87
@ -7655,13 +7655,6 @@ exports[`no explicit any`] = {
|
||||
"public/app/plugins/panel/heatmap/palettes.ts:4110363347": [
|
||||
[87, 59, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/heatmap/utils.ts:2711553971": [
|
||||
[64, 27, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[215, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[396, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[495, 10, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[527, 9, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||
],
|
||||
"public/app/plugins/panel/histogram/Histogram.tsx:3993177092": [
|
||||
[130, 31, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
[223, 32, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||
|
@ -62,7 +62,7 @@ interface PrepConfigOpts {
|
||||
theme: GrafanaTheme2;
|
||||
eventBus: EventBus;
|
||||
onhover?: null | ((evt?: HeatmapHoverEvent | null) => void);
|
||||
onclick?: null | ((evt?: any) => void);
|
||||
onclick?: null | ((evt?: Object) => void);
|
||||
onzoom?: null | ((evt: HeatmapZoomEvent) => void);
|
||||
isToolTipOpen: MutableRefObject<boolean>;
|
||||
timeZone: string;
|
||||
@ -113,8 +113,8 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
let rect: DOMRect;
|
||||
|
||||
builder.addHook('init', (u) => {
|
||||
u.root.querySelectorAll('.u-cursor-pt').forEach((el) => {
|
||||
Object.assign((el as HTMLElement).style, {
|
||||
u.root.querySelectorAll<HTMLElement>('.u-cursor-pt').forEach((el) => {
|
||||
Object.assign(el.style, {
|
||||
borderRadius: '0',
|
||||
border: '1px solid white',
|
||||
background: 'transparent',
|
||||
@ -175,7 +175,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
};
|
||||
const hoverEvent = new DataHoverEvent(payload);
|
||||
|
||||
let pendingOnleave = 0;
|
||||
let pendingOnleave: ReturnType<typeof setTimeout> | 0;
|
||||
|
||||
onhover &&
|
||||
builder.addHook('setLegend', (u) => {
|
||||
@ -213,7 +213,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
payload.rowIndex = undefined;
|
||||
payload.point[xScaleUnit] = null;
|
||||
eventBus.publish(hoverEvent);
|
||||
}, 100) as any;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -257,6 +257,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
return builder; // early abort (avoids error)
|
||||
}
|
||||
|
||||
// eslint-ignore @typescript-eslint/no-explicit-any
|
||||
const yFieldConfig = yField.config?.custom as PanelFieldConfig | undefined;
|
||||
const yScale = yFieldConfig?.scaleDistribution ?? { type: ScaleDistribution.Linear };
|
||||
const yAxisReverse = Boolean(yAxisConfig.reverse);
|
||||
@ -394,7 +395,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
size: yAxisConfig.axisWidth || null,
|
||||
label: yAxisConfig.axisLabel,
|
||||
theme: theme,
|
||||
formatValue: (v: any) => formattedValueToString(dispY(v)),
|
||||
formatValue: (v: number) => formattedValueToString(dispY(v)),
|
||||
splits: isOrdianalY
|
||||
? (self: uPlot) => {
|
||||
const meta = readHeatmapRowsCustomMeta(dataRef.current?.heatmap);
|
||||
@ -493,7 +494,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
index: palette,
|
||||
},
|
||||
},
|
||||
}) as any,
|
||||
}),
|
||||
theme,
|
||||
scaleKey: '', // facets' scales used (above)
|
||||
});
|
||||
@ -525,7 +526,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
},
|
||||
},
|
||||
exemplarFillColor
|
||||
) as any,
|
||||
),
|
||||
theme,
|
||||
scaleKey: '', // facets' scales used (above)
|
||||
});
|
||||
@ -570,6 +571,7 @@ export function prepConfig(opts: PrepConfigOpts) {
|
||||
if (sync && sync() !== DashboardCursorSync.Off) {
|
||||
cursor.sync = {
|
||||
key: '__global_',
|
||||
scales: [xScaleKey, yScaleKey],
|
||||
filters: {
|
||||
pub: (type: string, src: uPlot, x: number, y: number, w: number, h: number, dataIdx: number) => {
|
||||
if (x < 0) {
|
||||
@ -705,6 +707,8 @@ export function heatmapPathsDense(opts: PathbuilderOpts) {
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -765,6 +769,8 @@ export function heatmapPathsPoints(opts: PointsBuilderOpts, exemplarColor: strin
|
||||
u.ctx.restore();
|
||||
}
|
||||
);
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
// accepts xMax, yMin, yMax, count
|
||||
@ -881,10 +887,10 @@ export function heatmapPathsSparse(opts: PathbuilderOpts) {
|
||||
u.ctx.restore();
|
||||
|
||||
//console.timeEnd('heatmapPathsSparse');
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user