Class: Charty::Plotters::DistributionPlotter

Inherits:
AbstractPlotter show all
Defined in:
lib/charty/plotters/distribution_plotter.rb

Direct Known Subclasses

HistogramPlotter

Instance Attribute Summary collapse

Attributes inherited from AbstractPlotter

#color, #color_order, #data, #key_color, #palette, #title, #x, #x_label, #y, #y_label

Instance Method Summary collapse

Methods inherited from AbstractPlotter

#inspect, #processed_data, #render, #save, #to_iruby, #to_iruby_mimebundle, #var_levels

Constructor Details

#initialize(data:, variables:, **options, &block) ⇒ DistributionPlotter

Returns a new instance of DistributionPlotter.



17
18
19
20
21
22
# File 'lib/charty/plotters/distribution_plotter.rb', line 17

def initialize(data:, variables:, **options, &block)
  x, y, color = variables.values_at(:x, :y, :color)
  super(x, y, color, data: data, **options, &block)

  setup_variables
end

Instance Attribute Details

#color_normObject

Returns the value of attribute color_norm.



32
33
34
# File 'lib/charty/plotters/distribution_plotter.rb', line 32

def color_norm
  @color_norm
end

#input_formatObject (readonly)

Returns the value of attribute input_format.



51
52
53
# File 'lib/charty/plotters/distribution_plotter.rb', line 51

def input_format
  @input_format
end

#legendObject

Returns the value of attribute legend.



41
42
43
# File 'lib/charty/plotters/distribution_plotter.rb', line 41

def legend
  @legend
end

#plot_dataObject (readonly)

Returns the value of attribute plot_data.



51
52
53
# File 'lib/charty/plotters/distribution_plotter.rb', line 51

def plot_data
  @plot_data
end

#var_typesObject (readonly)

Returns the value of attribute var_types.



51
52
53
# File 'lib/charty/plotters/distribution_plotter.rb', line 51

def var_types
  @var_types
end

#variablesObject (readonly)

Returns the value of attribute variables.



30
31
32
# File 'lib/charty/plotters/distribution_plotter.rb', line 30

def variables
  @variables
end

#weightsObject

Returns the value of attribute weights.



24
25
26
# File 'lib/charty/plotters/distribution_plotter.rb', line 24

def weights
  @weights
end

Instance Method Details

#flat_structureObject



4
5
6
7
8
# File 'lib/charty/plotters/distribution_plotter.rb', line 4

def flat_structure
  {
    x: :@values
  }
end

#wide_structureObject



10
11
12
13
14
15
# File 'lib/charty/plotters/distribution_plotter.rb', line 10

def wide_structure
  {
    x: :@values,
    color: :@columns
  }
end