render()

in bindings/jupyter-modules/jupyter-ma-causal/src/containers/staticbar-svg-container/index.js [28:64]


  render() {
    const {
      data,
      width,
      height,
      padding: {left, right, top, bottom},
      groupName, // treatment or control
    } = this.props;

    const format = d3Format('.2f');

    return (
      <svg width={width} height={height}>
        <rect
          x={left}
          y={0}
          width={width - right - left}
          height={height}
          fill={groupName === 'treatment' ? '#3399ff' : '#c2c2d6'}
        />
        <text
          x={width - right - 3}
          y={(top + height - bottom) / 2}
          textAnchor="end"
          dominantBaseline="middle"
        >
          {groupName === 'treatment'
            ? data.length
              ? format(data[data.length - 1].y)
              : null
            : data.length
              ? format(data[0].y)
              : null}
        </text>
      </svg>
    );
  }