RhoInc / Webcharts

Reusable, flexible, interactive charts with JavaScript
MIT License
34 stars 6 forks source link

Add jitter/beeswarm option. #165

Open samussiah opened 6 years ago

samussiah commented 6 years ago
    this.current_data.forEach(function(d){
      d.matches = chart.current_data.filter(function(f){
        return f.values.x == d.values.x & f.values.y == d.values.y
      })

      d.count = d.matches.length
      d.i = d.matches.indexOf(d)

      if(d.i < d.count/2){
        d.offsetx = (d.i - (d.count/4))
        d.offsety = 1
      }else{
        d.offsetx = (d.i - (3*d.count/4))
        d.offsety = 0
      }
    })
jwildfire commented 4 years ago

Thinking this would be a mark-specific setting, so adding the new plugin label

samussiah commented 4 years ago

Agreed, point-specific.