mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
IconPanel: force 100% size (#40961)
This commit is contained in:
parent
5c72f3adbe
commit
f52ec5e5b0
@ -27,11 +27,26 @@ export class IconPanel extends Component<Props> {
|
|||||||
|
|
||||||
initElement = (props: Props) => {
|
initElement = (props: Props) => {
|
||||||
this.element = new ElementState(iconItem, props.options.root as any);
|
this.element = new ElementState(iconItem, props.options.root as any);
|
||||||
this.element.updateSize(props.width, props.height);
|
this.updateSize(props);
|
||||||
this.element.updateData(this.dims);
|
this.element.updateData(this.dims);
|
||||||
return this.element;
|
return this.element;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
updateSize = (props: Props) => {
|
||||||
|
const { width, height } = props;
|
||||||
|
this.element.anchor = {
|
||||||
|
top: true,
|
||||||
|
left: true,
|
||||||
|
};
|
||||||
|
this.element.placement = {
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
};
|
||||||
|
this.element.updateSize(width, height);
|
||||||
|
};
|
||||||
|
|
||||||
dims: DimensionContext = {
|
dims: DimensionContext = {
|
||||||
getColor: (color: ColorDimensionConfig) => getColorDimensionFromData(this.props.data, color),
|
getColor: (color: ColorDimensionConfig) => getColorDimensionFromData(this.props.data, color),
|
||||||
getScale: (scale: ScaleDimensionConfig) => getScaleDimensionFromData(this.props.data, scale),
|
getScale: (scale: ScaleDimensionConfig) => getScaleDimensionFromData(this.props.data, scale),
|
||||||
@ -44,7 +59,7 @@ export class IconPanel extends Component<Props> {
|
|||||||
let changed = false;
|
let changed = false;
|
||||||
|
|
||||||
if (width !== nextProps.width || height !== nextProps.height) {
|
if (width !== nextProps.width || height !== nextProps.height) {
|
||||||
this.element.updateSize(nextProps.width, nextProps.height);
|
this.updateSize(nextProps);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
if (data !== nextProps.data) {
|
if (data !== nextProps.data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user