Class: CTioga2::Graphics::Elements::Histogram
- Inherits:
-
Curve2D
- Object
- TiogaElement
- PlotBasedElement
- Curve2D
- CTioga2::Graphics::Elements::Histogram
- Includes:
- Log, Dobjects
- Defined in:
- lib/ctioga2/graphics/elements/histogram.rb
Overview
A histogram
Instance Attribute Summary collapse
-
#histogram_style ⇒ Object
The histogram style at the moment of the creation of the object.
Attributes inherited from Curve2D
Attributes inherited from PlotBasedElement
Attributes inherited from TiogaElement
#clipped, #depth, #location, #parent
Instance Method Summary collapse
- #get_boundaries ⇒ Object
-
#initialize(dataset, style, hstyle) ⇒ Histogram
constructor
A new instance of Histogram.
-
#make_closed_path(t, close_type = nil) ⇒ Object
The algorithms for closing the path just look ugly for histograms that are offset from something.
-
#make_path(t) ⇒ Object
First, a very naive way.
Methods included from Log
context, debug, error, fatal, #format_exception, #identify, info, init_logger, log_to, logger, set_level, #spawn, warn
Methods inherited from Curve2D
#can_clip?, #draw_errorbars, #draw_fill, #draw_markers, #draw_path, #get_axes, #real_do
Methods inherited from PlotBasedElement
Methods inherited from TiogaElement
Constructor Details
#initialize(dataset, style, hstyle) ⇒ Histogram
Returns a new instance of Histogram.
41 42 43 44 |
# File 'lib/ctioga2/graphics/elements/histogram.rb', line 41 def initialize(dataset, style, hstyle) super(dataset, style) @histogram_style = hstyle end |
Instance Attribute Details
#histogram_style ⇒ Object
The histogram style at the moment of the creation of the object.
38 39 40 |
# File 'lib/ctioga2/graphics/elements/histogram.rb', line 38 def histogram_style @histogram_style end |
Instance Method Details
#get_boundaries ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ctioga2/graphics/elements/histogram.rb', line 46 def get_boundaries ry = modified_yvalues bnds = Types::Boundaries.bounds(@function.x, ry) if ! @within_gb base = get_base nb = bnds.dup nb.bottom = base nb.top = base # include the width ? bnds.extend(nb) end return bnds end |
#make_closed_path(t, close_type = nil) ⇒ Object
The algorithms for closing the path just look ugly for histograms that are offset from something. The reasoning does not apply here.
92 93 94 95 96 97 98 99 |
# File 'lib/ctioga2/graphics/elements/histogram.rb', line 92 def make_closed_path(t, close_type = nil) org = get_cached_organization if org[:has_offsets][self] make_path(t) else super end end |
#make_path(t) ⇒ Object
First, a very naive way.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ctioga2/graphics/elements/histogram.rb', line 67 def make_path(t) base = get_base w, ho, yo = *get_properties(t) org = get_cached_organization h_o = org[:has_offsets][self] for x,y in @function xl = x + ho xr = xl + w b = yo[x] t.move_to_point(xl, base+b) t.append_point_to_path(xl, y+b) t.append_point_to_path(xr, y+b) t.append_point_to_path(xr, base+b) if h_o # close ! t.move_to_point(xl, base+b) end end end |