Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ipython_inline_figure.html
  • Loading branch information
mdboom committed Aug 26, 2013
commit ea03180ac056e297a9460364b5068c6185e0ee77
32 changes: 32 additions & 0 deletions lib/matplotlib/backends/web_backend/ipython_inline_figure.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Within the kernel, we don't know the address of the matplotlib
websocket server, so we have to get in client-side and fetch our
resources that way. -->
<script>
// We can't proceed until these Javascript files are fetched, so
// we fetch them synchronously
$.ajaxSetup({async: false});
$.getScript("http://" + window.location.hostname + ":{{ port }}{{prefix}}/_static/mpl.js");
$.getScript("http://" + window.location.hostname + ":{{ port }}{{prefix}}/mpl_interface.js");
$.ajaxSetup({async: true});

function init_figure{{ fig_id }}(e) {
$('div.output').off('resize');

var output_div = $(e.target).find('div.output_subarea');

var fig = new figure(
{{ repr(str(fig_id)) }},
"ws://" + window.location.hostname + ":{{ port }}{{ prefix}}/",
output_div);

// Fetch the first image
fig.context.drawImage(fig.imageObj, 0, 0);

fig.focus_on_mouseover = true;
}

// We can't initialize the figure contents until our content
// has been added to the DOM. This is a bit of hack to get an
// event for that.
$('div.output').resize(init_figure{{ fig_id }});
</script>