mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
return series label if selected stat is name
This commit is contained in:
parent
d8f1e99249
commit
55b4162e85
@ -17,6 +17,7 @@ interface Props extends PanelProps<GaugeOptions> {}
|
||||
export class GaugePanel extends PureComponent<Props> {
|
||||
renderMultipleGauge(timeSeries, theme) {
|
||||
const { options, height, width } = this.props;
|
||||
const { stat } = options;
|
||||
|
||||
return timeSeries.map((series, index) => {
|
||||
const singleStatWidth = 1 / timeSeries.length * 100;
|
||||
@ -48,9 +49,11 @@ export class GaugePanel extends PureComponent<Props> {
|
||||
gaugeHeight = repeatingGaugeHeight;
|
||||
}
|
||||
|
||||
const value = stat !== 'name' ? series.stats[stat] : series.label;
|
||||
|
||||
return (
|
||||
<div className="singlestat-panel" key={`${timeSeries.label}-${index}`} style={style}>
|
||||
{this.renderGauge(series.stats[options.stat], gaugeWidth, gaugeHeight, theme)}
|
||||
{this.renderGauge(value, gaugeWidth, gaugeHeight, theme)}
|
||||
<div style={{ textAlign: 'center' }}>{series.label}</div>
|
||||
</div>
|
||||
);
|
||||
@ -69,10 +72,9 @@ export class GaugePanel extends PureComponent<Props> {
|
||||
|
||||
renderSingleGauge(timeSeries, theme) {
|
||||
const { options, width, height } = this.props;
|
||||
const value = timeSeries[0].stats[options.stat];
|
||||
|
||||
return (
|
||||
<div className="singlestat-panel">{this.renderGauge(timeSeries[0].stats[options.stat], width, height, theme)}</div>
|
||||
);
|
||||
return <div className="singlestat-panel">{this.renderGauge(value, width, height, theme)}</div>;
|
||||
}
|
||||
|
||||
renderGaugeWithTableData(panelData, theme) {
|
||||
|
Loading…
Reference in New Issue
Block a user