all files / candela/components/TrackerDash/ ValueWidget.js

81.82% Statements 45/55
83.78% Branches 31/37
80% Functions 8/10
41.18% Lines 7/17
9 statements, 2 functions, 17 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                                
import ErrorBulletWidget from './ErrorBulletWidget';
import BoxAndWhiskerWidget from './BoxAndWhiskerWidget';
import VisComponent from '../../VisComponent';
 
class ValueWidget extends VisComponent {
  constructor (el, settings) {
    super(el);
 
    this.settings = settings;
    if (Array.isArray(settings.result.current)) {
      if (settings.result.current.length > 1) {
        this.Type = BoxAndWhiskerWidget;
      } else {
        settings.result.current = settings.result.current[0];
        this.Type = ErrorBulletWidget;
      }
    } else {
      this.Type = ErrorBulletWidget;
    }
  }
 
  render () {
    let widget = new this.Type(this.el, this.settings);
    widget.render();
  }
}
 
export default ValueWidget;