mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-09 15:08:04 -05:00
Plots can now use <img>
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user