Chart.js/Chart.min.js

40 lines
129 KiB
JavaScript
Raw Normal View History

2015-10-25 00:47:24 +02:00
!function t(e,i,a){function s(n,r){if(!i[n]){if(!e[n]){var h="function"==typeof require&&require;if(!r&&h)return h(n,!0);if(o)return o(n,!0);var l=new Error("Cannot find module '"+n+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[n]={exports:{}};e[n][0].call(c.exports,function(t){var i=e[n][1][t];return s(i?i:t)},c,c.exports,t,e,i,a)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<a.length;n++)s(a[n]);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
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-10-25 00:47:24 +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),e&&(this.controller=new i.Controller(this));var a=this;return i.helpers.addResizeListener(t.canvas.parentNode,function(){a.controller&&a.controller.config.options.responsive&&a.controller.resize()}),this.controller?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:{},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var i=0;i<t.data.datasets.length;i++)e.push('<li><span style="background-color:'+t.data.datasets[i].backgroundColor+'">'),t.data.datasets[i].label&&e.push(t.data.datasets[i].label),e.push("</span></li>");return e.push("</ul>"),e.join("")}}},"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,i=e.helpers={},a=i.each=function(t,e,i,a){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var o;if(a)for(o=t.length-1;o>=0;o--)e.apply(i,[t[o],o].concat(s));else for(o=0;o<t.length;o++)e.apply(i,[t[o],o].concat(s))}else for(var n in t)e.apply(i,[t[n],n].concat(s))},s=i.clone=function(t){var e={};return a(t,function(a,o){t.hasOwnProperty(o)&&(i.isArray(a)?e[o]=a.slice(0):"object"==typeof a&&null!==a?e[o]=s(a):e[o]=a)}),e},o=i.extend=function(t){return a(Array.prototype.slice.call(arguments,1),function(e){a(e,function(i,a){e.hasOwnProperty(a)&&(t[a]=i)})}),t},n=(i.configMerge=function(t){var a=s(t);return i.each(Array.prototype.slice.call(arguments,1),function(t){i.each(t,function(s,o){if(t.hasOwnProperty(o))if("scales"===o)a[o]=i.scaleMerge(a.hasOwnProperty(o)?a[o]:{},s);else if("scale"===o)a[o]=i.configMerge(a.hasOwnProperty(o)?a[o]:{},e.scaleService.getScaleDefaults(s.type),s);else if(a.hasOwnProperty(o)&&i.isArray(a[o])&&i.isArray(s)){var n=a[o];i.each(s,function(t,e){e<n.length?"object"==typeof n[e]&&null!==n[e]&&"object"==typeof t&&null!==t?n[e]=i.configMerge(n[e],t):n[e]=t:n.push(t)})}else a.hasOwnProperty(o)&&"object"==typeof a[o]&&null!==a[o]&&"object"==typeof s?a[o]=i.configMerge(a[o],s):a[o]=s})}),a},i.extendDeep=function(t){function e(t){return i.each(arguments,function(a){a!==t&&i.each(a,function(i,a){t[a]&&t[a].constructor&&t[a].constructor===Object?e(t[a],i):t[a]=i})}),t}return e.apply(this,arguments)},i.scaleMerge=function(t,a){var o=s(t);return i.each(a,function(t,s){a.hasOwnProperty(s)&&("xAxes"===s||"yAxes"===s?o.hasOwnProperty(s)?i.each(t,function(t,a){a>=o[s].length||!o[s][a].type?o[s].push(i.configMerge(t.type?e.scaleService.getScaleDefaults(t.type):{},t)):t.type!==o[s][a].type?o[s][a]=i.configMerge(o[s][a],t.type?e.scaleService.getScaleDefaults(t.type):{},t):o[s][a]=i.configMerge(o[s][a],t)}):(o[s]=[],i.each(t,function(t){o[s].push(i.configMerge(t.type?e.scaleService.getScaleDefaults(t.type):{},t))})):o.hasOwnProperty(s)&&"object"==typeof o[s]&&null!==o[s]&&"object"==typeof t?o[s]=i.configMerge(o[s],t):o[s]=t)}),o},i.getValueAtIndexOrDefault=function(t,e,a){return void 0===t||null===t?a:i.isArray(t)?e<t.length?t[e]:a:t},i.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},i.wher
this.ctx.textBaseline=n?"middle":"top"===this.options.position?"bottom":"top",this.ctx.fillText(s,0,0),this.ctx.restore())}},this),this.options.scaleLabel.show&&(this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillStyle=this.options.scaleLabel.fontColor,this.ctx.font=i.fontString(this.options.scaleLabel.fontSize,this.options.scaleLabel.fontStyle,this.options.scaleLabel.fontFamily),s=this.left+(this.right-this.left)/2,o="bottom"==this.options.position?this.bottom-this.options.scaleLabel.fontSize/2:this.top+this.options.scaleLabel.fontSize/2,this.ctx.fillText(this.options.scaleLabel.labelString,s,o))}else{e=!0;var c="right"==this.options.position?this.left:this.right-5,d="right"==this.options.position?this.left+5:this.right;if(i.each(this.ticks,function(a,s){var o=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),o+=i.aliasPixel(this.ctx.lineWidth),this.ctx.beginPath(),this.options.gridLines.drawTicks&&(this.ctx.moveTo(c,o),this.ctx.lineTo(d,o)),this.options.gridLines.drawOnChartArea&&(this.ctx.moveTo(t.left,o),this.ctx.lineTo(t.right,o)),this.ctx.stroke()),this.options.ticks.show){var n,h=this.getPixelForTick(s,this.options.gridLines.offsetGridLines);this.ctx.save(),"left"==this.options.position?this.options.ticks.mirror?(n=this.right+this.options.ticks.padding,this.ctx.textAlign="left"):(n=this.right-this.options.ticks.padding,this.ctx.textAlign="right"):this.options.ticks.mirror?(n=this.left-this.options.ticks.padding,this.ctx.textAlign="right"):(n=this.left+this.options.ticks.padding,this.ctx.textAlign="left"),this.ctx.translate(n,h),this.ctx.rotate(-1*i.toRadians(this.labelRotation)),this.ctx.font=r,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,o=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,o),this.ctx.rotate(u),this.ctx.textAlign="center",this.ctx.fillStyle=this.options.scaleLabel.fontColor,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,e,a){this.constructors[t]=e,this.defaults[t]=i.clone(a)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(t){return this.defaults.hasOwnProperty(t)?i.scaleMerge(e.defaults.scale,this.defaults[t]):{}},update:function(t,e,a){var s=e>30?5:2,o=a>30?5:2;if(t){var n=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}),d=e/2,u=a/2;d-=2*s,u-=2*o;var g=(e-d)/(n.length+r.length),m=(a-u)/(h.length+l.length),p=[],f=function(t){var e=t.update(g,u);p.push({horizontal:!1,minSize:e,scale:t})},b=function(t){var e=t.update(d,m);p.push({horizontal:!0,minSize:e,scale:t})};i.each(n,f),i.each(r,f),i.each(h,b),i.each(l,b);var v=a-2*o,x=e-2*s;i.each(p,function(t){t.horizontal?v-=t.minSize.height:x-=t.minSize.width});var y=function(t){var e=i.findNextWhere(p,function(e){return e.scale===t});e&&t.update(e.minSize.width,v)},k=function(t){var e=i.findNextWhere(p,function(e){return e.scale===t}),a={left:D,right:w,top:0,bottom:0};e&&t
initialize:function(t,e){this.chart=t,this.index=e,this.linkScales(),this.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){this.getDataset().xAxisID||(this.getDataset().xAxisID=this.chart.options.scales.xAxes[0].id),this.getDataset().yAxisID||(this.getDataset().yAxisID=this.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getScaleForId:function(t){return this.chart.scales[t]},addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[],this.getDataset().metaDataset=this.getDataset().metaDataset||new e.elements.Line({_chart:this.chart.chart,_datasetIndex:this.index,_points:this.getDataset().metaData}),i.each(this.getDataset().data,function(t,i){this.getDataset().metaData[i]=this.getDataset().metaData[i]||new e.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:i})},this)},addElementAndReset:function(t){this.getDataset().metaData=this.getDataset().metaData||[];var i=new e.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:t});this.updateElement(i,t,!0),this.getDataset().metaData.splice(t,0,i),this.updateBezierControlPoints()},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){var e,a=this.getDataset().metaDataset,s=this.getDataset().metaData,o=this.getScaleForId(this.getDataset().yAxisID);this.getScaleForId(this.getDataset().xAxisID);e=o.min<0&&o.max<0?o.getPixelForValue(o.max):o.min>0&&o.max>0?o.getPixelForValue(o.min):o.getPixelForValue(0),i.extend(a,{_scale:o,_datasetIndex:this.index,_children:s,_model:{tension:a.custom&&a.custom.tension?a.custom.tension:this.getDataset().tension||this.chart.options.elements.line.tension,backgroundColor:a.custom&&a.custom.backgroundColor?a.custom.backgroundColor:this.getDataset().backgroundColor||this.chart.options.elements.line.backgroundColor,borderWidth:a.custom&&a.custom.borderWidth?a.custom.borderWidth:this.getDataset().borderWidth||this.chart.options.elements.line.borderWidth,borderColor:a.custom&&a.custom.borderColor?a.custom.borderColor:this.getDataset().borderColor||this.chart.options.elements.line.borderColor,borderCapStyle:a.custom&&a.custom.borderCapStyle?a.custom.borderCapStyle:this.getDataset().borderCapStyle||this.chart.options.elements.line.borderCapStyle,borderDash:a.custom&&a.custom.borderDash?a.custom.borderDash:this.getDataset().borderDash||this.chart.options.elements.line.borderDash,borderDashOffset:a.custom&&a.custom.borderDashOffset?a.custom.borderDashOffset:this.getDataset().borderDashOffset||this.chart.options.elements.line.borderDashOffset,borderJoinStyle:a.custom&&a.custom.borderJoinStyle?a.custom.borderJoinStyle:this.getDataset().borderJoinStyle||this.chart.options.elements.line.borderJoinStyle,fill:a.custom&&a.custom.fill?a.custom.fill:void 0!==this.getDataset().fill?this.getDataset().fill:this.chart.options.elements.line.fill,scaleTop:o.top,scaleBottom:o.bottom,scaleZero:e}}),a.pivot(),i.each(s,function(e,i){this.updateElement(e,i,t)},this),this.updateBezierControlPoints()},updateElement:function(t,e,a){var s,o=this.getScaleForId(this.getDataset().yAxisID),n=this.getScaleForId(this.getDataset().xAxisID);s=o.min<0&&o.max<0?o.getPixelForValue(o.max):o.min>0&&o.max>0?o.getPixelForValue(o.min):o.getPixelForValue(0),i.extend(t,{_chart:this.chart.chart,_xScale:n,_yScale:o,_datasetIndex:this.index,_index:e,_model:{x:n.getPixelForValue(this.getDataset().data[e],e,this.index,this.chart.isCombo),y:a?s:o.getPixelForValue(this.getDataset().data[e],e,this.index),tension:t.custom&&t.custom.tension?t.custom.tension:this.getDataset().tension||this.chart.options.elements.line.tension,radius:t.custom&&t.custom.radius?t.custom.radius:i.getValueAtIndexOrDefault(this.getDataset().radius,e,this.chart.options.elements.point.radius),backgroundColor:t.custom&&t.custo
display:"YYYY",maxStep:!1}}},s={position:"bottom",time:{format:!1,unit:!1,round:!1,displayFormat:!1}},o=e.Scale.extend({getLabelMoment:function(t,e){return this.labelMoments[t][e]},buildLabelMoments:function(){var t=[];this.data.labels&&this.data.labels.length>0?(i.each(this.data.labels,function(e,i){var a=this.parseTime(e);this.options.time.round&&a.startOf(this.options.time.round),t.push(a)},this),this.options.time.min?this.firstTick=this.parseTime(this.options.time.min):this.firstTick=moment.min.call(this,t),this.options.time.max?this.lastTick=this.parseTime(this.options.time.max):this.lastTick=moment.max.call(this,t)):(this.firstTick=null,this.lastTick=null),i.each(this.data.datasets,function(e,a){var s=[];"object"==typeof e.data[0]?i.each(e.data,function(t,e){var i=this.parseTime(this.getRightValue(t));this.options.time.round&&i.startOf(this.options.time.round),s.push(i),this.firstTick=null!==this.firstTick?moment.min(this.firstTick,i):i,this.lastTick=null!==this.lastTick?moment.max(this.lastTick,i):i},this):s=t,this.labelMoments.push(s)},this),this.firstTick=this.firstTick.clone(),this.lastTick=this.lastTick.clone()},buildTicks:function(t){if(this.ticks=[],this.labelMoments=[],this.buildLabelMoments(),this.options.time.unit)this.tickUnit=this.options.time.unit||"day",this.displayFormat=a.unit[this.tickUnit].display,this.tickRange=Math.ceil(this.lastTick.diff(this.firstTick,this.tickUnit,!0));else{var e=this.width-(this.paddingLeft+this.paddingRight),s=e/this.options.ticks.fontSize+4,o=this.options.time.round?0:2;this.tickUnit="millisecond",this.tickRange=Math.ceil(this.lastTick.diff(this.firstTick,this.tickUnit,!0)+o),this.displayFormat=a.unit[this.tickUnit].display,i.each(a.units,function(t){this.tickRange<=s||(this.tickUnit=t,this.tickRange=Math.ceil(this.lastTick.diff(this.firstTick,this.tickUnit)+o),this.displayFormat=a.unit[t].display)},this)}this.firstTick.startOf(this.tickUnit),this.lastTick.endOf(this.tickUnit),this.smallestLabelSeparation=this.width,i.each(this.data.datasets,function(t,e){for(var i=1;i<this.labelMoments[e].length;i++)this.smallestLabelSeparation=Math.min(this.smallestLabelSeparation,this.labelMoments[e][i].diff(this.labelMoments[e][i-1],this.tickUnit,!0))},this),this.options.time.displayFormat&&(this.displayFormat=this.options.time.displayFormat);for(var n=0;n<=this.tickRange;++n)this.ticks.push(this.firstTick.clone().add(n,this.tickUnit))},getLabelForIndex:function(t,e){var i=this.data.labels&&t<this.data.labels.length?this.data.labels[t]:"";return"object"==typeof this.data.datasets[e].data[0]&&(i=this.getRightValue(this.data.datasets[e].data[t])),i},convertTicksToLabels:function(){this.ticks=this.ticks.map(function(t,e,i){var s=t.format(this.options.time.displayFormat?this.options.time.displayFormat:a.unit[this.tickUnit].display);return this.options.ticks.userCallback?this.options.ticks.userCallback(s,e,i):s},this)},getPixelForValue:function(t,e,i,a){var s=this.getLabelMoment(i,e),o=s.diff(this.firstTick,this.tickUnit,!0),n=o/this.tickRange;if(this.isHorizontal()){var r=this.width-(this.paddingLeft+this.paddingRight),h=(r/Math.max(this.ticks.length-1,1),r*n+this.paddingLeft);return this.left+Math.round(h)}var l=this.height-(this.paddingTop+this.paddingBottom),c=(l/Math.max(this.ticks.length-1,1),l*n+this.paddingTop);return this.top+Math.round(c)},parseTime:function(t){return"function"==typeof t.getMonth||"number"==typeof t?moment(t):t.isValid&&t.isValid()?t:"string"!=typeof this.options.time.format&&this.options.time.format.call?this.options.time.format(t):moment(t,this.options.time.format)}});e.scaleService.registerScaleType("time",o,s)}.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.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}),o=a.startAngle<-.5*Math.PI?a.startAngle+2*Math.PI:a.startAngle>1.5*Math.PI?a.startAngle-2*Math.PI:a.startAngle,n=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>=o&&s.angle<=n,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
*/
2015-10-25 00:47:24 +02:00
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},e.elements.Line=e.Element.extend({draw:function(){var t=this._view,a=this._chart.ctx,s=this._children[0],o=this._children[this._children.length-1];if(a.save(),i.each(this._children,function(e,s){var o=i.previousItem(this._children,s),n=i.nextItem(this._children,s);return s||a.moveTo(e._view.x,t.scaleZero),e._view.skip&&!this.loop?(a.lineTo(o._view.x,t.scaleZero),void a.moveTo(n._view.x,t.scaleZero)):o._view.skip?void a.lineTo(e._view.x,e._view.y):t.tension>0&&s?void a.bezierCurveTo(o._view.controlPointNextX,o._view.controlPointNextY,e._view.controlPointPreviousX,e._view.controlPointPreviousY,e._view.x,e._view.y):void a.lineTo(e._view.x,e._view.y)},this),this._loop){if(t.tension>0&&!s._view.skip)return void a.bezierCurveTo(o._view.controlPointNextX,o._view.controlPointNextY,s._view.controlPointPreviousX,s._view.controlPointPreviousY,s._view.x,s._view.y);a.lineTo(s._view.x,s._view.y)}if(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 o=i.previousItem(this._children,s),n=i.nextItem(this._children,s);return s||a.moveTo(e._view.x,t.scaleZero),e._view.skip&&!this.loop?void a.moveTo(n._view.x,t.scaleZero):o._view.skip?void a.moveTo(e._view.x,e._view.y):t.tension>0&&s?void a.bezierCurveTo(o._view.controlPointNextX,o._view.controlPointNextY,e._view.controlPointPreviousX,e._view.controlPointPreviousY,e._view.x,e._view.y):void a.lineTo(e._view.x,e._view.y)},this),this._loop&&!s._view.skip){if(t.tension>0)return void a.bezierCurveTo(o._view.controlPointNextX,o._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-10-25 00:47:24 +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,o=e.base-(e.base-e.y),n=e.borderWidth/2;e.borderWidth&&(a+=n,s-=n,o+=n),t.beginPath(),t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.moveTo(a,e.base),t.lineTo(a,o),t.lineTo(s,o),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={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{template:"(<%= value.x %>, <%= value.y %>)",multiTemplate:"<%if (datasetLabel){%><%=datasetLabel%>: <%}%>(<%= value.x %>, <%= value.y %>)"}};e.Bubble=function(t,s){return s.options=i.configMerge(a,s.options),s.type="bubble",new e(t,s)}}.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