Chart.js/Chart.min.js

46 lines
154 KiB
JavaScript
Raw Normal View History

2015-09-28 19:28:52 +02:00
!function t(e,i,a){function s(o,r){if(!i[o]){if(!e[o]){var h="function"==typeof require&&require;if(!r&&h)return h(o,!0);if(n)return n(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[o]={exports:{}};e[o][0].call(c.exports,function(t){var i=e[o][1][t];return s(i?i:t)},c,c.exports,t,e,i,a)}return i[o].exports}for(var n="function"==typeof require&&require,o=0;o<a.length;o++)s(a[o]);return s}({1:[function(t,e,i){!function(){var i=t("color-convert"),a=t("color-string"),s=function(t){if(t instanceof s)return t;if(!(this instanceof s))return new s(t);if(this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},"string"==typeof t){var e=a.getRgba(t);if(e)this.setValues("rgb",e);else if(e=a.getHsla(t))this.setValues("hsl",e);else{if(!(e=a.getHwb(t)))throw new Error('Unable to parse color from string "'+t+'"');this.setValues("hwb",e)}}else if("object"==typeof t){var e=t;if(void 0!==e.r||void 0!==e.red)this.setValues("rgb",e);else if(void 0!==e.l||void 0!==e.lightness)this.setValues("hsl",e);else if(void 0!==e.v||void 0!==e.value)this.setValues("hsv",e);else if(void 0!==e.w||void 0!==e.whiteness)this.setValues("hwb",e);else{if(void 0===e.c&&void 0===e.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(t));this.setValues("cmyk",e)}}};s.prototype={rgb:function(t){return this.setSpace("rgb",arguments)},hsl:function(t){return this.setSpace("hsl",arguments)},hsv:function(t){return this.setSpace("hsv",arguments)},hwb:function(t){return this.setSpace("hwb",arguments)},cmyk:function(t){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){return 1!==this.values.alpha?this.values.hwb.concat([this.values.alpha]):this.values.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values.rgb;return t.concat([this.values.alpha])},hslaArray:function(){var t=this.values.hsl;return t.concat([this.values.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return a.hexString(this.values.rgb)},rgbString:function(){return a.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return a.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return a.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return a.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return a.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return a.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return a.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){return this.values.rgb[0]<<16|this.values.rgb[1]<<8|this.values.rgb[2]},luminosity:function(){for(var t=this.values.rgb,e=[],i=0;i<t.length;i++){var a=t[i]/255;e[i]=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),i=t.luminosity();return e>i?(e+.05)/(i+.05):(i+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return 128>e},light:function(){return
//! moment.js
//! version : 2.10.6
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moment=e()}(this,function(){"use strict";function t(){return Ri.apply(null,arguments)}function e(t){Ri=t}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function a(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function s(t,e){var i,a=[];for(i=0;i<t.length;++i)a.push(e(t[i],i));return a}function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function o(t,e){for(var i in e)n(e,i)&&(t[i]=e[i]);return n(e,"toString")&&(t.toString=e.toString),n(e,"valueOf")&&(t.valueOf=e.valueOf),t}function r(t,e,i,a){return At(t,e,i,a,!0).utc()}function h(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function l(t){return null==t._pf&&(t._pf=h()),t._pf}function c(t){if(null==t._isValid){var e=l(t);t._isValid=!(isNaN(t._d.getTime())||!(e.overflow<0)||e.empty||e.invalidMonth||e.invalidWeekday||e.nullInput||e.invalidFormat||e.userInvalidated),t._strict&&(t._isValid=t._isValid&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour)}return t._isValid}function u(t){var e=r(NaN);return null!=t?o(l(e),t):l(e).userInvalidated=!0,e}function d(t,e){var i,a,s;if("undefined"!=typeof e._isAMomentObject&&(t._isAMomentObject=e._isAMomentObject),"undefined"!=typeof e._i&&(t._i=e._i),"undefined"!=typeof e._f&&(t._f=e._f),"undefined"!=typeof e._l&&(t._l=e._l),"undefined"!=typeof e._strict&&(t._strict=e._strict),"undefined"!=typeof e._tzm&&(t._tzm=e._tzm),"undefined"!=typeof e._isUTC&&(t._isUTC=e._isUTC),"undefined"!=typeof e._offset&&(t._offset=e._offset),"undefined"!=typeof e._pf&&(t._pf=l(e)),"undefined"!=typeof e._locale&&(t._locale=e._locale),Fi.length>0)for(i in Fi)a=Fi[i],s=e[a],"undefined"!=typeof s&&(t[a]=s);return t}function f(e){d(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),Li===!1&&(Li=!0,t.updateOffset(this),Li=!1)}function m(t){return t instanceof f||null!=t&&null!=t._isAMomentObject}function g(t){return 0>t?Math.ceil(t):Math.floor(t)}function p(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=g(e)),i}function v(t,e,i){var a,s=Math.min(t.length,e.length),n=Math.abs(t.length-e.length),o=0;for(a=0;s>a;a++)(i&&t[a]!==e[a]||!i&&p(t[a])!==p(e[a]))&&o++;return o+n}function b(){}function x(t){return t?t.toLowerCase().replace("_","-"):t}function y(t){for(var e,i,a,s,n=0;n<t.length;){for(s=x(t[n]).split("-"),e=s.length,i=x(t[n+1]),i=i?i.split("-"):null;e>0;){if(a=_(s.slice(0,e).join("-")))return a;if(i&&i.length>=e&&v(s,i,!0)>=e-1)break;e--}n++}return null}function _(t){var e=null;if(!Yi[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=Wi._abbr,require("./locale/"+t),w(e)}catch(i){}return Yi[t]}function w(t,e){var i;return t&&(i="undefined"==typeof e?k(t):D(t,e),i&&(Wi=i)),Wi._abbr}function D(t,e){return null!==e?(e.abbr=t,Yi[t]=Yi[t]||new b,Yi[t].set(e),w(t),Yi[t]):(delete Yi[t],null)}function k(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Wi;if(!i(t)){if(e=_(t))return e;t=[t]}return y(t)}function C(t,e){var i=t.toLowerCase();zi[i]=zi[i+"s"]=zi[e]=t}function S(t){return"string"==typeof t?zi[t]||zi[t.toLowerCase()]:void 0}function M(t){var e,i,a={};for(i in t)n(t,i)&&(e=S(i),e&&(a[e]=t[i]));return a}function A(e,i){return function(a){return null!=a?(P(this,e,a),t.updateOffset(this,i),this):I(this,e)}}function I(t,e){return t._d["get"+(t._isUTC?"UTC":"")+e]()}function P(t,e,i){return t._d["set"+(t._isUTC?"UTC":"")+e](i)}function T(t,e){var i;if("object"==typeof t)for(i in t)this.set(i,t[i]);else if(t=S(t),"function"==typeof this[t])return this[t](e);return this}function O(t,e,i){var a=""+Math.abs(t),s=e-a.length,n=t>=0;return(n?i?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+a}function R(t,e,i,a){var s=a;"string"==typeof a&&(s=function(){return this[a]()}),t&&(Ei[t]=s),e&&(Ei[e[0]]=function(){return O(s.apply(this,arguments),e[1],e[2])}),i&&(Ei[i]=function(){return this.locale
Va.millisecond=Va.milliseconds=za,Va.utcOffset=Vt,Va.utc=Ht,Va.local=Et,Va.parseZone=Nt,Va.hasAlignedHourOffset=Ut,Va.isDST=jt,Va.isDSTShifted=Gt,Va.isLocal=qt,Va.isUtcOffset=Zt,Va.isUtc=Xt,Va.isUTC=Xt,Va.zoneAbbr=Xe,Va.zoneName=Je,Va.dates=tt("dates accessor is deprecated. Use date instead.",Ia),Va.months=tt("months accessor is deprecated. Use month instead",J),Va.years=tt("years accessor is deprecated. Use year instead",xa),Va.zone=tt("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Bt);var Ba=Va,Ha={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ea={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Na="Invalid date",Ua="%d",ja=/\d{1,2}/,Ga={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},qa=b.prototype;qa._calendar=Ha,qa.calendar=Ke,qa._longDateFormat=Ea,qa.longDateFormat=ti,qa._invalidDate=Na,qa.invalidDate=ei,qa._ordinal=Ua,qa.ordinal=ii,qa._ordinalParse=ja,qa.preparse=ai,qa.postformat=ai,qa._relativeTime=Ga,qa.relativeTime=si,qa.pastFuture=ni,qa.set=oi,qa.months=G,qa._months=da,qa.monthsShort=q,qa._monthsShort=fa,qa.monthsParse=Z,qa.week=ct,qa._week=ya,qa.firstDayOfYear=dt,qa.firstDayOfWeek=ut,qa.weekdays=Ye,qa._weekdays=Pa,qa.weekdaysMin=Ve,qa._weekdaysMin=Oa,qa.weekdaysShort=ze,qa._weekdaysShort=Ta,qa.weekdaysParse=Be,qa.isPM=Ge,qa._meridiemParse=Ra,qa.meridiem=qe,w("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,i=1===p(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),t.lang=tt("moment.lang is deprecated. Use moment.locale instead.",w),t.langData=tt("moment.langData is deprecated. Use moment.localeData instead.",k);var Za=Math.abs,Xa=ki("ms"),Ja=ki("s"),Qa=ki("m"),$a=ki("h"),Ka=ki("d"),ts=ki("w"),es=ki("M"),is=ki("y"),as=Si("milliseconds"),ss=Si("seconds"),ns=Si("minutes"),os=Si("hours"),rs=Si("days"),hs=Si("months"),ls=Si("years"),cs=Math.round,us={s:45,m:45,h:22,d:26,M:11},ds=Math.abs,fs=Rt.prototype;fs.abs=mi,fs.add=pi,fs.subtract=vi,fs.as=wi,fs.asMilliseconds=Xa,fs.asSeconds=Ja,fs.asMinutes=Qa,fs.asHours=$a,fs.asDays=Ka,fs.asWeeks=ts,fs.asMonths=es,fs.asYears=is,fs.valueOf=Di,fs._bubble=xi,fs.get=Ci,fs.milliseconds=as,fs.seconds=ss,fs.minutes=ns,fs.hours=os,fs.days=rs,fs.weeks=Mi,fs.months=hs,fs.years=ls,fs.humanize=Ti,fs.toISOString=Oi,fs.toString=Oi,fs.toJSON=Oi,fs.locale=ve,fs.localeData=be,fs.toIsoString=tt("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Oi),fs.lang=Aa,R("X",0,0,"unix"),R("x",0,0,"valueOf"),V("x",Ki),V("X",ea),E("X",function(t,e,i){i._d=new Date(1e3*parseFloat(t,10))}),E("x",function(t,e,i){i._d=new Date(p(t))}),t.version="2.10.6",e(It),t.fn=Ba,t.min=Tt,t.max=Ot,t.utc=r,t.unix=Qe,t.months=li,t.isDate=a,t.locale=w,t.invalid=u,t.duration=Jt,t.isMoment=m,t.weekdays=ui,t.parseZone=$e,t.localeData=k,t.isDuration=Wt,t.monthsShort=ci,t.weekdaysMin=fi,t.defineLocale=D,t.weekdaysShort=di,t.normalizeUnits=S,t.relativeTimeThreshold=Pi;var ms=t;return ms}),/*!
2014-06-29 19:36:25 +02:00
* Chart.js
* http://chartjs.org/
2015-06-04 03:45:14 +02:00
* Version: 2.0.0-alpha
2014-06-29 19:36:25 +02:00
*
2015-01-07 23:49:33 +01:00
* Copyright 2015 Nick Downie
2014-06-29 19:36:25 +02:00
* Released under the MIT license
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
*/
2015-09-28 19:28:52 +02:00
function(){"use strict";var t=this,e=t.Chart,i=function(t,e){this.config=e,t.length&&t[0].getContext&&(t=t[0]),t.getContext&&(t=t.getContext("2d")),this.ctx=t,this.canvas=t.canvas,this.width=t.canvas.width||parseInt(i.helpers.getStyle(t.canvas,"width"))||i.helpers.getMaximumWidth(t.canvas),this.height=t.canvas.height||parseInt(i.helpers.getStyle(t.canvas,"height"))||i.helpers.getMaximumHeight(t.canvas),this.aspectRatio=this.width/this.height,(isNaN(this.aspectRatio)||isFinite(this.aspectRatio)===!1)&&(this.aspectRatio=void 0!==e.aspectRatio?e.aspectRatio:2),this.originalCanvasStyleWidth=t.canvas.style.width,this.originalCanvasStyleHeight=t.canvas.style.height,i.helpers.retinaScale(this);var a=this;return i.helpers.addResizeListener(t.canvas.parentNode,function(){e.options.responsive&&a.controller.resize()}),e?(this.controller=new i.Controller(this),this.controller):this};i.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove","touchend"],hover:{onHover:null,mode:"single",animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",elements:{},legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i = 0; i < data.datasets.length; i++){%><li><span style="background-color:<%=data.datasets[i].backgroundColor%>"><%if(data.datasets[i].label){%><%=data.datasets[i].label%><%}%></span></li><%}%></ul>'}},"undefined"!=typeof amd?define(function(){return i}):"object"==typeof module&&module.exports&&(module.exports=i),t.Chart=i,i.noConflict=function(){return t.Chart=e,i}}.call(this),function(){"use strict";var t=this,e=(t.Chart,Chart.helpers={}),i=e.each=function(t,e,i,a){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;if(a)for(n=t.length-1;n>=0;n--)e.apply(i,[t[n],n].concat(s));else for(n=0;n<t.length;n++)e.apply(i,[t[n],n].concat(s))}else for(var o in t)e.apply(i,[t[o],o].concat(s))},a=e.clone=function(t){var s={};return i(t,function(i,n){t.hasOwnProperty(n)&&(e.isArray(i)?s[n]=i.slice(0):"object"==typeof i&&null!==i?s[n]=a(i):s[n]=i)}),s},s=e.extend=function(t){return i(Array.prototype.slice.call(arguments,1),function(e){i(e,function(i,a){e.hasOwnProperty(a)&&(t[a]=i)})}),t},n=(e.configMerge=function(t){var i=a(t);return e.each(Array.prototype.slice.call(arguments,1),function(t){e.each(t,function(a,s){if(t.hasOwnProperty(s))if("scales"===s)i[s]=e.scaleMerge(i.hasOwnProperty(s)?i[s]:{},a);else if("scale"===s)i[s]=e.configMerge(i.hasOwnProperty(s)?i[s]:{},Chart.scaleService.getScaleDefaults(a.type),a);else if(i.hasOwnProperty(s)&&e.isArray(i[s])&&e.isArray(a)){var n=i[s];e.each(a,function(t,i){i<n.length?"object"==typeof n[i]&&null!==n[i]&&"object"==typeof t&&null!==t?n[i]=e.configMerge(n[i],t):n[i]=t:n.push(t)})}else i.hasOwnProperty(s)&&"object"==typeof i[s]&&null!==i[s]&&"object"==typeof a?i[s]=e.configMerge(i[s],a):i[s]=a})}),i},e.extendDeep=function(t){function i(t){return e.each(arguments,function(a){a!==t&&e.each(a,function(e,a){t[a]&&t[a].constructor&&t[a].constructor===Object?i(t[a],e):t[a]=e})}),t}return i.apply(this,arguments)},e.scaleMerge=function(t,i){var s=a(t);return e.each(i,function(t,a){i.hasOwnProperty(a)&&("xAxes"===a||"yAxes"===a?s.hasOwnProperty(a)?e.each(t,function(t,i){i>=s[a].length||!s[a][i].type?s[a].push(e.configMerge(t.type?Chart.scaleService.getScaleDefaults(t.type):{},t)):t.type!==s[a][i].type?s[a][i]=e.configMerge(s[a][i],t.type?Chart.scaleService.getScaleDefaults(t.type):{},t):s[a][i]=e.configMerge(s[a][i],t)}):(s[a]=[],e.each(t,function(t){s[a].push(e.configMerge(t.type?Chart.scaleService.getScaleDefaults(t.type):{},t))})):s.hasOwnProperty(a)&&"object"==typeof s[a]&&null!==s[a]&&"object"==typeof t?s[a]=e.configMerge(s[a],t):s[a]=t)}),s},e.getValueAtIndexOrDefault=function(t,i,a){return void 0===t||null===t?a:e.isArray(t)?i<t.length?t[i]:a:t},e.indexOf=function(t,e){if(Array.prototype.indexOf)return t.indexOf(e);for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1},e.where=function(t,i){var a=[];return e.each(t,function(t){i(t)&&a.push(t)}),a},e.
2015-09-28 13:45:50 +02:00
e=!0;var l="right"==this.options.position?this.left:this.right-5,c="right"==this.options.position?this.left+5:this.right;if(i.each(this.ticks,function(a,s){var n=this.getPixelForTick(s);if(this.options.gridLines.show&&(s===("undefined"!=typeof this.zeroLineIndex?this.zeroLineIndex:0)?(this.ctx.lineWidth=this.options.gridLines.zeroLineWidth,this.ctx.strokeStyle=this.options.gridLines.zeroLineColor,e=!0):e&&(this.ctx.lineWidth=this.options.gridLines.lineWidth,this.ctx.strokeStyle=this.options.gridLines.color,e=!1),n+=i.aliasPixel(this.ctx.lineWidth),this.ctx.beginPath(),this.options.gridLines.drawTicks&&(this.ctx.moveTo(l,n),this.ctx.lineTo(c,n)),this.options.gridLines.drawOnChartArea&&(this.ctx.moveTo(t.left,n),this.ctx.lineTo(t.right,n)),this.ctx.stroke()),this.options.ticks.show){var o,r=this.getPixelForTick(s,this.options.gridLines.offsetGridLines);this.ctx.save(),"left"==this.options.position?this.options.ticks.mirror?(o=this.right+this.options.ticks.padding,this.ctx.textAlign="left"):(o=this.right-this.options.ticks.padding,this.ctx.textAlign="right"):this.options.ticks.mirror?(o=this.left-this.options.ticks.padding,this.ctx.textAlign="right"):(o=this.left+this.options.ticks.padding,this.ctx.textAlign="left"),this.ctx.translate(o,r),this.ctx.rotate(-1*i.toRadians(this.labelRotation)),this.ctx.font=this.font,this.ctx.textBaseline="middle",this.ctx.fillText(a,0,0),this.ctx.restore()}},this),this.options.scaleLabel.show){s="left"==this.options.position?this.left+this.options.scaleLabel.fontSize/2:this.right-this.options.scaleLabel.fontSize/2,n=this.top+(this.bottom-this.top)/2;var u="left"==this.options.position?-.5*Math.PI:.5*Math.PI;this.ctx.save(),this.ctx.translate(s,n),this.ctx.rotate(u),this.ctx.textAlign="center",this.ctx.font=i.fontString(this.options.scaleLabel.fontSize,this.options.scaleLabel.fontStyle,this.options.scaleLabel.fontFamily),this.ctx.textBaseline="middle",this.ctx.fillText(this.options.scaleLabel.labelString,0,0),this.ctx.restore()}}}}})}.call(this),function(){"use strict";var t=this,e=t.Chart,i=e.helpers;e.scaleService={constructors:{},defaults:{},registerScaleType:function(t,a,s){this.constructors[t]=a,this.defaults[t]=i.scaleMerge(e.defaults.scale,s)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(t){return this.defaults.hasOwnProperty(t)?this.defaults[t]:{}},update:function(t,e,a){var s=e>30?5:2,n=a>30?5:2;if(t){var o=i.where(t.scales,function(t){return"left"==t.options.position}),r=i.where(t.scales,function(t){return"right"==t.options.position}),h=i.where(t.scales,function(t){return"top"==t.options.position}),l=i.where(t.scales,function(t){return"bottom"==t.options.position}),c=i.where(t.scales,function(t){return"chartArea"==t.options.position}),u=e/2,d=a/2;u-=2*s,d-=2*n;var f=(e-u)/(o.length+r.length),m=(a-d)/(h.length+l.length),g=[],p=function(t){var e=t.update(f,d);g.push({horizontal:!1,minSize:e,scale:t})},v=function(t){var e=t.update(u,m);g.push({horizontal:!0,minSize:e,scale:t})};i.each(o,p),i.each(r,p),i.each(h,v),i.each(l,v);var b=a-2*n,x=e-2*s;i.each(g,function(t){t.horizontal?b-=t.minSize.height:x-=t.minSize.width});var y=function(t){var e=i.findNextWhere(g,function(e){return e.scale===t});e&&t.update(e.minSize.width,b)},_=function(t){var e=i.findNextWhere(g,function(e){return e.scale===t}),a={left:w,right:D,top:0,bottom:0};e&&t.update(x,e.minSize.height,a)},w=s,D=s,k=n,C=n;i.each(o,y),i.each(r,y),i.each(o,function(t){w+=t.width}),i.each(r,function(t){D+=t.width}),i.each(h,_),i.each(l,_),i.each(h,function(t){k+=t.height}),i.each(l,function(t){C+=t.height}),i.each(o,function(t){var e=i.findNextWhere(g,function(e){return e.scale===t}),a={left:0,right:0,top:k,bottom:C};e&&t.update(e.minSize.width,b,a)}),i.each(r,function(t){var e=i.findNextWhere(g,function(e){return e.scale===t}),a={left:0,right:0,top:k,bottom:C};e&&t.update(e.minSize.width,b,a)}),w=s,D=s,k=n,C=n,i.each(o,function(t){w+=t.width}),i.each(r,function(t){D+=t.width}),i.each(h,function(t){k+=t.height}),i.each(l,function(t){C+=t.height});var
2015-09-28 19:28:52 +02:00
this.getDataset().metaData.splice(t,0,i)},removeElement:function(t){this.getDataset().metaData.splice(t,1)},reset:function(){this.update(!0)},buildOrUpdateElements:function(){var t=this.getDataset().data.length,e=this.getDataset().metaData.length;if(e>t)this.getDataset().metaData.splice(t,e-t);else if(t>e)for(var i=e;t>i;++i)this.addElementAndReset(i)},update:function(t){this.chart.outerRadius=Math.max((i.min([this.chart.chart.width,this.chart.chart.height])-this.chart.options.elements.arc.borderWidth/2)/2,0),this.chart.innerRadius=Math.max(this.chart.options.cutoutPercentage?this.chart.outerRadius/100*this.chart.options.cutoutPercentage:1,0),this.chart.radiusLength=(this.chart.outerRadius-this.chart.innerRadius)/this.chart.data.datasets.length,this.getDataset().total=0,i.each(this.getDataset().data,function(t){this.getDataset().total+=Math.abs(t)},this),this.outerRadius=this.chart.outerRadius-this.chart.radiusLength*this.index,this.innerRadius=this.outerRadius-this.chart.radiusLength,i.each(this.getDataset().metaData,function(e,i){this.updateElement(e,i,t)},this)},updateElement:function(t,e,a){var s=1/this.getDataset().data.length*2,n=-.5*Math.PI+Math.PI*s*e,o=n+s*Math.PI,r={x:this.chart.chart.width/2,y:this.chart.chart.height/2,innerRadius:0,outerRadius:this.chart.options.animateScale?0:this.chart.scale.getDistanceFromCenterForValue(this.getDataset().data[e]),startAngle:this.chart.options.animateRotate?Math.PI*-.5:n,endAngle:this.chart.options.animateRotate?Math.PI*-.5:o,backgroundColor:t.custom&&t.custom.backgroundColor?t.custom.backgroundColor:i.getValueAtIndexOrDefault(this.getDataset().backgroundColor,e,this.chart.options.elements.arc.backgroundColor),hoverBackgroundColor:t.custom&&t.custom.hoverBackgroundColor?t.custom.hoverBackgroundColor:i.getValueAtIndexOrDefault(this.getDataset().hoverBackgroundColor,e,this.chart.options.elements.arc.hoverBackgroundColor),borderWidth:t.custom&&t.custom.borderWidth?t.custom.borderWidth:i.getValueAtIndexOrDefault(this.getDataset().borderWidth,e,this.chart.options.elements.arc.borderWidth),borderColor:t.custom&&t.custom.borderColor?t.custom.borderColor:i.getValueAtIndexOrDefault(this.getDataset().borderColor,e,this.chart.options.elements.arc.borderColor),label:i.getValueAtIndexOrDefault(this.chart.data.labels,e,this.chart.data.labels[e])};i.extend(t,{_chart:this.chart.chart,_datasetIndex:this.index,_index:e,_model:a?r:{x:this.chart.chart.width/2,y:this.chart.chart.height/2,innerRadius:0,outerRadius:this.chart.scale.getDistanceFromCenterForValue(this.getDataset().data[e]),startAngle:n,endAngle:o,backgroundColor:t.custom&&t.custom.backgroundColor?t.custom.backgroundColor:i.getValueAtIndexOrDefault(this.getDataset().backgroundColor,e,this.chart.options.elements.arc.backgroundColor),hoverBackgroundColor:t.custom&&t.custom.hoverBackgroundColor?t.custom.hoverBackgroundColor:i.getValueAtIndexOrDefault(this.getDataset().hoverBackgroundColor,e,this.chart.options.elements.arc.hoverBackgroundColor),borderWidth:t.custom&&t.custom.borderWidth?t.custom.borderWidth:i.getValueAtIndexOrDefault(this.getDataset().borderWidth,e,this.chart.options.elements.arc.borderWidth),borderColor:t.custom&&t.custom.borderColor?t.custom.borderColor:i.getValueAtIndexOrDefault(this.getDataset().borderColor,e,this.chart.options.elements.arc.borderColor),label:i.getValueAtIndexOrDefault(this.chart.data.labels,e,this.chart.data.labels[e])}}),t.pivot()},draw:function(t){var e=t||1;i.each(this.getDataset().metaData,function(t,i){t.transition(e).draw()},this)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],a=t._index;t._model.backgroundColor=t.custom&&t.custom.hoverBackgroundColor?t.custom.hoverBackgroundColor:i.getValueAtIndexOrDefault(e.hoverBackgroundColor,a,i.color(t._model.backgroundColor).saturate(.5).darken(.1).rgbString()),t._model.borderColor=t.custom&&t.custom.hoverBorderColor?t.custom.hoverBorderColor:i.getValueAtIndexOrDefault(e.hoverBorderColor,a,i.color(t._model.borderColor).saturate(.5).darken(.1).rgbString()),t._model.borderWidth=t.custom&&t.custom.hoverBorderWidth?t.custom.hov
2015-06-12 22:00:48 +02:00
* Chart.js
* http://chartjs.org/
* Version: 2.0.0-alpha
*
* Copyright 2015 Nick Downie
* Released under the MIT license
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
*/
function(){"use strict";var t=this,e=t.Chart,i=e.helpers;e.defaults.global.elements.arc={backgroundColor:e.defaults.global.defaultColor,borderColor:"#fff",borderWidth:2},e.elements.Arc=e.Element.extend({inLabelRange:function(t){var e=this._view;return e?Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2):!1},inRange:function(t,e){var a=this._view;if(a){var s=i.getAngleFromPoint(a,{x:t,y:e}),n=a.startAngle<-.5*Math.PI?a.startAngle+2*Math.PI:a.startAngle>1.5*Math.PI?a.startAngle-2*Math.PI:a.startAngle,o=a.endAngle<-.5*Math.PI?a.endAngle+2*Math.PI:a.endAngle>1.5*Math.PI?a.endAngle-2*Math.PI:a.endAngle,r=s.angle>=n&&s.angle<=o,h=s.distance>=a.innerRadius&&s.distance<=a.outerRadius;return r&&h}return!1},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,i=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},draw:function(){var t=this._chart.ctx,e=this._view;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,e.startAngle,e.endAngle),t.arc(e.x,e.y,e.innerRadius,e.endAngle,e.startAngle,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}.call(this),/*!
2015-06-12 22:00:48 +02:00
* Chart.js
* http://chartjs.org/
* Version: 2.0.0-alpha
*
* Copyright 2015 Nick Downie
* Released under the MIT license
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
*/
function(){"use strict";var t=this,e=t.Chart,i=e.helpers;e.defaults.global.elements.line={tension:.4,backgroundColor:e.defaults.global.defaultColor,borderWidth:3,borderColor:e.defaults.global.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",fill:!0,skipNull:!0,drawNull:!1},e.elements.Line=e.Element.extend({draw:function(){var t=this._view,a=this._chart.ctx,s=this._children[0],n=this._children[this._children.length-1];a.save(),i.each(this._children,function(e,s){var n=i.previousItem(this._children,s),o=i.nextItem(this._children,s);return 0===s?void a.moveTo(e._view.x,e._view.y):(e._view.skip&&t.skipNull&&!this._loop?(a.lineTo(n._view.x,e._view.y),a.moveTo(o._view.x,e._view.y)):n._view.skip&&t.skipNull&&!this._loop&&(a.moveTo(e._view.x,n._view.y),a.lineTo(e._view.x,e._view.y)),void(n._view.skip&&t.skipNull?a.moveTo(e._view.x,e._view.y):t.tension>0?a.bezierCurveTo(n._view.controlPointNextX,n._view.controlPointNextY,e._view.controlPointPreviousX,e._view.controlPointPreviousY,e._view.x,e._view.y):a.lineTo(e._view.x,e._view.y)))},this),this._loop&&(t.tension>0&&!s._view.skip?a.bezierCurveTo(n._view.controlPointNextX,n._view.controlPointNextY,s._view.controlPointPreviousX,s._view.controlPointPreviousY,s._view.x,s._view.y):a.lineTo(s._view.x,s._view.y)),this._children.length>0&&t.fill&&(a.lineTo(this._children[this._children.length-1]._view.x,t.scaleZero),a.lineTo(this._children[0]._view.x,t.scaleZero),a.fillStyle=t.backgroundColor||e.defaults.global.defaultColor,a.closePath(),a.fill()),a.lineCap=t.borderCapStyle||e.defaults.global.elements.line.borderCapStyle,a.setLineDash&&a.setLineDash(t.borderDash||e.defaults.global.elements.line.borderDash),a.lineDashOffset=t.borderDashOffset||e.defaults.global.elements.line.borderDashOffset,a.lineJoin=t.borderJoinStyle||e.defaults.global.elements.line.borderJoinStyle,a.lineWidth=t.borderWidth||e.defaults.global.elements.line.borderWidth,a.strokeStyle=t.borderColor||e.defaults.global.defaultColor,a.beginPath(),i.each(this._children,function(e,s){var n=i.previousItem(this._children,s),o=i.nextItem(this._children,s);return 0===s?void a.moveTo(e._view.x,e._view.y):e._view.skip&&t.skipNull&&!this._loop?(a.moveTo(n._view.x,e._view.y),void a.moveTo(o._view.x,e._view.y)):n._view.skip&&t.skipNull&&!this._loop?(a.moveTo(e._view.x,n._view.y),void a.moveTo(e._view.x,e._view.y)):n._view.skip&&t.skipNull?void a.moveTo(e._view.x,e._view.y):void(t.tension>0?a.bezierCurveTo(n._view.controlPointNextX,n._view.controlPointNextY,e._view.controlPointPreviousX,e._view.controlPointPreviousY,e._view.x,e._view.y):a.lineTo(e._view.x,e._view.y))},this),this._loop&&!s._view.skip&&(t.tension>0?a.bezierCurveTo(n._view.controlPointNextX,n._view.controlPointNextY,s._view.controlPointPreviousX,s._view.controlPointPreviousY,s._view.x,s._view.y):a.lineTo(s._view.x,s._view.y)),a.stroke(),a.restore()}})}.call(this),/*!
2015-06-12 22:00:48 +02:00
* Chart.js
* http://chartjs.org/
* Version: 2.0.0-alpha
*
* Copyright 2015 Nick Downie
* Released under the MIT license
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
*/
2015-09-28 19:28:52 +02:00
function(){"use strict";var t=this,e=t.Chart;e.helpers;e.defaults.global.elements.point={radius:3,backgroundColor:e.defaults.global.defaultColor,borderWidth:1,borderColor:e.defaults.global.defaultColor,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},e.elements.Point=e.Element.extend({inRange:function(t,e){var i=this._view;if(i){var a=i.hitRadius+i.radius;return Math.pow(t-i.x,2)+Math.pow(e-i.y,2)<Math.pow(a,2)}return!1},inLabelRange:function(t){var e=this._view;return e?Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2):!1},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(){var t=this._view,i=this._chart.ctx;t.skip||(t.radius>0||t.borderWidth>0)&&(i.beginPath(),i.arc(t.x,t.y,t.radius||e.defaults.global.elements.point.radius,0,2*Math.PI),i.closePath(),i.strokeStyle=t.borderColor||e.defaults.global.defaultColor,i.lineWidth=t.borderWidth||e.defaults.global.elements.point.borderWidth,i.fillStyle=t.backgroundColor||e.defaults.global.defaultColor,i.fill(),i.stroke())}})}.call(this),function(){"use strict";var t=this,e=t.Chart;e.helpers;e.defaults.global.elements.rectangle={backgroundColor:e.defaults.global.defaultColor,borderWidth:0,borderColor:e.defaults.global.defaultColor},e.elements.Rectangle=e.Element.extend({draw:function(){var t=this._chart.ctx,e=this._view,i=e.width/2,a=e.x-i,s=e.x+i,n=e.base-(e.base-e.y),o=e.borderWidth/2;e.borderWidth&&(a+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.moveTo(a,e.base),t.lineTo(a,n),t.lineTo(s,n),t.lineTo(s,e.base),t.fill(),e.borderWidth&&t.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=this._view,a=!1;return i&&(a=i.y<i.base?t>=i.x-i.width/2&&t<=i.x+i.width/2&&e>=i.y&&e<=i.base:t>=i.x-i.width/2&&t<=i.x+i.width/2&&e>=i.base&&e<=i.y),a},inLabelRange:function(t){var e=this._view;return e?t>=e.x-e.width/2&&t<=e.x+e.width/2:!1},tooltipPosition:function(){var t=this._view;return t.y<t.base?{x:t.x,y:t.y}:{x:t.x,y:t.base}}})}.call(this),function(){"use strict";var t=this,e=t.Chart;e.helpers;e.Bar=function(t,i){return i.type="bar",new e(t,i)}}.call(this),function(){"use strict";var t=this,e=t.Chart,i=e.helpers,a={aspectRatio:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i = 0; i < data.datasets[0].data.length; i++){%><li><span style="background-color:<%=data.datasets[0].backgroundColor[i]%>"><%if(data.labels && i < data.labels.length){%><%=data.labels[i]%><%}%></span></li><%}%></ul>'};e.Doughnut=function(t,s){return s.options=i.configMerge(a,s.options),s.type="doughnut",new e(t,s)}}.call(this),function(){"use strict";var t=this,e=t.Chart;e.helpers;e.Line=function(t,i){return i.type="line",new e(t,i)}}.call(this),function(){"use strict";var t=this,e=t.Chart,i=e.helpers,a={aspectRatio:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i = 0; i < data.datasets[0].data.length; i++){%><li><span style="background-color:<%=data.datasets[0].backgroundColor[i]%>"><%if(data.labels && i < data.labels.length){%><%=data.labels[i]%><%}%></span></li><%}%></ul>'};e.PolarArea=function(t,s){return s.options=i.configMerge(a,s.options),s.type="polarArea",new e(t,s)}}.call(this),function(){"use strict";var t=this,e=t.Chart,i=e.helpers,a={aspectRatio:1};e.Radar=function(t,s){return s.options=i.configMerge(a,s.options),s.type="radar",new e(t,s)}}.call(this),function(){"use strict";var t=this,e=t.Chart,i=e.helpers,a={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{template:"(<%= value.x %>, <%= value.y %>)",multiTemplate:"<%if (datasetLabel){%><%=datasetLabel%>: <%}%>(<%= value.x %>, <%= value.y %>)"}};e.Scatter=function(t,s){return s.options=i.configMerge(a,s.options),s.type="line",new e(t,s)}}.call(this);