Generates JavaScript function for rendering the chart.

 Parameters:
  *div_id            [Required] The ID of the DIV element that the Google Chart should be rendered in.
167926
def draw_js(element_id)
      js = ""
      js << "\n  function #{chart_function_name(element_id)}() {"
      js << "\n    #{@data_table.to_js}"
      js << "\n    var chart = new google.#{chart_class}.#{chart_name}(document.getElementById('#{element_id}'));"
      @listeners.each do |listener|
        js << "\n    google.visualization.events.addListener(chart, '#{listener[:event]}', #{listener[:callback]});"
      end
      js << "\n    chart.draw(data_table, #{js_parameters(@options)});"
      js << "\n  };"
      js
    end
1343056
public static String createJquery(Chart<?> chart, String divId) {
        return createJquery(chart, divId, null);
    }
861070
function _draw_table_or_something(resp, manager){

	// Wipe interface.
	jQuery('#' + interface_id).empty();

	// Vary by what we got.
	if( ! resp.success() || resp.total_documents() === 0 ){
	    jQuery('#' + interface_id).append('<em>No results given your input and search fields. Please refine and try again.</em>');
	    last_response = null;
	}else{
	    last_response = resp;

	    // Render the buttons.
	    //console.log('user_buttons: ', user_buttons);
	    if( user_buttons && user_buttons.length && user_buttons.length > 0 ){

		// Ensure we have somewhere to put our buttons. If not
		// supplied with an injection id, make our own and use
		// it.
		var insert_div_id = user_buttons_div_id;
		if( ! user_buttons_div_id ){

		    // Generate new dic and add it to the display.
		    var ubt_attrs = {
			'generate_id': true
		    };
		    var ubt = new bbop.html.tag('div', ubt_attrs);
		    jQuery('#' + interface_id).append(ubt.to_string());
		    
		    // Ensure the id.
		    insert_div_id = ubt.get_id();
		}

		// Add all of the defined buttons after the spacing.
		_draw_user_buttons(user_buttons, insert_div_id);
	    }

	    // Display results.
	    var bwd = bbop.widget.display;
	    results_table =
		new bwd.results_table_by_class_conf_b3(conf_class, resp, linker,
						       handler, interface_id,
						       selectable_p,
						       select_column_id,
						       select_item_name);
	}
    }
226247
public function run()
	{
		$id = $this->getId();
		$this->htmlOptions['id'] = $id;
		// if no container is set, it will create one
		if ($this->containerId == null) {
			$this->containerId = 'div-chart' . $id;
			echo '<div ' . CHtml::renderAttributes($this->htmlOptions) . '></div>';
		}
		$this->registerClientScript();
	}
1335848
def show(self):
        
        display(HTML("""<div id="%s"></div>""" % (self.igv_id)))
        # DON'T check status before showing browser,
        msg = json.dumps({
            "id": self.igv_id,
            "command": "create",
            "options": self.config
        })
        self.comm.send(msg)
1207844
def _add_event_in_element(self, element, event):
        

        if not self.main_script_added:
            self._generate_main_scripts()

        if self.script_list is not None:
            self.id_generator.generate_id(element)
            self.script_list.append_text(
                event
                + "Elements.push('"
                + element.get_attribute('id')
                + "');"
            )
1170618
function bootstrap_interactive(id, opts) {
    var el = document.getElementById(id);

    if (!el) {
      console.log("Whoops -- the lsv-interactive function couldn't find a <div> with the id you provided. You probably mistyped it in debug.js.");
      return;
    }

    // ought to already have this, but let's be sure
    if (!/\blsv-interactive\b/.test(el.className)) {
      // console.log("Warning: The <div> with the id", id, "didn't have the lsv-interactive class, which is weird.");
      el.className += " lsv-interactive";
    }

    if (/\blsv-interactive--rendered\b/.test(el.className)) {
      console.log("Interactive", id, "already rendered -- skipping");
      return;
    } else {
      el.className += " lsv-interactive--rendered";
      console.log("Loading interactive", id);
    }

    // remove screenshot
    var screenshot = el.getElementsByTagName("img");
    if (screenshot && screenshot[0]) {
      el.removeChild(screenshot[0]);
    }

    // get params
    var params = {};
    for (var c = 0; c < el.attributes.length; c += 1) {
      var attr = el.attributes[c];
      if (/^data-/.test(attr.nodeName)) {
        var key = attr.nodeName.split("data-")[1];
        params[key] = attr.nodeValue;
      }
    }

    // return the DOM object
    return {
      version: "0.4.0a",
      id: id,
      el: el,
      width: function () {
        return el.offsetWidth;
      },
      height: function () {
        return el.offsetHeight;
      },
      page_width: document.body.offsetWidth,
      page_height: document.body.offsetHeight,
      params: params,
      is_touch_device: is_touch_device(),
      onresize: function (f, delay) {
        if (!document.addEventListener) {
          console.log("onresize not supported in this browser");
          return;
        }
        delay = typeof delay != "number" ? 250 : delay;
        var resizeTimer;

        // shouldn't overwrite anything important
        // http://stackoverflow.com/questions/22204902/does-window-addeventlistenermessage-overwrite-other-listeners
        window.addEventListener("resize", function () {
          clearTimeout(resizeTimer);
          resizeTimer = setTimeout(function () {
            f(el.offsetWidth, el.offsetHeight);
          }, delay);
        });
      }
    };

  }
516502
function (id) {
            var self = this;
            var plot = {};

            // Get plot options and store it
            plot.options = self.getElemOptions(
                self.options.map.defaultPlot,
                (self.options.plots[id] ? self.options.plots[id] : {}),
                self.options.legend.plot
            );

            // Set plot coords
            self.setPlotCoords(plot);

            // Draw SVG before setPlotAttributes()
            if (plot.options.type === "svg") {
                plot.mapElem = self.paper.path(plot.options.path);
            }

            // Set plot size attrs
            self.setPlotAttributes(plot);

            // Draw other types of plots
            if (plot.options.type === "square") {
                plot.mapElem = self.paper.rect(
                    plot.options.attrs.x,
                    plot.options.attrs.y,
                    plot.options.attrs.width,
                    plot.options.attrs.height
                );
            } else if (plot.options.type === "image") {
                plot.mapElem = self.paper.image(
                    plot.options.attrs.src,
                    plot.options.attrs.x,
                    plot.options.attrs.y,
                    plot.options.attrs.width,
                    plot.options.attrs.height
                );
            } else if (plot.options.type === "svg") {
                // Nothing to do
            } else {
                // Default = circle
                plot.mapElem = self.paper.circle(
                    plot.options.attrs.x,
                    plot.options.attrs.y,
                    plot.options.attrs.r
                );
            }

            self.initElem(id, 'plot', plot);

            return plot;
        }
117720
def create_graph_html(js_template, css_template, html_template=None):
    
    if html_template is None:
        html_template = read_lib('html', 'graph')

    # Create div ID for the graph and give it to the JS and CSS templates so
    # they can reference the graph.
    graph_id = 'graph-{0}'.format(_get_random_id())
    js = populate_template(js_template, graph_id=graph_id)
    css = populate_template(css_template, graph_id=graph_id)

    return populate_template(
        html_template,
        graph_id=graph_id,
        css=css,
        js=js
    )
319225
public static String createJquery(Chart<?> chart, String divId, String javaScriptVar) {
        StringBuilder builder = new StringBuilder();
        builder.append("$(document).ready(function(){\r\n");
        if (javaScriptVar != null) {
            builder.append("   var ").append(javaScriptVar).append("=");
        }
        builder.append("   $.jqplot('").append(divId).append("', ");
        builder.append(chart.getChartData().toJsonString());
        builder.append(", ");
        builder.append(jqPlotToJson(chart.getChartConfiguration()));
        builder.append(");\r\n");
        builder.append("});\r\n");
        return builder.toString();
    }
185627
def render_js_code(self, id_, *args, **kwargs):
        """"""
        if id_:
            options = self.render_select2_options_code(
                    dict(self.get_options()), id_)
            return mark_safe(self.html.format(id=id_, options=options))
        return u''
1120834
def render(self, name, value, attrs=None, **kwargs):
        
        output = super(Select2Mixin, self).render(
            name, value, attrs=attrs, **kwargs)
        id_ = attrs['id']
        output += self.render_js_code(
            id_, name, value, attrs=attrs, **kwargs)
        return mark_safe(output)
1369849
function(_id){
		        var _input = _e._$get(_id);
		        _cache[_id] = 2;
		        if (!!_input.value) return;
		        _e._$setStyle(
		            _e._$wrapInline(_input,_ropt),
		            'display','none'
		        );
		    }
705519
def get_customjs(self, references, plot_id=None):
        
        # Generate callback JS code to get all the requested data
        if plot_id is None:
            plot_id = self.plot.id or 'PLACEHOLDER_PLOT_ID'
        self_callback = self.js_callback.format(comm_id=self.comm.id,
                                                timeout=self.timeout,
                                                debounce=self.debounce,
                                                plot_id=plot_id)

        attributes = self.attributes_js(self.attributes)
        conditions = ["%s" % cond for cond in self.skip]
        conditional = ''
        if conditions:
            conditional = 'if (%s) { return };\n' % (' || '.join(conditions))
        data = "var data = {};\n"
        code = conditional + data + attributes + self.code + self_callback
        return CustomJS(args=references, code=code)
25133
def prepare_chart(index, chart_id, drawing_id) # :nodoc:
      @chart.id = chart_id - 1

      drawing = Drawing.new
      @drawing = drawing
      @drawing.orientation = @page_setup.orientation

      @external_drawing_links << [ '/drawing', "../drawings/drawing#{drawing_id}.xml" ]

      @drawing_links << [ '/chart', "../charts/chart#{chart_id}.xml"]
    end
857114
public function renderJs(): void
	{
		if ($this->mode === self::MODE_DEFAULT) {
			$el = Html::el('script type="text/javascript" async defer');
			$el->src = self::GOOGLE_PLATFORM_URL;
			$el->addText("{lang: '" . $this->lang . "'}");

			echo $el;

		} elseif ($this->mode === self::MODE_EXPLICIT) {
			$wrapper = Html::el();

			$el = Html::el('script type="text/javascript" async defer');
			$el->src = self::GOOGLE_PLATFORM_URL;
			$el->addText("{lang: '" . $this->lang . "', parsetags: 'explicit'}");
			$wrapper->addHtml($el);

			$el = Html::el('script type="text/javascript"');
			$el->addText('gapi.plusone.go();');
			$wrapper->addHtml($el);

			echo $wrapper;

		} elseif ($this->mode === self::MODE_DYNAMIC) {
			$el = Html::el('script type="text/javascript"');
			$el->addText("window.___gcfg = {lang: '" . $this->lang . "'};");
			$el->addText("(function(){var po=document.createElement('script');po.type='text/javascript';po.async=true;po.src='" . self::GOOGLE_PLATFORM_URL . "';vars=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);})();");

			echo $el;
		}
	}
1371252
function requestId(options){

    options = extend({}, DEFAULTS);

    return function requestIdMiddleware(req, res, next){

        let id = _getId(req, options);
        let attributeName = options.attributeName;

        // console.log('requestid', id);

        /*
         * Want to expose the genrated
         * id in the request and response
         */
        req[attributeName] = id;

        if(res.req) res.req[attributeName] = id;

        /*
         * We send a header with the required
         * id...
         */
        if(options.resHeader) {
            res.set(options.resHeader, id);
        }

        next();
    }
}