Class: RailsDataExplorer::Chart::DescriptiveStatisticsTable

Inherits:
RailsDataExplorer::Chart show all
Defined in:
lib/rails_data_explorer/chart/descriptive_statistics_table.rb

Overview

Responsibilities:

* Render a table with descriptive statistics for a data series of any type.

Collaborators:

* DataSet

Instance Attribute Summary

Attributes inherited from RailsDataExplorer::Chart

#output_buffer

Instance Method Summary collapse

Methods inherited from RailsDataExplorer::Chart

#dom_id, #render?

Constructor Details

#initialize(_data_set, options = {}) ⇒ DescriptiveStatisticsTable

Returns a new instance of DescriptiveStatisticsTable.



14
15
16
17
# File 'lib/rails_data_explorer/chart/descriptive_statistics_table.rb', line 14

def initialize(_data_set, options = {})
  @data_set = _data_set
  @options = {}.merge(options)
end

Instance Method Details

#renderObject



19
20
21
22
23
24
25
26
27
# File 'lib/rails_data_explorer/chart/descriptive_statistics_table.rb', line 19

def render
  return ''  unless render?
  (:div, id: dom_id, class: 'rde-chart rde-descriptive-statistics-table') do
    @data_set.data_series.map { |data_series|
      (:h3, "Descriptive Statistics", class: 'rde-chart-title') +
      render_html_table(data_series.descriptive_statistics_table)
    }.join.html_safe
  end
end