_renderLines()

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


  _renderLines() {
    const {data} = this.props;
    if (!data || !data.lines) {
      return null;
    }

    const xScale = this._getXScale();
    const yScale = this._getYScale();

    return data.lines.map(({name, line}, index) => {
      const getSVGLine = d3Line()
        .x(d => xScale(d.x))
        .y(d => yScale(d.y));
      return (
        <path
          key={name}
          d={getSVGLine(line)}
          fill="none"
          stroke={colorScale(index)}
          strokeWidth={2}
        />
      );
    });
  }