I was able to solve the question: Uncaught TypeError: Cannot read property 'showBarChart' of undefined in React
var that = this;
chart.tooltip.contentGenerator(function (d) {
      var html = "<div>";
      d.series.forEach(function(elem){
        Object.keys(data_obj).forEach(function(key_1) {
          var outer_obj = data_obj[key_1];
          if (outer_obj["key"] === elem.key) {
              that.showBarChart(elem.key);
              var expr = outer_obj["values"][0]["expr"];
              html += "<p>" + elem.key + "</p>";
              html += "<p>x = " + d.value + ", y = " + elem.value + "</p>";
          }
        });
      })
      html += "</div>";
      return html;
    });
However, the solution led to a very weird bug in nvd3 scatterChart when the tooltip does not go away on mouse out and just stays on the page.
How could I fix it?

