Kcnarf/d3-beeswarm

add a maximum size, and provide strategies if exceeded

Kcnarf opened this issue · 1 comments

Exceeding strategies could be:

  • omit exceeding data
  • wrap (overlapping at maximum size)
  • place data at modulo(maxSize) (overlapping in the center of the blob)
  • automatic radius reduction
  • automatic stretching with overlapping like d3.layout.force

This will not be added to this plugin because one of the beeswarm main feature is non-overlapping of data.

If one wants to go beyond this constraint, he/she may consider these alternatives:

  • use this plugin to arrange data with a particular radius, and draw each datum with a larger radius, so that drawn datum will overlap ; with drawn-radius = 1.25*arrangement-radius, each drawn datum will be overlapped at most by ~50% (0,25+0,25), leaving enought space to point/hover each datum independently
  • based on the arrangement provided by the plugin, make your own adequate strategy; considering that the arrangement must not exceed 250px height, and that the arrangement is 400 px height:
    • omit strategy is implemented as .style('display', function(d) { return (bee.y>250)? none : null; }))
    • wrap strategy is implemented as .attr('cy', function(d) { return (bee.y>250)? Math.sign(bee.y)*250 : bee.y; }))
    • modulo strategy is implemented as .attr('cy', function(d) { return bee.y%250; }))
    • linear stretching strategy is implemented as .attr('cy', function(d) { return bee.y*250/400; }))
    • quadratic stretching strategy (no overlapping around the axis, high overlapping at extremes) is implemented as .attr('cy', function(d) { return bee.y - Math.sign(bee.y)*(400-250)*Math.pow((bee.y/400), 2); }));