Added explicit border-spacing to compensate for global removal of
padding. Flot should really take care of this itself; layout-critical
styles shouldn't depend on the user-agent defaults.
Slightly widened the page to account for the fact that most people have
widescreen monitors these days. Also made text larger and more legible,
and created a nice 'clipping' effect for the placeholder.
To improve organization with the increasing number of examples, every
example page is now the index of its own subdirectory, which contains
all the files specific to that example.
The base implementation uses the new drawText and getTextInfo methods to
draw text in HTML. Canvas rendering has been moved to overrides of
these methods within the canvas-render plugin.
These methods provide a common way to draw HTML text above a canvas.
The getTextInfo method generates div HTML for text with a given font
style/class and angle, measures the element's dimensions, and saves
everything in a cache. The drawText method takes the resulting entry,
finishes generating the inline styles necessary to position the div, and
adds the result to a buffer. The render method dumps the buffer into an
overlay and expires unused cache entries.
Moved canvas creation and size management into a new Canvas class.
This is the first step towards a more object-oriented architecture.
Since we create multiple canvases, and have to maintain several
module-global variables to track their properties, they are the ideal
place to start.
This commit also removes sizing code that was duplicated between
makeCanvas and resizeCanvas.
Thus, prevent it from becoming topmost (it may cause strange looks if
original series is not topmost: some part of it becomes topmost and
overwrites some lines and points that should be above it instead).
Due to limitations in our plugin architecture, the categories plugin
duplicates code from Flot's core for adding a dummy point to snap the y
axis to zero. We can get rid of this duplication in 0.9; for now we'll
just update the duplicate to match the change in core that introduced
the new 'zero' option.
This also includes a tweak to zero's default. Previously zero only
received a value if lines were visible; now it always receives a value,
matching the behavior of other contextual options.
Use bind, rather than .mouseleave, because we officially still support
jQuery 1.2.6, which doesn't define a shortcut for mouseenter or
mouseleave. This was a bug/oversight that was fixed somewhere around
1.3.x. We can return to using .mouseleave when we drop support for
1.2.6.
Rounding errors are introduced when calculating the percentage when the total is 100 (for example if percentages have already been calculated). Calculating (total/100) first eliminates the error in this case.