_renderGrids()

in bindings/jupyter-modules/jupyter-ma-causal/src/components/multi-line-chart/index.js [165:205]


  _renderGrids() {
    const {
      width,
      height,
      padding: {left, right, top},
    } = this.props;
    const xScale = this._getXScale();
    const yScale = this._getYScale();
    return (
      <React.Fragment>
        {yScale.ticks(10).map(t => {
          const y = yScale(t);
          return (
            <line
              key={`y-${t}`}
              x1={left}
              y1={y}
              x2={width - right}
              y2={y}
              stroke="lightgray"
              strokeWidth={1}
            />
          );
        })}
        {xScale.ticks(10).map(t => {
          const x = xScale(t);
          return (
            <line
              key={`x-${t}`}
              x1={x}
              y1={top}
              x2={x}
              y2={height - top}
              stroke="lightgray"
              strokeWidth={1}
            />
          );
        })}
      </React.Fragment>
    );
  }