module Charty::Backends::Plotly::IRubyOutput

Public Class Methods

mathjax_config() click to toggle source
# File lib/charty/backends/plotly.rb, line 914
        def self.mathjax_config
          <<~END
            if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}
          END
        end
prepare() click to toggle source
# File lib/charty/backends/plotly.rb, line 883
        def self.prepare
          return if @prepared

          html = <<~HTML
            <script type="text/javascript">
              %{win_config}
              %{mathjax_config}
              require.config({
                paths: {
                  plotly: "https://cdn.plot.ly/plotly-latest.min"
                }
              });
            </script>
          HTML

          html %= {
            win_config: window_plotly_config,
            mathjax_config: mathjax_config
          }

          IRuby.display(html, mime: "text/html")
          @prepared = true
        end
window_plotly_config() click to toggle source
# File lib/charty/backends/plotly.rb, line 907
        def self.window_plotly_config
          <<~END
            window.PlotlyConfig = {MathJaxConfig: 'local'};
          END
        end