mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
VizLegend: Fixes flicking visualization height & re-render (#66331)
* VizLegend: Fixes flicking visualization height & re-render * Fix test
This commit is contained in:
parent
77852d587d
commit
0c032460ca
@ -61,7 +61,7 @@ export const VizLayout: VizLayoutComponentType = ({ width, height, legend, child
|
||||
containerStyle.flexDirection = 'column';
|
||||
legendStyle.maxHeight = maxHeight;
|
||||
|
||||
if (legendMeasure) {
|
||||
if (legendMeasure.height) {
|
||||
size = { width, height: height - legendMeasure.height };
|
||||
}
|
||||
break;
|
||||
@ -69,7 +69,7 @@ export const VizLayout: VizLayoutComponentType = ({ width, height, legend, child
|
||||
containerStyle.flexDirection = 'row';
|
||||
legendStyle.maxWidth = maxWidth;
|
||||
|
||||
if (legendMeasure) {
|
||||
if (legendMeasure.width) {
|
||||
size = { width: width - legendMeasure.width, height };
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,11 @@ import { LegendDisplayMode, SortOrder, TooltipDisplayMode } from '@grafana/schem
|
||||
import { PieChartPanel } from './PieChartPanel';
|
||||
import { PanelOptions, PieChartType, PieChartLegendValues } from './panelcfg.gen';
|
||||
|
||||
jest.mock('react-use', () => ({
|
||||
...jest.requireActual('react-use'),
|
||||
useMeasure: () => [() => {}, { width: 100, height: 100 }],
|
||||
}));
|
||||
|
||||
type PieChartPanelProps = ComponentProps<typeof PieChartPanel>;
|
||||
|
||||
describe('PieChartPanel', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user