A upper level function of drawer::toCanvasBtn. You should only use it under SPS projects. For you own apps, still use the drawer::toCanvasBtn.

canvasBtn(dom, id = "", isID = TRUE, class = "text-center", placement = "top")

Arguments

dom

a HTML DOM selector, mostly common is to select the element by ID:

e.g. a plot with ID "plot1", to select, use dom = "plot1" to select the plot if isID = TRUE. If isID = FALSE, use dom = "#plot1"

Other complex selector is supported. First turn isID = FALSE, then try things like dom = ".btn i" selects an icon inside an element with "btn" class. If more than one element is matched, only the first one will be screenshoted.

id

ID of this button, optional.

isID

bool, if the dom argument is selected by ID or other selector

class

string, length 1, other html class add to the button wrapper

placement

where should the tiptool place, top, bottom, left, right.

Value

a button group with several options

Examples

canvasBtn("#mydiv")
#> <div class="text-center" data-popoverid="bspopover64535844"> #> <div class="btn-group to-canvas" id=""> #> <button type="button" class="btn btn-primary" onclick="toCanvas(&quot;##mydiv&quot;, &quot;core_canvas&quot;)">To Canvas</button> #> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> #> <span class="caret"></span> #> <span class="sr-only">Toggle Dropdown</span> #> </button> #> <ul class="dropdown-menu"> #> <li> #> <a href="#" onclick="toPng(&quot;##mydiv&quot;)">Save as png</a> #> </li> #> <li> #> <a href="#" onclick="toJpg(&quot;##mydiv&quot;)">Save as jpg</a> #> </li> #> </ul> #> </div> #> <script> #> bsPopover( #> "bspopover64535844", "top", "Send to Canvas", "Take a screenshot of current plot and send to SPS Canvas tab, #> or save as an image", "#ebebeb", "black", #> "black", "14px", "12px", "hover focus", "600", #> "400", "1", false #> ) #> </script> #> </div>