Class: Nyaplot::CircularPlot

Inherits:
Plot
  • Object
show all
Includes:
Jsonizable
Defined in:
lib/bionya/plot.rb

Instance Attribute Summary collapse

Attributes inherited from Plot

#bg_color, #grid_color, #height, #legend, #legend_options, #legend_width, #margin, #rotate_x_label, #rotate_y_label, #width, #x_label, #x_scale, #xrange, #y_label, #y_scale, #yrange, #zoom

Instance Method Summary collapse

Methods included from Jsonizable

#as_json, #get_property, included, #init_properties, #set_property, #to_json

Methods inherited from Plot

#add_with_df, #configure, #df_list, #export_html, #show, #to_iruby

Constructor Details

#initialize(df, group_label, nested_label) ⇒ CircularPlot


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bionya/plot.rb', line 27

def initialize(df, group_label, nested_label)
  super()
  @df = df
  @inner_num = 0
  @outer_num = 1
  @nested_label = nested_label

  set_property(:axis_extra_options, {})
  group_by(group_label)
  color(['#253494'])
  extension('Bionya')
end

Instance Attribute Details

#chordBoolean


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#colorArray<String>


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#fill_bySymbol


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#inner_radiusNumeric


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#outer_radiusNumeric


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#paddingNumeric


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#text_colorString


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

#text_sizeNumeric


22
# File 'lib/bionya/plot.rb', line 22

define_group_properties(:axis_extra_options, [:df_id, :inner_radius, :outer_radius, :group_by, :axis, :chord, :matrix, :inner_num, :outer_num, :color, :text_color, :text_size, :fill_by, :padding])

Instance Method Details

#add(layer, type, *labels) ⇒ Diagram

Add diagram to the plot


63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/bionya/plot.rb', line 63

def add(layer, type, *labels)
  if(layer>0)
    @outer_num += 1
  elsif
    @inner_num += 1
  end

  diagram = Diagram.new(@df, type, labels.push(@nested_label))
  diagram.layer(layer)
  @axis = diagram.x
  self.diagrams.push(diagram)
  return diagram
end

#add_chord(matrix) ⇒ Object

Add chord to the plot


43
44
45
# File 'lib/bionya/plot.rb', line 43

def add_chord(matrix)
  @matrix = matrix
end

#add_connector_with_df(df, from, to) ⇒ Diagram

Add connector to the plot


52
53
54
55
56
# File 'lib/bionya/plot.rb', line 52

def add_connector_with_df(df, from, to)
  diagram = Diagram.new(df, :connector, [from, to])
  self.diagrams.push(diagram)
  return diagram
end

#before_to_jsonObject


77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/bionya/plot.rb', line 77

def before_to_json
  zoom(true)
  width(800) if width.nil?
  height(800) if height.nil?

  inner_num(@inner_num)
  outer_num(@outer_num)
  df_id(@df.name)
  axis(@axis)

  self.options[:axis_extra_options] = axis_extra_options
end