chartist_js 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc361f7fdbed3f9342ac5038fa83ccd4057cd035
4
- data.tar.gz: 8253cf5aea7d285a83dcc77295644bb4077e2b8e
3
+ metadata.gz: 5933dd58c1ee6ea7c521d9709b90b438c58bfabc
4
+ data.tar.gz: f8f761360fb4fa70fc300f1d622f71f6fff15e87
5
5
  SHA512:
6
- metadata.gz: 13328565bbae86b9b84fa8af20f2d3b1de4a2818843069d1bc77599a3e0b773f2abf55436961ea718e2f1981a60896e6595e38400d75e9cc2215c929a9a9c195
7
- data.tar.gz: 1a651a693a821494830d7324eeb81ee415bc1ff9d9ab04b44b32f315959f47c62ba5c59b58644e86ffb085d5dc715fc33d72208298cdfb5f2be6449f6b283169
6
+ metadata.gz: 7ff96ea335632cc7103c9a63d52095f4f2b58a4b3af4c4f9c497e7cfcdc61f76d84aff21c29be6b7f00c3c392aa6e0caa8de69538a854c44eb89c57becc99700
7
+ data.tar.gz: 271a0d72381b28f17f9de7e951e169d412e108f2f69fd90ca9248b700ffdd24b9ba245323345d9263127d5f18ee9e0e936834251a16b4e0eed22fb8e42b2c115
@@ -10,4 +10,4 @@
10
10
  # Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  # about supported directives.
12
12
  #
13
- #= require_tree ./chartist_js
13
+ #= require ./chartist_js/chartist
@@ -1,3 +1,3 @@
1
1
  module ChartistJs
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartist_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Gorbunov
@@ -37,8 +37,6 @@ files:
37
37
  - app/assets/javascripts/chartist_js.js.coffee
38
38
  - app/assets/javascripts/chartist_js/LICENSE
39
39
  - app/assets/javascripts/chartist_js/chartist.js
40
- - app/assets/javascripts/chartist_js/chartist.min.js
41
- - app/assets/javascripts/chartist_js/chartist.min.map
42
40
  - app/assets/stylesheets/chartist_js.css.scss
43
41
  - app/assets/stylesheets/chartist_js/_modules.scss
44
42
  - app/assets/stylesheets/chartist_js/chartist.scss
@@ -1,8 +0,0 @@
1
- /* Chartist.js 0.1.11
2
- * Copyright © 2014 Gion Kunz
3
- * Free to use under the WTFPL license.
4
- * http://www.wtfpl.net/
5
- */
6
-
7
- !function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define([],b):a.Chartist=b()}(this,function(){var a={};return a.version="0.1.11",function(a,b,c){"use strict";c.noop=function(a){return a},c.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},c.extend=function(a,b){a=a||{};for(var d in b)a[d]="object"==typeof b[d]?c.extend(a[d],b[d]):b[d];return a},c.getHeight=function(a){return a.clientHeight||Math.round(a.getBBox().height)||a.parentNode.clientHeight},c.getWidth=function(a){return a.clientWidth||Math.round(a.getBBox().width)||a.parentNode.clientWidth},c.createSvg=function(a,d,e,f){var g,h=a.nodeType?a:b.querySelector(a);if(!h)throw'Container node with selector "'+a+'" not found';return void 0!==h._ctChart?(g=h._ctChart.attr({width:d||"100%",height:e||"100%"}).removeAllClasses().addClass(f),g.empty()):(g=c.svg("svg").attr({width:d||"100%",height:e||"100%"}).addClass(f),h.appendChild(g._node),h._ctChart=g),g},c.getDataArray=function(a){for(var b=[],c=0;c<a.series.length;c++)b[c]="object"==typeof a.series[c]&&void 0!==a.series[c].data?a.series[c].data:a.series[c];return b},c.normalizeDataArray=function(a,b){for(var c=0;c<a.length;c++)if(a[c].length!==b)for(var d=a[c].length;b>d;d++)a[c][d]=0;return a},c.orderOfMagnitude=function(a){return Math.floor(Math.log(Math.abs(a))/Math.LN10)},c.projectLength=function(a,b,d,e){var f=c.getAvailableHeight(a,e);return b/d.range*f},c.getAvailableHeight=function(a,b){return c.getHeight(a._node)-2*b.chartPadding-b.axisX.offset},c.getHighLow=function(a){var b,c,d={high:-Number.MAX_VALUE,low:Number.MAX_VALUE};for(b=0;b<a.length;b++)for(c=0;c<a[b].length;c++)a[b][c]>d.high&&(d.high=a[b][c]),a[b][c]<d.low&&(d.low=a[b][c]);return d},c.getBounds=function(a,b,d,e){var f,g,h,i=c.getHighLow(b);for(i.high=d.high||(0===d.high?0:i.high),i.low=d.low||(0===d.low?0:i.low),(e||0===e)&&(i.high=Math.max(e,i.high),i.low=Math.min(e,i.low)),i.valueRange=i.high-i.low,i.oom=c.orderOfMagnitude(i.valueRange),i.min=Math.floor(i.low/Math.pow(10,i.oom))*Math.pow(10,i.oom),i.max=Math.ceil(i.high/Math.pow(10,i.oom))*Math.pow(10,i.oom),i.range=i.max-i.min,i.step=Math.pow(10,i.oom),i.numberOfSteps=Math.round(i.range/i.step);;){var j=c.projectLength(a,i.step/2,i,d);if(!(j>=d.axisY.scaleMinSpace))break;i.step/=2}for(g=i.min,h=i.max,f=i.min;f<=i.max;f+=i.step)f+i.step<i.low&&(g+=i.step),f-i.step>i.high&&(h-=i.step);for(i.min=g,i.max=h,i.range=i.max-i.min,i.values=[],f=i.min;f<=i.max;f+=i.step)i.values.push(f);return i},c.calculateLabelOffset=function(a,b,c,d,e){for(var f=0,g=0;g<b.length;g++){var h=d(b[g],g);if(h||0===h){var i=a.elem("text",{dx:0,dy:0},c).text(""+h);f=Math.max(f,e(i._node)),i.remove()}}return f},c.interpolateData=function(a,b,c){for(var d=0;d<a.length;d++){var e=b(a[d],d);(e||0===e)&&c(a,d,e)}},c.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},c.createChartRect=function(a,b,d,e){return{x1:b.chartPadding+e,y1:(b.height||c.getHeight(a._node))-b.chartPadding-d,x2:(b.width||c.getWidth(a._node))-b.chartPadding,y2:b.chartPadding,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}}},c.createXAxis=function(a,b,d,e,f){b.labels.forEach(function(g,h){var i=f.axisX.labelInterpolationFnc(g,h),j=a.x1+a.width()/b.labels.length*h;if((i||0===i)&&(f.axisX.showGrid&&d.elem("line",{x1:j,y1:a.y1,x2:j,y2:a.y2},[f.classNames.grid,f.classNames.horizontal].join(" ")),f.axisX.showLabel)){var k=e.elem("text",{dx:j+2},[f.classNames.label,f.classNames.horizontal].join(" ")).text(""+i);k.attr({dy:a.y1+c.getHeight(k._node)+f.axisX.offset})}})},c.createYAxis=function(a,b,c,d,e,f){b.values.forEach(function(g,h){var i=f.axisY.labelInterpolationFnc(g,h),j=a.y1-a.height()/b.values.length*h;(i||0===i)&&(f.axisY.showGrid&&c.elem("line",{x1:a.x1,y1:j,x2:a.x2,y2:j},[f.classNames.grid,f.classNames.vertical].join(" ")),f.axisY.showLabel&&d.elem("text",{dx:"right"===f.axisY.labelAlign?e-f.axisY.offset+f.chartPadding:f.chartPadding,dy:j-2,"text-anchor":"right"===f.axisY.labelAlign?"end":"start"},[f.classNames.label,f.classNames.vertical].join(" ")).text(""+i))})},c.projectPoint=function(a,b,c,d){return{x:a.x1+a.width()/c.length*d,y:a.y1-a.height()*(c[d]-b.min)/(b.range+b.step)}},c.optionsProvider=function(b,d,e,f){function g(){if(h=c.extend({},j),e)for(i=0;i<e.length;i++){var b=a.matchMedia(e[i][0]);b.matches&&(h=c.extend(h,e[i][1]))}return f(h),h}var h,i,j=c.extend(c.extend({},b),d),k=[];if(!a.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(e)for(i=0;i<e.length;i++){var l=a.matchMedia(e[i][0]);l.addListener(g),k.push(l)}return g()},c.catmullRom2bezier=function(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4===d?f[3]={x:+a[0],y:+a[1]}:e-2===d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4===d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push([(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}}(window,document,a),function(a,b,c){"use strict";c.svg=function(a,d,e,f){function g(a,b){return Object.keys(b).forEach(function(c){a.setAttribute(c,b[c])}),a}function h(a,c,d,e,f){var h=b.createElementNS(p,c);return h._ctSvgElement=a,f&&f.appendChild(h),d&&g(h,d),e&&m(h,e),h}function i(a,c){a.appendChild(b.createTextNode(c))}function j(a){for(;a.firstChild;)a.removeChild(a.firstChild)}function k(a){a.parentNode.removeChild(a)}function l(a){return a.getAttribute("class")?a.getAttribute("class").trim().split(/\s+/):[]}function m(a,b){a.setAttribute("class",l(a).concat(b.trim().split(/\s+/)).filter(function(a,b,c){return c.indexOf(a)===b}).join(" "))}function n(a,b){var c=b.trim().split(/\s+/);a.setAttribute("class",l(a).filter(function(a){return-1===c.indexOf(a)}).join(" "))}function o(a){a.className=""}var p="http://www.w3.org/2000/svg";return{_node:h(this,a,d,e,f?f._node:void 0),_parent:f,parent:function(){return this._parent},attr:function(a){return g(this._node,a),this},empty:function(){return j(this._node),this},remove:function(){return k(this._node),this},elem:function(a,b,d){return c.svg(a,b,d,this)},text:function(a){return i(this._node,a),this},addClass:function(a){return m(this._node,a),this},removeClass:function(a){return n(this._node,a),this},removeAllClasses:function(){return o(this._node),this},classes:function(){return l(this._node)}}}}(window,document,a),function(a,b,c){"use strict";c.Line=function(b,d,e,f){function g(a){var e,f,g,h=[],j=c.normalizeDataArray(c.getDataArray(d),d.labels.length);i=c.createSvg(b,a.width,a.height,a.classNames.chart),g=c.getBounds(i,j,a),e=a.axisX.offset,a.axisX.showLabel&&(e+=c.calculateLabelOffset(i,d.labels,[a.classNames.label,a.classNames.horizontal].join(" "),a.axisX.labelInterpolationFnc,c.getHeight)),f=a.axisY.offset,a.axisY.showLabel&&(f+=c.calculateLabelOffset(i,g.values,[a.classNames.label,a.classNames.horizontal].join(" "),a.axisY.labelInterpolationFnc,c.getWidth));var k=c.createChartRect(i,a,e,f),l=i.elem("g"),m=i.elem("g");c.createXAxis(k,d,m,l,a),c.createYAxis(k,g,m,l,f,a);for(var n=0;n<d.series.length;n++){h[n]=i.elem("g"),h[n].addClass([a.classNames.series,d.series[n].className||a.classNames.series+"-"+c.alphaNumerate(n)].join(" "));var o,p=c.projectPoint(k,g,j[n],0),q=[p.x,p.y];a.showPoint&&(o=h[n].elem("line",{x1:p.x,y1:p.y,x2:p.x+.01,y2:p.y},a.classNames.point));for(var r=1;r<j[n].length;r++)p=c.projectPoint(k,g,j[n],r),q.push(p.x,p.y),a.showPoint&&(o=h[n].elem("line",{x1:p.x,y1:p.y,x2:p.x+.01,y2:p.y},a.classNames.point));if(a.showLine){var s="M"+q[0]+","+q[1]+" ";if(a.lineSmooth&&q.length>4)for(var t=c.catmullRom2bezier(q),u=0;u<t.length;u++)s+="C"+t[u].join();else for(var v=3;v<q.length;v+=2)s+="L "+q[v-1]+","+q[v];h[n].elem("path",{d:s},a.classNames.line)}}}var h,i,j={axisX:{offset:10,showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop},axisY:{offset:15,showLabel:!0,showGrid:!0,labelAlign:"right",labelInterpolationFnc:c.noop,scaleMinSpace:30},width:void 0,height:void 0,showLine:!0,showPoint:!0,lineSmooth:!0,low:void 0,high:void 0,chartPadding:5,classNames:{chart:"ct-chart-line",label:"ct-label",series:"ct-series",line:"ct-line",point:"ct-point",grid:"ct-grid",vertical:"ct-vertical",horizontal:"ct-horizontal"}};return h=c.optionsProvider(j,e,f,function(a){h=a,g(h)}),a.addEventListener("resize",function(){g(h)}),{version:c.version,update:function(){g(h)}}}}(window,document,a),function(a,b,c){"use strict";c.Bar=function(b,d,e,f){function g(a){var e,f,g,h=[],j=c.normalizeDataArray(c.getDataArray(d),d.labels.length);i=c.createSvg(b,a.width,a.height,a.classNames.chart),g=c.getBounds(i,j,a,0),e=a.axisX.offset,a.axisX.showLabel&&(e+=c.calculateLabelOffset(i,d.labels,[a.classNames.label,a.classNames.horizontal].join(" "),a.axisX.labelInterpolationFnc,c.getHeight)),f=a.axisY.offset,a.axisY.showLabel&&(f+=c.calculateLabelOffset(i,g.values,[a.classNames.label,a.classNames.horizontal].join(" "),a.axisY.labelInterpolationFnc,c.getWidth));var k=c.createChartRect(i,a,e,f),l=i.elem("g"),m=i.elem("g"),n=c.projectPoint(k,g,[0],0);c.createXAxis(k,d,m,l,a),c.createYAxis(k,g,m,l,f,a);for(var o=0;o<d.series.length;o++){var p=o-(d.series.length-1)/2,q=k.width()/j[o].length/2;h[o]=i.elem("g"),h[o].addClass([a.classNames.series,d.series[o].className||a.classNames.series+"-"+c.alphaNumerate(o)].join(" "));for(var r=0;r<j[o].length;r++){var s,t=c.projectPoint(k,g,j[o],r);t.x+=q+p*a.seriesBarDistance,s=h[o].elem("line",{x1:t.x,y1:n.y,x2:t.x,y2:t.y},a.classNames.bar+(d.series[o].barClasses?" "+d.series[o].barClasses:""))}}}var h,i,j={axisX:{offset:10,showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop},axisY:{offset:15,showLabel:!0,showGrid:!0,labelAlign:"right",labelInterpolationFnc:c.noop,scaleMinSpace:40},width:void 0,height:void 0,high:void 0,low:void 0,chartPadding:5,seriesBarDistance:15,classNames:{chart:"ct-chart-bar",label:"ct-label",series:"ct-series",bar:"ct-bar",thin:"ct-thin",thick:"ct-thick",grid:"ct-grid",vertical:"ct-vertical",horizontal:"ct-horizontal"}};return h=c.optionsProvider(j,e,f,function(a){h=a,g(h)}),a.addEventListener("resize",function(){g(h)}),{version:c.version,update:function(){g(h)}}}}(window,document,a),function(a,b,c){"use strict";c.Pie=function(b,d,e,f){function g(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function h(a){var e,f,h,i,k=[],l=a.startAngle,m=c.getDataArray(d);j=c.createSvg(b,a.width,a.height,a.classNames.chart),e=c.createChartRect(j,a,0,0),f=Math.min(e.width()/2,e.height()/2),i=a.total||m.reduce(function(a,b){return a+b},0),f-=a.donut?a.donutWidth/2:0,h=a.donut?f:f/2,h+=a.labelOffset;for(var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=0;o<d.series.length;o++){k[o]=j.elem("g"),k[o].addClass([a.classNames.series,d.series[o].className||a.classNames.series+"-"+c.alphaNumerate(o)].join(" "));var p=l+m[o]/i*360;p-l===360&&(p-=.01);var q=c.polarToCartesian(n.x,n.y,f,l-(0===o?0:.2)),r=c.polarToCartesian(n.x,n.y,f,p),s=180>=p-l?"0":"1",t=["M",r.x,r.y,"A",f,f,0,s,0,q.x,q.y];a.donut===!1&&t.push("L",n.x,n.y);var u=k[o].elem("path",{d:t.join(" ")},a.classNames.slice+(a.donut?" "+a.classNames.donut:""));if(a.donut===!0&&u.attr({style:"stroke-width: "+ +a.donutWidth+"px"}),a.showLabel){var v=c.polarToCartesian(n.x,n.y,h,l+(p-l)/2),w=a.labelInterpolationFnc(d.labels?d.labels[o]:m[o],o);k[o].elem("text",{dx:v.x,dy:v.y,"text-anchor":g(n,v,a.labelDirection),text:""+w},a.classNames.label).text(""+w)}l=p}}var i,j,k={width:void 0,height:void 0,chartPadding:5,classNames:{chart:"ct-chart-pie",series:"ct-series",slice:"ct-slice",donut:"ct-donut",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelInterpolationFnc:c.noop,labelOverflow:!1,labelDirection:"neutral"};return i=c.optionsProvider(k,e,f,function(a){i=a,h(i)}),a.addEventListener("resize",function(){h(i)}),{version:c.version,update:function(){h(i)}}}}(window,document,a),a});
8
- //# sourceMappingURL=chartist.min.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chartist.min.js","sources":["chartist.js"],"names":["root","factory","exports","module","define","amd","this","Chartist","version","window","document","noop","n","alphaNumerate","String","fromCharCode","extend","target","source","prop","getHeight","svgElement","clientHeight","Math","round","getBBox","height","parentNode","getWidth","clientWidth","width","createSvg","query","className","svg","container","nodeType","querySelector","undefined","_ctChart","attr","removeAllClasses","addClass","empty","appendChild","_node","getDataArray","data","array","i","series","length","normalizeDataArray","dataArray","j","orderOfMagnitude","value","floor","log","abs","LN10","projectLength","bounds","options","availableHeight","getAvailableHeight","range","chartPadding","axisX","offset","getHighLow","highLow","high","Number","MAX_VALUE","low","getBounds","normalizedData","referenceValue","newMin","newMax","max","min","valueRange","oom","pow","ceil","step","numberOfSteps","axisY","scaleMinSpace","values","push","calculateLabelOffset","labelClass","labelInterpolationFnc","offsetFnc","interpolated","label","elem","dx","dy","text","remove","interpolateData","callback","index","interpolatedValue","polarToCartesian","centerX","centerY","radius","angleInDegrees","angleInRadians","PI","x","cos","y","sin","createChartRect","xAxisOffset","yAxisOffset","x1","y1","x2","y2","createXAxis","chartRect","grid","labels","forEach","pos","showGrid","classNames","horizontal","join","showLabel","createYAxis","vertical","labelAlign","text-anchor","projectPoint","optionsProvider","defaultOptions","responsiveOptions","optionsChangedCallbackFnc","applyOptions","currentOptions","baseOptions","mql","matchMedia","matches","mediaQueryListeners","addListener","catmullRom2bezier","crp","z","d","iLen","p","name","attributes","parent","node","Object","keys","key","setAttribute","createElementNS","svgns","_ctSvgElement","t","createTextNode","firstChild","removeChild","classes","getAttribute","trim","split","names","concat","filter","self","indexOf","removeClass","removedClasses","_parent","Line","createChart","seriesGroups","chart","point","pathCoordinates","showPoint","showLine","svgPathString","lineSmooth","cr","k","l","line","changedOptions","addEventListener","update","Bar","zeroPoint","biPol","periodHalfWidth","bar","seriesBarDistance","barClasses","thin","thick","Pie","determineAnchorPosition","center","direction","toTheRight","labelRadius","totalDataSum","startAngle","total","reduce","previousValue","currentValue","donut","donutWidth","labelOffset","endAngle","start","end","arcSweep","path","slice","style","labelPosition","labelDirection","labelOverflow"],"mappings":";;;;;;CAAC,SAASA,EAAMC,GACU,gBAAZC,SACNC,OAAOD,QAAUD,IAEK,kBAAXG,SAAyBA,OAAOC,IAC3CD,UAAWH,GAGXD,EAAe,SAAIC,KAEzBK,KAAM,WAcN,GAAIC,KA60CJ,OA50CAA,GAASC,QAAU,SAElB,SAAUC,EAAQC,EAAUH,GAC3B,YAGAA,GAASI,KAAO,SAAUC,GACxB,MAAOA,IAITL,EAASM,cAAgB,SAAUD,GAEjC,MAAOE,QAAOC,aAAa,GAAKH,EAAI,KAItCL,EAASS,OAAS,SAAUC,EAAQC,GAClCD,EAASA,KACT,KAAK,GAAIE,KAAQD,GAEbD,EAAOE,GADmB,gBAAjBD,GAAOC,GACDZ,EAASS,OAAOC,EAAOE,GAAOD,EAAOC,IAErCD,EAAOC,EAG1B,OAAOF,IAKTV,EAASa,UAAY,SAAUC,GAC7B,MAAOA,GAAWC,cAAgBC,KAAKC,MAAMH,EAAWI,UAAUC,SAAWL,EAAWM,WAAWL,cAGrGf,EAASqB,SAAW,SAAUP,GAC5B,MAAOA,GAAWQ,aAAeN,KAAKC,MAAMH,EAAWI,UAAUK,QAAUT,EAAWM,WAAWE,aAInGtB,EAASwB,UAAY,SAAUC,EAAOF,EAAOJ,EAAQO,GAEnD,GACEC,GADEC,EAAYH,EAAMI,SAAWJ,EAAQtB,EAAS2B,cAAcL,EAIhE,KAAKG,EACH,KAAM,iCAAmCH,EAAQ,aAwBnD,OApB2BM,UAAvBH,EAAUI,UACZL,EAAMC,EAAUI,SAASC,MACvBV,MAAOA,GAAS,OAChBJ,OAAQA,GAAU,SACjBe,mBAAmBC,SAAST,GAE/BC,EAAIS,UAIJT,EAAM3B,EAAS2B,IAAI,OAAOM,MACxBV,MAAOA,GAAS,OAChBJ,OAAQA,GAAU,SACjBgB,SAAST,GAGZE,EAAUS,YA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G,EAAGqG,EAAaE,GAAcQ,EAAWR,GAAc,GACpHjH,EAAoB5C,EAAQgC,sBAAsBhD,EAAKkF,OAASlF,EAAKkF,OAAOhF,GAAKI,EAAUJ,GAAIA,EAEjG4I,GAAa5I,GAAGkD,KAAK,QACnBC,GAAIuI,EAAcxH,EAClBd,GAAIsI,EAActH,EAClBuB,cAAe0E,EAAwBC,EAAQoB,EAAe5K,EAAQ6K,gBACtEtI,KAAM,GAAKK,GACV5C,EAAQsE,WAAWnC,OAAOI,KAAK,GAAKK,GAKzCiH,EAAaQ,GAxIjB,GAqBEjF,GACAjH,EAtBE6G,GACAjH,MAAOQ,OACPZ,OAAQY,OACR6B,aAAc,EACdkE,YACEyD,MAAO,eACP5I,OAAQ,YACRuL,MAAO,WACPR,MAAO,WACP/H,MAAO,YAET0H,WAAY,EACZC,MAAOvL,OACP2L,OAAO,EACPC,WAAY,GACZ1F,WAAW,EACX2F,YAAa,EACbpI,sBAAuBxF,EAASI,KAChCkO,eAAe,EACfD,eAAgB,UA2IpB,OAhBAzF,GAAiB5I,EAASuI,gBAAgBC,EAAgBhF,EAASiF,EAAmB,SAAUyD,GAC9FtD,EAAiBsD,EACjBb,EAAYzC,KASd1I,EAAOiM,iBAAiB,SAAU,WAChCd,EAAYzC,MAKZ3I,QAASD,EAASC,QAClBmM,OAAQ,WACNf,EAAYzC,OAKlB1I,OAAQC,SAAUH,GAEbA","sourcesContent":["(function(root, factory) {\n if(typeof exports === 'object') {\n module.exports = factory();\n }\n else if(typeof define === 'function' && define.amd) {\n define([], factory);\n }\n else {\n root['Chartist'] = factory();\n }\n}(this, function() {\n\n /* Chartist.js 0.1.11\n * Copyright © 2014 Gion Kunz\n * Free to use under the WTFPL license.\n * http://www.wtfpl.net/\n */\n /**\n * The core module of Chartist that is mainly providing static functions and higher level functions for chart modules.\n *\n * @module Chartist.Core\n */\n\n // This object is prepared for export via UMD\n var Chartist = {};\n Chartist.version = '0.1.11';\n\n (function (window, document, Chartist) {\n 'use strict';\n\n // Helps to simplify functional style code\n Chartist.noop = function (n) {\n return n;\n };\n\n // Generates a-z from number\n Chartist.alphaNumerate = function (n) {\n // Limit to a-z\n return String.fromCharCode(97 + n % 26);\n };\n\n // Simple recursive object extend\n Chartist.extend = function (target, source) {\n target = target || {};\n for (var prop in source) {\n if (typeof source[prop] === 'object') {\n target[prop] = Chartist.extend(target[prop], source[prop]);\n } else {\n target[prop] = source[prop];\n }\n }\n return target;\n };\n\n // Get element height / width with fallback to svg BoundingBox or parent container dimensions\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=530985\n Chartist.getHeight = function (svgElement) {\n return svgElement.clientHeight || Math.round(svgElement.getBBox().height) || svgElement.parentNode.clientHeight;\n };\n\n Chartist.getWidth = function (svgElement) {\n return svgElement.clientWidth || Math.round(svgElement.getBBox().width) || svgElement.parentNode.clientWidth;\n };\n\n // Create Chartist SVG element\n Chartist.createSvg = function (query, width, height, className) {\n // Get dom object from query or if already dom object just use it\n var container = query.nodeType ? query : document.querySelector(query),\n svg;\n\n // If container was not found we throw up\n if (!container) {\n throw 'Container node with selector \"' + query + '\" not found';\n }\n\n // If already contains our svg object we clear it, set width / height and return\n if (container._ctChart !== undefined) {\n svg = container._ctChart.attr({\n width: width || '100%',\n height: height || '100%'\n }).removeAllClasses().addClass(className);\n // Clear the draw if its already used before so we start fresh\n svg.empty();\n\n } else {\n // Create svg object with width and height or use 100% as default\n svg = Chartist.svg('svg').attr({\n width: width || '100%',\n height: height || '100%'\n }).addClass(className);\n\n // Add the DOM node to our container\n container.appendChild(svg._node);\n container._ctChart = svg;\n }\n\n return svg;\n };\n\n // Convert data series into plain array\n Chartist.getDataArray = function (data) {\n var array = [];\n\n for (var i = 0; i < data.series.length; i++) {\n // If the series array contains an object with a data property we will use the property\n // otherwise the value directly (array or number)\n array[i] = typeof(data.series[i]) === 'object' && data.series[i].data !== undefined ?\n data.series[i].data : data.series[i];\n }\n\n return array;\n };\n\n // Add missing values at the end of the arrays\n Chartist.normalizeDataArray = function (dataArray, length) {\n for (var i = 0; i < dataArray.length; i++) {\n if (dataArray[i].length === length) {\n continue;\n }\n\n for (var j = dataArray[i].length; j < length; j++) {\n dataArray[i][j] = 0;\n }\n }\n\n return dataArray;\n };\n\n Chartist.orderOfMagnitude = function (value) {\n return Math.floor(Math.log(Math.abs(value)) / Math.LN10);\n };\n\n Chartist.projectLength = function (svg, length, bounds, options) {\n var availableHeight = Chartist.getAvailableHeight(svg, options);\n return (length / bounds.range * availableHeight);\n };\n\n Chartist.getAvailableHeight = function (svg, options) {\n return Chartist.getHeight(svg._node) - (options.chartPadding * 2) - options.axisX.offset;\n };\n\n // Get highest and lowest value of data array\n Chartist.getHighLow = function (dataArray) {\n var i,\n j,\n highLow = {\n high: -Number.MAX_VALUE,\n low: Number.MAX_VALUE\n };\n\n for (i = 0; i < dataArray.length; i++) {\n for (j = 0; j < dataArray[i].length; j++) {\n if (dataArray[i][j] > highLow.high) {\n highLow.high = dataArray[i][j];\n }\n\n if (dataArray[i][j] < highLow.low) {\n highLow.low = dataArray[i][j];\n }\n }\n }\n\n return highLow;\n };\n\n // Find the highest and lowest values in a two dimensional array and calculate scale based on order of magnitude\n Chartist.getBounds = function (svg, normalizedData, options, referenceValue) {\n var i,\n newMin,\n newMax,\n bounds = Chartist.getHighLow(normalizedData);\n\n // Overrides of high / low from settings\n bounds.high = options.high || (options.high === 0 ? 0 : bounds.high);\n bounds.low = options.low || (options.low === 0 ? 0 : bounds.low);\n\n // Overrides of high / low based on reference value, it will make sure that the invisible reference value is\n // used to generate the chart. This is useful when the chart always needs to contain the position of the\n // invisible reference value in the view i.e. for bipolar scales.\n if (referenceValue || referenceValue === 0) {\n bounds.high = Math.max(referenceValue, bounds.high);\n bounds.low = Math.min(referenceValue, bounds.low);\n }\n\n bounds.valueRange = bounds.high - bounds.low;\n bounds.oom = Chartist.orderOfMagnitude(bounds.valueRange);\n bounds.min = Math.floor(bounds.low / Math.pow(10, bounds.oom)) * Math.pow(10, bounds.oom);\n bounds.max = Math.ceil(bounds.high / Math.pow(10, bounds.oom)) * Math.pow(10, bounds.oom);\n bounds.range = bounds.max - bounds.min;\n bounds.step = Math.pow(10, bounds.oom);\n bounds.numberOfSteps = Math.round(bounds.range / bounds.step);\n\n // Optimize scale step by checking if subdivision is possible based on horizontalGridMinSpace\n while (true) {\n var length = Chartist.projectLength(svg, bounds.step / 2, bounds, options);\n if (length >= options.axisY.scaleMinSpace) {\n bounds.step /= 2;\n } else {\n break;\n }\n }\n\n // Narrow min and max based on new step\n newMin = bounds.min;\n newMax = bounds.max;\n for (i = bounds.min; i <= bounds.max; i += bounds.step) {\n if (i + bounds.step < bounds.low) {\n newMin += bounds.step;\n }\n\n if (i - bounds.step > bounds.high) {\n newMax -= bounds.step;\n }\n }\n bounds.min = newMin;\n bounds.max = newMax;\n bounds.range = bounds.max - bounds.min;\n\n bounds.values = [];\n for (i = bounds.min; i <= bounds.max; i += bounds.step) {\n bounds.values.push(i);\n }\n\n return bounds;\n };\n\n Chartist.calculateLabelOffset = function (svg, data, labelClass, labelInterpolationFnc, offsetFnc) {\n var offset = 0;\n for (var i = 0; i < data.length; i++) {\n // If interpolation function returns falsy value we skipp this label\n var interpolated = labelInterpolationFnc(data[i], i);\n if (!interpolated && interpolated !== 0) {\n continue;\n }\n\n var label = svg.elem('text', {\n dx: 0,\n dy: 0\n }, labelClass).text('' + interpolated);\n\n // Check if this is the largest label and update offset\n offset = Math.max(offset, offsetFnc(label._node));\n // Remove label after offset Calculation\n label.remove();\n }\n\n return offset;\n };\n\n // Used to iterate over array, interpolate using a interpolation function and executing callback (used for rendering)\n Chartist.interpolateData = function (data, labelInterpolationFnc, callback) {\n for (var index = 0; index < data.length; index++) {\n // If interpolation function returns falsy value we skipp this label\n var interpolatedValue = labelInterpolationFnc(data[index], index);\n if (!interpolatedValue && interpolatedValue !== 0) {\n continue;\n }\n\n callback(data, index, interpolatedValue);\n }\n };\n\n Chartist.polarToCartesian = function (centerX, centerY, radius, angleInDegrees) {\n var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;\n\n return {\n x: centerX + (radius * Math.cos(angleInRadians)),\n y: centerY + (radius * Math.sin(angleInRadians))\n };\n };\n\n // Initialize chart drawing rectangle (area where chart is drawn) x1,y1 = bottom left / x2,y2 = top right\n Chartist.createChartRect = function (svg, options, xAxisOffset, yAxisOffset) {\n return {\n x1: options.chartPadding + yAxisOffset,\n y1: (options.height || Chartist.getHeight(svg._node)) - options.chartPadding - xAxisOffset,\n x2: (options.width || Chartist.getWidth(svg._node)) - options.chartPadding,\n y2: options.chartPadding,\n width: function () {\n return this.x2 - this.x1;\n },\n height: function () {\n return this.y1 - this.y2;\n }\n };\n };\n\n Chartist.createXAxis = function (chartRect, data, grid, labels, options) {\n // Create X-Axis\n data.labels.forEach(function (value, index) {\n var interpolatedValue = options.axisX.labelInterpolationFnc(value, index),\n pos = chartRect.x1 + chartRect.width() / data.labels.length * index;\n\n // If interpolated value returns falsey (except 0) we don't draw the grid line\n if (!interpolatedValue && interpolatedValue !== 0) {\n return;\n }\n\n if (options.axisX.showGrid) {\n grid.elem('line', {\n x1: pos,\n y1: chartRect.y1,\n x2: pos,\n y2: chartRect.y2\n }, [options.classNames.grid, options.classNames.horizontal].join(' '));\n }\n\n if (options.axisX.showLabel) {\n // Use config offset for setting labels of\n var label = labels.elem('text', {\n dx: pos + 2\n }, [options.classNames.label, options.classNames.horizontal].join(' ')).text('' + interpolatedValue);\n\n // TODO: should use 'alignment-baseline': 'hanging' but not supported in firefox. Instead using calculated height to offset y pos\n label.attr({\n dy: chartRect.y1 + Chartist.getHeight(label._node) + options.axisX.offset\n });\n }\n });\n };\n\n Chartist.createYAxis = function (chartRect, bounds, grid, labels, offset, options) {\n // Create Y-Axis\n bounds.values.forEach(function (value, index) {\n var interpolatedValue = options.axisY.labelInterpolationFnc(value, index),\n pos = chartRect.y1 - chartRect.height() / bounds.values.length * index;\n\n // If interpolated value returns falsey (except 0) we don't draw the grid line\n if (!interpolatedValue && interpolatedValue !== 0) {\n return;\n }\n\n if (options.axisY.showGrid) {\n grid.elem('line', {\n x1: chartRect.x1,\n y1: pos,\n x2: chartRect.x2,\n y2: pos\n }, [options.classNames.grid, options.classNames.vertical].join(' '));\n }\n\n if (options.axisY.showLabel) {\n labels.elem('text', {\n dx: options.axisY.labelAlign === 'right' ? offset - options.axisY.offset + options.chartPadding : options.chartPadding,\n dy: pos - 2,\n 'text-anchor': options.axisY.labelAlign === 'right' ? 'end' : 'start'\n }, [options.classNames.label, options.classNames.vertical].join(' ')).text('' + interpolatedValue);\n }\n });\n };\n\n Chartist.projectPoint = function (chartRect, bounds, data, index) {\n return {\n x: chartRect.x1 + chartRect.width() / data.length * index,\n y: chartRect.y1 - chartRect.height() * (data[index] - bounds.min) / (bounds.range + bounds.step)\n };\n };\n\n // Provides options handling functionality with callback for options changes triggered by responsive options and media query matches\n // TODO: With multiple media queries the handleMediaChange function is triggered too many times, only need one\n Chartist.optionsProvider = function (defaultOptions, options, responsiveOptions, optionsChangedCallbackFnc) {\n var baseOptions = Chartist.extend(Chartist.extend({}, defaultOptions), options),\n currentOptions,\n mediaQueryListeners = [],\n i;\n\n function applyOptions() {\n currentOptions = Chartist.extend({}, baseOptions);\n\n if (responsiveOptions) {\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n if (mql.matches) {\n currentOptions = Chartist.extend(currentOptions, responsiveOptions[i][1]);\n }\n }\n }\n\n optionsChangedCallbackFnc(currentOptions);\n return currentOptions;\n }\n\n if (!window.matchMedia) {\n throw 'window.matchMedia not found! Make sure you\\'re using a polyfill.';\n } else if (responsiveOptions) {\n\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n mql.addListener(applyOptions);\n mediaQueryListeners.push(mql);\n }\n }\n\n return applyOptions();\n };\n\n // http://schepers.cc/getting-to-the-point\n Chartist.catmullRom2bezier = function (crp, z) {\n var d = [];\n for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {\n var p = [\n {x: +crp[i - 2], y: +crp[i - 1]},\n {x: +crp[i], y: +crp[i + 1]},\n {x: +crp[i + 2], y: +crp[i + 3]},\n {x: +crp[i + 4], y: +crp[i + 5]}\n ];\n if (z) {\n if (!i) {\n p[0] = {x: +crp[iLen - 2], y: +crp[iLen - 1]};\n } else if (iLen - 4 === i) {\n p[3] = {x: +crp[0], y: +crp[1]};\n } else if (iLen - 2 === i) {\n p[2] = {x: +crp[0], y: +crp[1]};\n p[3] = {x: +crp[2], y: +crp[3]};\n }\n } else {\n if (iLen - 4 === i) {\n p[3] = p[2];\n } else if (!i) {\n p[0] = {x: +crp[i], y: +crp[i + 1]};\n }\n }\n d.push(\n [\n (-p[0].x + 6 * p[1].x + p[2].x) / 6,\n (-p[0].y + 6 * p[1].y + p[2].y) / 6,\n (p[1].x + 6 * p[2].x - p[3].x) / 6,\n (p[1].y + 6 * p[2].y - p[3].y) / 6,\n p[2].x,\n p[2].y\n ]\n );\n }\n\n return d;\n };\n\n }(window, document, Chartist));;/**\n * Chartist SVG module for simple SVG DOM abstraction\n *\n * @module Chartist.svg\n */\n /* global Chartist */\n (function(window, document, Chartist) {\n 'use strict';\n\n Chartist.svg = function(name, attributes, className, parent) {\n\n var svgns = 'http://www.w3.org/2000/svg';\n\n function attr(node, attributes) {\n Object.keys(attributes).forEach(function(key) {\n node.setAttribute(key, attributes[key]);\n });\n\n return node;\n }\n\n function elem(svg, name, attributes, className, parentNode) {\n var node = document.createElementNS(svgns, name);\n node._ctSvgElement = svg;\n\n if(parentNode) {\n parentNode.appendChild(node);\n }\n\n if(attributes) {\n attr(node, attributes);\n }\n\n if(className) {\n addClass(node, className);\n }\n\n return node;\n }\n\n function text(node, t) {\n node.appendChild(document.createTextNode(t));\n }\n\n function empty(node) {\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n }\n\n function remove(node) {\n node.parentNode.removeChild(node);\n }\n\n function classes(node) {\n return node.getAttribute('class') ? node.getAttribute('class').trim().split(/\\s+/) : [];\n }\n\n function addClass(node, names) {\n node.setAttribute('class',\n classes(node)\n .concat(names.trim().split(/\\s+/))\n .filter(function(elem, pos, self) {\n return self.indexOf(elem) === pos;\n }).join(' ')\n );\n }\n\n function removeClass(node, names) {\n var removedClasses = names.trim().split(/\\s+/);\n\n node.setAttribute('class', classes(node).filter(function(name) {\n return removedClasses.indexOf(name) === -1;\n }).join(' '));\n }\n\n function removeAllClasses(node) {\n node.className = '';\n }\n\n return {\n _node: elem(this, name, attributes, className, parent ? parent._node : undefined),\n _parent: parent,\n parent: function() {\n return this._parent;\n },\n attr: function(attributes) {\n attr(this._node, attributes);\n return this;\n },\n empty: function() {\n empty(this._node);\n return this;\n },\n remove: function() {\n remove(this._node);\n return this;\n },\n elem: function(name, attributes, className) {\n return Chartist.svg(name, attributes, className, this);\n },\n text: function(t) {\n text(this._node, t);\n return this;\n },\n addClass: function(names) {\n addClass(this._node, names);\n return this;\n },\n removeClass: function(names) {\n removeClass(this._node, names);\n return this;\n },\n removeAllClasses: function() {\n removeAllClasses(this._node);\n return this;\n },\n classes: function() {\n return classes(this._node);\n }\n };\n };\n\n }(window, document, Chartist));;/**\n * The Chartist line chart can be used to draw Line or Scatter charts. If used in the browser you can access the global `Chartist` namespace where you find the `Line` function as a main entry point.\n *\n * For examples on how to use the line chart please check the examples of the `Chartist.Line` method.\n *\n * @module Chartist.Line\n */\n /* global Chartist */\n (function(window, document, Chartist){\n 'use strict';\n\n /**\n * This method creates a new line chart and returns an object handle to the internal closure. Currently you can use the returned object only for updating / redrawing the chart.\n *\n * @memberof Chartist.Line\n * @param {string|HTMLElement} query A selector query string or directly a DOM element\n * @param {object} data The data object that needs to consist of a labels and a series array\n * @param {object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {object} An object with a version and an update method to manually redraw the chart\n * @function\n *\n * @example\n * // These are the default options of the line chart\n * var options = {\n * // Options for X-Axis\n * axisX: {\n * // The offset of the labels to the chart area\n * offset: 10,\n * // If labels should be shown or not\n * showLabel: true,\n * // If the axis grid should be drawn or not\n * showGrid: true,\n * // Interpolation function that allows you to intercept the value from the axis label\n * labelInterpolationFnc: function(value){return value;}\n * },\n * // Options for Y-Axis\n * axisY: {\n * // The offset of the labels to the chart area\n * offset: 15,\n * // If labels should be shown or not\n * showLabel: true,\n * // If the axis grid should be drawn or not\n * showGrid: true,\n * // For the Y-Axis you can set a label alignment property of right or left\n * labelAlign: 'right',\n * // Interpolation function that allows you to intercept the value from the axis label\n * labelInterpolationFnc: function(value){return value;},\n * // This value specifies the minimum height in pixel of the scale steps\n * scaleMinSpace: 30\n * },\n * // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n * width: undefined,\n * // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n * height: undefined,\n * // If the line should be drawn or not\n * showLine: true,\n * // If dots should be drawn or not\n * showPoint: true,\n * // Specify if the lines should be smoothed (Catmull-Rom-Splines will be used)\n * lineSmooth: true,\n * // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n * low: undefined,\n * // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n * high: undefined,\n * // Padding of the chart drawing area to the container element and labels\n * chartPadding: 5,\n * // Override the class names that get used to generate the SVG structure of the chart\n * classNames: {\n * chart: 'ct-chart-line',\n * label: 'ct-label',\n * series: 'ct-series',\n * line: 'ct-line',\n * point: 'ct-point',\n * grid: 'ct-grid',\n * vertical: 'ct-vertical',\n * horizontal: 'ct-horizontal'\n * }\n * };\n *\n * @example\n * // Create a simple line chart\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // As options we currently only set a static size of 300x200 px\n * var options = {\n * width: '300px',\n * height: '200px'\n * };\n *\n * // In the global name space Chartist we call the Line function to initialize a line chart. As a first parameter we pass in a selector where we would like to get our chart created. Second parameter is the actual data object and as a third parameter we pass in our options\n * Chartist.Line('.ct-chart', data, options);\n *\n * @example\n * // Create a line chart with responsive options\n *\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In adition to the regular options we specify responsive option overrides that will override the default configutation based on the matching media queries.\n * var responsiveOptions = [\n * ['screen and (min-width: 641px) and (max-width: 1024px)', {\n * showPoint: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return Mon, Tue, Wed etc. on medium screens\n * return value.slice(0, 3);\n * }\n * }\n * }],\n * ['screen and (max-width: 640px)', {\n * showLine: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return M, T, W etc. on small screens\n * return value[0];\n * }\n * }\n * }]\n * ];\n *\n * Chartist.Line('.ct-chart', data, null, responsiveOptions);\n *\n */\n Chartist.Line = function (query, data, options, responsiveOptions) {\n\n var defaultOptions = {\n axisX: {\n offset: 10,\n showLabel: true,\n showGrid: true,\n labelInterpolationFnc: Chartist.noop\n },\n axisY: {\n offset: 15,\n showLabel: true,\n showGrid: true,\n labelAlign: 'right',\n labelInterpolationFnc: Chartist.noop,\n scaleMinSpace: 30\n },\n width: undefined,\n height: undefined,\n showLine: true,\n showPoint: true,\n lineSmooth: true,\n low: undefined,\n high: undefined,\n chartPadding: 5,\n classNames: {\n chart: 'ct-chart-line',\n label: 'ct-label',\n series: 'ct-series',\n line: 'ct-line',\n point: 'ct-point',\n grid: 'ct-grid',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal'\n }\n },\n currentOptions,\n svg;\n\n function createChart(options) {\n var xAxisOffset,\n yAxisOffset,\n seriesGroups = [],\n bounds,\n normalizedData = Chartist.normalizeDataArray(Chartist.getDataArray(data), data.labels.length);\n\n // Create new svg object\n svg = Chartist.createSvg(query, options.width, options.height, options.classNames.chart);\n\n // initialize bounds\n bounds = Chartist.getBounds(svg, normalizedData, options);\n\n xAxisOffset = options.axisX.offset;\n if (options.axisX.showLabel) {\n xAxisOffset += Chartist.calculateLabelOffset(\n svg,\n data.labels,\n [options.classNames.label, options.classNames.horizontal].join(' '),\n options.axisX.labelInterpolationFnc,\n Chartist.getHeight\n );\n }\n\n yAxisOffset = options.axisY.offset;\n if (options.axisY.showLabel) {\n yAxisOffset += Chartist.calculateLabelOffset(\n svg,\n bounds.values,\n [options.classNames.label, options.classNames.horizontal].join(' '),\n options.axisY.labelInterpolationFnc,\n Chartist.getWidth\n );\n }\n\n var chartRect = Chartist.createChartRect(svg, options, xAxisOffset, yAxisOffset);\n // Start drawing\n var labels = svg.elem('g'),\n grid = svg.elem('g');\n\n Chartist.createXAxis(chartRect, data, grid, labels, options);\n Chartist.createYAxis(chartRect, bounds, grid, labels, yAxisOffset, options);\n\n // Draw the series\n // initialize series groups\n for (var i = 0; i < data.series.length; i++) {\n seriesGroups[i] = svg.elem('g');\n // Use series class from series data or if not set generate one\n seriesGroups[i].addClass([\n options.classNames.series,\n (data.series[i].className || options.classNames.series + '-' + Chartist.alphaNumerate(i))\n ].join(' '));\n\n var p = Chartist.projectPoint(chartRect, bounds, normalizedData[i], 0),\n pathCoordinates = [p.x, p.y],\n point;\n\n // First dot we need to add before loop\n if (options.showPoint) {\n // Small offset for Firefox to render squares correctly\n point = seriesGroups[i].elem('line', {\n x1: p.x,\n y1: p.y,\n x2: p.x + 0.01,\n y2: p.y\n }, options.classNames.point);\n }\n\n // First point is created, continue with rest\n for (var j = 1; j < normalizedData[i].length; j++) {\n p = Chartist.projectPoint(chartRect, bounds, normalizedData[i], j);\n pathCoordinates.push(p.x, p.y);\n\n //If we should show points we need to create them now to avoid secondary loop\n // Small offset for Firefox to render squares correctly\n if (options.showPoint) {\n point = seriesGroups[i].elem('line', {\n x1: p.x,\n y1: p.y,\n x2: p.x + 0.01,\n y2: p.y\n }, options.classNames.point);\n }\n }\n\n if (options.showLine) {\n var svgPathString = 'M' + pathCoordinates[0] + ',' + pathCoordinates[1] + ' ';\n\n // If smoothed path and path has more than two points then use catmull rom to bezier algorithm\n if (options.lineSmooth && pathCoordinates.length > 4) {\n\n var cr = Chartist.catmullRom2bezier(pathCoordinates);\n for(var k = 0; k < cr.length; k++) {\n svgPathString += 'C' + cr[k].join();\n }\n } else {\n for(var l = 3; l < pathCoordinates.length; l += 2) {\n svgPathString += 'L ' + pathCoordinates[l - 1] + ',' + pathCoordinates[l];\n }\n }\n\n seriesGroups[i].elem('path', {\n d: svgPathString\n }, options.classNames.line);\n }\n }\n }\n\n // Obtain current options based on matching media queries (if responsive options are given)\n // This will also register a listener that is re-creating the chart based on media changes\n currentOptions = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, function (changedOptions) {\n currentOptions = changedOptions;\n createChart(currentOptions);\n });\n\n // TODO: Currently we need to re-draw the chart on window resize. This is usually very bad and will affect performance.\n // This is done because we can't work with relative coordinates when drawing the chart because SVG Path does not\n // work with relative positions yet. We need to check if we can do a viewBox hack to switch to percentage.\n // See http://mozilla.6506.n7.nabble.com/Specyfing-paths-with-percentages-unit-td247474.html\n // Update: can be done using the above method tested here: http://codepen.io/gionkunz/pen/KDvLj\n // The problem is with the label offsets that can't be converted into percentage and affecting the chart container\n window.addEventListener('resize', function () {\n createChart(currentOptions);\n });\n\n // Public members\n return {\n version: Chartist.version,\n update: function () {\n createChart(currentOptions);\n }\n };\n };\n\n }(window, document, Chartist));\n ;/**\n * The bar chart module of Chartist that can be used to draw unipolar or bipolar bar and grouped bar charts.\n *\n * @module Chartist.Bar\n */\n /* global Chartist */\n (function(window, document, Chartist){\n 'use strict';\n\n /**\n * This method creates a new bar chart and returns an object handle with delegations to the internal closure of the bar chart. You can use the returned object to redraw the chart.\n *\n * @memberof Chartist.Bar\n * @param {string|HTMLElement} query A selector query string or directly a DOM element\n * @param {object} data The data object that needs to consist of a labels and a series array\n * @param {object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {object} An object with a version and an update method to manually redraw the chart\n * @function\n *\n * @example\n * // These are the default options of the line chart\n * var options = {\n * // Options for X-Axis\n * axisX: {\n * // The offset of the labels to the chart area\n * offset: 10,\n * // If labels should be shown or not\n * showLabel: true,\n * // If the axis grid should be drawn or not\n * showGrid: true,\n * // Interpolation function that allows you to intercept the value from the axis label\n * labelInterpolationFnc: function(value){return value;}\n * },\n * // Options for Y-Axis\n * axisY: {\n * // The offset of the labels to the chart area\n * offset: 15,\n * // If labels should be shown or not\n * showLabel: true,\n * // If the axis grid should be drawn or not\n * showGrid: true,\n * // For the Y-Axis you can set a label alignment property of right or left\n * labelAlign: 'right',\n * // Interpolation function that allows you to intercept the value from the axis label\n * labelInterpolationFnc: function(value){return value;},\n * // This value specifies the minimum height in pixel of the scale steps\n * scaleMinSpace: 30\n * },\n * // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n * width: undefined,\n * // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n * height: undefined,\n * // If the line should be drawn or not\n * showLine: true,\n * // If dots should be drawn or not\n * showPoint: true,\n * // Specify if the lines should be smoothed (Catmull-Rom-Splines will be used)\n * lineSmooth: true,\n * // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n * low: undefined,\n * // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n * high: undefined,\n * // Padding of the chart drawing area to the container element and labels\n * chartPadding: 5,\n * // Specify the distance in pixel of bars in a group\n * seriesBarDistance: 15,\n * // Override the class names that get used to generate the SVG structure of the chart\n * classNames: {\n * chart: 'ct-chart-bar',\n * label: 'ct-label',\n * series: 'ct-series',\n * bar: 'ct-bar',\n * point: 'ct-point',\n * grid: 'ct-grid',\n * vertical: 'ct-vertical',\n * horizontal: 'ct-horizontal'\n * }\n * };\n *\n * @example\n * // Create a simple bar chart\n * var data = {\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In the global name space Chartist we call the Bar function to initialize a bar chart. As a first parameter we pass in a selector where we would like to get our chart created and as a second parameter we pass our data object.\n * Chartist.Bar('.ct-chart', data);\n *\n * @example\n * // This example creates a bipolar grouped bar chart where the boundaries are limitted to -10 and 10\n * Chartist.Bar('.ct-chart', {\n * labels: [1, 2, 3, 4, 5, 6, 7],\n * series: [\n * [1, 3, 2, -5, -3, 1, -6],\n * [-5, -2, -4, -1, 2, -3, 1]\n * ]\n * }, {\n * seriesBarDistance: 12,\n * low: -10,\n * heigh: 10\n * });\n *\n */\n Chartist.Bar = function (query, data, options, responsiveOptions) {\n\n var defaultOptions = {\n axisX: {\n offset: 10,\n showLabel: true,\n showGrid: true,\n labelInterpolationFnc: Chartist.noop\n },\n axisY: {\n offset: 15,\n showLabel: true,\n showGrid: true,\n labelAlign: 'right',\n labelInterpolationFnc: Chartist.noop,\n scaleMinSpace: 40\n },\n width: undefined,\n height: undefined,\n high: undefined,\n low: undefined,\n chartPadding: 5,\n seriesBarDistance: 15,\n classNames: {\n chart: 'ct-chart-bar',\n label: 'ct-label',\n series: 'ct-series',\n bar: 'ct-bar',\n thin: 'ct-thin',\n thick: 'ct-thick',\n grid: 'ct-grid',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal'\n }\n },\n currentOptions,\n svg;\n\n function createChart(options) {\n var xAxisOffset,\n yAxisOffset,\n seriesGroups = [],\n bounds,\n normalizedData = Chartist.normalizeDataArray(Chartist.getDataArray(data), data.labels.length);\n\n // Create new svg element\n svg = Chartist.createSvg(query, options.width, options.height, options.classNames.chart);\n\n // initialize bounds\n bounds = Chartist.getBounds(svg, normalizedData, options, 0);\n\n xAxisOffset = options.axisX.offset;\n if (options.axisX.showLabel) {\n xAxisOffset += Chartist.calculateLabelOffset(\n svg,\n data.labels,\n [options.classNames.label, options.classNames.horizontal].join(' '),\n options.axisX.labelInterpolationFnc,\n Chartist.getHeight\n );\n }\n\n yAxisOffset = options.axisY.offset;\n if (options.axisY.showLabel) {\n yAxisOffset += Chartist.calculateLabelOffset(\n svg,\n bounds.values,\n [options.classNames.label, options.classNames.horizontal].join(' '),\n options.axisY.labelInterpolationFnc,\n Chartist.getWidth\n );\n }\n\n var chartRect = Chartist.createChartRect(svg, options, xAxisOffset, yAxisOffset);\n // Start drawing\n var labels = svg.elem('g'),\n grid = svg.elem('g'),\n // Projected 0 point\n zeroPoint = Chartist.projectPoint(chartRect, bounds, [0], 0);\n\n Chartist.createXAxis(chartRect, data, grid, labels, options);\n Chartist.createYAxis(chartRect, bounds, grid, labels, yAxisOffset, options);\n\n // Draw the series\n // initialize series groups\n for (var i = 0; i < data.series.length; i++) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = i - (data.series.length - 1) / 2,\n // Half of the period with between vertical grid lines used to position bars\n periodHalfWidth = chartRect.width() / normalizedData[i].length / 2;\n\n seriesGroups[i] = svg.elem('g');\n // Use series class from series data or if not set generate one\n seriesGroups[i].addClass([\n options.classNames.series,\n (data.series[i].className || options.classNames.series + '-' + Chartist.alphaNumerate(i))\n ].join(' '));\n\n for(var j = 0; j < normalizedData[i].length; j++) {\n var p = Chartist.projectPoint(chartRect, bounds, normalizedData[i], j),\n bar;\n\n // Offset to center bar between grid lines and using bi-polar offset for multiple series\n // TODO: Check if we should really be able to add classes to the series. Should be handles with SASS and semantic / specific selectors\n p.x += periodHalfWidth + (biPol * options.seriesBarDistance);\n\n bar = seriesGroups[i].elem('line', {\n x1: p.x,\n y1: zeroPoint.y,\n x2: p.x,\n y2: p.y\n }, options.classNames.bar + (data.series[i].barClasses ? ' ' + data.series[i].barClasses : ''));\n }\n }\n }\n\n // Obtain current options based on matching media queries (if responsive options are given)\n // This will also register a listener that is re-creating the chart based on media changes\n currentOptions = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, function (changedOptions) {\n currentOptions = changedOptions;\n createChart(currentOptions);\n });\n\n // TODO: Currently we need to re-draw the chart on window resize. This is usually very bad and will affect performance.\n // This is done because we can't work with relative coordinates when drawing the chart because SVG Path does not\n // work with relative positions yet. We need to check if we can do a viewBox hack to switch to percentage.\n // See http://mozilla.6506.n7.nabble.com/Specyfing-paths-with-percentages-unit-td247474.html\n // Update: can be done using the above method tested here: http://codepen.io/gionkunz/pen/KDvLj\n // The problem is with the label offsets that can't be converted into percentage and affecting the chart container\n window.addEventListener('resize', function () {\n createChart(currentOptions);\n });\n\n // Public members\n return {\n version: Chartist.version,\n update: function () {\n createChart(currentOptions);\n }\n };\n };\n\n }(window, document, Chartist));\n ;/**\n * The pie chart module of Chartist that can be used to draw pie, donut or gauge charts\n *\n * @module Chartist.Pie\n */\n /* global Chartist */\n (function(window, document, Chartist) {\n 'use strict';\n\n /**\n * This method creates a new pie chart and returns an object that can be used to redraw the chart.\n *\n * @memberof Chartist.Pie\n * @param {string|HTMLElement} query A selector query string or directly a DOM element\n * @param {object} data The data object in the pie chart needs to have a series property with a one dimensional data array. The values will be normalized against each other and don't necessarily need to be in percentage.\n * @param {object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {object} An object with a version and an update method to manually redraw the chart\n * @function\n *\n * @example\n * // Default options of the pie chart\n * var defaultOptions = {\n * // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n * width: undefined,\n * // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n * height: undefined,\n * // Padding of the chart drawing area to the container element and labels\n * chartPadding: 5,\n * // Override the class names that get used to generate the SVG structure of the chart\n * classNames: {\n * chart: 'ct-chart-pie',\n * series: 'ct-series',\n * slice: 'ct-slice',\n * donut: 'ct-donut',\n label: 'ct-label'\n * },\n * // The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise.\n * startAngle: 0,\n * // An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts.\n * total: undefined,\n * // If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices.\n * donut: false,\n * // Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future.\n * donutWidth: 60,\n * // If a label should be shown or not\n * showLabel: true,\n * // Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center.\n * labelOffset: 0,\n * // An interpolation function for the label value\n * labelInterpolationFnc: function(value, index) {return value;},\n * // Label direction can be 'neutral', 'explode' or 'implode'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center.\n * labelDirection: 'neutral'\n * };\n *\n * @example\n * // Simple pie chart example with four series\n * Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * });\n *\n * @example\n * // Drawing a donut chart\n * Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * }, {\n * donut: true\n * });\n *\n * @example\n * // Using donut, startAngle and total to draw a gauge chart\n * Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * donut: true,\n * donutWidth: 20,\n * startAngle: 270,\n * total: 200\n * });\n *\n * @example\n * // Drawing a pie chart with padding and labels that are outside the pie\n * Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * chartPadding: 30,\n * labelOffset: 50,\n * labelDirection: 'explode'\n * });\n */\n Chartist.Pie = function (query, data, options, responsiveOptions) {\n\n var defaultOptions = {\n width: undefined,\n height: undefined,\n chartPadding: 5,\n classNames: {\n chart: 'ct-chart-pie',\n series: 'ct-series',\n slice: 'ct-slice',\n donut: 'ct-donut',\n label: 'ct-label'\n },\n startAngle: 0,\n total: undefined,\n donut: false,\n donutWidth: 60,\n showLabel: true,\n labelOffset: 0,\n labelInterpolationFnc: Chartist.noop,\n labelOverflow: false,\n labelDirection: 'neutral'\n },\n currentOptions,\n svg;\n\n function determineAnchorPosition(center, label, direction) {\n var toTheRight = label.x > center.x;\n\n if(toTheRight && direction === 'explode' ||\n !toTheRight && direction === 'implode') {\n return 'start';\n } else if(toTheRight && direction === 'implode' ||\n !toTheRight && direction === 'explode') {\n return 'end';\n } else {\n return 'middle';\n }\n }\n\n function createChart(options) {\n var seriesGroups = [],\n chartRect,\n radius,\n labelRadius,\n totalDataSum,\n startAngle = options.startAngle,\n dataArray = Chartist.getDataArray(data);\n\n // Create SVG.js draw\n svg = Chartist.createSvg(query, options.width, options.height, options.classNames.chart);\n // Calculate charting rect\n chartRect = Chartist.createChartRect(svg, options, 0, 0);\n // Get biggest circle radius possible within chartRect\n radius = Math.min(chartRect.width() / 2, chartRect.height() / 2);\n // Calculate total of all series to get reference value or use total reference from optional options\n totalDataSum = options.total || dataArray.reduce(function(previousValue, currentValue) {\n return previousValue + currentValue;\n }, 0);\n\n // If this is a donut chart we need to adjust our radius to enable strokes to be drawn inside\n // Unfortunately this is not possible with the current SVG Spec\n // See this proposal for more details: http://lists.w3.org/Archives/Public/www-svg/2003Oct/0000.html\n radius -= options.donut ? options.donutWidth / 2 : 0;\n\n // If a donut chart then the label position is at the radius, if regular pie chart it's half of the radius\n // see https://github.com/gionkunz/chartist-js/issues/21\n labelRadius = options.donut ? radius : radius / 2;\n // Add the offset to the labelRadius where a negative offset means closed to the center of the chart\n labelRadius += options.labelOffset;\n\n // Calculate end angle based on total sum and current data value and offset with padding\n var center = {\n x: chartRect.x1 + chartRect.width() / 2,\n y: chartRect.y2 + chartRect.height() / 2\n };\n\n // Draw the series\n // initialize series groups\n for (var i = 0; i < data.series.length; i++) {\n seriesGroups[i] = svg.elem('g');\n // Use series class from series data or if not set generate one\n seriesGroups[i].addClass([\n options.classNames.series,\n (data.series[i].className || options.classNames.series + '-' + Chartist.alphaNumerate(i))\n ].join(' '));\n\n var endAngle = startAngle + dataArray[i] / totalDataSum * 360;\n // If we need to draw the arc for all 360 degrees we need to add a hack where we close the circle\n // with Z and use 359.99 degrees\n if(endAngle - startAngle === 360) {\n endAngle -= 0.01;\n }\n\n var start = Chartist.polarToCartesian(center.x, center.y, radius, startAngle - (i === 0 ? 0 : 0.2)),\n end = Chartist.polarToCartesian(center.x, center.y, radius, endAngle),\n arcSweep = endAngle - startAngle <= 180 ? '0' : '1',\n d = [\n // Start at the end point from the cartesian coordinates\n 'M', end.x, end.y,\n // Draw arc\n 'A', radius, radius, 0, arcSweep, 0, start.x, start.y\n ];\n\n // If regular pie chart (no donut) we add a line to the center of the circle for completing the pie\n if(options.donut === false) {\n d.push('L', center.x, center.y);\n }\n\n // Create the SVG path\n // If this is a donut chart we add the donut class, otherwise just a regular slice\n var path = seriesGroups[i].elem('path', {\n d: d.join(' ')\n }, options.classNames.slice + (options.donut ? ' ' + options.classNames.donut : ''));\n\n // If this is a donut, we add the stroke-width as style attribute\n if(options.donut === true) {\n path.attr({\n 'style': 'stroke-width: ' + (+options.donutWidth) + 'px'\n });\n }\n\n // If we need to show labels we need to add the label for this slice now\n if(options.showLabel) {\n // Position at the labelRadius distance from center and between start and end angle\n var labelPosition = Chartist.polarToCartesian(center.x, center.y, labelRadius, startAngle + (endAngle - startAngle) / 2),\n interpolatedValue = options.labelInterpolationFnc(data.labels ? data.labels[i] : dataArray[i], i);\n\n seriesGroups[i].elem('text', {\n dx: labelPosition.x,\n dy: labelPosition.y,\n 'text-anchor': determineAnchorPosition(center, labelPosition, options.labelDirection),\n text: '' + interpolatedValue\n }, options.classNames.label).text('' + interpolatedValue);\n }\n\n // Set next startAngle to current endAngle. Use slight offset so there are no transparent hairline issues\n // (except for last slice)\n startAngle = endAngle;\n }\n }\n\n // Obtain current options based on matching media queries (if responsive options are given)\n // This will also register a listener that is re-creating the chart based on media changes\n currentOptions = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, function (changedOptions) {\n currentOptions = changedOptions;\n createChart(currentOptions);\n });\n\n // TODO: Currently we need to re-draw the chart on window resize. This is usually very bad and will affect performance.\n // This is done because we can't work with relative coordinates when drawing the chart because SVG Path does not\n // work with relative positions yet. We need to check if we can do a viewBox hack to switch to percentage.\n // See http://mozilla.6506.n7.nabble.com/Specyfing-paths-with-percentages-unit-td247474.html\n // Update: can be done using the above method tested here: http://codepen.io/gionkunz/pen/KDvLj\n // The problem is with the label offsets that can't be converted into percentage and affecting the chart container\n window.addEventListener('resize', function () {\n createChart(currentOptions);\n });\n\n // Public members\n return {\n version: Chartist.version,\n update: function () {\n createChart(currentOptions);\n }\n };\n };\n\n }(window, document, Chartist));\n\n return Chartist;\n\n}));\n"]}