Timeline: Fix y-axis being cropped (#34508) (#34515)

(cherry picked from commit dbe281530c)

Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
Grot (@grafanabot)
2021-05-20 17:08:41 +02:00
committed by GitHub
co-authored by Torkel Ödegaard
parent 57f5b34038
commit 255b91b2ba
@@ -25,7 +25,6 @@ import {
} from '@grafana/ui';
import { TimelineCoreOptions, getConfig } from './timeline';
import { AxisPlacement, ScaleDirection, ScaleOrientation } from '@grafana/ui/src/components/uPlot/config';
import { measureText } from '@grafana/ui/src/utils/measureText';
import { TimelineFieldConfig, TimelineOptions } from './types';
const defaultConfig: TimelineFieldConfig = {
@@ -80,14 +79,6 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<TimelineOptions> = ({
return FALLBACK_COLOR;
};
const yAxisWidth =
frame.fields.reduce((maxWidth, field) => {
return Math.max(
maxWidth,
measureText(getFieldDisplayName(field, frame), Math.round(10 * devicePixelRatio)).width
);
}, 0) + 24;
const opts: TimelineCoreOptions = {
// should expose in panel config
mode: mode!,
@@ -154,7 +145,6 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<TimelineOptions> = ({
values: coreConfig.yValues,
grid: false,
ticks: false,
size: yAxisWidth,
gap: 16,
theme,
});