Commit Graph

50 Commits (ea4bfb11ce87815c7402096f2fd2b71978d02a92)

Author SHA1 Message Date
Nick Schonning 7c52f44431 Convert remaining tabs to spaces 13 years ago
David Schnur e0413b9308 Factor out duplicate variable definitions. 13 years ago
David Schnur f39c71fbc7 Remove unused variable definitions. 13 years ago
David Schnur 9fc03e5375 Switch to === and !== for safer equality testing. 13 years ago
David Schnur 49c312c36d Fix lines incorrectly broken before an operator. 13 years ago
David Schnur f24a67e752 Wrap one-statement if and for blocks in braces. 13 years ago
David Schnur 68337794a6 Merge branch 'master' into code-cleanup 13 years ago
David Schnur f12481559d Merge pull request #1024 from nmorel/master
Regression on pie plugin in the data format allowed
13 years ago
Nicolas Morel 14f694f9b9 Fixed regression on pie plugin on data format allowed (without recursion) 13 years ago
Lee Willis 5fe3646ab0 Remove $.isNumeric() for compat with jQuery < 1.7. Fixes #1026 13 years ago
David Schnur b3fe4bdef3 Added missing semicolons. 13 years ago
David Schnur d3b2f0c114 Added missing radix parameters. 13 years ago
martinqt 1e6c45bd95 Update js files 13 years ago
David Schnur 64b28faf0d Avoid combining a single pie slice into 'other'.
Resolves #638.
13 years ago
David Schnur a6ce78d156 Remove unnecessary debugging code.
Modern browser consoles obviate the need for an object logging function.
13 years ago
David Schnur e491dc7a06 Cache the data value, since it is used repeatedly. 13 years ago
David Schnur d3a6bc965f Remove unnecessary numeric value checks.
The previous processing step already guarantees that the values are
numeric.
13 years ago
David Schnur 2a189b2cfb Improve the data value fix-up step.
This resolves #534 by handling the case where data is a string, whether
it is provided alone or as a pair.  We can also eliminate the old and
unnecessary check for undefined values.
13 years ago
David Schnur ef73cf7ec1 Set processed back to false after processing.
This temporary fix addresses the problem described in #810, and possibly
#945, where calls to setData for a pie chart do nothing.
13 years ago
David Schnur 7317b9c632 Remove the non-existent second 'data' parameter. 13 years ago
David Schnur 9ede692e2f Removed the unused plugin-global raw variable. 13 years ago
David Schnur 55864254d2 Removed unnecessary plugin-global variables.
The canvasWidth, canvasHeight, legendWidth and legendHeight variables
existed only to share data between the setupPie and draw functions.  Now
that setupPie has been folded into draw, they're no longer necessary.
13 years ago
David Schnur 6d70144d5e Moved setupPie into the draw function.
This code is only used to prepare the plot for drawing; inlining it is
cleaner and will allow us to get rid of some plugin-global variables
that existed only to give setupPie a way to share data with the draw
function.
13 years ago
David Schnur cfc07ff285 Eliminate the plugin-global redraw flag.
The redraw flag starts out as true, then is immediately set to false on
draw.  If labels are enabled, drawPie calls drawLabels, which calls
drawLabel for each label.  Any label that can't fit sets redraw back to
true, so the whole process can repeat.

This isn't the most obvious mechanism, and forces one to remember to do
things like setting redraw back to true after drawing, so the plot can
redraw itself on resize or when setting new data.

Instead we now have drawPie return true when it drew successfully, and
false otherwise, which the same happening in drawLabels and drawLabel.
Instead of checking the flag, we now just check the return value.

This has the added benefit of slightly improving performance in the case
where several redraws are necessary, since it now short-circuits out of
the draw loop as soon as one label fails to fit.
13 years ago
David Schnur fa463311dc Make redrawAttempts and shrink proper constants. 13 years ago
David Schnur 778894324d Make the slice total a local variable.
The total is only used within the combine function; it doesn't need to
exist at the top level of the plugin.
13 years ago
David Schnur a1c84203bd Moved fixData and calcData into combine.
They're small and not used anywhere else, so keeping them in separate
functions only serves to increase complexity.
13 years ago
David Schnur a03c4c199d Moved other hooks out of the processOptions hook.
In plugins we should never add hooks conditionally; the condition should
remain within individual hooks, so the plugin can be toggled at any
time.

Ideally we should also 'inline' the hook functions, since they're used
nowhere else.  But since that would involve a lot of code changes, we'll
put it off until the broader cleanup effort scheduled for 0.9.0.
13 years ago
David Schnur f294bf19a3 Cleaned up processOptions and bindEvents hooks. 13 years ago
James Ward f6198f5db2 Change evaluation order for calculating percentage
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.
13 years ago
David Schnur d09b278601 Allow the pie to redraw on resize or update.
When a pie's labels don't fit within its container, the pie is redrawn
with a smaller radius until the labels fit, or a fixed number of retry
attempts are exhausted. The redraw flag was not reset on success,
however, which prevented the pie from being redrawn again after a resize
or update.
13 years ago
David Schnur 02c701b057 Check dimensions on draw, not just on startup.
Previously the container dimensions were checked only once, which
prevented the pie from changing in size as its container was resized.
13 years ago
Anthony Ryan 50a45ba995 Remove Internet Explorer specific code, that appears to have no impact on actual rendering see bug #905 13 years ago
David Schnur 9e21074d82 Updated license headers for #805.
Added licensing information to each file's headers, along with some
minor cleanup.
14 years ago
David Schnur b3a19afb05 Comment out bizzarre impossible code. 14 years ago
David Schnur 179bed9617 Declare variables that should have been local. 14 years ago
David Schnur eac2d075f0 Removed extra comma that was causing IE7 errors. 14 years ago
David Schnur 7ee31a6099 Added work-around for the Excanvas 100% arc bug.
When a slice equals (or comes close enough that it is equal in
floating-point representation) 100% of the pie, it was no longer drawn
by Excanvas.  This is because of a long-standing issue where VML won't
draw an arc whose begin and end are the same.  Rather than some hack,
like adding/subtracting a small value, we'll simply draw two arcs for
every slice, with each covering half of the slice's angle.
14 years ago
David Schnur 6aa3696e59 Further style cleanup. 14 years ago
David Schnur 0a601d037b Cleaned up whitespace, braces and strings. 14 years ago
David Schnur 5951dcb03c Ensure that pie's legendWidth remains numeric.
Substitute zero when .width() returns undefined, since legendWidth is
used in numeric calculations that break when it is undefined.  This
became a problem with the release of jQuery 1.8.0, which returns
undefined instead of null when an element doesn't exist.  This was fixed
in 1.8.1, but this is good practice anyway.
14 years ago
Lau Bech Lauritzen a175706711 Use placeholder dimensions instead og canvas dimensions in calculations which fixes draw bug after introducing Retina support in Flot core 14 years ago
Julien Thomas b48f1aa9e7 Pie: Allow to set shadow distance and alpha of a tilted pie 14 years ago
Julien Thomas c095d66be3 Pie: Whitespace cleanup, this file uses tabs for indentation 14 years ago
David Schnur d0fba4a5b9 Prevent pie slice outlines from being drawn when the stroke width is zero (issue 585) 14 years ago
Ole Laursen b2fedcd828 Fix recently introduced bug in pie plugin pointed out by Chris R. Patterson 15 years ago
Ole Laursen 2d2ca32a5c Fix problem with null values and pie plugin (patch by gcruxifix) 15 years ago
olau@iola.dk 147f940e5b Fix problem with floating point comparison (report and patch by jparish9001)
git-svn-id: https://flot.googlecode.com/svn/trunk@286 1e0a6537-2640-0410-bfb7-f154510ff394
16 years ago
olau@iola.dk 4363320767 Fix bug with unhighlighting slices (fix by Johan Sall Larson)
git-svn-id: https://flot.googlecode.com/svn/trunk@279 1e0a6537-2640-0410-bfb7-f154510ff394
16 years ago
the.d0rp 7cbc14160e git-svn-id: https://flot.googlecode.com/svn/trunk@228 1e0a6537-2640-0410-bfb7-f154510ff394 17 years ago