Class: RCharts::GraphHelper::Series::Path
- Inherits:
-
Object
- Object
- RCharts::GraphHelper::Series::Path
- Defined in:
- app/helpers/rcharts/graph_helper/series/path.rb
Overview
:nodoc:
Defined Under Namespace
Classes: PathBuffer
Constant Summary collapse
- POINT_SIZE =
38
Instance Method Summary collapse
- #area_path ⇒ Object
-
#initialize(points = [], previous_points = [], origin: 0, smoothing: nil) ⇒ Path
constructor
A new instance of Path.
- #line_path ⇒ Object
- #mask_spans ⇒ Object
Constructor Details
#initialize(points = [], previous_points = [], origin: 0, smoothing: nil) ⇒ Path
Returns a new instance of Path.
31 32 33 34 35 36 |
# File 'app/helpers/rcharts/graph_helper/series/path.rb', line 31 def initialize(points = [], previous_points = [], origin: 0, smoothing: nil) @points = points @previous_points = previous_points @smoothing = smoothing @origin = origin end |
Instance Method Details
#area_path ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/helpers/rcharts/graph_helper/series/path.rb', line 46 def area_path if compacted_points.empty? '' else line_or_curve_data.prepend(*initial_area_data).concat(*final_area_data, previous_line_or_curve_data) end end |
#line_path ⇒ Object
38 39 40 41 42 43 44 |
# File 'app/helpers/rcharts/graph_helper/series/path.rb', line 38 def line_path if compacted_points.empty? '' else line_or_curve_data.prepend(initial_line_data) end end |
#mask_spans ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'app/helpers/rcharts/graph_helper/series/path.rb', line 54 def mask_spans points.compact.chunk(&:complete?).filter_map do |complete, chunk| next unless complete chunk.sort_by!(&:x) chunk.first => { x:, y: } chunk.last - chunk.first => { x: width, y: height } { x:, y:, width:, height: } end end |