Like the danvk mentioned above , try specifying the "underlayCallback" parameter in your call to "new Dygraph()" . Use the HTML Canvas context to draw a line.
Example below: (xmin and xmax are the times of your unix era in milliseconds)
var yavg= 50, xmin=1357016400000, xmax=1359694800000; new Dygraph(document.getElementById('graph1'), data,{ (....other options....), underlayCallback:function(ctx,area,dygraph){ var xl = dygraph.toDomCoords(xmin,yavg); var xr = dygraph.toDomCoords(xmax,yavg); ctx.strokeStyle= 'green'; ctx.beginPath(); ctx.moveTo(xl[0],xl[1]); ctx.lineTo(xr[0],xr[1]); ctx.closePath(); ctx.stroke(); }});
source share