Class: CTioga2::Graphics::CurveGenerator
- Inherits:
-
Object
- Object
- CTioga2::Graphics::CurveGenerator
- Defined in:
- lib/ctioga2/graphics/generator.rb
Overview
This class is in charge of generating Elements::TiogaElement, such as Elements::Curve2D, from a dataset. It takes care of generating the appropriate style and of transforming the coordinates.
Instance Attribute Summary collapse
-
#current_curves ⇒ Object
The current kind of generated.
-
#legend_provider ⇒ Object
The provider of legends, a Legends::LegendProvider object.
-
#style_factory ⇒ Object
A Styles::CurveStyleFactory object that handles the styles for every single curve that will be drawn.
Instance Method Summary collapse
-
#curve_from_dataset(plot, dataset, options = {}) ⇒ Object
Creates a Elements::TiogaElement representing the dataset and returns it.
-
#initialize ⇒ CurveGenerator
constructor
Creates a CurveGenerator object.
Constructor Details
#initialize ⇒ CurveGenerator
Creates a CurveGenerator object.
43 44 45 46 47 |
# File 'lib/ctioga2/graphics/generator.rb', line 43 def initialize @legend_provider = Legends::LegendProvider.new @style_factory = Styles::CurveStyleFactory.new @current_curves = :xy_plot end |
Instance Attribute Details
#current_curves ⇒ Object
The current kind of generated. It is a symbol
40 41 42 |
# File 'lib/ctioga2/graphics/generator.rb', line 40 def current_curves @current_curves end |
#legend_provider ⇒ Object
The provider of legends, a Legends::LegendProvider object.
37 38 39 |
# File 'lib/ctioga2/graphics/generator.rb', line 37 def legend_provider @legend_provider end |
#style_factory ⇒ Object
A Styles::CurveStyleFactory object that handles the styles for every single curve that will be drawn.
33 34 35 |
# File 'lib/ctioga2/graphics/generator.rb', line 33 def style_factory @style_factory end |
Instance Method Details
#curve_from_dataset(plot, dataset, options = {}) ⇒ Object
Creates a Elements::TiogaElement representing the dataset and returns it.
todo
-
(other kinds of) coordinate transformations
-
other kinds of curves (pseudo-3D, surfaces, histograms…)
55 56 57 58 59 60 61 |
# File 'lib/ctioga2/graphics/generator.rb', line 55 def curve_from_dataset(plot, dataset, = {}) # Does coordinate transforms first ? # \todo copy datasets here rather than overwriting them ! plot.style.transforms.transform_2d!(dataset) return send(@current_curves, plot, dataset, ) end |