getLeftLabel()

in bindings/jupyter-modules/jupyter-ma-causal/src/containers/slidebar-svg-container/index.js [46:62]


  getLeftLabel() {
    const format = d3Format('.2f');
    const {sliderValue, data} = this.props;
    if (!data.length) {
      return null;
    }
    if (sliderValue === null || sliderValue === undefined) {
      return format(data[data.length - 1].y);
    }

    const idx = data.findIndex(d => d.x > sliderValue);
    if (idx === -1) {
      return format(data[data.length - 1].y);
    } else {
      return format(data[idx && idx - 1].y);
    }
  }