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:
Marcus Andersson
2020-04-04 16:57:06 +02:00
committed by GitHub
parent 5ccefed7d7
commit dea91c1fd6
5 changed files with 120 additions and 33 deletions

View File

@@ -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;
}
}