mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Panel: added possibility to group plugins in a panel according to a grid. (#22028)
* POC grid layout of gague. * added a grid property that can be used to auto size the charts within a panel. * fill the grid * fix lint * change default for stat panel * avoid empty cells * Moved to absolute positioning * Fixed spacing * Another fix * Improve layout algorithm * VizRepeater: Reverted back to so this is auto behavior for some panels Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import {
|
||||
ReducerID,
|
||||
getDisplayValueAlignmentFactors,
|
||||
DisplayValueAlignmentFactors,
|
||||
VizOrientation,
|
||||
} from '@grafana/data';
|
||||
|
||||
import { getFieldLinksSupplier } from 'app/features/panel/panellinks/linkSuppliers';
|
||||
@@ -97,23 +96,9 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
|
||||
height={height}
|
||||
source={data}
|
||||
renderCounter={renderCounter}
|
||||
orientation={getOrientation(width, height, options.orientation)}
|
||||
autoGrid={true}
|
||||
orientation={options.orientation}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat panel custom auto orientation
|
||||
*/
|
||||
function getOrientation(width: number, height: number, orientation: VizOrientation): VizOrientation {
|
||||
if (orientation !== VizOrientation.Auto) {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
if (width / height > 2) {
|
||||
return VizOrientation.Vertical;
|
||||
} else {
|
||||
return VizOrientation.Horizontal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user