module Plotly::Offline::Exportable
Public Instance Methods
generate_html(path: 'plot.html', open: true)
click to toggle source
@param path [String] @param open [Boolean]
# File lib/plotly/offline/exportable.rb, line 17 def generate_html(path: 'plot.html', open: true) html = create_html(@data, layout: @layout) File.write(path, html.render) Launchy.open(File.absolute_path(path)) if open end
show()
click to toggle source
for IRuby
# File lib/plotly/offline/exportable.rb, line 9 def show # @todo unless defined? IRuby html = create_html(@data, layout: @layout, embedded: true) IRuby.display(html) end
to_html()
click to toggle source
# File lib/plotly/offline/exportable.rb, line 23 def to_html html = create_html(@data, layout: @layout, embedded: true) html.render end
Private Instance Methods
create_html(data, layout: {}, embedded: false)
click to toggle source
# File lib/plotly/offline/exportable.rb, line 30 def create_html(data, layout: {}, embedded: false) id = UUIDTools::UUID.random_create.to_s HTML.new(id, data.map(&:to_h), layout: layout.to_h, embedded: embedded) end