code: def get_javascript(self):
      return """
          name_to_component = %s;
          
          name_to_coord = {}; // term -> {x, y, svg} 
          origViewBox = {}; // svgid -> viewbox
          
          Array.prototype.forEach.call(
              document.querySelectorAll(".dotgraph"),
              function(svg) {
                  origViewBox[svg.id] = svg.getAttribute('viewBox');
                  
                  Array.prototype.forEach.call(
                      svg.getElementsByTagName('text'), 
                      function(text) {
                          name_to_coord[text.textContent] = {
                              "x": text.getAttribute("x"), 
                              "y": text.getAttribute("y"), 
                              "svg": svg.id
                          };
                      }
                  )
              }
          ) 
          
          panZoomInstance = null;
          
          
          function zoomToName(name) {
          
              //panZoomInstance.reset();
                          
                          
              console.log("ZOOMING TO "); console.log(name);
              panZoomInstance.fit();
              panZoomInstance.center(); 
              
              var pzSizes = panZoomInstance.getSizes();
              var centerX = name_to_coord[name].x;
              var centerY = -name_to_coord[name].y;
              var newX = centerX*pzSizes["width"]/pzSizes["viewBox"]["width"];
              var newY = centerY*pzSizes["height"]/pzSizes["viewBox"]["height"];
              
              //var zoomRatio = 1/(pzSizes["width"]/pzSizes["viewBox"]["width"]);
              console.log('zr '.concat(name, ' ', pzSizes, ' ', centerX, ' ', centerY, ' ', newX, ' ', newY));       
              panZoomInstance.zoomAtPointBy(5, {'x':newX, 'y':newY});
          }
          
          function panToName(name) {
              var x = name_to_coord[name].x; 
              var y = panZoomInstance.getSizes().viewBox.height + Number.parseInt(name_to_coord[name].y); 
              panZoomInstance.reset() 
              panZoomInstance.zoom(1/panZoomInstance.getSizes().realZoom, true)
              panZoomInstance.pan({x:0,y:0});
              var realZoom = panZoomInstance.getSizes().realZoom; 
              var destX = -((x * realZoom) - (panZoomInstance.getSizes().width/2));
              var destY = -((y * realZoom) - (panZoomInstance.getSizes().height/2));
              panZoomInstance.pan({'x':0,'y':0}); 
              panZoomInstance.pan({'x': destX, 'y': destY})
          }
              
          
          function showTermGraph(term) {
              var nodeName = 'svg' + name_to_component[term];
              document.getElementById(nodeName).style.display='block'; 
              %s
              panToName(term);
          }
  
          Array.from(document.querySelectorAll('.node')).map(
              function (node) {
                  node.addEventListener('mouseenter', mouseEnterNode);
                  node.addEventListener('mouseleave', mouseLeaveNode);
                  node.addEventListener('click', clickNode);
              }
          )
          
          function clickNode() {
              document.querySelectorAll(".dotgraph")
                  .forEach(node => node.style.display = 'none');
  
              var term = Array.prototype.filter
                  .call(this.children, (x => x.tagName === "text"))[0].textContent;
  
              plotInterface.handleSearchTerm(term, true);
          }
  
          function mouseEnterNode(event) {
              var term = Array.prototype.filter.call(this.children, (x => x.tagName === "text"))[0].textContent;
              plotInterface.showTooltipSimple(term);
              this.style.fill="red";
          }
  
          function mouseLeaveNode() {
              plotInterface.tooltip.transition().style('opacity', 0)
              this.style.fill="black";
          }""" % (
          json.dumps(self.component_graph.get_node_to_component_dict()),
          self._get_pan_and_zoom_js(),
      )
  
file_path: scattertext/scattertext/graphs/ComponentDiGraphHTMLRenderer.py
imports: import json
label_desc: Use image node_id 4 for calling the ComponentDiGraphHTMLRenderer obj's underlying member method code with example usage: obj.get_javascript() and returns: unknown