Class: Cosmos::XyPlotEditor
- Inherits:
-
LinegraphPlotEditor
- Object
- Qt::Base
- Qt::Widget
- PlotEditor
- LinegraphPlotEditor
- Cosmos::XyPlotEditor
- Defined in:
- lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb
Overview
Widget which contains the X-Y plot for editing
Direct Known Subclasses
Constant Summary
Constants inherited from LinegraphPlotEditor
Instance Method Summary collapse
-
#initialize(parent, plot = nil) ⇒ XyPlotEditor
constructor
A new instance of XyPlotEditor.
-
#plot ⇒ Object
Returns the edited plot.
Constructor Details
#initialize(parent, plot = nil) ⇒ XyPlotEditor
Returns a new instance of XyPlotEditor.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb', line 23 def initialize(parent, plot = nil) plot = XyPlot.new unless plot super(parent, plot) # Float Choosers for Manual Scaling manual_x_scale_min = nil manual_x_scale_min = plot.manual_x_scale[0] if plot.manual_x_scale @manual_x_scale_min = FloatChooser.new(self, 'Manual X Axis Minimum:', manual_x_scale_min.to_s) @layout.addWidget(@manual_x_scale_min) manual_x_scale_max = nil manual_x_scale_max = plot.manual_x_scale[1] if plot.manual_x_scale @manual_x_scale_max = FloatChooser.new(self, 'Manual X Axis Maximum:', manual_x_scale_max.to_s) @layout.addWidget(@manual_x_scale_max) end |
Instance Method Details
#plot ⇒ Object
Returns the edited plot
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb', line 39 def plot plot = super() manual_x_scale_max = @manual_x_scale_max.string.strip manual_x_scale_min = @manual_x_scale_min.string.strip if not manual_x_scale_max.empty? or not manual_x_scale_min.empty? if manual_x_scale_max.to_f > manual_x_scale_min.to_f plot.manual_x_scale = [manual_x_scale_min.to_f, manual_x_scale_max.to_f] elsif manual_x_scale_min.to_f > manual_x_scale_max.to_f plot.manual_x_scale = [manual_x_scale_max.to_f, manual_x_scale_min.to_f] else plot.manual_x_scale = nil end else plot.manual_x_scale = nil end plot end |