mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
[Timeseries] Place legend to bottom when on <lg display (#69045)
Place timeseries legend to bottom when on <lg display
This commit is contained in:
parent
bf4ab36bc0
commit
f515d2efac
@ -5,7 +5,7 @@ import { useMeasure } from 'react-use';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { LegendPlacement } from '@grafana/schema';
|
||||
|
||||
import { useStyles2 } from '../../themes/ThemeContext';
|
||||
import { useStyles2, useTheme2 } from '../../themes/ThemeContext';
|
||||
import { getFocusStyles } from '../../themes/mixins';
|
||||
import { CustomScrollbar } from '../CustomScrollbar/CustomScrollbar';
|
||||
|
||||
@ -30,6 +30,7 @@ export interface VizLayoutComponentType extends FC<VizLayoutProps> {
|
||||
* @beta
|
||||
*/
|
||||
export const VizLayout: VizLayoutComponentType = ({ width, height, legend, children }) => {
|
||||
const theme = useTheme2();
|
||||
const styles = useStyles2(getVizStyles);
|
||||
const containerStyle: CSSProperties = {
|
||||
display: 'flex',
|
||||
@ -50,7 +51,11 @@ export const VizLayout: VizLayoutComponentType = ({ width, height, legend, child
|
||||
);
|
||||
}
|
||||
|
||||
const { placement, maxHeight = '35%', maxWidth = '60%' } = legend.props;
|
||||
let { placement, maxHeight = '35%', maxWidth = '60%' } = legend.props;
|
||||
|
||||
if (document.body.clientWidth < theme.breakpoints.values.lg) {
|
||||
placement = 'bottom';
|
||||
}
|
||||
|
||||
let size: VizSize | null = null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user