Aligning a legend with plot container
This demo shows how we can use axis’ events to monitor its width, and automatically adjust position of the legend, so it is aligned perfectly with the plot area.
yAxis.events.on("boundschanged", function() { legend.set("dx", yAxis.width());});yAxis.events.on("boundschanged", function() { legend.set("dx", yAxis.width());});