_renderMetric()

in modules/core/src/components/hud/meter-widget.js [202:243]


  _renderMetric(cmdData, msrData, theme) {
    const {label, units = msrData.units, transformValue, precision, getWarning, style} = this.props;

    const cmdValue = cmdData && cmdData.data && cmdData.data.variable;
    const msrValue = msrData.data && msrData.data.variable;
    const cmdWarning = getWarning(cmdValue);
    const msrWarning = getWarning(msrValue);

    return (
      <div>
        <div style={{display: 'flex'}}>
          {cmdData && (
            <CmdValue theme={theme} warning={cmdWarning} userStyle={style.cmdValue}>
              <LabelComponent theme={theme} warning={cmdWarning} userStyle={style.label}>
                Cmd.
              </LabelComponent>
              <div>{formatValue(cmdValue, precision, transformValue) || '-'}</div>
            </CmdValue>
          )}
          <MsrValue
            theme={theme}
            warning={msrWarning}
            isOnlyValue={!cmdData}
            userStyle={style.msrValue}
          >
            <LabelComponent theme={theme} warning={msrWarning} userStyle={style.label}>
              {label}
            </LabelComponent>
            <div>{formatValue(msrValue, precision, transformValue) || '-'}</div>
          </MsrValue>
        </div>
        <UnitsComponent theme={theme} userStyle={style.units}>
          {units}
          {(cmdWarning || msrWarning) && (
            <Warning theme={theme} userStyle={style.warning}>
              {cmdWarning || msrWarning}
            </Warning>
          )}
        </UnitsComponent>
      </div>
    );
  }