Added code to flip tooltip position if near edge of graph.

The tooltip will be rendered outside the graph when hovering a series near the edge of the graph. Added some code to check the graph's width before generating the tooltip and "flip" the tooltip as necessary.