{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning:\n", "\n", "The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.\n", "\n", "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/utils/traitlets.py:5: UserWarning:\n", "\n", "IPython.utils.traitlets has moved to a top-level traitlets package.\n", "\n" ] }, { "data": { "application/javascript": [ "window.genUID = function() {\n", " return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n", " var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n", " return v.toString(16);\n", " });\n", "};\n", "\n", "var IPYTHON_VERSION = '3';\n", "\n", "require([\"widgets/js/widget\", \"widgets/js/manager\"], function (widget, manager) {\n", " if (!('DOMWidgetView' in widget)) {\n", "\n", " // we're in IPython2, things moved a bit from 2 --> 3.\n", " // construct the expected IPython3 widget API\n", " IPYTHON_VERSION = '2';\n", " manager = {WidgetManager: widget};\n", " widget = {DOMWidgetView: IPython.DOMWidgetView};\n", " }\n", "\n", " var GraphView = widget.DOMWidgetView.extend({\n", " render: function(){\n", " var that = this;\n", "\n", " var graphId = window.genUID();\n", " var loadingId = 'loading-'+graphId;\n", "\n", "\n", " var _graph_url = that.model.get('_graph_url');\n", "\n", " // variable plotlyDomain in the case of enterprise\n", " var url_parts = _graph_url.split('/');\n", " var plotlyDomain = url_parts[0] + '//' + url_parts[2];\n", "\n", " if(!('plotlyDomains' in window)){\n", " window.plotlyDomains = {};\n", " }\n", " window.plotlyDomains[graphId] = plotlyDomain;\n", "\n", " // Place IFrame in output cell div `$el`\n", " that.$el.css('width', '100%');\n", " that.$graph = $([''].join(' '));\n", " that.$graph.appendTo(that.$el);\n", "\n", " that.$loading = $('