class CTioga2::Graphics::Styles::ErrorBarStyle
This class represents the stylistic information necessary to draw an error bar. It derives from StrokeStyle
, as it is essentially a stroke.
Attributes
style[RW]
The error bar style. For now, not much here.
Public Instance Methods
show_error_bar(t, x, xmin, xmax, y, ymin, ymax)
click to toggle source
Shows an error bar with the appropriate stylistic information. x and y are the coordinates of the data point. The corresponding min and max are the minimum and maximum values for the error bars. If either is nil, no error bar on that direction is drawn.
todo maybe make provisions (one day) for complex error bars showing min/max and stddev as well ?
# File lib/ctioga2/graphics/styles/errorbar.rb, line 47 def show_error_bar(t, x, xmin, xmax, y, ymin, ymax) d = { 'x' => x, 'y' => y, 'color' => @line.color || Tioga::ColorConstants::Black, 'line_width' => @line.width || 1.0, } has = false if (xmin && xmax && (xmax - xmin != 0)) d['dx_plus'] = xmax - x d['dx_minus'] = x - xmin has = true end if (ymin && ymax && (ymax - ymin != 0)) d['dy_plus'] = ymax - y d['dy_minus'] = y - ymin has = true end # We won't draw something when there isn't anything to draw # ! if(has) # We should stop relying on Tioga for that. # Probably this is the place to reimplement that ? t.show_error_bars(d) end end