lib/nyaplot/diagram.rb in nyaplot-0.1.1 vs lib/nyaplot/diagram.rb in nyaplot-0.1.2
- old
+ new
@@ -47,11 +47,13 @@
# @return [Symbol] the column label from which bar chart is created
# @!attribute width
# @return [Numeric] the width of each bar. The specified value should be in the range 0 to 1.
# @!attribute color
# @return [Array<String>] array of color codes
- define_group_properties(:options, [:value, :x, :y, :width, :color])
+ # @!attribute legend
+ # @return [Bool] decide if the diagram prepare legend
+ define_group_properties(:options, [:value, :x, :y, :width, :color, :legend])
# calcurate xrange and yrange from recieved data
def process_data(df, labels)
case labels.length
when 1
@@ -86,11 +88,13 @@
# @return [Array<String>] array of color codes
# @!attribute stroke_color
# @return [String] color code
# @!attribute stroke_width
# @return [Numeric] the width of stroke
- define_group_properties(:options, [:title, :value, :bin_num, :width, :color, :stroke_color, :stroke_width])
+ # @!attribute legend
+ # @return [Bool] decide if the diagram prepare legend
+ define_group_properties(:options, [:title, :value, :bin_num, :width, :color, :stroke_color, :stroke_width, :legend])
def process_data(df, labels)
label = labels[0]
value(label)
@xrange = [(df[label].to_a.min < 0 ? df[label].to_a.min : 0), df[label].to_a.max]
@@ -160,11 +164,13 @@
# @return [String] color code
# @!attribute stroke_width
# @return [Numeric] the width of stroke
# @!attribute tooltip_contents
# @return [Array<Symbol>] column labels to display in tool-tip box
- define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents])
+ # @!attribute legend
+ # @return [Bool] decide if the diagram prepare legend
+ define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])
def process_data(df, labels)
label_x = labels[0]
label_y = labels[1]
x(label_x)
@@ -228,10 +234,12 @@
# @return [Symbol] the column label from which the line chart is created
# @!attribute color
# @return [String] the color code
# @!attribute stroke_width
# @return [Numeric] the width of stroke
- define_group_properties(:options, [:title, :x, :y, :color, :stroke_width])
+ # @!attribute legend
+ # @return [Bool] decide if the diagram prepare legend
+ define_group_properties(:options, [:title, :x, :y, :color, :stroke_width, :legend])
def process_data(df, labels)
label_x = labels[0]
label_y = labels[1]
x(label_x)