Parcourir la source

Merge branch 'gauge-multi-series' of github.com:grafana/grafana into gauge-multi-series

Torkel Ödegaard il y a 6 ans
Parent
commit
eff82abadd
1 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 6 6
      public/app/plugins/panel/gauge/GaugePanel.tsx

+ 6 - 6
public/app/plugins/panel/gauge/GaugePanel.tsx

@@ -17,6 +17,7 @@ interface Props extends PanelProps<GaugeOptions> {}
 export class GaugePanel extends PureComponent<Props> {
 export class GaugePanel extends PureComponent<Props> {
   renderMultipleGauge(timeSeries) {
   renderMultipleGauge(timeSeries) {
     const { options, height, width } = this.props;
     const { options, height, width } = this.props;
+    const { stat } = options;
 
 
     return timeSeries.map((series, index) => {
     return timeSeries.map((series, index) => {
       const singleStatWidth = 1 / timeSeries.length * 100;
       const singleStatWidth = 1 / timeSeries.length * 100;
@@ -48,9 +49,11 @@ export class GaugePanel extends PureComponent<Props> {
         gaugeHeight = repeatingGaugeHeight;
         gaugeHeight = repeatingGaugeHeight;
       }
       }
 
 
+      const value = stat !== 'name' ? series.stats[stat] : series.label;
+
       return (
       return (
         <div className="singlestat-panel" key={`${timeSeries.label}-${index}`} style={style}>
         <div className="singlestat-panel" key={`${timeSeries.label}-${index}`} style={style}>
-          {this.renderGauge(series.stats[options.stat], gaugeWidth, gaugeHeight)}
+          {this.renderGauge(value, gaugeWidth, gaugeHeight)}
           <div style={{ textAlign: 'center' }}>{series.label}</div>
           <div style={{ textAlign: 'center' }}>{series.label}</div>
         </div>
         </div>
       );
       );
@@ -77,12 +80,9 @@ export class GaugePanel extends PureComponent<Props> {
 
 
   renderSingleGauge(timeSeries) {
   renderSingleGauge(timeSeries) {
     const { options, width, height } = this.props;
     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)}
-      </div>
-    );
+    return <div className="singlestat-panel">{this.renderGauge(value, width, height)}</div>;
   }
   }
 
 
   renderGaugeWithTableData(panelData) {
   renderGaugeWithTableData(panelData) {