Module: Nyaplot::Diagrams::Arc
- Includes:
- Jsonizable
- Defined in:
- lib/bionya/diagram.rb
Instance Attribute Summary collapse
-
#axis ⇒ Boolean
Boolean whether to render axis along arcs.
-
#color ⇒ Array<String>
Colors in which arcs are filled.
-
#fill_by ⇒ Symbol
The column label to decide how to fill sybmols.
-
#layer ⇒ Numeric
The number of layer where the plot is placed.
-
#range ⇒ Array<Numeric>
The range of values on y-axis.
-
#width ⇒ Numeric
The width of bars [0..1].
Instance Method Summary collapse
Methods included from Jsonizable
#before_to_json, #get_property, included, #init_properties, #set_property, #to_json
Instance Attribute Details
#axis ⇒ Boolean
Returns Boolean whether to render axis along arcs.
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
#color ⇒ Array<String>
Returns colors in which arcs are filled.
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
#fill_by ⇒ Symbol
Returns the column label to decide how to fill sybmols.
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
#layer ⇒ Numeric
Returns The number of layer where the plot is placed.
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
#range ⇒ Array<Numeric>
Returns The range of values on y-axis.
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
#width ⇒ Numeric
Returns The width of bars [0..1].
17 |
# File 'lib/bionya/diagram.rb', line 17 define_group_properties(:options, [:range, :width, :color, :fill_by, :x, :y, :layer, :axis]) |
Instance Method Details
#process_data(df, labels) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bionya/diagram.rb', line 19 def process_data(df, labels) x(labels[0]) y(labels[1]) nested = df.column(labels[2]) # 'nested_label' column from CircularPlot raise 'received dataframe is not nested' unless nested.all? {|cell| cell.is_a? DataFrame} max = nested.reduce(-Float::INFINITY){|memo, df| [memo, df.column(y).max].max} min = nested.reduce(Float::INFINITY){|memo, df| [memo, df.column(y).min].min} if min > 0 range([0, max]) else range([min, max]) end end |