Class: Charty::Plotters::BarPlotter
- Inherits:
-
CategoricalPlotter
- Object
- AbstractPlotter
- CategoricalPlotter
- Charty::Plotters::BarPlotter
- Defined in:
- lib/charty/plotters/bar_plotter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cap_size ⇒ Object
Returns the value of attribute cap_size.
-
#error_color ⇒ Object
Returns the value of attribute error_color.
-
#error_width ⇒ Object
Returns the value of attribute error_width.
Attributes inherited from CategoricalPlotter
#dodge, #group_label, #group_names, #order, #orient, #plot_data, #saturation, #value_label, #width
Attributes included from EstimationSupport
#ci, #estimator, #n_boot, #units
Attributes included from RandomSupport
Attributes inherited from AbstractPlotter
#color, #color_order, #data, #key_color, #palette, #x, #y
Instance Method Summary collapse
-
#initialize(data: nil, variables: {}, **options, &block) ⇒ BarPlotter
constructor
A new instance of BarPlotter.
- #render ⇒ Object
-
#save(filename, **opts) ⇒ Object
TODO: - Should infer mime type from file’s extname - Should check backend’s supported mime type before begin_figure.
Methods included from EstimationSupport
Methods included from RandomSupport
Methods inherited from AbstractPlotter
Constructor Details
#initialize(data: nil, variables: {}, **options, &block) ⇒ BarPlotter
Returns a new instance of BarPlotter.
7 8 9 10 |
# File 'lib/charty/plotters/bar_plotter.rb', line 7 def initialize(data: nil, variables: {}, **, &block) x, y, color = variables.values_at(:x, :y, :color) super(x, y, color, data: data, **, &block) end |
Instance Attribute Details
#cap_size ⇒ Object
Returns the value of attribute cap_size.
39 40 41 |
# File 'lib/charty/plotters/bar_plotter.rb', line 39 def cap_size @cap_size end |
#error_color ⇒ Object
Returns the value of attribute error_color.
12 13 14 |
# File 'lib/charty/plotters/bar_plotter.rb', line 12 def error_color @error_color end |
#error_width ⇒ Object
Returns the value of attribute error_width.
33 34 35 |
# File 'lib/charty/plotters/bar_plotter.rb', line 33 def error_width @error_width end |
Instance Method Details
#render ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/charty/plotters/bar_plotter.rb', line 45 def render backend = Backends.current backend.begin_figure (backend) annotate_axes(backend) backend.invert_yaxis if orient == :h backend.show end |
#save(filename, **opts) ⇒ Object
TODO:
-
Should infer mime type from file’s extname
-
Should check backend’s supported mime type before begin_figure
57 58 59 60 61 62 63 64 |
# File 'lib/charty/plotters/bar_plotter.rb', line 57 def save(filename, **opts) backend = Backends.current backend.begin_figure (backend) annotate_axes(backend) backend.invert_yaxis if orient == :h backend.save(filename, **opts) end |