Module: Nyaplot::Diagrams::Scatter

Includes:
Jsonizable
Defined in:
lib/nyaplot/diagram.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Jsonizable

#before_to_json, #get_property, included, #init_properties, #set_property, #to_json

Instance Attribute Details

#colorArray<String>

Returns color code

Returns:

  • (Array<String>)

    color code



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#fill_bySymbol

Returns the column label to decide how to fill sybmols

Returns:

  • (Symbol)

    the column label to decide how to fill sybmols



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#legendBool

Returns decide if the diagram prepare legend

Returns:

  • (Bool)

    decide if the diagram prepare legend



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#shapeArray<String>

Returns shapes for each symbol

Returns:

  • (Array<String>)

    shapes for each symbol



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#shape_bySymbol

Returns the column label to decide shapes

Returns:

  • (Symbol)

    the column label to decide shapes



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#sizeArray<Numeric>

Returns the range of symbol size

Returns:

  • (Array<Numeric>)

    the range of symbol size



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#size_bySymbol

Returns the column label to decide size of symbols

Returns:

  • (Symbol)

    the column label to decide size of symbols



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#stroke_colorString

Returns color code

Returns:

  • (String)

    color code



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#stroke_widthNumeric

Returns the width of stroke

Returns:

  • (Numeric)

    the width of stroke



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#titleString

Returns the title of this chart

Returns:

  • (String)

    the title of this chart



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#tooltip_contentsArray<Symbol>

Returns column labels to display in tool-tip box

Returns:

  • (Array<Symbol>)

    column labels to display in tool-tip box



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#xSymbol

Returns the column label from which the line chart is created

Returns:

  • (Symbol)

    the column label from which the line chart is created



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

#ySymbol

Returns the column label from which the line chart is created

Returns:

  • (Symbol)

    the column label from which the line chart is created



171
# File 'lib/nyaplot/diagram.rb', line 171

define_group_properties(:options, [:title, :x, :y, :fill_by, :shape_by, :size_by, :color, :shape, :size, :stroke_color, :stroke_width, :tooltip_contents, :legend])

Instance Method Details

#process_data(df, labels) ⇒ Object



173
174
175
176
177
178
179
180
# File 'lib/nyaplot/diagram.rb', line 173

def process_data(df, labels)
  label_x = labels[0]
  label_y = labels[1]
  x(label_x)
  y(label_y)
  @xrange = [df[label_x].to_a.min, df[label_x].to_a.max]
  @yrange = [df[label_y].to_a.min, df[label_y].to_a.max]
end

#zoom?Boolean

Returns:

  • (Boolean)


182
183
184
# File 'lib/nyaplot/diagram.rb', line 182

def zoom?
  true
end