Created on October 20, 2014 22:25 | Updated over 5 years ago

**Link:** https://gist.github.com/jywarren/0d7433ccb5f8219671dc

continuous version of https://gist.github.com/jywarren/3791c67384c88d53f155 which draws a vertical line which bisects the area of the graph equally, on SpectralWorkbench.org -- for capture mode

// calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally draw: function() { // code to run every frame flotoptions.grid.markings = [] // calculate total area: var area = 0 $.each($W.data[0].data,function(i,v){ area += v[1] }) // now find the halfway point var count = 0 $.each($W.data[0].data,function(i,v){ if (count < area/2) { count += v[1] } else { // draw markers: flotoptions.grid.markings.push({ label: "centroid", color: "yellow", lineWidth: 1, xaxis: { from: v[0], to: v[0] } }); return false } }) }, setup: function() { // code to run on startup }