Class: Charty::Backends::PlotlyHelpers::PlotlyRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/charty/backends/plotly_helpers/plotly_renderer.rb

Instance Method Summary collapse

Instance Method Details

#render(figure) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'lib/charty/backends/plotly_helpers/plotly_renderer.rb', line 9

def render(figure)
  json = JSON.generate(figure, allow_nan: true)
  case json
  when /\b(?:Infinity|NaN)\b/
    visit(figure)
  else
    JSON.load(json)
  end
end