mirror of
https://github.com/grafana/grafana.git
synced 2025-01-28 17:24:59 -06:00
GraphNG: always use "x" as scaleKey for x axis (#33884)
This commit is contained in:
parent
2ff36fa47b
commit
a67fe57e56
@ -12,7 +12,7 @@ Object {
|
||||
"width": 1,
|
||||
},
|
||||
"labelFont": "12px \\"Roboto\\", \\"Helvetica\\", \\"Arial\\", sans-serif",
|
||||
"scale": "time",
|
||||
"scale": "x",
|
||||
"show": true,
|
||||
"side": 2,
|
||||
"size": [Function],
|
||||
@ -89,7 +89,7 @@ Object {
|
||||
[Function],
|
||||
],
|
||||
"scales": Array [
|
||||
"time",
|
||||
"x",
|
||||
"__fixed",
|
||||
],
|
||||
},
|
||||
@ -105,7 +105,7 @@ Object {
|
||||
"range": [Function],
|
||||
"time": undefined,
|
||||
},
|
||||
"time": Object {
|
||||
"x": Object {
|
||||
"auto": false,
|
||||
"dir": 1,
|
||||
"ori": 0,
|
||||
|
@ -48,11 +48,12 @@ export const preparePlotConfigBuilder: PrepConfig = ({ frame, theme, timeZone, g
|
||||
|
||||
let seriesIndex = 0;
|
||||
|
||||
let xScaleKey = '_x';
|
||||
const xScaleKey = 'x';
|
||||
let xScaleUnit = '_x';
|
||||
let yScaleKey = '';
|
||||
|
||||
if (xField.type === FieldType.time) {
|
||||
xScaleKey = 'time';
|
||||
xScaleUnit = 'time';
|
||||
builder.addScale({
|
||||
scaleKey: xScaleKey,
|
||||
orientation: ScaleOrientation.Horizontal,
|
||||
@ -74,7 +75,7 @@ export const preparePlotConfigBuilder: PrepConfig = ({ frame, theme, timeZone, g
|
||||
} else {
|
||||
// Not time!
|
||||
if (xField.config.unit) {
|
||||
xScaleKey = xField.config.unit;
|
||||
xScaleUnit = xField.config.unit;
|
||||
}
|
||||
|
||||
builder.addScale({
|
||||
@ -231,12 +232,12 @@ export const preparePlotConfigBuilder: PrepConfig = ({ frame, theme, timeZone, g
|
||||
pub: (type: string, src: uPlot, x: number, y: number, w: number, h: number, dataIdx: number) => {
|
||||
payload.columnIndex = dataIdx;
|
||||
if (x < 0 && y < 0) {
|
||||
payload.point[xScaleKey] = null;
|
||||
payload.point[xScaleUnit] = null;
|
||||
payload.point[yScaleKey] = null;
|
||||
eventBus.publish(new DataHoverClearEvent(payload));
|
||||
} else {
|
||||
// convert the points
|
||||
payload.point[xScaleKey] = src.posToVal(x, xScaleKey);
|
||||
payload.point[xScaleUnit] = src.posToVal(x, xScaleKey);
|
||||
payload.point[yScaleKey] = src.posToVal(y, yScaleKey);
|
||||
eventBus.publish(hoverEvent);
|
||||
hoverEvent.payload.down = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user