Class: Charty::Backends::Plotly
- Inherits:
-
Object
- Object
- Charty::Backends::Plotly
- Defined in:
- lib/charty/backends/plotly.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #initilize ⇒ Object
- #label(x, y) ⇒ Object
- #plot(plot, context) ⇒ Object
- #render(context, filename) ⇒ Object
- #series=(series) ⇒ Object
Class Attribute Details
.chart_id ⇒ Object
13 14 15 |
# File 'lib/charty/backends/plotly.rb', line 13 def chart_id @chart_id ||= 0 end |
.plotly_src ⇒ Object
23 24 25 |
# File 'lib/charty/backends/plotly.rb', line 23 def plotly_src @plotly_src ||= 'https://cdn.plot.ly/plotly-latest.min.js' end |
.with_api_load_tag ⇒ Object
17 18 19 20 21 |
# File 'lib/charty/backends/plotly.rb', line 17 def with_api_load_tag return @with_api_load_tag unless @with_api_load_tag.nil? @with_api_load_tag = true end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/charty/backends/plotly.rb', line 8 def context @context end |
Instance Method Details
#initilize ⇒ Object
28 29 |
# File 'lib/charty/backends/plotly.rb', line 28 def initilize end |
#label(x, y) ⇒ Object
31 32 |
# File 'lib/charty/backends/plotly.rb', line 31 def label(x, y) end |
#plot(plot, context) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/charty/backends/plotly.rb', line 42 def plot(plot, context) context = context self.class.chart_id += 1 case context.method when :bar render_graph(context, :bar) when :curve render_graph(context, :scatter) when :scatter render_graph(context, nil, options: {data: {mode: "markers"}}) else raise NotImplementedError end end |
#render(context, filename) ⇒ Object
38 39 40 |
# File 'lib/charty/backends/plotly.rb', line 38 def render(context, filename) plot(nil, context) end |
#series=(series) ⇒ Object
34 35 36 |
# File 'lib/charty/backends/plotly.rb', line 34 def series=(series) @series = series end |