@kevinburke/flot 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/dist/flot.js +87 -12
- package/dist/flot.min.js +1 -1
- package/dist/flot.min.js.map +1 -1
- package/dist/flot.mjs +87 -12
- package/dist/jquery.flot.js +87 -12
- package/dist/jquery.flot.min.js +1 -1
- package/dist/jquery.flot.min.js.map +1 -1
- package/dist/plugins/jquery.flot.crosshair.js +1 -1
- package/dist/plugins/jquery.flot.image.js +1 -1
- package/dist/plugins/jquery.flot.pie.js +9 -1
- package/dist/plugins/jquery.flot.pie.min.js +1 -1
- package/dist/plugins/jquery.flot.pie.min.js.map +1 -1
- package/dist/plugins/jquery.flot.resize.js +1 -1
- package/dist/plugins/jquery.flot.threshold.js +1 -1
- package/package.json +14 -6
- package/source/jquery.canvaswrapper.js +9 -3
- package/source/jquery.flot.js +23 -5
- package/source/jquery.flot.legend.js +36 -3
- package/source/jquery.flot.navigate.js +18 -0
- package/source/jquery.flot.pie.js +8 -0
- package/types/test.ts +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @kevinburke/flot v5.1.
|
|
1
|
+
/*! @kevinburke/flot v5.1.1 | MIT License | https://github.com/kevinburke/flot */
|
|
2
2
|
(function (jquery_flot_js, helpers_js) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -541,6 +541,11 @@
|
|
|
541
541
|
// Placed here because it needs to be accessed from multiple locations
|
|
542
542
|
|
|
543
543
|
function drawDonutHole(layer) {
|
|
544
|
+
// The closure-scoped `options` is set by the processDatapoints
|
|
545
|
+
// hook on first draw, but drawDonutHole can be reached from
|
|
546
|
+
// paths that fire before that hook, leaving `options` null.
|
|
547
|
+
// Read it eagerly. Upstream flot/flot#1559.
|
|
548
|
+
var options = plot.getOptions();
|
|
544
549
|
if (options.series.pie.innerRadius > 0) {
|
|
545
550
|
// subtract the center
|
|
546
551
|
layer.save();
|
|
@@ -653,6 +658,9 @@
|
|
|
653
658
|
// trigger click or hover event (they send the same parameters so we share their code)
|
|
654
659
|
|
|
655
660
|
function triggerClickHoverEvent(eventname, e) {
|
|
661
|
+
// See drawDonutHole above: read `options` fresh in case the
|
|
662
|
+
// event fires before processDatapoints has run.
|
|
663
|
+
var options = plot.getOptions();
|
|
656
664
|
var offset = plot.offset();
|
|
657
665
|
var canvasX = parseInt(e.pageX - offset.left);
|
|
658
666
|
var canvasY = parseInt(e.pageY - offset.top);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"use strict";var i={series:{pie:{show:!1,radius:"auto",innerRadius:0,startAngle:1.5,tilt:1,shadow:{left:5,top:15,alpha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"auto",formatter:function(e,t){return"<div style='font-size:x-small;text-align:center;padding:2px;color:"+t.color+";'>"+e+"<br/>"+Math.round(t.percent)+"%</div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:.5}}}};e.plugins.push({init:function(e){var i=null,s=null,r=null,a=null,l=null,n=null,o=!1,p=null,h=[];function c(e)
|
|
1
|
+
!function(e,t){"use strict";var i={series:{pie:{show:!1,radius:"auto",innerRadius:0,startAngle:1.5,tilt:1,shadow:{left:5,top:15,alpha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"auto",formatter:function(e,t){return"<div style='font-size:x-small;text-align:center;padding:2px;color:"+t.color+";'>"+e+"<br/>"+Math.round(t.percent)+"%</div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:.5}}}};e.plugins.push({init:function(e){var i=null,s=null,r=null,a=null,l=null,n=null,o=!1,p=null,h=[];function c(t){var i=e.getOptions();if(i.series.pie.innerRadius>0){t.save();var s=i.series.pie.innerRadius>1?i.series.pie.innerRadius:a*i.series.pie.innerRadius;t.globalCompositeOperation="destination-out",t.beginPath(),t.fillStyle=i.series.pie.stroke.color,t.arc(0,0,s,0,2*Math.PI,!1),t.fill(),t.closePath(),t.restore(),t.save(),t.beginPath(),t.strokeStyle=i.series.pie.stroke.color,t.arc(0,0,s,0,2*Math.PI,!1),t.stroke(),t.closePath(),t.restore()}}function u(e,t){for(var i=!1,s=-1,r=e.length,a=r-1;++s<r;a=s)(e[s][1]<=t[1]&&t[1]<e[a][1]||e[a][1]<=t[1]&&t[1]<e[s][1])&&t[0]<(e[a][0]-e[s][0])*(t[1]-e[s][1])/(e[a][1]-e[s][1])+e[s][0]&&(i=!i);return i}function g(e){f("plothover",e)}function d(e){f("plotclick",e)}function f(i,r){var o=e.getOptions(),c=e.offset(),g=function(t,i){for(var s,r,o=e.getData(),h=e.getOptions(),c=h.series.pie.radius>1?h.series.pie.radius:a*h.series.pie.radius,g=0;g<o.length;++g){var d=o[g];if(d.pie.show){if(p.save(),p.beginPath(),p.moveTo(0,0),p.arc(0,0,c,d.startAngle,d.startAngle+d.angle/2,!1),p.arc(0,0,c,d.startAngle+d.angle/2,d.startAngle+d.angle,!1),p.closePath(),s=t-l,r=i-n,p.isPointInPath){if(p.isPointInPath(t-l,i-n))return p.restore(),{datapoint:[d.percent,d.data],dataIndex:0,series:d,seriesIndex:g}}else if(u([[0,0],[c*Math.cos(d.startAngle),c*Math.sin(d.startAngle)],[c*Math.cos(d.startAngle+d.angle/4),c*Math.sin(d.startAngle+d.angle/4)],[c*Math.cos(d.startAngle+d.angle/2),c*Math.sin(d.startAngle+d.angle/2)],[c*Math.cos(d.startAngle+d.angle/1.5),c*Math.sin(d.startAngle+d.angle/1.5)],[c*Math.cos(d.startAngle+d.angle),c*Math.sin(d.startAngle+d.angle)]],[s,r]))return p.restore(),{datapoint:[d.percent,d.data],dataIndex:0,series:d,seriesIndex:g};p.restore()}}return null}(parseInt(r.pageX-c.left),parseInt(r.pageY-c.top));if(o.grid.autoHighlight)for(var d=0;d<h.length;++d){var f=h[d];f.auto!==i||g&&f.series===g.series||b(f.series)}g&&function(t,i){var s=v(t);-1===s?(h.push({series:t,auto:i}),e.triggerRedrawOverlay()):i||(h[s].auto=!1)}(g.series,i);var m={pageX:r.pageX,pageY:r.pageY};t.trigger(s,i,[m,g])}function b(t){null==t&&(h=[],e.triggerRedrawOverlay());var i=v(t);-1!==i&&(h.splice(i,1),e.triggerRedrawOverlay())}function v(e){for(var t=0;t<h.length;++t)if(h[t].series===e)return t;return-1}e.hooks.processOptions.push(function(e,t){t.series.pie.show&&(t.grid.show=!1,"auto"===t.series.pie.label.show&&(t.legend.show?t.series.pie.label.show=!1:t.series.pie.label.show=!0),"auto"===t.series.pie.radius&&(t.series.pie.label.show?t.series.pie.radius=3/4:t.series.pie.radius=1),t.series.pie.tilt>1?t.series.pie.tilt=1:t.series.pie.tilt<0&&(t.series.pie.tilt=0))}),e.hooks.bindEvents.push(function(e,i){var s=e.getOptions();s.series.pie.show&&(s.grid.hoverable&&(t.unbind(i,"mousemove"),t.bind(i,"mousemove",g),t.bind(i,"mouseleave",g)),s.grid.clickable&&(t.unbind(i,"click"),t.bind(i,"click",d)))}),e.hooks.shutdown.push(function(e,i){t.unbind(i,"mousemove",g),t.unbind(i,"mouseleave",g),t.unbind(i,"click",d),h=[]}),e.hooks.processDatapoints.push(function(e,a,l,n){e.getOptions().series.pie.show&&function(e){o||(o=!0,i=e.getCanvas(),s=i.parentElement,r=e.getOptions(),e.setData(function(e){var i,s,a=0,l=0,n=0,o=r.series.pie.combine.color,p=[];for(i=0;i<e.length;++i)s=e[i].data,Array.isArray(s)&&1===s.length&&(s=s[0]),Array.isArray(s)?!isNaN(parseFloat(s[1]))&&isFinite(s[1])?s[1]=+s[1]:s[1]=0:s=!isNaN(parseFloat(s))&&isFinite(s)?[1,+s]:[1,0],e[i].data=[s];for(i=0;i<e.length;++i)a+=e[i].data[0][1];for(i=0;i<e.length;++i)(s=e[i].data[0][1])/a<=r.series.pie.combine.threshold&&(l+=s,n++,o||(o=e[i].color));for(i=0;i<e.length;++i)s=e[i].data[0][1],(n<2||s/a>r.series.pie.combine.threshold)&&p.push(t.extend(e[i],{data:[[1,s]],color:e[i].color,label:e[i].label,angle:s*Math.PI*2/a,percent:s/(a/100)}));return n>1&&p.push({data:[[1,l]],color:o,label:r.series.pie.combine.label,angle:l*Math.PI*2/a,percent:l/(a/100)}),p}(e.getData())))}(e)}),e.hooks.drawOverlay.push(function(e,t){e.getOptions().series.pie.show&&function(e,t){var i=e.getOptions(),s=i.series.pie.radius>1?i.series.pie.radius:a*i.series.pie.radius;t.save(),t.translate(l,n),t.scale(1,i.series.pie.tilt);for(var r=0;r<h.length;++r)o(h[r].series);function o(e){e.angle<=0||isNaN(e.angle)||(t.fillStyle="rgba(255, 255, 255, "+i.series.pie.highlight.opacity+")",t.beginPath(),Math.abs(e.angle-2*Math.PI)>1e-9&&t.moveTo(0,0),t.arc(0,0,s,e.startAngle,e.startAngle+e.angle/2,!1),t.arc(0,0,s,e.startAngle+e.angle/2,e.startAngle+e.angle,!1),t.closePath(),t.fill())}c(t),t.restore()}(e,t)}),e.hooks.draw.push(function(e,i){e.getOptions().series.pie.show&&function(e,i){if(s){var h=t.width(e.getPlaceholder()),u=t.height(e.getPlaceholder()),g=s.querySelector(".legend"),d=g&&g.firstElementChild?g.firstElementChild.clientWidth:0;p=i,o=!1,a=Math.min(h,u/r.series.pie.tilt)/2,n=u/2+r.series.pie.offset.top,l=h/2,"auto"===r.series.pie.offset.left?(r.legend.position.match("w")?l+=d/2:l-=d/2,l<a?l=a:l>h-a&&(l=h-a)):l+=r.series.pie.offset.left;var f=e.getData(),b=0;do{b>0&&(a*=.95),b+=1,m(),r.series.pie.tilt<=.8&&w()}while(!y()&&b<10);if(b>=10){m();var v=document.createElement("div");v.className="error",v.textContent="Could not draw pie with labels contained inside canvas",s.insertBefore(v,s.firstChild)}e.setSeries&&e.insertLegend&&(e.setSeries(f),e.insertLegend())}function m(){p.clearRect(0,0,h,u);for(var e=s.querySelectorAll(".pieLabel, .pieLabelBackground"),t=0;t<e.length;t++)e[t].remove()}function w(){var e=r.series.pie.shadow.left,t=r.series.pie.shadow.top,i=r.series.pie.shadow.alpha,s=r.series.pie.radius>1?r.series.pie.radius:a*r.series.pie.radius;if(!(s>=h/2-e||s*r.series.pie.tilt>=u/2-t||s<=10)){p.save(),p.translate(e,t),p.globalAlpha=i,p.fillStyle="#000",p.translate(l,n),p.scale(1,r.series.pie.tilt);for(var o=1;o<=10;o++)p.beginPath(),p.arc(0,0,s,0,2*Math.PI,!1),p.fill(),s-=o;p.restore()}}function y(){var e,t=Math.PI*r.series.pie.startAngle,i=r.series.pie.radius>1?r.series.pie.radius:a*r.series.pie.radius;p.save(),p.translate(l,n),p.scale(1,r.series.pie.tilt),p.save();var o=t;for(e=0;e<f.length;++e)f[e].startAngle=o,g(f[e].angle,f[e].color,!0);if(p.restore(),r.series.pie.stroke.width>0){for(p.save(),p.lineWidth=r.series.pie.stroke.width,o=t,e=0;e<f.length;++e)g(f[e].angle,r.series.pie.stroke.color,!1);p.restore()}return c(p),p.restore(),!r.series.pie.label.show||function(){for(var e=t,i=r.series.pie.label.radius>1?r.series.pie.label.radius:a*r.series.pie.label.radius,o=0;o<f.length;++o){if(f[o].percent>=100*r.series.pie.label.threshold&&!p(f[o],e,o))return!1;e+=f[o].angle}return!0;function p(e,t,a){if(0===e.data[0][1])return!0;var o,p=r.legend.labelFormatter,c=r.series.pie.label.formatter;o=p?p(e.label,e):e.label,c&&(o=c(o,e));var g=(t+e.angle+t)/2,d=l+Math.round(Math.cos(g)*i),f=n+Math.round(Math.sin(g)*i)*r.series.pie.tilt,b=document.createElement("span");b.className="pieLabel",b.id="pieLabel"+a,b.style.position="absolute",b.style.top=f+"px",b.style.left=d+"px",b.innerHTML=o,s.appendChild(b);var v=s.querySelector("#pieLabel"+a),m=f-v.clientHeight/2,w=d-v.clientWidth/2;if(v.style.top=m+"px",v.style.left=w+"px",0-m>0||0-w>0||u-(m+v.clientHeight)<0||h-(w+v.clientWidth)<0)return!1;if(0!==r.series.pie.label.background.opacity){var y=r.series.pie.label.background.color;null==y&&(y=e.color);var k=document.createElement("div");k.className="pieLabelBackground",k.style.cssText="position:absolute;width:"+v.clientWidth+"px;height:"+v.clientHeight+"px;top:"+m+"px;left:"+w+"px;background-color:"+y+";",k.style.opacity=r.series.pie.label.background.opacity,v.parentNode.insertBefore(k,v)}return!0}}();function g(e,t,s){e<=0||isNaN(e)||(s?p.fillStyle=t:(p.strokeStyle=t,p.lineJoin="round"),p.beginPath(),Math.abs(e-2*Math.PI)>1e-9&&p.moveTo(0,0),p.arc(0,0,i,o,o+e/2,!1),p.arc(0,0,i,o+e/2,o+e,!1),p.closePath(),o+=e,s?p.fill():p.stroke())}}}(e,i)})},options:i,name:"pie",version:"1.1"})}(jquery_flot_js,helpers_js);
|
|
2
2
|
//# sourceMappingURL=jquery.flot.pie.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jquery.flot.pie.min.js","sources":["../../source/jquery.flot.pie.js"],"sourcesContent":["/* Flot plugin for rendering pie charts.\n\nCopyright (c) 2007-2014 IOLA and Ole Laursen.\nLicensed under the MIT license.\n\nThe plugin assumes that each series has a single data value, and that each\nvalue is a positive integer or zero. Negative numbers don't make sense for a\npie chart, and have unpredictable results. The values do NOT need to be\npassed in as percentages; the plugin will calculate the total and per-slice\npercentages internally.\n\n* Created by Brian Medendorp\n\n* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars\n\nThe plugin supports these options:\n\n series: {\n pie: {\n show: true/false\n radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'\n innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect\n startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result\n tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)\n offset: {\n top: integer value to move the pie up or down\n left: integer value to move the pie left or right, or 'auto'\n },\n stroke: {\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')\n width: integer pixel width of the stroke\n },\n label: {\n show: true/false, or 'auto'\n formatter: a user-defined function that modifies the text/style of the label text\n radius: 0-1 for percentage of fullsize, or a specified pixel length\n background: {\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')\n opacity: 0-1\n },\n threshold: 0-1 for the percentage value at which to hide labels (if they're too small)\n },\n combine: {\n threshold: 0-1 for the percentage value at which to combine slices (if they're too small)\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined\n label: any text value of what the combined slice should be labeled\n }\n highlight: {\n opacity: 0-1\n }\n }\n }\n\nMore detail and specific examples can be found in the included HTML file.\n\n*/\n\nimport { plugins } from './jquery.flot.js';\nimport { extend, bind, unbind, trigger, width, height } from './helpers.js';\n\n // Maximum redraw attempts when fitting labels within the plot\n\n var REDRAW_ATTEMPTS = 10;\n\n // Factor by which to shrink the pie when fitting labels within the plot\n\n var REDRAW_SHRINK = 0.95;\n\n function init(plot) {\n var canvas = null,\n target = null,\n options = null,\n maxRadius = null,\n centerLeft = null,\n centerTop = null,\n processed = false,\n ctx = null;\n\n // interactive variables\n\n var highlights = [];\n\n // add hook to determine if pie plugin in enabled, and then perform necessary operations\n\n plot.hooks.processOptions.push(function(plot, options) {\n if (options.series.pie.show) {\n options.grid.show = false;\n\n // set labels.show\n\n if (options.series.pie.label.show === \"auto\") {\n if (options.legend.show) {\n options.series.pie.label.show = false;\n } else {\n options.series.pie.label.show = true;\n }\n }\n\n // set radius\n\n if (options.series.pie.radius === \"auto\") {\n if (options.series.pie.label.show) {\n options.series.pie.radius = 3 / 4;\n } else {\n options.series.pie.radius = 1;\n }\n }\n\n // ensure sane tilt\n\n if (options.series.pie.tilt > 1) {\n options.series.pie.tilt = 1;\n } else if (options.series.pie.tilt < 0) {\n options.series.pie.tilt = 0;\n }\n }\n });\n\n plot.hooks.bindEvents.push(function(plot, eventHolder) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n if (options.grid.hoverable) {\n unbind(eventHolder, \"mousemove\");\n bind(eventHolder, \"mousemove\", onMouseMove);\n bind(eventHolder, \"mouseleave\", onMouseMove);\n }\n if (options.grid.clickable) {\n unbind(eventHolder, \"click\");\n bind(eventHolder, \"click\", onClick);\n }\n }\n });\n\n plot.hooks.shutdown.push(function (plot, eventHolder) {\n unbind(eventHolder, \"mousemove\", onMouseMove);\n unbind(eventHolder, \"mouseleave\", onMouseMove);\n unbind(eventHolder, \"click\", onClick);\n highlights = [];\n });\n\n plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n processDatapoints(plot, series, datapoints);\n }\n });\n\n plot.hooks.drawOverlay.push(function(plot, octx) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n drawOverlay(plot, octx);\n }\n });\n\n plot.hooks.draw.push(function(plot, newCtx) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n draw(plot, newCtx);\n }\n });\n\n function processDatapoints(plot, series, datapoints) {\n if (!processed) {\n processed = true;\n canvas = plot.getCanvas();\n target = canvas.parentElement;\n options = plot.getOptions();\n plot.setData(combine(plot.getData()));\n }\n }\n\n function combine(data) {\n var total = 0,\n combined = 0,\n numCombined = 0,\n color = options.series.pie.combine.color,\n newdata = [],\n i,\n value;\n\n // Fix up the raw data from Flot, ensuring the data is numeric\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data;\n\n // If the data is an array, we'll assume that it's a standard\n // Flot x-y pair, and are concerned only with the second value.\n\n // Note how we use the original array, rather than creating a\n // new one; this is more efficient and preserves any extra data\n // that the user may have stored in higher indexes.\n\n if (Array.isArray(value) && value.length === 1) {\n value = value[0];\n }\n\n if (Array.isArray(value)) {\n // Equivalent to $.isNumeric() but compatible with jQuery < 1.7\n if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {\n value[1] = +value[1];\n } else {\n value[1] = 0;\n }\n } else if (!isNaN(parseFloat(value)) && isFinite(value)) {\n value = [1, +value];\n } else {\n value = [1, 0];\n }\n\n data[i].data = [value];\n }\n\n // Sum up all the slices, so we can calculate percentages for each\n\n for (i = 0; i < data.length; ++i) {\n total += data[i].data[0][1];\n }\n\n // Count the number of slices with percentages below the combine\n // threshold; if it turns out to be just one, we won't combine.\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data[0][1];\n if (value / total <= options.series.pie.combine.threshold) {\n combined += value;\n numCombined++;\n if (!color) {\n color = data[i].color;\n }\n }\n }\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data[0][1];\n if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {\n newdata.push(\n extend(data[i], { /* extend to allow keeping all other original data values\n and using them e.g. in labelFormatter. */\n data: [[1, value]],\n color: data[i].color,\n label: data[i].label,\n angle: value * Math.PI * 2 / total,\n percent: value / (total / 100)\n })\n );\n }\n }\n\n if (numCombined > 1) {\n newdata.push({\n data: [[1, combined]],\n color: color,\n label: options.series.pie.combine.label,\n angle: combined * Math.PI * 2 / total,\n percent: combined / (total / 100)\n });\n }\n\n return newdata;\n }\n\n function draw(plot, newCtx) {\n if (!target) {\n return; // if no series were passed\n }\n\n var canvasWidth = width(plot.getPlaceholder()),\n canvasHeight = height(plot.getPlaceholder()),\n legendEl = target.querySelector(\".legend\"),\n legendWidth = legendEl && legendEl.firstElementChild ? legendEl.firstElementChild.clientWidth : 0;\n\n ctx = newCtx;\n\n // WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!\n\n // When combining smaller slices into an 'other' slice, we need to\n // add a new series. Since Flot gives plugins no way to modify the\n // list of series, the pie plugin uses a hack where the first call\n // to processDatapoints results in a call to setData with the new\n // list of series, then subsequent processDatapoints do nothing.\n\n // The plugin-global 'processed' flag is used to control this hack;\n // it starts out false, and is set to true after the first call to\n // processDatapoints.\n\n // Unfortunately this turns future setData calls into no-ops; they\n // call processDatapoints, the flag is true, and nothing happens.\n\n // To fix this we'll set the flag back to false here in draw, when\n // all series have been processed, so the next sequence of calls to\n // processDatapoints once again starts out with a slice-combine.\n // This is really a hack; in 0.9 we need to give plugins a proper\n // way to modify series before any processing begins.\n\n processed = false;\n\n // calculate maximum radius and center point\n maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;\n centerTop = canvasHeight / 2 + options.series.pie.offset.top;\n centerLeft = canvasWidth / 2;\n\n if (options.series.pie.offset.left === \"auto\") {\n if (options.legend.position.match(\"w\")) {\n centerLeft += legendWidth / 2;\n } else {\n centerLeft -= legendWidth / 2;\n }\n if (centerLeft < maxRadius) {\n centerLeft = maxRadius;\n } else if (centerLeft > canvasWidth - maxRadius) {\n centerLeft = canvasWidth - maxRadius;\n }\n } else {\n centerLeft += options.series.pie.offset.left;\n }\n\n var slices = plot.getData(),\n attempts = 0;\n\n // Keep shrinking the pie's radius until drawPie returns true,\n // indicating that all the labels fit, or we try too many times.\n do {\n if (attempts > 0) {\n maxRadius *= REDRAW_SHRINK;\n }\n attempts += 1;\n clear();\n if (options.series.pie.tilt <= 0.8) {\n drawShadow();\n }\n } while (!drawPie() && attempts < REDRAW_ATTEMPTS)\n\n if (attempts >= REDRAW_ATTEMPTS) {\n clear();\n var errorDiv = document.createElement('div');\n errorDiv.className = 'error';\n errorDiv.textContent = 'Could not draw pie with labels contained inside canvas';\n target.insertBefore(errorDiv, target.firstChild);\n }\n\n if (plot.setSeries && plot.insertLegend) {\n plot.setSeries(slices);\n plot.insertLegend();\n }\n\n // we're actually done at this point, just defining internal functions at this point\n function clear() {\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n var labels = target.querySelectorAll(\".pieLabel, .pieLabelBackground\");\n for (var li = 0; li < labels.length; li++) {\n labels[li].remove();\n }\n }\n\n function drawShadow() {\n var shadowLeft = options.series.pie.shadow.left;\n var shadowTop = options.series.pie.shadow.top;\n var edge = 10;\n var alpha = options.series.pie.shadow.alpha;\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n\n if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {\n return; // shadow would be outside canvas, so don't draw it\n }\n\n ctx.save();\n ctx.translate(shadowLeft, shadowTop);\n ctx.globalAlpha = alpha;\n ctx.fillStyle = \"#000\";\n\n // center and rotate to starting position\n ctx.translate(centerLeft, centerTop);\n ctx.scale(1, options.series.pie.tilt);\n\n //radius -= edge;\n for (var i = 1; i <= edge; i++) {\n ctx.beginPath();\n ctx.arc(0, 0, radius, 0, Math.PI * 2, false);\n ctx.fill();\n radius -= i;\n }\n\n ctx.restore();\n }\n\n function drawPie() {\n var startAngle = Math.PI * options.series.pie.startAngle;\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n var i;\n // center and rotate to starting position\n\n ctx.save();\n ctx.translate(centerLeft, centerTop);\n ctx.scale(1, options.series.pie.tilt);\n //ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera\n\n // draw slices\n ctx.save();\n\n var currentAngle = startAngle;\n for (i = 0; i < slices.length; ++i) {\n slices[i].startAngle = currentAngle;\n drawSlice(slices[i].angle, slices[i].color, true);\n }\n\n ctx.restore();\n\n // draw slice outlines\n if (options.series.pie.stroke.width > 0) {\n ctx.save();\n ctx.lineWidth = options.series.pie.stroke.width;\n currentAngle = startAngle;\n for (i = 0; i < slices.length; ++i) {\n drawSlice(slices[i].angle, options.series.pie.stroke.color, false);\n }\n\n ctx.restore();\n }\n\n // draw donut hole\n drawDonutHole(ctx);\n\n ctx.restore();\n\n // Draw the labels, returning true if they fit within the plot\n if (options.series.pie.label.show) {\n return drawLabels();\n } else return true;\n\n function drawSlice(angle, color, fill) {\n if (angle <= 0 || isNaN(angle)) {\n return;\n }\n\n if (fill) {\n ctx.fillStyle = color;\n } else {\n ctx.strokeStyle = color;\n ctx.lineJoin = \"round\";\n }\n\n ctx.beginPath();\n if (Math.abs(angle - Math.PI * 2) > 0.000000001) {\n ctx.moveTo(0, 0); // Center of the pie\n }\n\n //ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera\n ctx.arc(0, 0, radius, currentAngle, currentAngle + angle / 2, false);\n ctx.arc(0, 0, radius, currentAngle + angle / 2, currentAngle + angle, false);\n ctx.closePath();\n //ctx.rotate(angle); // This doesn't work properly in Opera\n currentAngle += angle;\n\n if (fill) {\n ctx.fill();\n } else {\n ctx.stroke();\n }\n }\n\n function drawLabels() {\n var currentAngle = startAngle;\n var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;\n\n for (var i = 0; i < slices.length; ++i) {\n if (slices[i].percent >= options.series.pie.label.threshold * 100) {\n if (!drawLabel(slices[i], currentAngle, i)) {\n return false;\n }\n }\n currentAngle += slices[i].angle;\n }\n\n return true;\n\n function drawLabel(slice, startAngle, index) {\n if (slice.data[0][1] === 0) {\n return true;\n }\n\n // format label text\n var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;\n\n if (lf) {\n text = lf(slice.label, slice);\n } else {\n text = slice.label;\n }\n\n if (plf) {\n text = plf(text, slice);\n }\n\n var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;\n var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);\n var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;\n\n var labelSpan = document.createElement('span');\n labelSpan.className = 'pieLabel';\n labelSpan.id = 'pieLabel' + index;\n labelSpan.style.position = 'absolute';\n labelSpan.style.top = y + 'px';\n labelSpan.style.left = x + 'px';\n labelSpan.innerHTML = text;\n target.appendChild(labelSpan);\n\n var label = target.querySelector(\"#pieLabel\" + index);\n var labelTop = (y - label.clientHeight / 2);\n var labelLeft = (x - label.clientWidth / 2);\n\n label.style.top = labelTop + 'px';\n label.style.left = labelLeft + 'px';\n\n // check to make sure that the label is not outside the canvas\n if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.clientHeight) < 0 || canvasWidth - (labelLeft + label.clientWidth) < 0) {\n return false;\n }\n\n if (options.series.pie.label.background.opacity !== 0) {\n // put in the transparent background separately to avoid blended labels and label boxes\n var c = options.series.pie.label.background.color;\n if (c == null) {\n c = slice.color;\n }\n\n var bgDiv = document.createElement('div');\n bgDiv.className = 'pieLabelBackground';\n bgDiv.style.cssText = 'position:absolute;width:' + label.clientWidth + 'px;height:' + label.clientHeight + 'px;top:' + labelTop + 'px;left:' + labelLeft + 'px;background-color:' + c + ';';\n bgDiv.style.opacity = options.series.pie.label.background.opacity;\n label.parentNode.insertBefore(bgDiv, label);\n }\n\n return true;\n } // end individual label function\n } // end drawLabels function\n } // end drawPie function\n } // end draw function\n\n // Placed here because it needs to be accessed from multiple locations\n\n function drawDonutHole(layer) {\n if (options.series.pie.innerRadius > 0) {\n // subtract the center\n layer.save();\n var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;\n layer.globalCompositeOperation = \"destination-out\"; // this does not work with excanvas, but it will fall back to using the stroke color\n layer.beginPath();\n layer.fillStyle = options.series.pie.stroke.color;\n layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);\n layer.fill();\n layer.closePath();\n layer.restore();\n\n // add inner stroke\n layer.save();\n layer.beginPath();\n layer.strokeStyle = options.series.pie.stroke.color;\n layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);\n layer.stroke();\n layer.closePath();\n layer.restore();\n\n // TODO: add extra shadow inside hole (with a mask) if the pie is tilted.\n }\n }\n\n //-- Additional Interactive related functions --\n\n function isPointInPoly(poly, pt) {\n for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {\n ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) ||\n (poly[j][1] <= pt[1] && pt[1] < poly[i][1])) &&\n (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) &&\n (c = !c);\n }\n return c;\n }\n\n function findNearbySlice(mouseX, mouseY) {\n var slices = plot.getData(),\n options = plot.getOptions(),\n radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,\n x, y;\n\n for (var i = 0; i < slices.length; ++i) {\n var s = slices[i];\n if (s.pie.show) {\n ctx.save();\n ctx.beginPath();\n ctx.moveTo(0, 0); // Center of the pie\n //ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.\n ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);\n ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);\n ctx.closePath();\n x = mouseX - centerLeft;\n y = mouseY - centerTop;\n\n if (ctx.isPointInPath) {\n if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {\n ctx.restore();\n return {\n datapoint: [s.percent, s.data],\n dataIndex: 0,\n series: s,\n seriesIndex: i\n };\n }\n } else {\n // excanvas for IE doesn;t support isPointInPath, this is a workaround.\n var p1X = radius * Math.cos(s.startAngle),\n p1Y = radius * Math.sin(s.startAngle),\n p2X = radius * Math.cos(s.startAngle + s.angle / 4),\n p2Y = radius * Math.sin(s.startAngle + s.angle / 4),\n p3X = radius * Math.cos(s.startAngle + s.angle / 2),\n p3Y = radius * Math.sin(s.startAngle + s.angle / 2),\n p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),\n p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),\n p5X = radius * Math.cos(s.startAngle + s.angle),\n p5Y = radius * Math.sin(s.startAngle + s.angle),\n arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],\n arrPoint = [x, y];\n\n // TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?\n\n if (isPointInPoly(arrPoly, arrPoint)) {\n ctx.restore();\n return {\n datapoint: [s.percent, s.data],\n dataIndex: 0,\n series: s,\n seriesIndex: i\n };\n }\n }\n\n ctx.restore();\n }\n }\n\n return null;\n }\n\n function onMouseMove(e) {\n triggerClickHoverEvent(\"plothover\", e);\n }\n\n function onClick(e) {\n triggerClickHoverEvent(\"plotclick\", e);\n }\n\n // trigger click or hover event (they send the same parameters so we share their code)\n\n function triggerClickHoverEvent(eventname, e) {\n var offset = plot.offset();\n var canvasX = parseInt(e.pageX - offset.left);\n var canvasY = parseInt(e.pageY - offset.top);\n var item = findNearbySlice(canvasX, canvasY);\n\n if (options.grid.autoHighlight) {\n // clear auto-highlights\n for (var i = 0; i < highlights.length; ++i) {\n var h = highlights[i];\n if (h.auto === eventname && !(item && h.series === item.series)) {\n unhighlight(h.series);\n }\n }\n }\n\n // highlight the slice\n\n if (item) {\n highlight(item.series, eventname);\n }\n\n // trigger any hover bind events\n\n var pos = { pageX: e.pageX, pageY: e.pageY };\n trigger(target, eventname, [pos, item]);\n }\n\n function highlight(s, auto) {\n //if (typeof s == \"number\") {\n // s = series[s];\n //}\n\n var i = indexOfHighlight(s);\n\n if (i === -1) {\n highlights.push({ series: s, auto: auto });\n plot.triggerRedrawOverlay();\n } else if (!auto) {\n highlights[i].auto = false;\n }\n }\n\n function unhighlight(s) {\n if (s == null) {\n highlights = [];\n plot.triggerRedrawOverlay();\n }\n\n //if (typeof s == \"number\") {\n // s = series[s];\n //}\n\n var i = indexOfHighlight(s);\n\n if (i !== -1) {\n highlights.splice(i, 1);\n plot.triggerRedrawOverlay();\n }\n }\n\n function indexOfHighlight(s) {\n for (var i = 0; i < highlights.length; ++i) {\n var h = highlights[i];\n if (h.series === s) {\n return i;\n }\n }\n return -1;\n }\n\n function drawOverlay(plot, octx) {\n var options = plot.getOptions();\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n\n octx.save();\n octx.translate(centerLeft, centerTop);\n octx.scale(1, options.series.pie.tilt);\n\n for (var i = 0; i < highlights.length; ++i) {\n drawHighlight(highlights[i].series);\n }\n\n drawDonutHole(octx);\n\n octx.restore();\n\n function drawHighlight(series) {\n if (series.angle <= 0 || isNaN(series.angle)) {\n return;\n }\n\n //octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();\n octx.fillStyle = \"rgba(255, 255, 255, \" + options.series.pie.highlight.opacity + \")\"; // this is temporary until we have access to parseColor\n octx.beginPath();\n if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {\n octx.moveTo(0, 0); // Center of the pie\n }\n octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);\n octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);\n octx.closePath();\n octx.fill();\n }\n }\n } // end init (plugin body)\n\n // define pie specific options and their default values\n var options = {\n series: {\n pie: {\n show: false,\n radius: \"auto\", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)\n innerRadius: 0, /* for donut */\n startAngle: 3 / 2,\n tilt: 1,\n shadow: {\n left: 5, // shadow left offset\n top: 15, // shadow top offset\n alpha: 0.02 // shadow alpha\n },\n offset: {\n top: 0,\n left: \"auto\"\n },\n stroke: {\n color: \"#fff\",\n width: 1\n },\n label: {\n show: \"auto\",\n formatter: function(label, slice) {\n return \"<div style='font-size:x-small;text-align:center;padding:2px;color:\" + slice.color + \";'>\" + label + \"<br/>\" + Math.round(slice.percent) + \"%</div>\";\n }, // formatter function\n radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)\n background: {\n color: null,\n opacity: 0\n },\n threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)\n },\n combine: {\n threshold: -1, // percentage at which to combine little slices into one larger slice\n color: null, // color to give the new slice (auto-generated if null)\n label: \"Other\" // label to give the new slice\n },\n highlight: {\n //color: \"#fff\", // will add this functionality once parseColor is available\n opacity: 0.5\n }\n }\n }\n };\n\n plugins.push({\n init: init,\n options: options,\n name: \"pie\",\n version: \"1.1\"\n });\n"],"names":["options","series","pie","show","radius","innerRadius","startAngle","tilt","shadow","left","top","alpha","offset","stroke","color","width","label","formatter","slice","Math","round","percent","background","opacity","threshold","combine","highlight","plugins","push","init","plot","canvas","target","maxRadius","centerLeft","centerTop","processed","ctx","highlights","drawDonutHole","layer","save","globalCompositeOperation","beginPath","fillStyle","arc","PI","fill","closePath","restore","strokeStyle","isPointInPoly","poly","pt","c","i","l","length","j","onMouseMove","e","triggerClickHoverEvent","onClick","eventname","item","mouseX","mouseY","x","y","slices","getData","getOptions","s","moveTo","angle","isPointInPath","datapoint","data","dataIndex","seriesIndex","cos","sin","findNearbySlice","parseInt","pageX","pageY","grid","autoHighlight","h","auto","unhighlight","indexOfHighlight","triggerRedrawOverlay","pos","trigger","splice","hooks","processOptions","legend","bindEvents","eventHolder","hoverable","unbind","bind","clickable","shutdown","processDatapoints","datapoints","getCanvas","parentElement","setData","value","total","combined","numCombined","newdata","Array","isArray","isNaN","parseFloat","isFinite","extend","drawOverlay","octx","translate","scale","drawHighlight","abs","draw","newCtx","canvasWidth","getPlaceholder","canvasHeight","height","legendEl","querySelector","legendWidth","firstElementChild","clientWidth","min","position","match","attempts","clear","drawShadow","drawPie","errorDiv","document","createElement","className","textContent","insertBefore","firstChild","setSeries","insertLegend","clearRect","labels","querySelectorAll","li","remove","shadowLeft","shadowTop","globalAlpha","currentAngle","drawSlice","lineWidth","drawLabel","index","text","lf","labelFormatter","plf","halfAngle","labelSpan","id","style","innerHTML","appendChild","labelTop","clientHeight","labelLeft","bgDiv","cssText","parentNode","drawLabels","lineJoin","name","version"],"mappings":"4BAuvBI,IAAIA,EAAU,CACVC,OAAQ,CACJC,IAAK,CACDC,MAAM,EACNC,OAAQ,OACRC,YAAa,EACbC,WAAY,IACZC,KAAM,EACNC,OAAQ,CACJC,KAAM,EACNC,IAAK,GACLC,MAAO,KAEXC,OAAQ,CACJF,IAAK,EACLD,KAAM,QAEVI,OAAQ,CACJC,MAAO,OACPC,MAAO,GAEXC,MAAO,CACHb,KAAM,OACNc,UAAW,SAASD,EAAOE,GACvB,MAAO,qEAAuEA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pie.min.js","sources":["../../source/jquery.flot.pie.js"],"sourcesContent":["/* Flot plugin for rendering pie charts.\n\nCopyright (c) 2007-2014 IOLA and Ole Laursen.\nLicensed under the MIT license.\n\nThe plugin assumes that each series has a single data value, and that each\nvalue is a positive integer or zero. Negative numbers don't make sense for a\npie chart, and have unpredictable results. The values do NOT need to be\npassed in as percentages; the plugin will calculate the total and per-slice\npercentages internally.\n\n* Created by Brian Medendorp\n\n* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars\n\nThe plugin supports these options:\n\n series: {\n pie: {\n show: true/false\n radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'\n innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect\n startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result\n tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)\n offset: {\n top: integer value to move the pie up or down\n left: integer value to move the pie left or right, or 'auto'\n },\n stroke: {\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')\n width: integer pixel width of the stroke\n },\n label: {\n show: true/false, or 'auto'\n formatter: a user-defined function that modifies the text/style of the label text\n radius: 0-1 for percentage of fullsize, or a specified pixel length\n background: {\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')\n opacity: 0-1\n },\n threshold: 0-1 for the percentage value at which to hide labels (if they're too small)\n },\n combine: {\n threshold: 0-1 for the percentage value at which to combine slices (if they're too small)\n color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined\n label: any text value of what the combined slice should be labeled\n }\n highlight: {\n opacity: 0-1\n }\n }\n }\n\nMore detail and specific examples can be found in the included HTML file.\n\n*/\n\nimport { plugins } from './jquery.flot.js';\nimport { extend, bind, unbind, trigger, width, height } from './helpers.js';\n\n // Maximum redraw attempts when fitting labels within the plot\n\n var REDRAW_ATTEMPTS = 10;\n\n // Factor by which to shrink the pie when fitting labels within the plot\n\n var REDRAW_SHRINK = 0.95;\n\n function init(plot) {\n var canvas = null,\n target = null,\n options = null,\n maxRadius = null,\n centerLeft = null,\n centerTop = null,\n processed = false,\n ctx = null;\n\n // interactive variables\n\n var highlights = [];\n\n // add hook to determine if pie plugin in enabled, and then perform necessary operations\n\n plot.hooks.processOptions.push(function(plot, options) {\n if (options.series.pie.show) {\n options.grid.show = false;\n\n // set labels.show\n\n if (options.series.pie.label.show === \"auto\") {\n if (options.legend.show) {\n options.series.pie.label.show = false;\n } else {\n options.series.pie.label.show = true;\n }\n }\n\n // set radius\n\n if (options.series.pie.radius === \"auto\") {\n if (options.series.pie.label.show) {\n options.series.pie.radius = 3 / 4;\n } else {\n options.series.pie.radius = 1;\n }\n }\n\n // ensure sane tilt\n\n if (options.series.pie.tilt > 1) {\n options.series.pie.tilt = 1;\n } else if (options.series.pie.tilt < 0) {\n options.series.pie.tilt = 0;\n }\n }\n });\n\n plot.hooks.bindEvents.push(function(plot, eventHolder) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n if (options.grid.hoverable) {\n unbind(eventHolder, \"mousemove\");\n bind(eventHolder, \"mousemove\", onMouseMove);\n bind(eventHolder, \"mouseleave\", onMouseMove);\n }\n if (options.grid.clickable) {\n unbind(eventHolder, \"click\");\n bind(eventHolder, \"click\", onClick);\n }\n }\n });\n\n plot.hooks.shutdown.push(function (plot, eventHolder) {\n unbind(eventHolder, \"mousemove\", onMouseMove);\n unbind(eventHolder, \"mouseleave\", onMouseMove);\n unbind(eventHolder, \"click\", onClick);\n highlights = [];\n });\n\n plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n processDatapoints(plot, series, datapoints);\n }\n });\n\n plot.hooks.drawOverlay.push(function(plot, octx) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n drawOverlay(plot, octx);\n }\n });\n\n plot.hooks.draw.push(function(plot, newCtx) {\n var options = plot.getOptions();\n if (options.series.pie.show) {\n draw(plot, newCtx);\n }\n });\n\n function processDatapoints(plot, series, datapoints) {\n if (!processed) {\n processed = true;\n canvas = plot.getCanvas();\n target = canvas.parentElement;\n options = plot.getOptions();\n plot.setData(combine(plot.getData()));\n }\n }\n\n function combine(data) {\n var total = 0,\n combined = 0,\n numCombined = 0,\n color = options.series.pie.combine.color,\n newdata = [],\n i,\n value;\n\n // Fix up the raw data from Flot, ensuring the data is numeric\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data;\n\n // If the data is an array, we'll assume that it's a standard\n // Flot x-y pair, and are concerned only with the second value.\n\n // Note how we use the original array, rather than creating a\n // new one; this is more efficient and preserves any extra data\n // that the user may have stored in higher indexes.\n\n if (Array.isArray(value) && value.length === 1) {\n value = value[0];\n }\n\n if (Array.isArray(value)) {\n // Equivalent to $.isNumeric() but compatible with jQuery < 1.7\n if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {\n value[1] = +value[1];\n } else {\n value[1] = 0;\n }\n } else if (!isNaN(parseFloat(value)) && isFinite(value)) {\n value = [1, +value];\n } else {\n value = [1, 0];\n }\n\n data[i].data = [value];\n }\n\n // Sum up all the slices, so we can calculate percentages for each\n\n for (i = 0; i < data.length; ++i) {\n total += data[i].data[0][1];\n }\n\n // Count the number of slices with percentages below the combine\n // threshold; if it turns out to be just one, we won't combine.\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data[0][1];\n if (value / total <= options.series.pie.combine.threshold) {\n combined += value;\n numCombined++;\n if (!color) {\n color = data[i].color;\n }\n }\n }\n\n for (i = 0; i < data.length; ++i) {\n value = data[i].data[0][1];\n if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {\n newdata.push(\n extend(data[i], { /* extend to allow keeping all other original data values\n and using them e.g. in labelFormatter. */\n data: [[1, value]],\n color: data[i].color,\n label: data[i].label,\n angle: value * Math.PI * 2 / total,\n percent: value / (total / 100)\n })\n );\n }\n }\n\n if (numCombined > 1) {\n newdata.push({\n data: [[1, combined]],\n color: color,\n label: options.series.pie.combine.label,\n angle: combined * Math.PI * 2 / total,\n percent: combined / (total / 100)\n });\n }\n\n return newdata;\n }\n\n function draw(plot, newCtx) {\n if (!target) {\n return; // if no series were passed\n }\n\n var canvasWidth = width(plot.getPlaceholder()),\n canvasHeight = height(plot.getPlaceholder()),\n legendEl = target.querySelector(\".legend\"),\n legendWidth = legendEl && legendEl.firstElementChild ? legendEl.firstElementChild.clientWidth : 0;\n\n ctx = newCtx;\n\n // WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!\n\n // When combining smaller slices into an 'other' slice, we need to\n // add a new series. Since Flot gives plugins no way to modify the\n // list of series, the pie plugin uses a hack where the first call\n // to processDatapoints results in a call to setData with the new\n // list of series, then subsequent processDatapoints do nothing.\n\n // The plugin-global 'processed' flag is used to control this hack;\n // it starts out false, and is set to true after the first call to\n // processDatapoints.\n\n // Unfortunately this turns future setData calls into no-ops; they\n // call processDatapoints, the flag is true, and nothing happens.\n\n // To fix this we'll set the flag back to false here in draw, when\n // all series have been processed, so the next sequence of calls to\n // processDatapoints once again starts out with a slice-combine.\n // This is really a hack; in 0.9 we need to give plugins a proper\n // way to modify series before any processing begins.\n\n processed = false;\n\n // calculate maximum radius and center point\n maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;\n centerTop = canvasHeight / 2 + options.series.pie.offset.top;\n centerLeft = canvasWidth / 2;\n\n if (options.series.pie.offset.left === \"auto\") {\n if (options.legend.position.match(\"w\")) {\n centerLeft += legendWidth / 2;\n } else {\n centerLeft -= legendWidth / 2;\n }\n if (centerLeft < maxRadius) {\n centerLeft = maxRadius;\n } else if (centerLeft > canvasWidth - maxRadius) {\n centerLeft = canvasWidth - maxRadius;\n }\n } else {\n centerLeft += options.series.pie.offset.left;\n }\n\n var slices = plot.getData(),\n attempts = 0;\n\n // Keep shrinking the pie's radius until drawPie returns true,\n // indicating that all the labels fit, or we try too many times.\n do {\n if (attempts > 0) {\n maxRadius *= REDRAW_SHRINK;\n }\n attempts += 1;\n clear();\n if (options.series.pie.tilt <= 0.8) {\n drawShadow();\n }\n } while (!drawPie() && attempts < REDRAW_ATTEMPTS)\n\n if (attempts >= REDRAW_ATTEMPTS) {\n clear();\n var errorDiv = document.createElement('div');\n errorDiv.className = 'error';\n errorDiv.textContent = 'Could not draw pie with labels contained inside canvas';\n target.insertBefore(errorDiv, target.firstChild);\n }\n\n if (plot.setSeries && plot.insertLegend) {\n plot.setSeries(slices);\n plot.insertLegend();\n }\n\n // we're actually done at this point, just defining internal functions at this point\n function clear() {\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n var labels = target.querySelectorAll(\".pieLabel, .pieLabelBackground\");\n for (var li = 0; li < labels.length; li++) {\n labels[li].remove();\n }\n }\n\n function drawShadow() {\n var shadowLeft = options.series.pie.shadow.left;\n var shadowTop = options.series.pie.shadow.top;\n var edge = 10;\n var alpha = options.series.pie.shadow.alpha;\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n\n if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {\n return; // shadow would be outside canvas, so don't draw it\n }\n\n ctx.save();\n ctx.translate(shadowLeft, shadowTop);\n ctx.globalAlpha = alpha;\n ctx.fillStyle = \"#000\";\n\n // center and rotate to starting position\n ctx.translate(centerLeft, centerTop);\n ctx.scale(1, options.series.pie.tilt);\n\n //radius -= edge;\n for (var i = 1; i <= edge; i++) {\n ctx.beginPath();\n ctx.arc(0, 0, radius, 0, Math.PI * 2, false);\n ctx.fill();\n radius -= i;\n }\n\n ctx.restore();\n }\n\n function drawPie() {\n var startAngle = Math.PI * options.series.pie.startAngle;\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n var i;\n // center and rotate to starting position\n\n ctx.save();\n ctx.translate(centerLeft, centerTop);\n ctx.scale(1, options.series.pie.tilt);\n //ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera\n\n // draw slices\n ctx.save();\n\n var currentAngle = startAngle;\n for (i = 0; i < slices.length; ++i) {\n slices[i].startAngle = currentAngle;\n drawSlice(slices[i].angle, slices[i].color, true);\n }\n\n ctx.restore();\n\n // draw slice outlines\n if (options.series.pie.stroke.width > 0) {\n ctx.save();\n ctx.lineWidth = options.series.pie.stroke.width;\n currentAngle = startAngle;\n for (i = 0; i < slices.length; ++i) {\n drawSlice(slices[i].angle, options.series.pie.stroke.color, false);\n }\n\n ctx.restore();\n }\n\n // draw donut hole\n drawDonutHole(ctx);\n\n ctx.restore();\n\n // Draw the labels, returning true if they fit within the plot\n if (options.series.pie.label.show) {\n return drawLabels();\n } else return true;\n\n function drawSlice(angle, color, fill) {\n if (angle <= 0 || isNaN(angle)) {\n return;\n }\n\n if (fill) {\n ctx.fillStyle = color;\n } else {\n ctx.strokeStyle = color;\n ctx.lineJoin = \"round\";\n }\n\n ctx.beginPath();\n if (Math.abs(angle - Math.PI * 2) > 0.000000001) {\n ctx.moveTo(0, 0); // Center of the pie\n }\n\n //ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera\n ctx.arc(0, 0, radius, currentAngle, currentAngle + angle / 2, false);\n ctx.arc(0, 0, radius, currentAngle + angle / 2, currentAngle + angle, false);\n ctx.closePath();\n //ctx.rotate(angle); // This doesn't work properly in Opera\n currentAngle += angle;\n\n if (fill) {\n ctx.fill();\n } else {\n ctx.stroke();\n }\n }\n\n function drawLabels() {\n var currentAngle = startAngle;\n var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;\n\n for (var i = 0; i < slices.length; ++i) {\n if (slices[i].percent >= options.series.pie.label.threshold * 100) {\n if (!drawLabel(slices[i], currentAngle, i)) {\n return false;\n }\n }\n currentAngle += slices[i].angle;\n }\n\n return true;\n\n function drawLabel(slice, startAngle, index) {\n if (slice.data[0][1] === 0) {\n return true;\n }\n\n // format label text\n var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;\n\n if (lf) {\n text = lf(slice.label, slice);\n } else {\n text = slice.label;\n }\n\n if (plf) {\n text = plf(text, slice);\n }\n\n var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;\n var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);\n var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;\n\n var labelSpan = document.createElement('span');\n labelSpan.className = 'pieLabel';\n labelSpan.id = 'pieLabel' + index;\n labelSpan.style.position = 'absolute';\n labelSpan.style.top = y + 'px';\n labelSpan.style.left = x + 'px';\n labelSpan.innerHTML = text;\n target.appendChild(labelSpan);\n\n var label = target.querySelector(\"#pieLabel\" + index);\n var labelTop = (y - label.clientHeight / 2);\n var labelLeft = (x - label.clientWidth / 2);\n\n label.style.top = labelTop + 'px';\n label.style.left = labelLeft + 'px';\n\n // check to make sure that the label is not outside the canvas\n if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.clientHeight) < 0 || canvasWidth - (labelLeft + label.clientWidth) < 0) {\n return false;\n }\n\n if (options.series.pie.label.background.opacity !== 0) {\n // put in the transparent background separately to avoid blended labels and label boxes\n var c = options.series.pie.label.background.color;\n if (c == null) {\n c = slice.color;\n }\n\n var bgDiv = document.createElement('div');\n bgDiv.className = 'pieLabelBackground';\n bgDiv.style.cssText = 'position:absolute;width:' + label.clientWidth + 'px;height:' + label.clientHeight + 'px;top:' + labelTop + 'px;left:' + labelLeft + 'px;background-color:' + c + ';';\n bgDiv.style.opacity = options.series.pie.label.background.opacity;\n label.parentNode.insertBefore(bgDiv, label);\n }\n\n return true;\n } // end individual label function\n } // end drawLabels function\n } // end drawPie function\n } // end draw function\n\n // Placed here because it needs to be accessed from multiple locations\n\n function drawDonutHole(layer) {\n // The closure-scoped `options` is set by the processDatapoints\n // hook on first draw, but drawDonutHole can be reached from\n // paths that fire before that hook, leaving `options` null.\n // Read it eagerly. Upstream flot/flot#1559.\n var options = plot.getOptions();\n if (options.series.pie.innerRadius > 0) {\n // subtract the center\n layer.save();\n var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;\n layer.globalCompositeOperation = \"destination-out\"; // this does not work with excanvas, but it will fall back to using the stroke color\n layer.beginPath();\n layer.fillStyle = options.series.pie.stroke.color;\n layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);\n layer.fill();\n layer.closePath();\n layer.restore();\n\n // add inner stroke\n layer.save();\n layer.beginPath();\n layer.strokeStyle = options.series.pie.stroke.color;\n layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);\n layer.stroke();\n layer.closePath();\n layer.restore();\n\n // TODO: add extra shadow inside hole (with a mask) if the pie is tilted.\n }\n }\n\n //-- Additional Interactive related functions --\n\n function isPointInPoly(poly, pt) {\n for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {\n ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) ||\n (poly[j][1] <= pt[1] && pt[1] < poly[i][1])) &&\n (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) &&\n (c = !c);\n }\n return c;\n }\n\n function findNearbySlice(mouseX, mouseY) {\n var slices = plot.getData(),\n options = plot.getOptions(),\n radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,\n x, y;\n\n for (var i = 0; i < slices.length; ++i) {\n var s = slices[i];\n if (s.pie.show) {\n ctx.save();\n ctx.beginPath();\n ctx.moveTo(0, 0); // Center of the pie\n //ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.\n ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);\n ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);\n ctx.closePath();\n x = mouseX - centerLeft;\n y = mouseY - centerTop;\n\n if (ctx.isPointInPath) {\n if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {\n ctx.restore();\n return {\n datapoint: [s.percent, s.data],\n dataIndex: 0,\n series: s,\n seriesIndex: i\n };\n }\n } else {\n // excanvas for IE doesn;t support isPointInPath, this is a workaround.\n var p1X = radius * Math.cos(s.startAngle),\n p1Y = radius * Math.sin(s.startAngle),\n p2X = radius * Math.cos(s.startAngle + s.angle / 4),\n p2Y = radius * Math.sin(s.startAngle + s.angle / 4),\n p3X = radius * Math.cos(s.startAngle + s.angle / 2),\n p3Y = radius * Math.sin(s.startAngle + s.angle / 2),\n p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),\n p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),\n p5X = radius * Math.cos(s.startAngle + s.angle),\n p5Y = radius * Math.sin(s.startAngle + s.angle),\n arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],\n arrPoint = [x, y];\n\n // TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?\n\n if (isPointInPoly(arrPoly, arrPoint)) {\n ctx.restore();\n return {\n datapoint: [s.percent, s.data],\n dataIndex: 0,\n series: s,\n seriesIndex: i\n };\n }\n }\n\n ctx.restore();\n }\n }\n\n return null;\n }\n\n function onMouseMove(e) {\n triggerClickHoverEvent(\"plothover\", e);\n }\n\n function onClick(e) {\n triggerClickHoverEvent(\"plotclick\", e);\n }\n\n // trigger click or hover event (they send the same parameters so we share their code)\n\n function triggerClickHoverEvent(eventname, e) {\n // See drawDonutHole above: read `options` fresh in case the\n // event fires before processDatapoints has run.\n var options = plot.getOptions();\n var offset = plot.offset();\n var canvasX = parseInt(e.pageX - offset.left);\n var canvasY = parseInt(e.pageY - offset.top);\n var item = findNearbySlice(canvasX, canvasY);\n\n if (options.grid.autoHighlight) {\n // clear auto-highlights\n for (var i = 0; i < highlights.length; ++i) {\n var h = highlights[i];\n if (h.auto === eventname && !(item && h.series === item.series)) {\n unhighlight(h.series);\n }\n }\n }\n\n // highlight the slice\n\n if (item) {\n highlight(item.series, eventname);\n }\n\n // trigger any hover bind events\n\n var pos = { pageX: e.pageX, pageY: e.pageY };\n trigger(target, eventname, [pos, item]);\n }\n\n function highlight(s, auto) {\n //if (typeof s == \"number\") {\n // s = series[s];\n //}\n\n var i = indexOfHighlight(s);\n\n if (i === -1) {\n highlights.push({ series: s, auto: auto });\n plot.triggerRedrawOverlay();\n } else if (!auto) {\n highlights[i].auto = false;\n }\n }\n\n function unhighlight(s) {\n if (s == null) {\n highlights = [];\n plot.triggerRedrawOverlay();\n }\n\n //if (typeof s == \"number\") {\n // s = series[s];\n //}\n\n var i = indexOfHighlight(s);\n\n if (i !== -1) {\n highlights.splice(i, 1);\n plot.triggerRedrawOverlay();\n }\n }\n\n function indexOfHighlight(s) {\n for (var i = 0; i < highlights.length; ++i) {\n var h = highlights[i];\n if (h.series === s) {\n return i;\n }\n }\n return -1;\n }\n\n function drawOverlay(plot, octx) {\n var options = plot.getOptions();\n var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;\n\n octx.save();\n octx.translate(centerLeft, centerTop);\n octx.scale(1, options.series.pie.tilt);\n\n for (var i = 0; i < highlights.length; ++i) {\n drawHighlight(highlights[i].series);\n }\n\n drawDonutHole(octx);\n\n octx.restore();\n\n function drawHighlight(series) {\n if (series.angle <= 0 || isNaN(series.angle)) {\n return;\n }\n\n //octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();\n octx.fillStyle = \"rgba(255, 255, 255, \" + options.series.pie.highlight.opacity + \")\"; // this is temporary until we have access to parseColor\n octx.beginPath();\n if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {\n octx.moveTo(0, 0); // Center of the pie\n }\n octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);\n octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);\n octx.closePath();\n octx.fill();\n }\n }\n } // end init (plugin body)\n\n // define pie specific options and their default values\n var options = {\n series: {\n pie: {\n show: false,\n radius: \"auto\", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)\n innerRadius: 0, /* for donut */\n startAngle: 3 / 2,\n tilt: 1,\n shadow: {\n left: 5, // shadow left offset\n top: 15, // shadow top offset\n alpha: 0.02 // shadow alpha\n },\n offset: {\n top: 0,\n left: \"auto\"\n },\n stroke: {\n color: \"#fff\",\n width: 1\n },\n label: {\n show: \"auto\",\n formatter: function(label, slice) {\n return \"<div style='font-size:x-small;text-align:center;padding:2px;color:\" + slice.color + \";'>\" + label + \"<br/>\" + Math.round(slice.percent) + \"%</div>\";\n }, // formatter function\n radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)\n background: {\n color: null,\n opacity: 0\n },\n threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)\n },\n combine: {\n threshold: -1, // percentage at which to combine little slices into one larger slice\n color: null, // color to give the new slice (auto-generated if null)\n label: \"Other\" // label to give the new slice\n },\n highlight: {\n //color: \"#fff\", // will add this functionality once parseColor is available\n opacity: 0.5\n }\n }\n }\n };\n\n plugins.push({\n init: init,\n options: options,\n name: \"pie\",\n version: \"1.1\"\n });\n"],"names":["options","series","pie","show","radius","innerRadius","startAngle","tilt","shadow","left","top","alpha","offset","stroke","color","width","label","formatter","slice","Math","round","percent","background","opacity","threshold","combine","highlight","plugins","push","init","plot","canvas","target","maxRadius","centerLeft","centerTop","processed","ctx","highlights","drawDonutHole","layer","getOptions","save","globalCompositeOperation","beginPath","fillStyle","arc","PI","fill","closePath","restore","strokeStyle","isPointInPoly","poly","pt","c","i","l","length","j","onMouseMove","e","triggerClickHoverEvent","onClick","eventname","item","mouseX","mouseY","x","y","slices","getData","s","moveTo","angle","isPointInPath","datapoint","data","dataIndex","seriesIndex","cos","sin","findNearbySlice","parseInt","pageX","pageY","grid","autoHighlight","h","auto","unhighlight","indexOfHighlight","triggerRedrawOverlay","pos","trigger","splice","hooks","processOptions","legend","bindEvents","eventHolder","hoverable","unbind","bind","clickable","shutdown","processDatapoints","datapoints","getCanvas","parentElement","setData","value","total","combined","numCombined","newdata","Array","isArray","isNaN","parseFloat","isFinite","extend","drawOverlay","octx","translate","scale","drawHighlight","abs","draw","newCtx","canvasWidth","getPlaceholder","canvasHeight","height","legendEl","querySelector","legendWidth","firstElementChild","clientWidth","min","position","match","attempts","clear","drawShadow","drawPie","errorDiv","document","createElement","className","textContent","insertBefore","firstChild","setSeries","insertLegend","clearRect","labels","querySelectorAll","li","remove","shadowLeft","shadowTop","globalAlpha","currentAngle","drawSlice","lineWidth","drawLabel","index","text","lf","labelFormatter","plf","halfAngle","labelSpan","id","style","innerHTML","appendChild","labelTop","clientHeight","labelLeft","bgDiv","cssText","parentNode","drawLabels","lineJoin","name","version"],"mappings":"4BA+vBI,IAAIA,EAAU,CACVC,OAAQ,CACJC,IAAK,CACDC,MAAM,EACNC,OAAQ,OACRC,YAAa,EACbC,WAAY,IACZC,KAAM,EACNC,OAAQ,CACJC,KAAM,EACNC,IAAK,GACLC,MAAO,KAEXC,OAAQ,CACJF,IAAK,EACLD,KAAM,QAEVI,OAAQ,CACJC,MAAO,OACPC,MAAO,GAEXC,MAAO,CACHb,KAAM,OACNc,UAAW,SAASD,EAAOE,GACvB,MAAO,qEAAuEA,EAAMJ,MAAQ,MAAQE,EAAQ,QAAUG,KAAKC,MAAMF,EAAMG,SAAW,SACtJ,EACAjB,OAAQ,EACRkB,WAAY,CACRR,MAAO,KACPS,QAAS,GAEbC,UAAW,GAEfC,QAAS,CACLD,WAAW,EACXV,MAAO,KACPE,MAAO,SAEXU,UAAW,CAEPH,QAAS,OAMzBI,EAAAA,QAAQC,KAAK,CACTC,KA1uBJ,SAAcC,GACV,IAAIC,EAAS,KACTC,EAAS,KACThC,EAAU,KACViC,EAAY,KACZC,EAAa,KACbC,EAAY,KACZC,GAAY,EACZC,EAAM,KAINC,EAAa,GA4cjB,SAASC,EAAcC,GAKnB,IAAIxC,EAAU8B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H,YAAc,aAAe1H,EAAMmK,aAAe,UAAYD,EAAW,WAAaE,EAAY,uBAAyB7H,EAAI,IACxL8H,EAAMN,MAAMxJ,QAAUvB,EAAQC,OAAOC,IAAIc,MAAMM,WAAWC,QAC1DP,EAAMuK,WAAWhC,aAAa8B,EAAOrK,EACzC,CAEA,OAAO,CACX,CACJ,CA5GWwK,GAGX,SAASpB,EAAU1F,EAAO5D,EAAOkC,GACzB0B,GAAS,GAAK4C,MAAM5C,KAIpB1B,EACAX,EAAIQ,UAAY/B,GAEhBuB,EAAIc,YAAcrC,EAClBuB,EAAIoJ,SAAW,SAGnBpJ,EAAIO,YACAzB,KAAK4G,IAAIrD,EAAkB,EAAVvD,KAAK4B,IAAU,MAChCV,EAAIoC,OAAO,EAAG,GAIlBpC,EAAIS,IAAI,EAAG,EAAG1C,EAAQ+J,EAAcA,EAAezF,EAAQ,GAAG,GAC9DrC,EAAIS,IAAI,EAAG,EAAG1C,EAAQ+J,EAAezF,EAAQ,EAAGyF,EAAezF,GAAO,GACtErC,EAAIY,YAEJkH,GAAgBzF,EAEZ1B,EACAX,EAAIW,OAEJX,EAAIxB,SAEZ,CA6EJ,CACJ,CA3XQmH,CAAKlG,EAAMmG,EAEnB,EA6lBJ,EAmDIjI,QAASA,EACT0L,KAAM,MACNC,QAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevinburke/flot",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "JavaScript plotting library for engineering and scientific applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/flot.js",
|
|
@@ -19,7 +19,15 @@
|
|
|
19
19
|
"default": "./dist/jquery.flot.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/",
|
|
24
|
+
"source/",
|
|
25
|
+
"types/",
|
|
26
|
+
"docs/",
|
|
27
|
+
"CHANGELOG.md",
|
|
28
|
+
"LICENSE.txt",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
23
31
|
"scripts": {
|
|
24
32
|
"prepack": "npx rollup --config rollup.config.js"
|
|
25
33
|
},
|
|
@@ -41,18 +49,18 @@
|
|
|
41
49
|
}
|
|
42
50
|
},
|
|
43
51
|
"devDependencies": {
|
|
44
|
-
"@biomejs/biome": "^
|
|
52
|
+
"@biomejs/biome": "^2.4.12",
|
|
45
53
|
"@playwright/test": "^1.59.1",
|
|
46
54
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
47
55
|
"@rollup/plugin-terser": "^1.0.0",
|
|
48
56
|
"@size-limit/file": "^12.0.1",
|
|
49
57
|
"@types/jquery": "^4.0.0",
|
|
50
|
-
"happy-dom": "^
|
|
51
|
-
"jquery": "^
|
|
58
|
+
"happy-dom": "^20.9.0",
|
|
59
|
+
"jquery": "^4.0.0",
|
|
52
60
|
"rollup": "^4.60.1",
|
|
53
61
|
"size-limit": "^12.0.1",
|
|
54
62
|
"terser": "^5.36.0",
|
|
55
63
|
"typescript": "^6.0.2",
|
|
56
|
-
"vitest": "^
|
|
64
|
+
"vitest": "^4.1.4"
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -496,10 +496,16 @@ var Canvas = function(cls, container) {
|
|
|
496
496
|
var styleCache = layerCache[styleKey];
|
|
497
497
|
for (var key in styleCache) {
|
|
498
498
|
if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
|
|
499
|
+
// styleCache entries can exist without a
|
|
500
|
+
// positions array (e.g. when a Flot plugin
|
|
501
|
+
// populates the cache outside the normal
|
|
502
|
+
// addText path). Upstream flot/flot#1444.
|
|
499
503
|
var positions = styleCache[key].positions;
|
|
500
|
-
positions
|
|
501
|
-
position
|
|
502
|
-
|
|
504
|
+
if (positions != null) {
|
|
505
|
+
positions.forEach(function(position) {
|
|
506
|
+
position.active = false;
|
|
507
|
+
});
|
|
508
|
+
}
|
|
503
509
|
}
|
|
504
510
|
}
|
|
505
511
|
}
|
package/source/jquery.flot.js
CHANGED
|
@@ -1660,8 +1660,11 @@ import { drawSeries as drawSeriesModule } from './jquery.flot.drawSeries.js';
|
|
|
1660
1660
|
};
|
|
1661
1661
|
|
|
1662
1662
|
// we might need an extra decimal since forced
|
|
1663
|
-
// ticks don't necessarily fit naturally
|
|
1664
|
-
|
|
1663
|
+
// ticks don't necessarily fit naturally.
|
|
1664
|
+
// Guard against axis.delta <= 0 (min == max): Math.log(0)
|
|
1665
|
+
// is -Infinity, so extraDec would be +Infinity and
|
|
1666
|
+
// toFixed(Infinity) throws. Upstream #1869 / PR #1870.
|
|
1667
|
+
if (!axis.mode && opts.tickDecimals == null && axis.delta > 0) {
|
|
1665
1668
|
var extraDec = Math.max(0, -Math.floor(Math.log(axis.delta) / Math.LN10) + 1),
|
|
1666
1669
|
ts = axis.tickGenerator(axis, plot);
|
|
1667
1670
|
|
|
@@ -2576,7 +2579,13 @@ import { drawSeries as drawSeriesModule } from './jquery.flot.drawSeries.js';
|
|
|
2576
2579
|
maxy = maxDistance / series.yaxis.scale,
|
|
2577
2580
|
points = series.datapoints.points,
|
|
2578
2581
|
ps = series.datapoints.pointsize,
|
|
2579
|
-
|
|
2582
|
+
// Seed with maxDistance (or its square, matching the
|
|
2583
|
+
// default squared-distance metric) so points outside
|
|
2584
|
+
// the hover radius are never selected. Without this,
|
|
2585
|
+
// the maxx/maxy coordinate-space pre-filter is the
|
|
2586
|
+
// only radius check, and it's disabled for axes with
|
|
2587
|
+
// inverseTransform — see upstream flot/flot#1871.
|
|
2588
|
+
smallestDistance = computeDistance ? maxDistance : maxDistance * maxDistance;
|
|
2580
2589
|
|
|
2581
2590
|
// with inverse transforms, we can't use the maxx/maxy
|
|
2582
2591
|
// optimization, sadly
|
|
@@ -2776,7 +2785,16 @@ import { drawSeries as drawSeriesModule } from './jquery.flot.drawSeries.js';
|
|
|
2776
2785
|
} else {
|
|
2777
2786
|
// assume this is a gradient spec; IE currently only
|
|
2778
2787
|
// supports a simple vertical gradient properly, so that's
|
|
2779
|
-
// what we support too
|
|
2788
|
+
// what we support too.
|
|
2789
|
+
// createLinearGradient throws if any coordinate is NaN or
|
|
2790
|
+
// ±Infinity (e.g. when the plot container has zero size
|
|
2791
|
+
// or the user supplies bogus bounds) — fall back to the
|
|
2792
|
+
// default solid color instead. Global isFinite coerces
|
|
2793
|
+
// null → 0 (finite), matching the drawSeriesPoints path
|
|
2794
|
+
// that passes (null, null). Upstream flot/flot#1867.
|
|
2795
|
+
if (!isFinite(top) || !isFinite(bottom)) {
|
|
2796
|
+
return defaultColor;
|
|
2797
|
+
}
|
|
2780
2798
|
var gradient = ctx.createLinearGradient(0, top, 0, bottom);
|
|
2781
2799
|
|
|
2782
2800
|
for (var i = 0, l = spec.colors.length; i < l; ++i) {
|
|
@@ -2804,7 +2822,7 @@ import { drawSeries as drawSeriesModule } from './jquery.flot.drawSeries.js';
|
|
|
2804
2822
|
// Plugin registry. Plugins push to this array to register themselves.
|
|
2805
2823
|
export var plugins = [];
|
|
2806
2824
|
|
|
2807
|
-
export var version = "5.1.
|
|
2825
|
+
export var version = "5.1.1";
|
|
2808
2826
|
|
|
2809
2827
|
// The main plot function.
|
|
2810
2828
|
export function plot(placeholder, data, options) {
|
|
@@ -119,6 +119,17 @@ import { plugins } from './jquery.flot.js';
|
|
|
119
119
|
shape.strokeWidth = entry.options.points.lineWidth;
|
|
120
120
|
iconHtml += getEntryIconHtml(shape);
|
|
121
121
|
}
|
|
122
|
+
// fallback for plugin-drawn series (pie, errorbars, etc.)
|
|
123
|
+
// that don't turn on any of lines/bars/points — without
|
|
124
|
+
// this the legend entry has a label but no icon. Upstream
|
|
125
|
+
// flot/flot#1641, minus the switch to `else if` so series
|
|
126
|
+
// that deliberately overlay (e.g. lines + points) keep
|
|
127
|
+
// rendering both icons.
|
|
128
|
+
if (iconHtml === '') {
|
|
129
|
+
shape.name = 'box';
|
|
130
|
+
shape.fillColor = entry.color;
|
|
131
|
+
iconHtml += getEntryIconHtml(shape);
|
|
132
|
+
}
|
|
122
133
|
|
|
123
134
|
labelHtml = '<text x="' + shape.xPos + '" y="' + shape.yPos + '" text-anchor="start"><tspan dx="2em" dy="1.2em">' + shape.label + '</tspan></text>'
|
|
124
135
|
html[j++] = '<g>' + iconHtml + labelHtml + '</g>';
|
|
@@ -158,9 +169,17 @@ import { plugins } from './jquery.flot.js';
|
|
|
158
169
|
legendEl.style.pointerEvents = 'none';
|
|
159
170
|
placeholder.appendChild(legendEl);
|
|
160
171
|
} else {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
// Accept either a DOM Element or a jQuery-wrapped container.
|
|
173
|
+
// Upstream flot/flot#1750 switched to `$(container).get(0)` to
|
|
174
|
+
// always land on the underlying element; since this fork is
|
|
175
|
+
// jQuery-optional, do the unwrap inline.
|
|
176
|
+
var container = options.legend.container;
|
|
177
|
+
if (container && typeof container.get === 'function' && container[0]) {
|
|
178
|
+
container = container[0];
|
|
179
|
+
}
|
|
180
|
+
container.innerHTML = html.join('');
|
|
181
|
+
container.style.width = width + 'px';
|
|
182
|
+
container.style.height = height + 'em';
|
|
164
183
|
}
|
|
165
184
|
}
|
|
166
185
|
|
|
@@ -254,6 +273,14 @@ import { plugins } from './jquery.flot.js';
|
|
|
254
273
|
'width="1.5em" height="1.5em"' +
|
|
255
274
|
'/>';
|
|
256
275
|
break;
|
|
276
|
+
case 'box':
|
|
277
|
+
html = '<use xlink:href="#box" class="legendIcon" ' +
|
|
278
|
+
'x="' + x + '" ' +
|
|
279
|
+
'y="' + y + '" ' +
|
|
280
|
+
'fill="' + fill + '" ' +
|
|
281
|
+
'width="1.5em" height="1.5em"' +
|
|
282
|
+
'/>';
|
|
283
|
+
break;
|
|
257
284
|
default:
|
|
258
285
|
// default is circle
|
|
259
286
|
html = '<use xlink:href="#circle" class="legendIcon" ' +
|
|
@@ -276,6 +303,12 @@ import { plugins } from './jquery.flot.js';
|
|
|
276
303
|
'<polyline points="0,15 5,5 10,10 15,0"/>' +
|
|
277
304
|
'</symbol>' +
|
|
278
305
|
|
|
306
|
+
// Fallback icon for plugin-drawn series that don't turn on
|
|
307
|
+
// any of lines / bars / points. Upstream flot/flot#1641.
|
|
308
|
+
'<symbol id="box" stroke-width="1" viewBox="-5 -5 25 25">' +
|
|
309
|
+
'<rect x="0" y="0" width="15" height="15"/>' +
|
|
310
|
+
'</symbol>' +
|
|
311
|
+
|
|
279
312
|
'<symbol id="area" stroke-width="1" viewBox="-5 -5 25 25">' +
|
|
280
313
|
'<polyline points="0,15 5,5 10,10 15,0, 15,15, 0,15"/>' +
|
|
281
314
|
'</symbol>' +
|
|
@@ -555,6 +555,17 @@ import { bind, unbind, trigger, css } from './helpers.js';
|
|
|
555
555
|
var minD = axis.p2c(opts.panRange[0]) - axis.p2c(axis.min);
|
|
556
556
|
// calc max delta (revealing right edge of plot)
|
|
557
557
|
var maxD = axis.p2c(opts.panRange[1]) - axis.p2c(axis.max);
|
|
558
|
+
// For the y-axis, screen coordinates are inverted
|
|
559
|
+
// (p2c(smaller v) > p2c(larger v)), so minD/maxD end up
|
|
560
|
+
// with the opposite signs from the x-axis case. Swap
|
|
561
|
+
// them so the clamp comparisons below keep their
|
|
562
|
+
// x-axis semantics. Upstream flot/flot#1789, ports the
|
|
563
|
+
// minimal form of PR #1793.
|
|
564
|
+
if (axis.direction === 'y') {
|
|
565
|
+
var swap = minD;
|
|
566
|
+
minD = maxD;
|
|
567
|
+
maxD = swap;
|
|
568
|
+
}
|
|
558
569
|
// limit delta to min or max if enabled
|
|
559
570
|
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD;
|
|
560
571
|
if (opts.panRange[1] !== undefined && d <= minD) d = minD;
|
|
@@ -719,6 +730,13 @@ import { bind, unbind, trigger, css } from './helpers.js';
|
|
|
719
730
|
var minD = p + axis.p2c(opts.panRange[0]) - axis.p2c(axisMin);
|
|
720
731
|
// calc max delta (revealing right edge of plot)
|
|
721
732
|
var maxD = p + axis.p2c(opts.panRange[1]) - axis.p2c(axisMax);
|
|
733
|
+
// Same y-axis swap as plot.pan — see comment there.
|
|
734
|
+
// Upstream flot/flot#1789 / PR #1793.
|
|
735
|
+
if (axis.direction === 'y') {
|
|
736
|
+
var swap = minD;
|
|
737
|
+
minD = maxD;
|
|
738
|
+
maxD = swap;
|
|
739
|
+
}
|
|
722
740
|
// limit delta to min or max if enabled
|
|
723
741
|
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD;
|
|
724
742
|
if (opts.panRange[1] !== undefined && d <= minD) d = minD;
|
|
@@ -539,6 +539,11 @@ import { extend, bind, unbind, trigger, width, height } from './helpers.js';
|
|
|
539
539
|
// Placed here because it needs to be accessed from multiple locations
|
|
540
540
|
|
|
541
541
|
function drawDonutHole(layer) {
|
|
542
|
+
// The closure-scoped `options` is set by the processDatapoints
|
|
543
|
+
// hook on first draw, but drawDonutHole can be reached from
|
|
544
|
+
// paths that fire before that hook, leaving `options` null.
|
|
545
|
+
// Read it eagerly. Upstream flot/flot#1559.
|
|
546
|
+
var options = plot.getOptions();
|
|
542
547
|
if (options.series.pie.innerRadius > 0) {
|
|
543
548
|
// subtract the center
|
|
544
549
|
layer.save();
|
|
@@ -651,6 +656,9 @@ import { extend, bind, unbind, trigger, width, height } from './helpers.js';
|
|
|
651
656
|
// trigger click or hover event (they send the same parameters so we share their code)
|
|
652
657
|
|
|
653
658
|
function triggerClickHoverEvent(eventname, e) {
|
|
659
|
+
// See drawDonutHole above: read `options` fresh in case the
|
|
660
|
+
// event fires before processDatapoints has run.
|
|
661
|
+
var options = plot.getOptions();
|
|
654
662
|
var offset = plot.offset();
|
|
655
663
|
var canvasX = parseInt(e.pageX - offset.left);
|
|
656
664
|
var canvasY = parseInt(e.pageY - offset.top);
|