module Nyaplot::Diagrams::Arc

Public Instance Methods

process_data(df, labels) click to toggle source
# 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