flot/flot — pull request #71 by sanakhet (2012-08-13 23:29:39+00:00)
Title: HTML5 measureText cross-browser inconsistency fix (Issue #736)

Fix for HTML5 canvas measureText cross-browser inconsistency. (Issue #736)

It was necessary to devise a work-around since measureText seems to behave differently in each browser / with different font family stacks. The change was essentially as follows:

Do the measurements in the DOM instead by creating a hidden span (once before setting up the axes), inserting a label then measuring it, then removing the span (once after setting up the axes).

There doesn't appear to be a way to attach an example file easily on to this pull request, but if anyone would like to test this out... see the included test .html file below.

PS
- I've never done a pull request, so lets hope I did it properly.
- I'd much rather use measureText, but since it doesn't seem to be able to measure consistently across major browsers some alternative is necessary. IF there's a better solution, feel free to let me know!
- ...and of course, give me a heads up if there are any bugs I might have missed.

Cheers,

Jeff