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

Skip to content

Commit ea03180

Browse files
committed
Add ipython_inline_figure.html
1 parent 27482be commit ea03180

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- Within the kernel, we don't know the address of the matplotlib
2+
websocket server, so we have to get in client-side and fetch our
3+
resources that way. -->
4+
<script>
5+
// We can't proceed until these Javascript files are fetched, so
6+
// we fetch them synchronously
7+
$.ajaxSetup({async: false});
8+
$.getScript("http://" + window.location.hostname + ":{{ port }}{{prefix}}/_static/mpl.js");
9+
$.getScript("http://" + window.location.hostname + ":{{ port }}{{prefix}}/mpl_interface.js");
10+
$.ajaxSetup({async: true});
11+
12+
function init_figure{{ fig_id }}(e) {
13+
$('div.output').off('resize');
14+
15+
var output_div = $(e.target).find('div.output_subarea');
16+
17+
var fig = new figure(
18+
{{ repr(str(fig_id)) }},
19+
"ws://" + window.location.hostname + ":{{ port }}{{ prefix}}/",
20+
output_div);
21+
22+
// Fetch the first image
23+
fig.context.drawImage(fig.imageObj, 0, 0);
24+
25+
fig.focus_on_mouseover = true;
26+
}
27+
28+
// We can't initialize the figure contents until our content
29+
// has been added to the DOM. This is a bit of hack to get an
30+
// event for that.
31+
$('div.output').resize(init_figure{{ fig_id }});
32+
</script>

0 commit comments

Comments
 (0)