diff --git a/plotly/plotly/plotly.py b/plotly/plotly/plotly.py index 432a4888074..e3ba3fa4292 100644 --- a/plotly/plotly/plotly.py +++ b/plotly/plotly/plotly.py @@ -406,14 +406,15 @@ class Stream: Stream example: # Initialize a streaming graph # by embedding stream_id's in the graph's traces - >>> stream_id = "your_stream_id" # See {plotly_domain}/settings - >>> py.plot(Data([Scatter(x=[], - y=[], - stream=dict(token=stream_id, maxpoints=100))]) + import plotly.plotly as py + from plotly.graph_objs import Data, Scatter, Stream + stream_id = "your_stream_id" # See {plotly_domain}/settings + py.plot(Data([Scatter(x=[], y=[], + stream=Stream(token=stream_id, maxpoints=100))])) # Stream data to the import trace - >>> stream = Stream(stream_id) # Initialize a stream object - >>> stream.open() # Open the stream - >>> stream.write(dict(x=1, y=1)) # Plot (1, 1) in your graph + stream = Stream(stream_id) # Initialize a stream object + stream.open() # Open the stream + stream.write(dict(x=1, y=1)) # Plot (1, 1) in your graph """ @utils.template_doc(**tools.get_config_file()) diff --git a/plotly/widgets/graphWidget.js b/plotly/widgets/graphWidget.js index eb1ccbc0eb5..f9f5baa8249 100644 --- a/plotly/widgets/graphWidget.js +++ b/plotly/widgets/graphWidget.js @@ -11,19 +11,24 @@ require(["widgets/js/widget"], function(WidgetManager){ render: function(){ var that = this; - var frameId = window.genUID(); - var loadingId = 'loading-'+frameId; + var graphId = window.genUID(); + var loadingId = 'loading-'+graphId; var _graph_url = that.model.get('_graph_url'); - // variable plotly_domain in the case of enterprise + // variable plotlyDomain in the case of enterprise var url_parts = _graph_url.split('/'); - var plotly_domain = url_parts[0] + '//' + url_parts[2]; + var plotlyDomain = url_parts[0] + '//' + url_parts[2]; + + if(!('plotlyDomains' in window)){ + window.plotlyDomains = {}; + } + window.plotlyDomains[graphId] = plotlyDomain; // Place IFrame in output cell div `$el` that.$el.css('width', '100%'); - that.$graph = $(['