Commit 53d6112f authored by David Schnur's avatar David Schnur

Merge pull request #78 from julthomas/pie-shadow

Added options to customize tilted pie shadows.
parents df8c7ea5 b48f1aa9
...@@ -671,6 +671,11 @@ $("#interactive").bind("plotclick", pieClick);</b><br/> ...@@ -671,6 +671,11 @@ $("#interactive").bind("plotclick", pieClick);</b><br/>
<li><b>innerRadius:</b> <i>0</i> - 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.</li> <li><b>innerRadius:</b> <i>0</i> - 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.</li>
<li><b>startAngle:</b> <i>3/2</i> - 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).</li> <li><b>startAngle:</b> <i>3/2</i> - 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).</li>
<li><b>tilt:</b> <i>1</i> - 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).</li> <li><b>tilt:</b> <i>1</i> - 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).</li>
<li><b>shadow:</b> <ul>
<li><b>top:</b> <i>5</i> - Vertical distance in pixel of the tilted pie shadow.</li>
<li><b>left:</b> <i>15</i> - Horizontal distance in pixel of the tilted pie shadow.</li>
<li><b>alpha:</b> <i>0.02</i> - Alpha value of the tilted pie shadow.</li>
</ul>
<li><b>offset:</b> <ul> <li><b>offset:</b> <ul>
<li><b>top:</b> <i>0</i> - Pixel distance to move the pie up and down (relative to the center).</li> <li><b>top:</b> <i>0</i> - Pixel distance to move the pie up and down (relative to the center).</li>
<li><b>left:</b> <i>'auto'</i> - Pixel distance to move the pie left and right (relative to the center).</li> <li><b>left:</b> <i>'auto'</i> - Pixel distance to move the pie left and right (relative to the center).</li>
......
...@@ -310,10 +310,10 @@ More detail and specific examples can be found in the included HTML file. ...@@ -310,10 +310,10 @@ More detail and specific examples can be found in the included HTML file.
function drawShadow() function drawShadow()
{ {
var shadowLeft = 5; var shadowLeft = options.series.pie.shadow.left;
var shadowTop = 15; var shadowTop = options.series.pie.shadow.top;
var edge = 10; var edge = 10;
var alpha = 0.02; var alpha = options.series.pie.shadow.alpha;
// set radius // set radius
if (options.series.pie.radius>1) if (options.series.pie.radius>1)
...@@ -586,10 +586,10 @@ More detail and specific examples can be found in the included HTML file. ...@@ -586,10 +586,10 @@ More detail and specific examples can be found in the included HTML file.
triggerClickHoverEvent('plothover', e); triggerClickHoverEvent('plothover', e);
} }
function onClick(e) function onClick(e)
{ {
triggerClickHoverEvent('plotclick', e); triggerClickHoverEvent('plotclick', e);
} }
// trigger click or hover event (they send the same parameters so we share their code) // trigger click or hover event (they send the same parameters so we share their code)
function triggerClickHoverEvent(eventname, e) function triggerClickHoverEvent(eventname, e)
...@@ -612,7 +612,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -612,7 +612,7 @@ More detail and specific examples can be found in the included HTML file.
// highlight the slice // highlight the slice
if (item) if (item)
highlight(item.series, eventname); highlight(item.series, eventname);
// trigger any hover bind events // trigger any hover bind events
var pos = { pageX: e.pageX, pageY: e.pageY }; var pos = { pageX: e.pageX, pageY: e.pageY };
...@@ -712,6 +712,11 @@ More detail and specific examples can be found in the included HTML file. ...@@ -712,6 +712,11 @@ More detail and specific examples can be found in the included HTML file.
innerRadius:0, /* for donut */ innerRadius:0, /* for donut */
startAngle: 3/2, startAngle: 3/2,
tilt: 1, tilt: 1,
shadow: {
left: 5, // shadow left offset
top: 15, // shadow top offset
alpha: 0.02, // shadow alpha
},
offset: { offset: {
top: 0, top: 0,
left: 'auto' left: 'auto'
...@@ -744,7 +749,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -744,7 +749,7 @@ More detail and specific examples can be found in the included HTML file.
} }
} }
}; };
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment