@kevinburke/flot 5.0.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 +129 -0
- package/README.md +2 -2
- package/dist/flot.js +100 -21
- package/dist/flot.min.js +1 -1
- package/dist/flot.min.js.map +1 -1
- package/dist/flot.mjs +100 -21
- package/dist/jquery.flot.js +100 -21
- 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 +2 -2
- package/dist/plugins/jquery.flot.threshold.min.js +1 -1
- package/dist/plugins/jquery.flot.threshold.min.js.map +1 -1
- package/package.json +19 -6
- package/source/globals.d.ts +22 -0
- package/source/jquery.canvaswrapper.js +15 -9
- package/source/jquery.flot.browser.js +4 -2
- package/source/jquery.flot.composeImages.js +1 -1
- package/source/jquery.flot.js +27 -7
- package/source/jquery.flot.legend.js +36 -3
- package/source/jquery.flot.navigate.js +18 -0
- package/source/jquery.flot.pie.js +9 -1
- package/source/jquery.flot.threshold.js +1 -1
- package/types/index.d.ts +580 -0
- package/types/jquery.d.ts +37 -0
- package/types/test.ts +72 -0
- package/types/tsconfig.json +15 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @kevinburke/flot v5.
|
|
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, data, 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,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,EAAQ+J,EAAezF,EAAQ,EAAGyF,EAAezF,GAAO,GACtErC,EAAIW,YAEJmH,GAAgBzF,EAEZ3B,EACAV,EAAIU,OAEJV,EAAIxB,SAEZ,CA6EJ,CACJ,CA3XQmH,CAAKlG,EAAMmG,EAEnB,EAqlBJ,EAmDIjI,QAASA,EACT0L,KAAM,MACNC,QAAS"}
|
|
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 // 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,EAC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3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
if (y < below) p = threspoints;
|
|
79
79
|
else p = newpoints;
|
|
80
80
|
|
|
81
|
-
if (addCrossingPoints && prevp !== p &&
|
|
81
|
+
if (addCrossingPoints && prevp !== undefined && prevp !== p &&
|
|
82
82
|
x !== null && i > 0 &&
|
|
83
83
|
origpoints[i - ps] != null) {
|
|
84
84
|
var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(o,s){"use strict";o.plugins.push({init:function(o){function t(o,t,n,l,e){var h,r,i,u,p,a=n.pointsize,f=s.extend({},t);f.datapoints={points:[],pointsize:a,format:n.format},f.label=null,f.color=e,f.threshold=null,f.originSeries=t,f.data=[];var d,c=n.points,g=t.lines.show,
|
|
1
|
+
!function(o,s){"use strict";o.plugins.push({init:function(o){function t(o,t,n,l,e){var h,r,i,u,p,a=n.pointsize,f=s.extend({},t);f.datapoints={points:[],pointsize:a,format:n.format},f.label=null,f.color=e,f.threshold=null,f.originSeries=t,f.data=[];var d,c=n.points,g=t.lines.show,v=[],b=[];for(h=0;h<c.length;h+=a){if(r=c[h],p=u,u=(i=c[h+1])<l?v:b,g&&void 0!==p&&p!==u&&null!==r&&h>0&&null!=c[h-a]){var w=r+(l-i)*(r-c[h-a])/(i-c[h-a+1]);for(p.push(w),p.push(l),d=2;d<a;++d)p.push(c[h+d]);for(u.push(null),u.push(null),d=2;d<a;++d)u.push(c[h+d]);for(u.push(w),u.push(l),d=2;d<a;++d)u.push(c[h+d])}for(u.push(r),u.push(i),d=2;d<a;++d)u.push(c[h+d])}if(n.points=b,f.datapoints.points=v,f.datapoints.points.length>0){var j=o.getData().indexOf(t);o.getData().splice(j+1,0,f)}}o.hooks.processDatapoints.push(function(o,s,n){s.threshold&&(s.threshold instanceof Array?(s.threshold.sort(function(o,s){return o.below-s.below}),s.threshold.forEach(function(l){t(o,s,n,l.below,l.color)})):t(o,s,n,s.threshold.below,s.threshold.color))})},options:{series:{threshold:null}},name:"threshold",version:"1.2"})}(jquery_flot_js,helpers_js);
|
|
2
2
|
//# sourceMappingURL=jquery.flot.threshold.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jquery.flot.threshold.min.js","sources":["../../source/jquery.flot.threshold.js"],"sourcesContent":["/* Flot plugin for thresholding data.\n\nCopyright (c) 2007-2014 IOLA and Ole Laursen.\nLicensed under the MIT license.\n\nThe plugin supports these options:\n\n series: {\n threshold: {\n below: number\n color: colorspec\n }\n }\n\nIt can also be applied to a single series, like this:\n\n $.plot( $(\"#placeholder\"), [{\n data: [ ... ],\n threshold: { ... }\n }])\n\nAn array can be passed for multiple thresholding, like this:\n\n threshold: [{\n below: number1\n color: color1\n },{\n below: number2\n color: color2\n }]\n\nThese multiple threshold objects can be passed in any order since they are\nsorted by the processing function.\n\nThe data points below \"below\" are drawn with the specified color. This makes\nit easy to mark points below 0, e.g. for budget data.\n\nInternally, the plugin works by splitting the data into two series, above and\nbelow the threshold. The extra series below the threshold will have its label\ncleared and the special \"originSeries\" attribute set to the original series.\nYou may need to check for this in hover events.\n\n*/\n\nimport { plugins } from './jquery.flot.js';\nimport { extend } from './helpers.js';\n\n var options = {\n series: { threshold: null } // or { below: number, color: color spec}\n };\n\n function init(plot) {\n function thresholdData(plot, s, datapoints, below, color) {\n var ps = datapoints.pointsize, i, x, y, p, prevp,\n thresholded = extend({}, s); // note: shallow copy\n\n thresholded.datapoints = { points: [], pointsize: ps, format: datapoints.format };\n thresholded.label = null;\n thresholded.color = color;\n thresholded.threshold = null;\n thresholded.originSeries = s;\n thresholded.data = [];\n\n var origpoints = datapoints.points,\n addCrossingPoints = s.lines.show;\n\n var threspoints = [];\n var newpoints = [];\n var m;\n\n for (i = 0; i < origpoints.length; i += ps) {\n x = origpoints[i];\n y = origpoints[i + 1];\n\n prevp = p;\n if (y < below) p = threspoints;\n else p = newpoints;\n\n if (addCrossingPoints && prevp !== p &&\n x !== null && i > 0 &&\n origpoints[i - ps] != null) {\n var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]);\n prevp.push(interx);\n prevp.push(below);\n for (m = 2; m < ps; ++m) {\n prevp.push(origpoints[i + m]);\n }\n\n p.push(null); // start new segment\n p.push(null);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n\n p.push(interx);\n p.push(below);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n }\n\n p.push(x);\n p.push(y);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n }\n\n datapoints.points = newpoints;\n thresholded.datapoints.points = threspoints;\n\n if (thresholded.datapoints.points.length > 0) {\n var origIndex = plot.getData().indexOf(s);\n // Insert newly-generated series right after original one (to prevent it from becoming top-most)\n plot.getData().splice(origIndex + 1, 0, thresholded);\n }\n\n // FIXME: there are probably some edge cases left in bars\n }\n\n function processThresholds(plot, s, datapoints) {\n if (!s.threshold) return;\n if (s.threshold instanceof Array) {\n s.threshold.sort(function(a, b) {\n return a.below - b.below;\n });\n\n s.threshold.forEach(function(th) {\n thresholdData(plot, s, datapoints, th.below, th.color);\n });\n } else {\n thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color);\n }\n }\n\n plot.hooks.processDatapoints.push(processThresholds);\n }\n\n plugins.push({\n init: init,\n options: options,\n name: 'threshold',\n version: '1.2'\n });\n"],"names":["plugins","push","init","plot","thresholdData","s","datapoints","below","color","i","x","y","p","prevp","ps","pointsize","thresholded","extend","points","format","label","threshold","originSeries","data","m","origpoints","addCrossingPoints","lines","show","threspoints","newpoints","length","interx","origIndex","getData","indexOf","splice","hooks","processDatapoints","Array","sort","a","b","forEach","th","options","series","name","version"],"mappings":"4BA0IIA,EAAAA,QAAQC,KAAK,CACTC,KAxFJ,SAAcC,GACV,SAASC,EAAcD,EAAME,EAAGC,EAAYC,EAAOC,GAC/C,IAA+BC,EAAGC,EAAGC,EAAGC,EAAGC,EAAvCC,EAAKR,EAAWS,UAChBC,EAAcC,EAAAA,OAAO,GAAIZ,GAE7BW,EAAYV,WAAa,CAAEY,OAAQ,GAAIH,UAAWD,EAAIK,OAAQb,EAAWa,QACzEH,EAAYI,MAAQ,KACpBJ,EAAYR,MAAQA,EACpBQ,EAAYK,UAAY,KACxBL,EAAYM,aAAejB,EAC3BW,EAAYO,KAAO,GAEnB,IAKIC,EALAC,EAAanB,EAAWY,OACxBQ,EAAoBrB,EAAEsB,MAAMC,KAE5BC,EAAc,GACdC,EAAY,GAGhB,IAAKrB,EAAI,EAAGA,EAAIgB,EAAWM,OAAQtB,GAAKK,EAAI,CAQxC,GAPAJ,EAAIe,EAAWhB,GAGfI,EAAQD,EACOA,GAHfD,EAAIc,EAAWhB,EAAI,IAGXF,EAAWsB,EACVC,EAELJ,
|
|
1
|
+
{"version":3,"file":"jquery.flot.threshold.min.js","sources":["../../source/jquery.flot.threshold.js"],"sourcesContent":["/* Flot plugin for thresholding data.\n\nCopyright (c) 2007-2014 IOLA and Ole Laursen.\nLicensed under the MIT license.\n\nThe plugin supports these options:\n\n series: {\n threshold: {\n below: number\n color: colorspec\n }\n }\n\nIt can also be applied to a single series, like this:\n\n $.plot( $(\"#placeholder\"), [{\n data: [ ... ],\n threshold: { ... }\n }])\n\nAn array can be passed for multiple thresholding, like this:\n\n threshold: [{\n below: number1\n color: color1\n },{\n below: number2\n color: color2\n }]\n\nThese multiple threshold objects can be passed in any order since they are\nsorted by the processing function.\n\nThe data points below \"below\" are drawn with the specified color. This makes\nit easy to mark points below 0, e.g. for budget data.\n\nInternally, the plugin works by splitting the data into two series, above and\nbelow the threshold. The extra series below the threshold will have its label\ncleared and the special \"originSeries\" attribute set to the original series.\nYou may need to check for this in hover events.\n\n*/\n\nimport { plugins } from './jquery.flot.js';\nimport { extend } from './helpers.js';\n\n var options = {\n series: { threshold: null } // or { below: number, color: color spec}\n };\n\n function init(plot) {\n function thresholdData(plot, s, datapoints, below, color) {\n var ps = datapoints.pointsize, i, x, y, p, prevp,\n thresholded = extend({}, s); // note: shallow copy\n\n thresholded.datapoints = { points: [], pointsize: ps, format: datapoints.format };\n thresholded.label = null;\n thresholded.color = color;\n thresholded.threshold = null;\n thresholded.originSeries = s;\n thresholded.data = [];\n\n var origpoints = datapoints.points,\n addCrossingPoints = s.lines.show;\n\n var threspoints = [];\n var newpoints = [];\n var m;\n\n for (i = 0; i < origpoints.length; i += ps) {\n x = origpoints[i];\n y = origpoints[i + 1];\n\n prevp = p;\n if (y < below) p = threspoints;\n else p = newpoints;\n\n if (addCrossingPoints && prevp !== undefined && prevp !== p &&\n x !== null && i > 0 &&\n origpoints[i - ps] != null) {\n var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]);\n prevp.push(interx);\n prevp.push(below);\n for (m = 2; m < ps; ++m) {\n prevp.push(origpoints[i + m]);\n }\n\n p.push(null); // start new segment\n p.push(null);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n\n p.push(interx);\n p.push(below);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n }\n\n p.push(x);\n p.push(y);\n for (m = 2; m < ps; ++m) {\n p.push(origpoints[i + m]);\n }\n }\n\n datapoints.points = newpoints;\n thresholded.datapoints.points = threspoints;\n\n if (thresholded.datapoints.points.length > 0) {\n var origIndex = plot.getData().indexOf(s);\n // Insert newly-generated series right after original one (to prevent it from becoming top-most)\n plot.getData().splice(origIndex + 1, 0, thresholded);\n }\n\n // FIXME: there are probably some edge cases left in bars\n }\n\n function processThresholds(plot, s, datapoints) {\n if (!s.threshold) return;\n if (s.threshold instanceof Array) {\n s.threshold.sort(function(a, b) {\n return a.below - b.below;\n });\n\n s.threshold.forEach(function(th) {\n thresholdData(plot, s, datapoints, th.below, th.color);\n });\n } else {\n thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color);\n }\n }\n\n plot.hooks.processDatapoints.push(processThresholds);\n }\n\n plugins.push({\n init: init,\n options: options,\n name: 'threshold',\n version: '1.2'\n });\n"],"names":["plugins","push","init","plot","thresholdData","s","datapoints","below","color","i","x","y","p","prevp","ps","pointsize","thresholded","extend","points","format","label","threshold","originSeries","data","m","origpoints","addCrossingPoints","lines","show","threspoints","newpoints","length","undefined","interx","origIndex","getData","indexOf","splice","hooks","processDatapoints","Array","sort","a","b","forEach","th","options","series","name","version"],"mappings":"4BA0IIA,EAAAA,QAAQC,KAAK,CACTC,KAxFJ,SAAcC,GACV,SAASC,EAAcD,EAAME,EAAGC,EAAYC,EAAOC,GAC/C,IAA+BC,EAAGC,EAAGC,EAAGC,EAAGC,EAAvCC,EAAKR,EAAWS,UAChBC,EAAcC,EAAAA,OAAO,GAAIZ,GAE7BW,EAAYV,WAAa,CAAEY,OAAQ,GAAIH,UAAWD,EAAIK,OAAQb,EAAWa,QACzEH,EAAYI,MAAQ,KACpBJ,EAAYR,MAAQA,EACpBQ,EAAYK,UAAY,KACxBL,EAAYM,aAAejB,EAC3BW,EAAYO,KAAO,GAEnB,IAKIC,EALAC,EAAanB,EAAWY,OACxBQ,EAAoBrB,EAAEsB,MAAMC,KAE5BC,EAAc,GACdC,EAAY,GAGhB,IAAKrB,EAAI,EAAGA,EAAIgB,EAAWM,OAAQtB,GAAKK,EAAI,CAQxC,GAPAJ,EAAIe,EAAWhB,GAGfI,EAAQD,EACOA,GAHfD,EAAIc,EAAWhB,EAAI,IAGXF,EAAWsB,EACVC,EAELJ,QAA+BM,IAAVnB,GAAuBA,IAAUD,GAChD,OAANF,GAAcD,EAAI,GACI,MAAtBgB,EAAWhB,EAAIK,GAAa,CAC5B,IAAImB,EAASvB,GAAKH,EAAQI,IAAMD,EAAIe,EAAWhB,EAAIK,KAAQH,EAAIc,EAAWhB,EAAIK,EAAK,IAGnF,IAFAD,EAAMZ,KAAKgC,GACXpB,EAAMZ,KAAKM,GACNiB,EAAI,EAAGA,EAAIV,IAAMU,EAClBX,EAAMZ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
|
"description": "JavaScript plotting library for engineering and scientific applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/flot.js",
|
|
7
7
|
"module": "./dist/flot.mjs",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
11
|
+
"types": "./types/index.d.ts",
|
|
10
12
|
"import": "./dist/flot.mjs",
|
|
11
13
|
"require": "./dist/flot.js",
|
|
12
14
|
"default": "./dist/flot.js"
|
|
13
15
|
},
|
|
14
16
|
"./jquery": {
|
|
17
|
+
"types": "./types/jquery.d.ts",
|
|
15
18
|
"import": "./dist/jquery.flot.js",
|
|
16
19
|
"default": "./dist/jquery.flot.js"
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/",
|
|
24
|
+
"source/",
|
|
25
|
+
"types/",
|
|
26
|
+
"docs/",
|
|
27
|
+
"CHANGELOG.md",
|
|
28
|
+
"LICENSE.txt",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
20
31
|
"scripts": {
|
|
21
32
|
"prepack": "npx rollup --config rollup.config.js"
|
|
22
33
|
},
|
|
@@ -38,16 +49,18 @@
|
|
|
38
49
|
}
|
|
39
50
|
},
|
|
40
51
|
"devDependencies": {
|
|
41
|
-
"@biomejs/biome": "^
|
|
52
|
+
"@biomejs/biome": "^2.4.12",
|
|
42
53
|
"@playwright/test": "^1.59.1",
|
|
43
54
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
44
55
|
"@rollup/plugin-terser": "^1.0.0",
|
|
45
56
|
"@size-limit/file": "^12.0.1",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
57
|
+
"@types/jquery": "^4.0.0",
|
|
58
|
+
"happy-dom": "^20.9.0",
|
|
59
|
+
"jquery": "^4.0.0",
|
|
48
60
|
"rollup": "^4.60.1",
|
|
49
61
|
"size-limit": "^12.0.1",
|
|
50
62
|
"terser": "^5.36.0",
|
|
51
|
-
"
|
|
63
|
+
"typescript": "^6.0.2",
|
|
64
|
+
"vitest": "^4.1.4"
|
|
52
65
|
}
|
|
53
66
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Ambient globals referenced by flot source files for browser/environment
|
|
2
|
+
// detection. These are intentionally undefined in many environments; the
|
|
3
|
+
// source uses `typeof X !== 'undefined'` or `!!window.X` guards.
|
|
4
|
+
|
|
5
|
+
declare const opr: { addons?: unknown } | undefined;
|
|
6
|
+
declare const InstallTrigger: unknown;
|
|
7
|
+
declare const TextEncoderLite: typeof TextEncoder | undefined;
|
|
8
|
+
declare const timezoneJS: { Date: new (...args: unknown[]) => Date } | undefined;
|
|
9
|
+
|
|
10
|
+
// Browser-specific / non-standard globals accessed for feature detection.
|
|
11
|
+
interface Window {
|
|
12
|
+
opr?: { addons?: unknown };
|
|
13
|
+
opera?: unknown;
|
|
14
|
+
chrome?: { webstore?: unknown };
|
|
15
|
+
StyleMedia?: unknown;
|
|
16
|
+
safari?: { pushNotification?: unknown };
|
|
17
|
+
HTMLElement: typeof HTMLElement;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface Document {
|
|
21
|
+
documentMode?: unknown;
|
|
22
|
+
}
|
|
@@ -127,7 +127,7 @@ var Canvas = function(cls, container) {
|
|
|
127
127
|
// already been rendered, and remove those that are no longer active.
|
|
128
128
|
|
|
129
129
|
for (var layerKey in cache) {
|
|
130
|
-
if (hasOwnProperty.call(cache, layerKey)) {
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
|
|
131
131
|
var layer = this.getSVGLayer(layerKey),
|
|
132
132
|
layerCache = cache[layerKey];
|
|
133
133
|
|
|
@@ -135,10 +135,10 @@ var Canvas = function(cls, container) {
|
|
|
135
135
|
layer.style.display = 'none';
|
|
136
136
|
|
|
137
137
|
for (var styleKey in layerCache) {
|
|
138
|
-
if (hasOwnProperty.call(layerCache, styleKey)) {
|
|
138
|
+
if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
|
|
139
139
|
var styleCache = layerCache[styleKey];
|
|
140
140
|
for (var key in styleCache) {
|
|
141
|
-
if (hasOwnProperty.call(styleCache, key)) {
|
|
141
|
+
if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
|
|
142
142
|
var val = styleCache[key],
|
|
143
143
|
positions = val.positions;
|
|
144
144
|
|
|
@@ -492,14 +492,20 @@ var Canvas = function(cls, container) {
|
|
|
492
492
|
var layerCache = this._textCache[layer];
|
|
493
493
|
if (layerCache != null) {
|
|
494
494
|
for (var styleKey in layerCache) {
|
|
495
|
-
if (hasOwnProperty.call(layerCache, styleKey)) {
|
|
495
|
+
if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
|
|
496
496
|
var styleCache = layerCache[styleKey];
|
|
497
497
|
for (var key in styleCache) {
|
|
498
|
-
if (hasOwnProperty.call(styleCache, key)) {
|
|
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
|
}
|
|
@@ -528,7 +534,7 @@ var Canvas = function(cls, container) {
|
|
|
528
534
|
Canvas.prototype.clearCache = function() {
|
|
529
535
|
var cache = this._textCache;
|
|
530
536
|
for (var layerKey in cache) {
|
|
531
|
-
if (hasOwnProperty.call(cache, layerKey)) {
|
|
537
|
+
if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
|
|
532
538
|
var layer = this.getSVGLayer(layerKey);
|
|
533
539
|
while (layer.firstChild) {
|
|
534
540
|
layer.removeChild(layer.firstChild);
|
|
@@ -20,7 +20,9 @@ export var browser = {
|
|
|
20
20
|
},
|
|
21
21
|
|
|
22
22
|
isSafari: function() {
|
|
23
|
-
|
|
23
|
+
var top = window.top;
|
|
24
|
+
if (!top) return false;
|
|
25
|
+
return /constructor/i.test(top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!top['safari'] || (typeof top.safari !== 'undefined' && top.safari.pushNotification));
|
|
24
26
|
},
|
|
25
27
|
|
|
26
28
|
isMobileSafari: function() {
|
|
@@ -28,7 +30,7 @@ export var browser = {
|
|
|
28
30
|
},
|
|
29
31
|
|
|
30
32
|
isOpera: function() {
|
|
31
|
-
return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
33
|
+
return (!!window.opr && !!window.opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
32
34
|
},
|
|
33
35
|
|
|
34
36
|
isFirefox: function() {
|
|
@@ -180,7 +180,7 @@ import { browser } from './jquery.flot.browser.js';
|
|
|
180
180
|
|
|
181
181
|
// Encode the string as UTF-8 and convert it to a binary string. The UTF-8 encoding is required to
|
|
182
182
|
// capture unicode characters correctly.
|
|
183
|
-
utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)(
|
|
183
|
+
utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)().encode(source));
|
|
184
184
|
|
|
185
185
|
data = "data:image/svg+xml;base64," + btoa(utf8BinaryString);
|
|
186
186
|
img.src = data;
|