class RailsDataExplorer::Chart::StackedBarChartCategoricalPercent
Responsibilities:
* Render a stacked bar chart for bivariate analysis of two categorical data series. Renders percentage distribution of y-data series.
Collaborators:
* DataSet
Public Instance Methods
compute_y_axis_label(y_ds_name)
click to toggle source
@param y_ds_name [String] name of the y data series
# File lib/rails_data_explorer/chart/stacked_bar_chart_categorical_percent.rb, line 21 def compute_y_axis_label(y_ds_name) "#{ y_ds_name } distribution [%]" end
compute_y_value(data_matrix, x_val, y_val)
click to toggle source
Override this method to change how the y value is computed. E.g., to change from absolute values to percentages.
# File lib/rails_data_explorer/chart/stacked_bar_chart_categorical_percent.rb, line 16 def compute_y_value(data_matrix, x_val, y_val) (data_matrix[x_val][y_val] / data_matrix[x_val][:_sum].to_f) * 100 end