score:1

Accepted answer

The bar chart does not update because updateBarChart function is in the scope of d3.json("d1.json", function(datasetBarChart){}.

function up(d, i) {
    updateBarChart(d.data.category, color(i));
    updateLineChart(d.data.category, color(i));
}

To work around this, make the call for data and pass it to the render functions.

Updated plunker: https://plnkr.co/edit/L18QvDQ2FFvM29wJkx4i?p=preview


Related Query