Plots can now use <img>

This commit is contained in:
Joe Cheng
2012-06-27 11:10:22 -07:00
parent cc51dbd4e6
commit 3aa0702ff8
2 changed files with 12 additions and 7 deletions

View File

@@ -22,7 +22,7 @@
<input type="number" name="n" value="500" min="1" max="10000" />
</p>
<div id="plot1" class="live-plot"></div>
<img id="plot1" class="live-plot"/>
<div id="table1" class="live-html"></div>

View File

@@ -103,12 +103,17 @@
};
(function() {
this.onValueChange = function(data) {
$(this.el).empty();
if (!data)
return;
var img = document.createElement('img');
img.src = data;
this.el.appendChild(img);
if (this.el.tagName == 'IMG') {
this.el.src = data ? data : '';
}
else {
$(this.el).empty();
if (!data)
return;
var img = document.createElement('img');
img.src = data;
this.el.appendChild(img);
}
};
}).call(LivePlotBinding.prototype);