Skip to content

Allow for the option of a CDN in offline mode #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2016
Merged

Allow for the option of a CDN in offline mode #475

merged 5 commits into from
May 27, 2016

Conversation

yankev
Copy link
Contributor

@yankev yankev commented May 22, 2016

@chriddyp First attempt at it. Couldn't get it to work out.
Notes:

  • When I view the html for the ipynb, I can see the <script src ..> for loading plotlyjs.
  • the connected parameter is to see if a user wants to use the cdn (could name it differently, but for now connected=True --> use the cdn)

What happens:

screen shot 2016-05-22 at 12 13 50 am

@yankev
Copy link
Contributor Author

yankev commented May 22, 2016

After latest commit:

screen shot 2016-05-22 at 12 35 58 am

@fperez
Copy link

fperez commented May 23, 2016

Pinging @briehl, in case you have any extra feedback on the API for the KBase uses...

@@ -193,7 +208,7 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',

plot_html, plotdivid, width, height = _plot_html(
figure_or_data, show_link, link_text, validate,
'100%', 525, global_requirejs=True)
'100%', 525, global_requirejs=__PLOTLY_USE_CDN)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yankev : Should not this be opposite? I havent looked at the complete code, but if __PLOTLY_USE_CDN is True, should not global_requirejs=False?

@mdtusz
Copy link
Contributor

mdtusz commented May 24, 2016

I'm pretty sure @tarzzz's comment is right - might want to switch, or change the check for optional_line's to only check _PLOTLY_USE_CDN. Other than this, looks to me like it should be fine - just make sure that all the offline methods work with both CDN and script string injection, and that you can successfully load/reload/restart/share and all that jazz too!

@yankev
Copy link
Contributor Author

yankev commented May 25, 2016

@chriddyp @tarzzz @mdtusz If you guys have time, can you look over this. I ran through the QA-offline notebook and it seems to work (just have to make sure that you start from a clean dom where window.Plotly = undefined).

script_inject = (
''
'<script>'
# 'if(!window.Plotly) {{'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these meant to be uncommented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some persistence and notebook sharing issues from time to time when I left them in. So I just took them out for now.

@tarzzz
Copy link
Contributor

tarzzz commented May 26, 2016

@yankev : Looks good..

@cldougl
Copy link
Member

cldougl commented May 27, 2016

@yankev looks good to me too 💃

@yankev yankev merged commit 419098a into master May 27, 2016
@jackparmer
Copy link
Contributor

Hey @fperez and @briehl - This should be on pip now. Let us know if we can help out on this anymore!

'<script>'
'requirejs.config({'
'paths: { '
'\'plotly\': [\'https://cdn.plot.ly/plotly-latest.min\']},'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this supposed to be https://cdn.plot.ly/plotly-latest.min.js? Are you missing the ".js"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants