class RailsDataExplorer::Chart
Responsibilities:
* Visualize data * Integrate with front end visualization libraries
Collaborators:
* RdeTable
Attributes
output_buffer[RW]
Public Instance Methods
dom_id()
click to toggle source
# File lib/rails_data_explorer/chart.rb, line 17 def dom_id "rde-chart-#{ object_id }" end
render?()
click to toggle source
Returns true if this chart will be rendered. Sometimes we can't make that decision until render time. Override this method in sub classes, e.g., to avoid rendering ParallelCoordinates
when all data series are categorical.
# File lib/rails_data_explorer/chart.rb, line 24 def render? true end
Protected Instance Methods
render_html_table(rde_table)
click to toggle source
Renders an HTML table @param rde_table [RdeTable]
# File lib/rails_data_explorer/chart.rb, line 32 def render_html_table(rde_table) content_tag(:table, class: 'table rde-table') do rde_table.rows.map { |row| content_tag(row.tag, class: row.css_class) do row.cells.map { |cell| if cell.ruby_formatter content_tag( cell.tag, instance_exec(cell.value, &cell.ruby_formatter), class: cell.css_class, title: cell.title, style: cell.style, ) else content_tag( cell.tag, cell.value, class: cell.css_class, title: cell.title, style: cell.style, ) end }.join.html_safe end }.join.html_safe end end