Module: Plotly::Offline::Exportable

Included in:
Plot
Defined in:
lib/plotly/offline/exportable.rb

Instance Method Summary collapse

Instance Method Details

#generate_html(path: 'plot.html', open: true) ⇒ Object

Parameters:

  • path (String) (defaults to: 'plot.html')
  • open (Boolean) (defaults to: true)


17
18
19
20
21
# 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

#showObject

for IRuby



9
10
11
12
13
# 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_htmlObject



23
24
25
26
# File 'lib/plotly/offline/exportable.rb', line 23

def to_html
  html = create_html(@data, layout: @layout, embedded: true)
  html.render
end