mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: fix log-y-axis tick label skipping when decimals=0 (#55868)
This commit is contained in:
parent
2a12644778
commit
b8da1ffdc3
@ -276,6 +276,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
|
|||||||
theme,
|
theme,
|
||||||
grid: { show: customConfig.axisGridShow },
|
grid: { show: customConfig.axisGridShow },
|
||||||
decimals: field.config.decimals,
|
decimals: field.config.decimals,
|
||||||
|
distr: customConfig.scaleDistribution?.type,
|
||||||
...axisColorOpts,
|
...axisColorOpts,
|
||||||
},
|
},
|
||||||
field
|
field
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
systemDateFormats,
|
systemDateFormats,
|
||||||
TimeZone,
|
TimeZone,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { AxisPlacement } from '@grafana/schema';
|
import { AxisPlacement, ScaleDistribution } from '@grafana/schema';
|
||||||
|
|
||||||
import { measureText } from '../../../utils/measureText';
|
import { measureText } from '../../../utils/measureText';
|
||||||
import { PlotConfigBuilder } from '../types';
|
import { PlotConfigBuilder } from '../types';
|
||||||
@ -39,6 +39,7 @@ export interface AxisProps {
|
|||||||
color?: uPlot.Axis.Stroke;
|
color?: uPlot.Axis.Stroke;
|
||||||
border?: uPlot.Axis.Border;
|
border?: uPlot.Axis.Border;
|
||||||
decimals?: DecimalCount;
|
decimals?: DecimalCount;
|
||||||
|
distr?: ScaleDistribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UPLOT_AXIS_FONT_SIZE = 12;
|
export const UPLOT_AXIS_FONT_SIZE = 12;
|
||||||
@ -121,6 +122,7 @@ export class UPlotAxisBuilder extends PlotConfigBuilder<AxisProps, Axis> {
|
|||||||
color,
|
color,
|
||||||
border,
|
border,
|
||||||
decimals,
|
decimals,
|
||||||
|
distr = ScaleDistribution.Linear,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const font = `${UPLOT_AXIS_FONT_SIZE}px ${theme.typography.fontFamily}`;
|
const font = `${UPLOT_AXIS_FONT_SIZE}px ${theme.typography.fontFamily}`;
|
||||||
@ -131,7 +133,7 @@ export class UPlotAxisBuilder extends PlotConfigBuilder<AxisProps, Axis> {
|
|||||||
splits = [0, 1];
|
splits = [0, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decimals === 0) {
|
if (decimals === 0 && distr === ScaleDistribution.Linear) {
|
||||||
filter = (u, splits) => splits.map((v) => (Number.isInteger(v) ? v : null));
|
filter = (u, splits) => splits.map((v) => (Number.isInteger(v) ? v : null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user