let N_ROWS_MULTI = 50,
    N_CLICKS_MULTI = 0;

(function initMultiRowPlot() {

    let svg_dy = 550,
        cells = constructCells(N_ROWS_MULTI);

    // initialize plot
    addSVG("multi", svg_dy);
    plotRects("multi", cells);
})();

function clickMultRow() {

    N_CLICKS_MULTI++;

    if (N_CLICKS_MULTI >= 1) {

        if (N_CLICKS_MULTI == 1) {
            // update button text after first run
            d3.select("#button_multi")
              .attr("value", "Rerun");
        }

        // revert to original states for reruns
        clearStates("multi");
    }

    // run animation
    d3.range(N_ROWS_MULTI).forEach(row => {
        d3.select("#plot_multi")
          .selectAll(".row_" + row)
          .call(updateRow, "multi", row)
    });
}