examples/scatterplot/scatterplot.rb
#--------------------------------------------------------------------------------------
# This method updates and plots all the labels in the scatter plot.
#
# @param x_scale [Scale] the x scale for the updated dataset. Uses @x_scale as default
# since x_scale is used inside a block.  @x_scale should have already being updated
# @param y_scale [Scale] the y scale for the updated dataset. Uses @y_scale as default
# since y_scale is used inside a block.  @y_scale should have already being updated
#--------------------------------------------------------------------------------------
This method updates and plots all the labels in the scatter plot.
This method updates and plots all the labels in the scatter plot .
def update_labels(x_scale = @x_scale, y_scale = @y_scale)
    @svg.selectAll("text")
      .data(@dataset)
      .text { |d, i| "(#{d[0].to_i}, #{d[1].to_i})" }
      .attr("x") { |d, i| x_scale[d[0]] }
      .attr("y") { |d, i| y_scale[d[1]] }
  end
def update_labels ( x_scale = @x_scale , y_scale = @y_scale ) @svg . selectAll ( "text" ) . data ( @dataset ) . text { | d , i | "(#{d[0].to_i}, #{d[1].to_i})" } . attr ( "x" ) { | d , i | x_scale [ d [ 0 ] ] } . attr ( "y" ) { | d , i | y_scale [ d [ 1 ] ] } end
This method updates and plots all the labels in the scatter plot.
This method updates and plots all the labels in the scatter plot .
x_scale
the x scale for the updated dataset. Uses @x_scale as default since x_scale is used inside a block. @x_scale should have already being updated
the x scale for the updated dataset . Uses @x_scale as default since x_scale is used inside a block . @x_scale should have already being updated
y_scale
the y scale for the updated dataset. Uses @y_scale as default since y_scale is used inside a block. @y_scale should have already being updated
the y scale for the updated dataset . Uses @y_scale as default since y_scale is used inside a block . @y_scale should have already being updated