Class: GraphWidget
Class Method Summary collapse
Class Method Details
.graph(data = {}, title, graph, labels, opts) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/widgets/graph_widget.rb', line 13 def self.graph(data={}, title, graph, labels, opts) json_data = json_data(data) link_data = link_data(data) extra_classes = link_data.size > 0 ? "clickable_graph" : "" output = "<div id='#{graph}-#{title.parameterize}' class='graph #{extra_classes}'></div>" output << "<script>#{graph}(#{json_data},#{labels},'#{title.parameterize}',#{opts.to_json}, #{link_data.to_json.html_safe})</script>" output end |
.graph_widget(widget) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/widgets/graph_widget.rb', line 5 def self.() output = header(.color, .title, .row_size, .col_size) output << (.text) output << panel_content() output << cap output.html_safe end |