module Nyaplot::Diagrams::Bar

Public Instance Methods

process_data(df, labels) click to toggle source

calcurate xrange and yrange from recieved data

# File lib/nyaplot/diagram.rb, line 57
def process_data(df, labels)
  case labels.length
  when 1
    label = labels[0]
    value(label)
    @xrange = df[label].to_a.uniq
    @yrange = [0, df[label].to_a.length]
  when 2
    label_x = labels[0]
    label_y = labels[1]
    x(label_x)
    y(label_y)
    @xrange = df.column(label_x).to_a
    @yrange = [(df[label_y].to_a.min < 0 ? df[label_y].to_a.min : 0), df[label_y].to_a.max]
  end
end
zoom?() click to toggle source

internal use. Nyaplot::Plot asks diagram through this method whether to enable zooming option or not.

# File lib/nyaplot/diagram.rb, line 75
def zoom?
  false
end