From c095d66be3d1a5f68800e4e50fd8ab7898530ae6 Mon Sep 17 00:00:00 2001 From: Julien Thomas Date: Fri, 21 Sep 2012 18:55:30 +0200 Subject: [PATCH 1/2] Pie: Whitespace cleanup, this file uses tabs for indentation --- jquery.flot.pie.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index ef864a3..d3458ac 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -586,10 +586,10 @@ More detail and specific examples can be found in the included HTML file. triggerClickHoverEvent('plothover', e); } - function onClick(e) + function onClick(e) { triggerClickHoverEvent('plotclick', e); - } + } // trigger click or hover event (they send the same parameters so we share their code) function triggerClickHoverEvent(eventname, e) @@ -612,7 +612,7 @@ More detail and specific examples can be found in the included HTML file. // highlight the slice if (item) - highlight(item.series, eventname); + highlight(item.series, eventname); // trigger any hover bind events var pos = { pageX: e.pageX, pageY: e.pageY }; @@ -744,7 +744,7 @@ More detail and specific examples can be found in the included HTML file. } } }; - + $.plot.plugins.push({ init: init, options: options, From b48f1aa9e707ee117a2f387da452e3e31253bd33 Mon Sep 17 00:00:00 2001 From: Julien Thomas Date: Fri, 21 Sep 2012 18:57:38 +0200 Subject: [PATCH 2/2] Pie: Allow to set shadow distance and alpha of a tilted pie --- examples/pie.html | 5 +++++ jquery.flot.pie.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/pie.html b/examples/pie.html index b7bccf8..d72e82e 100644 --- a/examples/pie.html +++ b/examples/pie.html @@ -671,6 +671,11 @@ $("#interactive").bind("plotclick", pieClick);
  • innerRadius: 0 - Sets the radius of the donut hole. If value is between 0 and 1 (inclusive) then it will use that as a percentage of the radius, otherwise it will use the value as a direct pixel length.
  • startAngle: 3/2 - Factor of PI used for the starting angle (in radians) It can range between 0 and 2 (where 0 and 2 have the same result).
  • tilt: 1 - Percentage of tilt ranging from 0 and 1, where 1 has no change (fully vertical) and 0 is completely flat (fully horizontal -- in which case nothing actually gets drawn).
  • +
  • shadow:
      +
    • top: 5 - Vertical distance in pixel of the tilted pie shadow.
    • +
    • left: 15 - Horizontal distance in pixel of the tilted pie shadow.
    • +
    • alpha: 0.02 - Alpha value of the tilted pie shadow.
    • +
  • offset:
    • top: 0 - Pixel distance to move the pie up and down (relative to the center).
    • left: 'auto' - Pixel distance to move the pie left and right (relative to the center).
    • diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index d3458ac..107b076 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -310,10 +310,10 @@ More detail and specific examples can be found in the included HTML file. function drawShadow() { - var shadowLeft = 5; - var shadowTop = 15; + var shadowLeft = options.series.pie.shadow.left; + var shadowTop = options.series.pie.shadow.top; var edge = 10; - var alpha = 0.02; + var alpha = options.series.pie.shadow.alpha; // set radius if (options.series.pie.radius>1) @@ -712,6 +712,11 @@ More detail and specific examples can be found in the included HTML file. innerRadius:0, /* for donut */ startAngle: 3/2, tilt: 1, + shadow: { + left: 5, // shadow left offset + top: 15, // shadow top offset + alpha: 0.02, // shadow alpha + }, offset: { top: 0, left: 'auto'