New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details → →
Socket
Book a DemoSign in
Socket

react-chartkick

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-chartkick - npm Package Compare versions

Comparing version
0.3.1
to
0.3.2
+7
-0
CHANGELOG.md

@@ -0,1 +1,8 @@

## 0.3.2
- Added `innerRef` option
- Updated Chartkick.js to 3.1.1
- Fixed component names in React Developer Tools
- Removed `Object.assign` for older browsers
## 0.3.1

@@ -2,0 +9,0 @@

+15
-4

@@ -5,3 +5,3 @@ /*

* https://github.com/ankane/react-chartkick
* v0.3.1
* v0.3.2
* MIT License

@@ -13,2 +13,4 @@ */

function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
var chartId = 1;

@@ -75,5 +77,14 @@

var createComponent = function (chartType) {
return function (props) {
return React.createElement(ChartComponent, Object.assign({}, props, {chartType: chartType}))
}
var ChartkickComponent = function (ref) {
var innerRef = ref.innerRef;
var rest = objectWithoutProperties( ref, ["innerRef"] );
var props = rest;
// props cloned when split from innerRef, so we can modify directly
props.chartType = chartType;
props.ref = innerRef;
return React.createElement(ChartComponent, props)
};
ChartkickComponent.displayName = chartType.name;
return ChartkickComponent
};

@@ -80,0 +91,0 @@

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactChartkick={},t.React)}(this,function(t,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e){return function(t){return r.createElement(i,Object.assign({},t,{chartType:e}))}}var n,a=(function(t,e){t.exports=function(){function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t){return t instanceof Function}function r(t){return"[object Object]"===Object.prototype.toString.call(t)}function a(t,e){var n;for(n in e)r(e[n])||i(e[n])?(r(e[n])&&!r(t[n])&&(t[n]={}),i(e[n])&&!i(t[n])&&(t[n]=[]),a(t[n],e[n])):void 0!==e[n]&&(t[n]=e[n])}function $(t,e){var n={};return a(n,t),a(n,e),n}var l=/^(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)$/i,d=/(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)?(:)?(\d\d)?([.,]\d+)?($|Z|([+-])(\d\d)(:)?(\d\d)?)/i,h=String(1.5).charAt(1);function f(t){return""+t}function tt(t){return parseFloat(t)}function et(t){var e,n,r,a;if("object"!=typeof t)if("number"==typeof t)t=new Date(1e3*t);else{if(t=f(t),e=t.match(l))return n=parseInt(e[1],10),r=parseInt(e[3],10)-1,a=parseInt(e[5],10),new Date(n,r,a);var o=t.replace(/ /,"T").replace(" ","").replace("UTC","Z");t=function(t){var e,n,r,a,o,i,s,l,c,p,u;if("[object Date]"===(p=Object.prototype.toString.call(t)))return t;if("[object String]"!==p)return;if(r=t.match(d))return u=parseInt(r[1],10),i=parseInt(r[3],10)-1,e=parseInt(r[5],10),n=parseInt(r[7],10),o=r[9]?parseInt(r[9],10):0,c=r[11]?parseInt(r[11],10):0,a=r[12]?1e3*parseFloat(h+r[12].slice(1)):0,l=Date.UTC(u,i,e,n,o,c,a),r[13]&&r[14]&&(s=60*r[15],r[17]&&(s+=parseInt(r[17],10)),s*="-"===r[14]?-1:1,l-=60*s*1e3),new Date(l)}(o)||new Date(t)}return t}function c(t){if(!i(t)){var e,n=[];for(e in t)t.hasOwnProperty(e)&&n.push([e,t[e]]);t=n}return t}function o(o,i,s,l,c,p,u,d){return function(t,e,n){var r=t.data,a=$({},o);return a=$(a,n||{}),(t.hideLegend||"legend"in e)&&i(a,e.legend,t.hideLegend),e.title&&s(a,e.title),"min"in e?l(a,e.min):function(t){var e,n,r;for(e=0;e<t.length;e++)for(r=t[e].data,n=0;n<r.length;n++)if(r[n][1]<0)return!0;return!1}(r)||l(a,0),e.max&&c(a,e.max),"stacked"in e&&p(a,e.stacked),e.colors&&(a.colors=e.colors),e.xtitle&&u(a,e.xtitle),e.ytitle&&d(a,e.ytitle),a=$(a,e.library||{})}}function y(t,e){return t[0].getTime()-e[0].getTime()}function m(t,e){return t[0]-e[0]}function nt(t,e){return t-e}function rt(t){return 0===t.getMilliseconds()&&0===t.getSeconds()}function at(t){return rt(t)&&0===t.getMinutes()}function ot(t){return at(t)&&0===t.getHours()}function it(t){return ot(t)&&1===t.getDate()}function p(t){return!isNaN(et(t))&&6<=f(t).length}function u(t){return"number"==typeof t}function g(t,e,n){if(t=t||"",n.prefix&&(e<0&&(e*=-1,t+="-"),t+=n.prefix),n.thousands||n.decimal){var r=(e=f(e)).split(".");e=r[0],n.thousands&&(e=e.replace(/\B(?=(\d{3})+(?!\d))/g,n.thousands)),1<r.length&&(e+=(n.decimal||".")+r[1])}return t+e+(n.suffix||"")}function st(t,e,n){return n in e?e[n]:n in t.options?t.options[n]:null}var v={maintainAspectRatio:!1,animation:!1,tooltips:{displayColors:!1,callbacks:{}},legend:{},title:{fontSize:20,fontColor:"#333"}},z={scales:{yAxes:[{ticks:{maxTicksLimit:4},scaleLabel:{fontSize:16,fontColor:"#333"}}],xAxes:[{gridLines:{drawOnChartArea:!1},scaleLabel:{fontSize:16,fontColor:"#333"},time:{},ticks:{}}]}},lt=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#651067"],x=function(t,e,n){void 0!==e?(t.legend.display=!!e,e&&!0!==e&&(t.legend.position=e)):n&&(t.legend.display=!1)},b=function(t,e){t.title.display=!0,t.title.text=e},M=function(t,e){null!==e&&(t.scales.xAxes[0].ticks.min=tt(e))},w=function(t,e){t.scales.xAxes[0].ticks.max=tt(e)},C=function(t,e){t.scales.xAxes[0].stacked=!!e,t.scales.yAxes[0].stacked=!!e},A=function(t,e){t.scales.xAxes[0].scaleLabel.display=!0,t.scales.xAxes[0].scaleLabel.labelString=e},_=function(t,e){t.scales.yAxes[0].scaleLabel.display=!0,t.scales.yAxes[0].scaleLabel.labelString=e},ct=function(t){return null!=t},S=function(t,e,n){var r={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal};if("pie"!==n){var a=e.scales.yAxes;"bar"===n&&(a=e.scales.xAxes),a[0].ticks.callback||(a[0].ticks.callback=function(t){return g("",t,r)})}if(!e.tooltips.callbacks.label)if("scatter"===n)e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),n+"("+t.xLabel+", "+t.yLabel+")"};else if("bubble"===n)e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";n&&(n+=": ");var r=e.datasets[t.datasetIndex].data[t.index];return n+"("+t.xLabel+", "+t.yLabel+", "+r.v+")"};else if("pie"===n)e.tooltips.callbacks.label=function(t,e){var n=e.labels[t.index];return i(n)?(n=n.slice())[0]+=": ":n+=": ",g(n,e.datasets[t.datasetIndex].data[t.index],r)};else{var o="bar"===n?"xLabel":"yLabel";e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),g(n,t[o],r)}}},k=o($(v,z),x,b,function(t,e){if(e!==null){t.scales.yAxes[0].ticks.min=tt(e)}},function(t,e){t.scales.yAxes[0].ticks.max=tt(e)},C,A,_),T=function(t,e,n){var r,a=[],o=[],i=t.options.colors||lt,s=!0,l=!0,c=!0,p=!0,u=!0,d=!0,h=t.data,f=0;if("bubble"===n)for(var y=0;y<h.length;y++)for(var m=h[y],g=0;g<m.data.length;g++)m.data[g][2]>f&&(f=m.data[g][2]);var v,z,x,b,M,w,C,A,_,S,k,T=[],D=[];if("bar"===n||"column"===n||"number"!==t.xtype&&"bubble"!==t.xtype){var L,O,E=[];for(v=0;v<h.length;v++)for(x=h[v],z=0;z<x.data.length;z++)b=x.data[z],M="datetime"==t.xtype?b[0].getTime():b[0],T[M]||(T[M]=new Array(h.length)),T[M][v]=tt(b[1]),-1===E.indexOf(M)&&E.push(M);for("datetime"!==t.xtype&&"number"!==t.xtype||E.sort(nt),z=0;z<h.length;z++)D.push([]);for(O=0;O<E.length;O++)for(v=E[O],"datetime"===t.xtype?(L=new Date(tt(v)),s=s&&ot(L),r||(r=L.getDay()),l=l&&(A=r,ot(C=L)&&C.getDay()===A),c=c&&it(L),p=p&&(it(w=L)&&0===w.getMonth()),u=u&&at(L),d=d&&rt(L)):L=v,o.push(L),z=0;z<h.length;z++)D[z].push(void 0===T[v][z]?null:T[v][z])}else for(var j=0;j<h.length;j++){for(var I=h[j],B=[],N=0;N<I.data.length;N++){var R={x:tt(I.data[N][0]),y:tt(I.data[N][1])};"bubble"===n&&(R.r=20*tt(I.data[N][2])/f,R.v=I.data[N][2]),B.push(R)}D.push(B)}for(v=0;v<h.length;v++){var F=(x=h[v]).color||i[v],H="line"!==n?(S=.5,void 0,(k=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(_=F))?"rgba("+parseInt(k[1],16)+", "+parseInt(k[2],16)+", "+parseInt(k[3],16)+", "+S+")":_):F,P={label:x.name||"",data:D[v],fill:"area"===n,borderColor:F,backgroundColor:H,pointBackgroundColor:F,borderWidth:2,pointHoverBackgroundColor:F};x.stack&&(P.stack=x.stack);var U=st(t,x,"curve");!1===U&&(P.lineTension=0);var W=st(t,x,"points");!1===W&&(P.pointRadius=0,P.pointHitRadius=5),P=$(P=$(P=$(P,t.options.dataset||{}),x.library||{}),x.dataset||{}),a.push(P)}var V=t.options.xmin,Q=t.options.xmax;if("datetime"===t.xtype?(ct(V)&&(e.scales.xAxes[0].time.min=et(V).getTime()),ct(Q)&&(e.scales.xAxes[0].time.max=et(Q).getTime())):"number"===t.xtype&&(ct(V)&&(e.scales.xAxes[0].ticks.min=V),ct(Q)&&(e.scales.xAxes[0].ticks.max=Q)),"datetime"===t.xtype&&0<o.length){var J=(ct(V)?et(V):o[0]).getTime(),G=(ct(Q)?et(Q):o[0]).getTime();for(v=1;v<o.length;v++){var K=o[v].getTime();K<J&&(J=K),G<K&&(G=K)}var X,Y=(G-J)/864e5;if(!e.scales.xAxes[0].time.unit)if(p||3650<Y?(e.scales.xAxes[0].time.unit="year",X=365):c||300<Y?(e.scales.xAxes[0].time.unit="month",X=30):s||10<Y?(e.scales.xAxes[0].time.unit="day",X=1):u||.5<Y?(e.scales.xAxes[0].time.displayFormats={hour:"MMM D, h a"},e.scales.xAxes[0].time.unit="hour",X=1/24):d&&(e.scales.xAxes[0].time.displayFormats={minute:"h:mm a"},e.scales.xAxes[0].time.unit="minute",X=1/24/60),X&&0<Y){var Z=Math.ceil(Y/X/(t.element.offsetWidth/100));l&&1===X&&(Z=7*Math.ceil(Z/7)),e.scales.xAxes[0].time.unitStepSize=Z}e.scales.xAxes[0].time.tooltipFormat||(s?e.scales.xAxes[0].time.tooltipFormat="ll":u?e.scales.xAxes[0].time.tooltipFormat="MMM D, h a":d&&(e.scales.xAxes[0].time.tooltipFormat="h:mm a"))}var q={labels:o,datasets:a};return q},D=function(t){this.name="chartjs",this.library=t};D.prototype.renderLineChart=function(t,e){var n={};!t.options.max&&function(t){var e,n,r;for(e=0;e<t.length;e++)for(r=t[e].data,n=0;n<r.length;n++)if(0!=r[n][1])return!1;return!0}(t.data)&&(n.max=1);var r=k(t,$(n,t.options));S(t,r,e);var a=T(t,r,e||"line");"number"===t.xtype?(r.scales.xAxes[0].type="linear",r.scales.xAxes[0].position="bottom"):r.scales.xAxes[0].type="string"===t.xtype?"category":"time",this.drawChart(t,"line",a,r)},D.prototype.renderPieChart=function(t){var e=$({},v);t.options.donut&&(e.cutoutPercentage=50),"legend"in t.options&&x(e,t.options.legend),t.options.title&&b(e,t.options.title),e=$(e,t.options.library||{}),S(t,e,"pie");for(var n=[],r=[],a=0;a<t.data.length;a++){var o=t.data[a];n.push(o[0]),r.push(o[1])}var i={data:r,backgroundColor:t.options.colors||lt};i=$(i,t.options.dataset||{});var s={labels:n,datasets:[i]};this.drawChart(t,"pie",s,e)},D.prototype.renderColumnChart=function(t,e){var n;n="bar"===e?o($(v,z),x,b,M,w,C,A,_)(t,t.options):k(t,t.options),S(t,n,e);var r=T(t,n,"column");"bar"!==e&&function(t,e,n){var r=Math.ceil(t.element.offsetWidth/4/e.labels.length);if(r>25){r=25}else if(r<10){r=10}if(!n.scales.xAxes[0].ticks.callback){n.scales.xAxes[0].ticks.callback=function(t){t=f(t);if(t.length>r){return t.substring(0,r-2)+"..."}else{return t}}}}(t,r,n),this.drawChart(t,"bar"===e?"horizontalBar":"bar",r,n)},D.prototype.renderAreaChart=function(t){this.renderLineChart(t,"area")},D.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},D.prototype.renderScatterChart=function(t,e){e=e||"scatter";var n=k(t,t.options);S(t,n,e),"showLines"in n||(n.showLines=!1);var r=T(t,n,e);n.scales.xAxes[0].type="linear",n.scales.xAxes[0].position="bottom",this.drawChart(t,e,r,n)},D.prototype.renderBubbleChart=function(t){this.renderScatterChart(t,"bubble")},D.prototype.destroy=function(t){t.chart&&t.chart.destroy()};var L={chart:{},xAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},yAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},title:{text:null},credits:{enabled:!(D.prototype.drawChart=function(t,e,n,r){this.destroy(t);var a={type:e,data:n,options:r};t.options.code&&window.console.log("new Chart(ctx, "+JSON.stringify(a)+");"),t.element.innerHTML="<canvas></canvas>";var o=t.element.getElementsByTagName("CANVAS")[0];t.chart=new this.library(o,a)})},legend:{borderWidth:0},tooltip:{style:{fontSize:"12px"}},plotOptions:{areaspline:{},series:{marker:{}}}},O=function(t,e,n){void 0!==e?(t.legend.enabled=!!e,e&&!0!==e&&("top"===e||"bottom"===e?t.legend.verticalAlign=e:(t.legend.layout="vertical",t.legend.verticalAlign="middle",t.legend.align=e))):n&&(t.legend.enabled=!1)},E=function(t,e){t.title.text=e},j=o(L,O,E,function(t,e){t.yAxis.min=e},function(t,e){t.yAxis.max=e},function(t,e){t.plotOptions.series.stacking=e?!0===e?"normal":e:null},function(t,e){t.xAxis.title.text=e},function(t,e){t.yAxis.title.text=e}),I=function(t,e,n){var r={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal};"pie"===n||e.yAxis.labels.formatter||(e.yAxis.labels.formatter=function(){return g("",this.value,r)}),e.tooltip.pointFormatter||(e.tooltip.pointFormatter=function(){return'<span style="color:'+this.color+'">ā—</span> '+g(this.series.name+": <b>",this.y,r)+"</b><br/>"})},B=function(t){this.name="highcharts",this.library=t};B.prototype.renderLineChart=function(t,e){var n={};"areaspline"===(e=e||"spline")&&(n={plotOptions:{areaspline:{stacking:"normal"},area:{stacking:"normal"},series:{marker:{enabled:!1}}}}),!1===t.options.curve&&("areaspline"===e?e="area":"spline"===e&&(e="line"));var r,a,o,i=j(t,t.options,n);i.xAxis.type="string"===t.xtype?"category":"number"===t.xtype?"linear":"datetime",i.chart.type||(i.chart.type=e),I(t,i,e);var s=t.data;for(a=0;a<s.length;a++){if(s[a].name=s[a].name||"Value",r=s[a].data,"datetime"===t.xtype)for(o=0;o<r.length;o++)r[o][0]=r[o][0].getTime();!(s[a].marker={symbol:"circle"})===t.options.points&&(s[a].marker.enabled=!1)}this.drawChart(t,s,i)},B.prototype.renderScatterChart=function(t){var e=j(t,t.options,{});e.chart.type="scatter",this.drawChart(t,t.data,e)},B.prototype.renderPieChart=function(t){var e=$(L,{});t.options.colors&&(e.colors=t.options.colors),t.options.donut&&(e.plotOptions={pie:{innerSize:"50%"}}),"legend"in t.options&&O(e,t.options.legend),t.options.title&&E(e,t.options.title);var n=$(e,t.options.library||{});I(t,n,"pie");var r=[{type:"pie",name:t.options.label||"Value",data:t.data}];this.drawChart(t,r,n)},B.prototype.renderColumnChart=function(t,e){e=e||"column";var n,r,a,o,i=t.data,s=j(t,t.options),l=[],c=[];for(s.chart.type=e,I(t,s,e),n=0;n<i.length;n++)for(a=i[n],r=0;r<a.data.length;r++)o=a.data[r],l[o[0]]||(l[o[0]]=new Array(i.length),c.push(o[0])),l[o[0]][n]=o[1];"number"===t.xtype&&c.sort(nt),s.xAxis.categories=c;var p,u=[];for(n=0;n<i.length;n++){for(o=[],r=0;r<c.length;r++)o.push(l[c[r]][n]||0);p={name:i[n].name||"Value",data:o},i[n].stack&&(p.stack=i[n].stack),u.push(p)}this.drawChart(t,u,s)},B.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},B.prototype.renderAreaChart=function(t){this.renderLineChart(t,"areaspline")},B.prototype.destroy=function(t){t.chart&&t.chart.destroy()},B.prototype.drawChart=function(t,e,n){this.destroy(t),n.chart.renderTo=t.element.id,n.series=e,t.options.code&&window.console.log("new Highcharts.Chart("+JSON.stringify(n)+");"),t.chart=new this.library.Chart(n)};var N={},R=[],F={chartArea:{},fontName:"'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif",pointSize:6,legend:{textStyle:{fontSize:12,color:"#444"},alignment:"center",position:"right"},curveType:"function",hAxis:{textStyle:{color:"#666",fontSize:12},titleTextStyle:{},gridlines:{color:"transparent"},baselineColor:"#ccc",viewWindow:{}},vAxis:{textStyle:{color:"#666",fontSize:12},titleTextStyle:{},baselineColor:"#ccc",viewWindow:{}},tooltip:{textStyle:{color:"#666",fontSize:12}}},H=function(t,e,n){var r;void 0!==e?(r=e?!0===e?"right":e:"none",t.legend.position=r):n&&(t.legend.position="none")},P=function(t,e){t.title=e,t.titleTextStyle={color:"#333",fontSize:"20px"}},U=function(t,e){t.hAxis.viewWindow.min=e},W=function(t,e){t.hAxis.viewWindow.max=e},V=function(t,e){t.isStacked=e||!1},Q=function(t,e){t.hAxis.title=e,t.hAxis.titleTextStyle.italic=!1},J=function(t,e){t.vAxis.title=e,t.vAxis.titleTextStyle.italic=!1},G=o(F,H,P,function(t,e){t.vAxis.viewWindow.min=e},function(t,e){t.vAxis.viewWindow.max=e},V,Q,J),K=function(t){this.name="google",this.library=t};K.prototype.renderLineChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={};!1===r.options.curve&&(t.curveType="none"),!1===r.options.points&&(t.pointSize=0);var e=G(r,r.options,t),n=a.createDataTable(r.data,r.xtype);a.drawChart(r,"LineChart",n,e)})},K.prototype.renderPieChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={chartArea:{top:"10%",height:"80%"},legend:{}};r.options.colors&&(t.colors=r.options.colors),r.options.donut&&(t.pieHole=.5),"legend"in r.options&&H(t,r.options.legend),r.options.title&&P(t,r.options.title);var e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn("string",""),n.addColumn("number","Value"),n.addRows(r.data),a.drawChart(r,"PieChart",n,e)})},K.prototype.renderColumnChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=G(n,n.options),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"ColumnChart",e,t)})},K.prototype.renderBarChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=o(F,H,P,U,W,V,Q,J)(n,n.options,{hAxis:{gridlines:{color:"#ccc"}}}),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"BarChart",e,t)})},K.prototype.renderAreaChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=G(n,n.options,{isStacked:true,pointSize:0,areaOpacity:.5}),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"AreaChart",e,t)})},K.prototype.renderGeoChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={legend:"none",colorAxis:{colors:r.options.colors||["#f6c7b6","#ce502d"]}},e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn("string",""),n.addColumn("number",r.options.label||"Value"),n.addRows(r.data),a.drawChart(r,"GeoChart",n,e)})},K.prototype.renderScatterChart=function(l){var c=this;this.waitForLoaded(l,function(){var t,e,n,r,a=G(l,l.options,{}),o=l.data,i=[];for(t=0;t<o.length;t++)for(o[t].name=o[t].name||"Value",r=o[t].data,e=0;e<r.length;e++){var s=new Array(o.length+1);s[0]=r[e][0],s[t+1]=r[e][1],i.push(s)}for((n=new c.library.visualization.DataTable).addColumn("number",""),t=0;t<o.length;t++)n.addColumn("number",o[t].name);n.addRows(i),c.drawChart(l,"ScatterChart",n,a)})},K.prototype.renderTimeline=function(r){var a=this;this.waitForLoaded(r,"timeline",function(){var t={legend:"none"};r.options.colors&&(t.colors=r.options.colors);var e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn({type:"string",id:"Name"}),n.addColumn({type:"date",id:"Start"}),n.addColumn({type:"date",id:"End"}),n.addRows(r.data),r.element.style.lineHeight="normal",a.drawChart(r,"Timeline",n,e)})},K.prototype.destroy=function(t){t.chart&&t.chart.clearChart()},K.prototype.drawChart=function(t,e,n,r){this.destroy(t),t.options.code&&window.console.log("var data = new google.visualization.DataTable("+n.toJSON()+");\nvar chart = new google.visualization."+e+"(element);\nchart.draw(data, "+JSON.stringify(r)+");"),t.chart=new this.library.visualization[e](t.element),function(t){if(window.attachEvent){window.attachEvent("onresize",t)}else if(window.addEventListener){window.addEventListener("resize",t,true)}t()}(function(){t.chart.draw(n,r)})},K.prototype.waitForLoaded=function(t,e,n){var r=this;if(n||(n=e,e="corechart"),R.push({pack:e,callback:n}),N[e])this.runCallbacks();else{N[e]=!0;var a={packages:[e],callback:function(){r.runCallbacks()}},o=t.__config();o.language&&(a.language=o.language),"corechart"===e&&o.mapsApiKey&&(a.mapsApiKey=o.mapsApiKey),this.library.charts.load("current",a)}},K.prototype.runCallbacks=function(){for(var t,e=0;e<R.length;e++)t=R[e],this.library.visualization&&("corechart"===t.pack&&this.library.visualization.LineChart||"timeline"===t.pack&&this.library.visualization.Timeline)&&(t.callback(),R.splice(e,1),e--)},K.prototype.createDataTable=function(t,e){var n,r,a,o,i,s=[],l=[];for(n=0;n<t.length;n++)for(a=t[n],t[n].name=t[n].name||"Value",r=0;r<a.data.length;r++)o=a.data[r],i="datetime"===e?o[0].getTime():o[0],s[i]||(s[i]=new Array(t.length),l.push(i)),s[i][n]=tt(o[1]);var c,p=[],u=!0;for(r=0;r<l.length;r++)n=l[r],"datetime"===e?(c=new Date(tt(n)),u=u&&ot(c)):c="number"===e?tt(n):n,p.push([c].concat(s[n]));if("datetime"===e)p.sort(y);else if("number"===e){for(p.sort(m),n=0;n<p.length;n++)p[n][0]=f(p[n][0]);e="string"}var d=new this.library.visualization.DataTable;for(e="datetime"===e&&u?"date":e,d.addColumn(e,""),n=0;n<t.length;n++)d.addColumn("number",t[n].name);return d.addRows(p),d};var X=[],e=0,n=4;function Y(){if(e<n){var t=X.shift();t&&(e++,function(t,e,a){!function(t,e,n){var r=window.jQuery||window.Zepto||window.$;if(r)r.ajax({dataType:"json",url:t,success:e,error:n,complete:Z});else{var a=new XMLHttpRequest;a.open("GET",t,!0),a.setRequestHeader("Content-Type","application/json"),a.onload=function(){Z(),200===a.status?e(JSON.parse(a.responseText),a.statusText,a):n(a,"error",a.statusText)},a.send()}}(t,e,function(t,e,n){var r="string"==typeof n?n:n.message;a(r)})}(t[0],t[1],t[2]),Y())}}function Z(){e--,Y()}var q={},pt=[];function ut(t,e){document.body.innerText?t.innerText=e:t.textContent=e}function dt(t,e){ut(t,"Error Loading Chart: "+e),t.style.color="#ff0000"}function ht(e){try{e.__render()}catch(t){throw dt(e.element,t.message),t}}function ft(e,t){"string"==typeof t?function(t,e,n){X.push([t,e,n]),Y()}(t,function(t){e.rawData=t,ht(e)},function(t){dt(e.element,t)}):(e.rawData=t,ht(e))}function yt(t,e,n){if(t.addEventListener)return t.addEventListener(e,n,!1),n;var r=function(){return n.call(t,window.event)};return t.attachEvent("on"+e,r),r}function t(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)}function mt(t,e){if(t===e)return!1;for(;e&&e!==t;)e=e.parentNode;return e===t}function gt(t){var e=function(t){if(t){if("Highcharts"===t.product)return B;if(t.charts)return K;if(s(t))return D}throw new Error("Unknown adapter")}(t),n=new e(t);-1===pt.indexOf(n)&&pt.push(n)}function vt(t,e){e.options.messages&&e.options.messages.empty&&function(t,e){{if("PieChart"===e||"GeoChart"===e||"Timeline"===e)return 0===t.length;for(var n=0;n<t.length;n++)if(0<t[n].data.length)return!1;return!0}}(e.data,t)?ut(e.element,e.options.messages.empty):(function(t,e){var n,r,a,o;for(a="render"+t,o=e.options.adapter,function(){"Chart"in window&&gt(window.Chart);"Highcharts"in window&&gt(window.Highcharts);window.google&&window.google.charts&&gt(window.google)}(),n=0;n<pt.length;n++)if(r=pt[n],(!o||o===r.name)&&s(r[a]))return e.adapter=r.name,(e.__adapterObject=r)[a](e);throw 0<pt.length?new Error("No charting library found for "+t):new Error("No charting libraries found - be sure to include one before your charts")}(t,e),e.options.download&&!e.__downloadAttached&&"chartjs"===e.adapter&&function(n){var r=n.element,a=document.createElement("a"),o=n.options.download;!0===o?o={}:"string"==typeof o&&(o={filename:o});a.download=o.filename||"chart.png",a.style.position="absolute",a.style.top="20px",a.style.right="20px",a.style.zIndex=1e3,a.style.lineHeight="20px",a.target="_blank";var t=document.createElement("img");t.alt="Download",t.style.border="none",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABCFBMVEUAAADMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMywEsqxAAAAV3RSTlMAAQIDBggJCgsMDQ4PERQaHB0eISIjJCouLzE0OTo/QUJHSUpLTU5PUllhYmltcHh5foWLjI+SlaCio6atr7S1t7m6vsHHyM7R2tze5Obo7fHz9ff5+/1hlxK2AAAA30lEQVQYGUXBhVYCQQBA0TdYWAt2d3d3YWAHyur7/z9xgD16Lw0DW+XKx+1GgX+FRzM3HWQWrHl5N/oapW5RPe0PkBu+UYeICvozTWZVK23Ao04B79oJrOsJDOoxkZoQPWgX29pHpCZEk7rEvQYiNSFq1UMqvlCjJkRBS1R8hb00Vb/TajtBL7nTHE1X1vyMQF732dQhyF2o6SAwrzP06iUQzvwsArlnzcOdrgBhJyHa1QOgO9U1GsKuvjUTjavliZYQ8nNPapG6sap/3nrIdJ6bOWzmX/fy0XVpfzZP3S8OJT3g9EEiJwAAAABJRU5ErkJggg==",a.appendChild(t),r.style.position="relative",n.__downloadAttached=!0,n.__enterEvent=yt(r,"mouseover",function(t){var e=t.relatedTarget;e&&(e===this||mt(this,e))||!n.options.download||(a.href=n.toImage(o),r.appendChild(a))}),n.__leaveEvent=yt(r,"mouseout",function(t){var e=t.relatedTarget;e&&(e===this||mt(this,e))||a.parentNode&&a.parentNode.removeChild(a)})}(e))}var zt=function(t,e){return t="number"===e?tt(t):"datetime"===e?et(t):f(t)},xt=function(t,e){var n,r,a=[];for(r=0;r<t.length;r++)"bubble"===e?a.push([tt(t[r][0]),tt(t[r][1]),tt(t[r][2])]):(n=zt(t[r][0],e),a.push([n,tt(t[r][1])]));return"datetime"===e?a.sort(y):"number"===e&&a.sort(m),a};function bt(t,e){var n,r,a;for(n=0;n<t.length;n++)for(a=c(t[n].data),r=0;r<a.length;r++)if(!e(a[r][0]))return!1;return!0}function Mt(t,e,n){var r,a=t.options,o=t.rawData;for(!i(o)||"object"!=typeof o[0]||i(o[0])?(o=[{name:a.label,data:o}],t.hideLegend=!0):t.hideLegend=!1,t.xtype=e||(a.discrete?"string":function(t,e){return bt(t,u)?"number":!e&&bt(t,p)?"datetime":"string"}(o,n)),o=function(t){var e,n,r=[];for(e=0;e<t.length;e++){var a={};for(n in t[e])t[e].hasOwnProperty(n)&&(a[n]=t[e][n]);r.push(a)}return r}(o),r=0;r<o.length;r++)o[r].data=xt(c(o[r].data),t.xtype);return o}function wt(t){var e,n=c(t.rawData);for(e=0;e<n.length;e++)n[e]=[f(n[e][0]),tt(n[e][1])];return n}var Ct=function(t,e,n){var r;if("string"==typeof t&&(r=t,!(t=document.getElementById(t))))throw new Error("No element with id "+r);this.element=t,this.options=$(At.options,n||{}),this.dataSource=e,ft(At.charts[t.id]=this,e),this.options.refresh&&this.startRefresh()};Ct.prototype.getElement=function(){return this.element},Ct.prototype.getDataSource=function(){return this.dataSource},Ct.prototype.getData=function(){return this.data},Ct.prototype.getOptions=function(){return this.options},Ct.prototype.getChartObject=function(){return this.chart},Ct.prototype.getAdapter=function(){return this.adapter},Ct.prototype.updateData=function(t,e){this.dataSource=t,e&&this.__updateOptions(e),ft(this,t)},Ct.prototype.setOptions=function(t){this.__updateOptions(t),this.redraw()},Ct.prototype.redraw=function(){ft(this,this.rawData)},Ct.prototype.refreshData=function(){if("string"==typeof this.dataSource){var t=-1===this.dataSource.indexOf("?")?"?":"&",e=this.dataSource+t+"_="+(new Date).getTime();ft(this,e)}},Ct.prototype.startRefresh=function(){var t=this,e=this.options.refresh;if(e&&"string"!=typeof this.dataSource)throw new Error("Data source must be a URL for refresh");if(!this.intervalId){if(!e)throw new Error("No refresh interval");this.intervalId=setInterval(function(){t.refreshData()},1e3*e)}},Ct.prototype.stopRefresh=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)},Ct.prototype.toImage=function(t){if("chartjs"!==this.adapter)return null;if(t&&t.background&&"transparent"!==t.background){var e=this.chart.chart.canvas,n=this.chart.chart.ctx,r=document.createElement("canvas"),a=r.getContext("2d");return r.width=n.canvas.width,r.height=n.canvas.height,a.fillStyle=t.background,a.fillRect(0,0,r.width,r.height),a.drawImage(e,0,0),r.toDataURL("image/png")}return this.chart.toBase64Image()},Ct.prototype.destroy=function(){this.__adapterObject&&this.__adapterObject.destroy(this),this.__enterEvent&&t(this.element,"mouseover",this.__enterEvent),this.__leaveEvent&&t(this.element,"mouseout",this.__leaveEvent)},Ct.prototype.__updateOptions=function(t){var e=t.refresh&&t.refresh!==this.options.refresh;this.options=$(At.options,t),e&&(this.stopRefresh(),this.startRefresh())},Ct.prototype.__render=function(){this.data=this.__processData(),vt(this.__chartName(),this)},Ct.prototype.__config=function(){return q};var At={LineChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this)},e.prototype.__chartName=function(){return"LineChart"},e}(Ct),PieChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return wt(this)},e.prototype.__chartName=function(){return"PieChart"},e}(Ct),ColumnChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,null,!0)},e.prototype.__chartName=function(){return"ColumnChart"},e}(Ct),BarChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,null,!0)},e.prototype.__chartName=function(){return"BarChart"},e}(Ct),AreaChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this)},e.prototype.__chartName=function(){return"AreaChart"},e}(Ct),GeoChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return wt(this)},e.prototype.__chartName=function(){return"GeoChart"},e}(Ct),ScatterChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,"number")},e.prototype.__chartName=function(){return"ScatterChart"},e}(Ct),BubbleChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,"bubble")},e.prototype.__chartName=function(){return"BubbleChart"},e}(Ct),Timeline:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){var t,e=this.rawData;for(t=0;t<e.length;t++)e[t][1]=et(e[t][1]),e[t][2]=et(e[t][2]);return e},e.prototype.__chartName=function(){return"Timeline"},e}(Ct),charts:{},configure:function(t){for(var e in t)t.hasOwnProperty(e)&&(q[e]=t[e])},setDefaultOptions:function(t){At.options=t},eachChart:function(t){for(var e in At.charts)At.charts.hasOwnProperty(e)&&t(At.charts[e])},config:q,options:{},adapters:pt,addAdapter:gt,use:function(t){return gt(t),At}};return"undefined"==typeof window||window.Chartkick||(window.Chartkick=At),At.default=At}()}(n={exports:{}},n.exports),n.exports),o=1,i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.newChartType=function(t){var e=t.data,n={};for(var r in t)t.hasOwnProperty(r)&&"data"!==r&&"id"!==r&&"height"!==r&&"width"!==r&&(n[r]=t[r]);this.element&&(this.chart?this.chart.updateData(e,n):this.chart=new t.chartType(this.element,e,n))},e.prototype.componentDidMount=function(){this.newChartType(this.props)},e.prototype.componentDidUpdate=function(){this.newChartType(this.props)},e.prototype.render=function(){var e=this,t=this.props,n={height:t.height||"300px",lineHeight:t.height||"300px",width:t.width||"100%",textAlign:"center",color:"#999",fontSize:"14px",fontFamily:"'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif"};return this.chartId=t.id||this.chartId||"chart-"+o++,r.createElement("div",{id:this.chartId,style:n,ref:function(t){return e.element=t}},"Loading...")},e}(r.Component),s=e(a.LineChart),l=e(a.PieChart),c=e(a.ColumnChart),p=e(a.BarChart),u=e(a.AreaChart),d=e(a.ScatterChart),h=e(a.GeoChart),f=e(a.Timeline);t.AreaChart=u,t.BarChart=p,t.ColumnChart=c,t.GeoChart=h,t.LineChart=s,t.PieChart=l,t.ScatterChart=d,t.Timeline=f,t.default=a,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactChartkick={},t.React)}(this,function(t,a){"use strict";a=a&&a.hasOwnProperty("default")?a.default:a;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var e,n=(function(t,e){t.exports=function(){function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t){return t instanceof Function}function r(t){return"[object Object]"===Object.prototype.toString.call(t)}function a(t,e){var n;for(n in e)r(e[n])||i(e[n])?(r(e[n])&&!r(t[n])&&(t[n]={}),i(e[n])&&!i(t[n])&&(t[n]=[]),a(t[n],e[n])):void 0!==e[n]&&(t[n]=e[n])}function $(t,e){var n={};return a(n,t),a(n,e),n}var l=/^(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)$/i,d=/(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)?(:)?(\d\d)?([.,]\d+)?($|Z|([+-])(\d\d)(:)?(\d\d)?)/i,h=String(1.5).charAt(1);function f(t){return""+t}function tt(t){return parseFloat(t)}function et(t){var e,n,r,a;if("object"!=typeof t)if("number"==typeof t)t=new Date(1e3*t);else{if(t=f(t),e=t.match(l))return n=parseInt(e[1],10),r=parseInt(e[3],10)-1,a=parseInt(e[5],10),new Date(n,r,a);var o=t.replace(/ /,"T").replace(" ","").replace("UTC","Z");t=function(t){var e,n,r,a,o,i,s,l,c,p,u;if("[object Date]"===(p=Object.prototype.toString.call(t)))return t;if("[object String]"!==p)return;if(r=t.match(d))return u=parseInt(r[1],10),i=parseInt(r[3],10)-1,e=parseInt(r[5],10),n=parseInt(r[7],10),o=r[9]?parseInt(r[9],10):0,c=r[11]?parseInt(r[11],10):0,a=r[12]?1e3*parseFloat(h+r[12].slice(1)):0,l=Date.UTC(u,i,e,n,o,c,a),r[13]&&r[14]&&(s=60*r[15],r[17]&&(s+=parseInt(r[17],10)),s*="-"===r[14]?-1:1,l-=60*s*1e3),new Date(l)}(o)||new Date(t)}return t}function c(t){if(!i(t)){var e,n=[];for(e in t)t.hasOwnProperty(e)&&n.push([e,t[e]]);t=n}return t}function o(o,i,s,l,c,p,u,d){return function(t,e,n){var r=t.data,a=$({},o);return a=$(a,n||{}),(t.hideLegend||"legend"in e)&&i(a,e.legend,t.hideLegend),e.title&&s(a,e.title),"min"in e?l(a,e.min):function(t){var e,n,r;for(e=0;e<t.length;e++)for(r=t[e].data,n=0;n<r.length;n++)if(r[n][1]<0)return!0;return!1}(r)||l(a,0),e.max&&c(a,e.max),"stacked"in e&&p(a,e.stacked),e.colors&&(a.colors=e.colors),e.xtitle&&u(a,e.xtitle),e.ytitle&&d(a,e.ytitle),a=$(a,e.library||{})}}function y(t,e){return t[0].getTime()-e[0].getTime()}function m(t,e){return t[0]-e[0]}function nt(t,e){return t-e}function rt(t){return 0===t.getMilliseconds()&&0===t.getSeconds()}function at(t){return rt(t)&&0===t.getMinutes()}function ot(t){return at(t)&&0===t.getHours()}function it(t){return ot(t)&&1===t.getDate()}function p(t){return!isNaN(et(t))&&6<=f(t).length}function u(t){return"number"==typeof t}function g(t,e,n){if(t=t||"",n.prefix&&(e<0&&(e*=-1,t+="-"),t+=n.prefix),n.thousands||n.decimal){var r=(e=f(e)).split(".");e=r[0],n.thousands&&(e=e.replace(/\B(?=(\d{3})+(?!\d))/g,n.thousands)),1<r.length&&(e+=(n.decimal||".")+r[1])}return t+e+(n.suffix||"")}function st(t,e,n){return n in e?e[n]:n in t.options?t.options[n]:null}var v={maintainAspectRatio:!1,animation:!1,tooltips:{displayColors:!1,callbacks:{}},legend:{},title:{fontSize:20,fontColor:"#333"}},z={scales:{yAxes:[{ticks:{maxTicksLimit:4},scaleLabel:{fontSize:16,fontColor:"#333"}}],xAxes:[{gridLines:{drawOnChartArea:!1},scaleLabel:{fontSize:16,fontColor:"#333"},time:{},ticks:{}}]}},lt=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#651067"],x=function(t,e,n){void 0!==e?(t.legend.display=!!e,e&&!0!==e&&(t.legend.position=e)):n&&(t.legend.display=!1)},b=function(t,e){t.title.display=!0,t.title.text=e},M=function(t,e){null!==e&&(t.scales.xAxes[0].ticks.min=tt(e))},w=function(t,e){t.scales.xAxes[0].ticks.max=tt(e)},C=function(t,e){t.scales.xAxes[0].stacked=!!e,t.scales.yAxes[0].stacked=!!e},A=function(t,e){t.scales.xAxes[0].scaleLabel.display=!0,t.scales.xAxes[0].scaleLabel.labelString=e},_=function(t,e){t.scales.yAxes[0].scaleLabel.display=!0,t.scales.yAxes[0].scaleLabel.labelString=e},ct=function(t){return null!=t},k=function(t,e,n){var r={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal};if("pie"!==n){var a=e.scales.yAxes;"bar"===n&&(a=e.scales.xAxes),a[0].ticks.callback||(a[0].ticks.callback=function(t){return g("",t,r)})}if(!e.tooltips.callbacks.label)if("scatter"===n)e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),n+"("+t.xLabel+", "+t.yLabel+")"};else if("bubble"===n)e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";n&&(n+=": ");var r=e.datasets[t.datasetIndex].data[t.index];return n+"("+t.xLabel+", "+t.yLabel+", "+r.v+")"};else if("pie"===n)e.tooltips.callbacks.label=function(t,e){var n=e.labels[t.index];return i(n)?(n=n.slice())[0]+=": ":n+=": ",g(n,e.datasets[t.datasetIndex].data[t.index],r)};else{var o="bar"===n?"xLabel":"yLabel";e.tooltips.callbacks.label=function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),g(n,t[o],r)}}},S=o($(v,z),x,b,function(t,e){if(e!==null){t.scales.yAxes[0].ticks.min=tt(e)}},function(t,e){t.scales.yAxes[0].ticks.max=tt(e)},C,A,_),T=function(t,e,n){var r,a=[],o=[],i=t.options.colors||lt,s=!0,l=!0,c=!0,p=!0,u=!0,d=!0,h=t.data,f=0;if("bubble"===n)for(var y=0;y<h.length;y++)for(var m=h[y],g=0;g<m.data.length;g++)m.data[g][2]>f&&(f=m.data[g][2]);var v,z,x,b,M,w,C,A,_,k,S,T=[],D=[];if("bar"===n||"column"===n||"number"!==t.xtype&&"bubble"!==t.xtype){var L,O,E=[];for(v=0;v<h.length;v++)for(x=h[v],z=0;z<x.data.length;z++)b=x.data[z],M="datetime"==t.xtype?b[0].getTime():b[0],T[M]||(T[M]=new Array(h.length)),T[M][v]=tt(b[1]),-1===E.indexOf(M)&&E.push(M);for("datetime"!==t.xtype&&"number"!==t.xtype||E.sort(nt),z=0;z<h.length;z++)D.push([]);for(O=0;O<E.length;O++)for(v=E[O],"datetime"===t.xtype?(L=new Date(tt(v)),s=s&&ot(L),r||(r=L.getDay()),l=l&&(A=r,ot(C=L)&&C.getDay()===A),c=c&&it(L),p=p&&(it(w=L)&&0===w.getMonth()),u=u&&at(L),d=d&&rt(L)):L=v,o.push(L),z=0;z<h.length;z++)D[z].push(void 0===T[v][z]?null:T[v][z])}else for(var j=0;j<h.length;j++){for(var I=h[j],B=[],N=0;N<I.data.length;N++){var R={x:tt(I.data[N][0]),y:tt(I.data[N][1])};"bubble"===n&&(R.r=20*tt(I.data[N][2])/f,R.v=I.data[N][2]),B.push(R)}D.push(B)}for(v=0;v<h.length;v++){var F=(x=h[v]).color||i[v],H="line"!==n?(k=.5,void 0,(S=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(_=F))?"rgba("+parseInt(S[1],16)+", "+parseInt(S[2],16)+", "+parseInt(S[3],16)+", "+k+")":_):F,P={label:x.name||"",data:D[v],fill:"area"===n,borderColor:F,backgroundColor:H,pointBackgroundColor:F,borderWidth:2,pointHoverBackgroundColor:F};x.stack&&(P.stack=x.stack);var U=st(t,x,"curve");!1===U&&(P.lineTension=0);var W=st(t,x,"points");!1===W&&(P.pointRadius=0,P.pointHitRadius=5),P=$(P=$(P=$(P,t.options.dataset||{}),x.library||{}),x.dataset||{}),a.push(P)}var V=t.options.xmin,Q=t.options.xmax;if("datetime"===t.xtype?(ct(V)&&(e.scales.xAxes[0].time.min=et(V).getTime()),ct(Q)&&(e.scales.xAxes[0].time.max=et(Q).getTime())):"number"===t.xtype&&(ct(V)&&(e.scales.xAxes[0].ticks.min=V),ct(Q)&&(e.scales.xAxes[0].ticks.max=Q)),"datetime"===t.xtype&&0<o.length){var J=(ct(V)?et(V):o[0]).getTime(),G=(ct(Q)?et(Q):o[0]).getTime();for(v=1;v<o.length;v++){var K=o[v].getTime();K<J&&(J=K),G<K&&(G=K)}var X,Y=(G-J)/864e5;if(!e.scales.xAxes[0].time.unit)if(p||3650<Y?(e.scales.xAxes[0].time.unit="year",X=365):c||300<Y?(e.scales.xAxes[0].time.unit="month",X=30):s||10<Y?(e.scales.xAxes[0].time.unit="day",X=1):u||.5<Y?(e.scales.xAxes[0].time.displayFormats={hour:"MMM D, h a"},e.scales.xAxes[0].time.unit="hour",X=1/24):d&&(e.scales.xAxes[0].time.displayFormats={minute:"h:mm a"},e.scales.xAxes[0].time.unit="minute",X=1/24/60),X&&0<Y){var Z=Math.ceil(Y/X/(t.element.offsetWidth/100));l&&1===X&&(Z=7*Math.ceil(Z/7)),e.scales.xAxes[0].time.unitStepSize=Z}e.scales.xAxes[0].time.tooltipFormat||(s?e.scales.xAxes[0].time.tooltipFormat="ll":u?e.scales.xAxes[0].time.tooltipFormat="MMM D, h a":d&&(e.scales.xAxes[0].time.tooltipFormat="h:mm a"))}var q={labels:o,datasets:a};return q},D=function(t){this.name="chartjs",this.library=t};D.prototype.renderLineChart=function(t,e){var n={};!t.options.max&&function(t){var e,n,r;for(e=0;e<t.length;e++)for(r=t[e].data,n=0;n<r.length;n++)if(0!=r[n][1])return!1;return!0}(t.data)&&(n.max=1);var r=S(t,$(n,t.options));k(t,r,e);var a=T(t,r,e||"line");"number"===t.xtype?(r.scales.xAxes[0].type="linear",r.scales.xAxes[0].position="bottom"):r.scales.xAxes[0].type="string"===t.xtype?"category":"time",this.drawChart(t,"line",a,r)},D.prototype.renderPieChart=function(t){var e=$({},v);t.options.donut&&(e.cutoutPercentage=50),"legend"in t.options&&x(e,t.options.legend),t.options.title&&b(e,t.options.title),e=$(e,t.options.library||{}),k(t,e,"pie");for(var n=[],r=[],a=0;a<t.data.length;a++){var o=t.data[a];n.push(o[0]),r.push(o[1])}var i={data:r,backgroundColor:t.options.colors||lt};i=$(i,t.options.dataset||{});var s={labels:n,datasets:[i]};this.drawChart(t,"pie",s,e)},D.prototype.renderColumnChart=function(t,e){var n;if("bar"===e){var r=$(v,z);delete r.scales.yAxes[0].ticks.maxTicksLimit,n=o(r,x,b,M,w,C,A,_)(t,t.options)}else n=S(t,t.options);k(t,n,e);var a=T(t,n,"column");"bar"!==e&&function(t,e,n){var r=Math.ceil(t.element.offsetWidth/4/e.labels.length);if(r>25){r=25}else if(r<10){r=10}if(!n.scales.xAxes[0].ticks.callback){n.scales.xAxes[0].ticks.callback=function(t){t=f(t);if(t.length>r){return t.substring(0,r-2)+"..."}else{return t}}}}(t,a,n),this.drawChart(t,"bar"===e?"horizontalBar":"bar",a,n)},D.prototype.renderAreaChart=function(t){this.renderLineChart(t,"area")},D.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},D.prototype.renderScatterChart=function(t,e){e=e||"scatter";var n=S(t,t.options);k(t,n,e),"showLines"in n||(n.showLines=!1);var r=T(t,n,e);n.scales.xAxes[0].type="linear",n.scales.xAxes[0].position="bottom",this.drawChart(t,e,r,n)},D.prototype.renderBubbleChart=function(t){this.renderScatterChart(t,"bubble")},D.prototype.destroy=function(t){t.chart&&t.chart.destroy()};var L={chart:{},xAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},yAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},title:{text:null},credits:{enabled:!(D.prototype.drawChart=function(t,e,n,r){this.destroy(t);var a={type:e,data:n,options:r};t.options.code&&window.console.log("new Chart(ctx, "+JSON.stringify(a)+");"),t.element.innerHTML="<canvas></canvas>";var o=t.element.getElementsByTagName("CANVAS")[0];t.chart=new this.library(o,a)})},legend:{borderWidth:0},tooltip:{style:{fontSize:"12px"}},plotOptions:{areaspline:{},series:{marker:{}}}},O=function(t,e,n){void 0!==e?(t.legend.enabled=!!e,e&&!0!==e&&("top"===e||"bottom"===e?t.legend.verticalAlign=e:(t.legend.layout="vertical",t.legend.verticalAlign="middle",t.legend.align=e))):n&&(t.legend.enabled=!1)},E=function(t,e){t.title.text=e},j=o(L,O,E,function(t,e){t.yAxis.min=e},function(t,e){t.yAxis.max=e},function(t,e){t.plotOptions.series.stacking=e?!0===e?"normal":e:null},function(t,e){t.xAxis.title.text=e},function(t,e){t.yAxis.title.text=e}),I=function(t,e,n){var r={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal};"pie"===n||e.yAxis.labels.formatter||(e.yAxis.labels.formatter=function(){return g("",this.value,r)}),e.tooltip.pointFormatter||(e.tooltip.pointFormatter=function(){return'<span style="color:'+this.color+'">ā—</span> '+g(this.series.name+": <b>",this.y,r)+"</b><br/>"})},B=function(t){this.name="highcharts",this.library=t};B.prototype.renderLineChart=function(t,e){var n={};"areaspline"===(e=e||"spline")&&(n={plotOptions:{areaspline:{stacking:"normal"},area:{stacking:"normal"},series:{marker:{enabled:!1}}}}),!1===t.options.curve&&("areaspline"===e?e="area":"spline"===e&&(e="line"));var r,a,o,i=j(t,t.options,n);i.xAxis.type="string"===t.xtype?"category":"number"===t.xtype?"linear":"datetime",i.chart.type||(i.chart.type=e),I(t,i,e);var s=t.data;for(a=0;a<s.length;a++){if(s[a].name=s[a].name||"Value",r=s[a].data,"datetime"===t.xtype)for(o=0;o<r.length;o++)r[o][0]=r[o][0].getTime();!(s[a].marker={symbol:"circle"})===t.options.points&&(s[a].marker.enabled=!1)}this.drawChart(t,s,i)},B.prototype.renderScatterChart=function(t){var e=j(t,t.options,{});e.chart.type="scatter",this.drawChart(t,t.data,e)},B.prototype.renderPieChart=function(t){var e=$(L,{});t.options.colors&&(e.colors=t.options.colors),t.options.donut&&(e.plotOptions={pie:{innerSize:"50%"}}),"legend"in t.options&&O(e,t.options.legend),t.options.title&&E(e,t.options.title);var n=$(e,t.options.library||{});I(t,n,"pie");var r=[{type:"pie",name:t.options.label||"Value",data:t.data}];this.drawChart(t,r,n)},B.prototype.renderColumnChart=function(t,e){e=e||"column";var n,r,a,o,i=t.data,s=j(t,t.options),l=[],c=[];for(s.chart.type=e,I(t,s,e),n=0;n<i.length;n++)for(a=i[n],r=0;r<a.data.length;r++)o=a.data[r],l[o[0]]||(l[o[0]]=new Array(i.length),c.push(o[0])),l[o[0]][n]=o[1];"number"===t.xtype&&c.sort(nt),s.xAxis.categories=c;var p,u=[];for(n=0;n<i.length;n++){for(o=[],r=0;r<c.length;r++)o.push(l[c[r]][n]||0);p={name:i[n].name||"Value",data:o},i[n].stack&&(p.stack=i[n].stack),u.push(p)}this.drawChart(t,u,s)},B.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},B.prototype.renderAreaChart=function(t){this.renderLineChart(t,"areaspline")},B.prototype.destroy=function(t){t.chart&&t.chart.destroy()},B.prototype.drawChart=function(t,e,n){this.destroy(t),n.chart.renderTo=t.element.id,n.series=e,t.options.code&&window.console.log("new Highcharts.Chart("+JSON.stringify(n)+");"),t.chart=new this.library.Chart(n)};var N={},R=[],F={chartArea:{},fontName:"'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif",pointSize:6,legend:{textStyle:{fontSize:12,color:"#444"},alignment:"center",position:"right"},curveType:"function",hAxis:{textStyle:{color:"#666",fontSize:12},titleTextStyle:{},gridlines:{color:"transparent"},baselineColor:"#ccc",viewWindow:{}},vAxis:{textStyle:{color:"#666",fontSize:12},titleTextStyle:{},baselineColor:"#ccc",viewWindow:{}},tooltip:{textStyle:{color:"#666",fontSize:12}}},H=function(t,e,n){var r;void 0!==e?(r=e?!0===e?"right":e:"none",t.legend.position=r):n&&(t.legend.position="none")},P=function(t,e){t.title=e,t.titleTextStyle={color:"#333",fontSize:"20px"}},U=function(t,e){t.hAxis.viewWindow.min=e},W=function(t,e){t.hAxis.viewWindow.max=e},V=function(t,e){t.isStacked=e||!1},Q=function(t,e){t.hAxis.title=e,t.hAxis.titleTextStyle.italic=!1},J=function(t,e){t.vAxis.title=e,t.vAxis.titleTextStyle.italic=!1},G=o(F,H,P,function(t,e){t.vAxis.viewWindow.min=e},function(t,e){t.vAxis.viewWindow.max=e},V,Q,J),K=function(t){this.name="google",this.library=t};K.prototype.renderLineChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={};!1===r.options.curve&&(t.curveType="none"),!1===r.options.points&&(t.pointSize=0);var e=G(r,r.options,t),n=a.createDataTable(r.data,r.xtype);a.drawChart(r,"LineChart",n,e)})},K.prototype.renderPieChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={chartArea:{top:"10%",height:"80%"},legend:{}};r.options.colors&&(t.colors=r.options.colors),r.options.donut&&(t.pieHole=.5),"legend"in r.options&&H(t,r.options.legend),r.options.title&&P(t,r.options.title);var e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn("string",""),n.addColumn("number","Value"),n.addRows(r.data),a.drawChart(r,"PieChart",n,e)})},K.prototype.renderColumnChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=G(n,n.options),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"ColumnChart",e,t)})},K.prototype.renderBarChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=o(F,H,P,U,W,V,Q,J)(n,n.options,{hAxis:{gridlines:{color:"#ccc"}}}),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"BarChart",e,t)})},K.prototype.renderAreaChart=function(n){var r=this;this.waitForLoaded(n,function(){var t=G(n,n.options,{isStacked:true,pointSize:0,areaOpacity:.5}),e=r.createDataTable(n.data,n.xtype);r.drawChart(n,"AreaChart",e,t)})},K.prototype.renderGeoChart=function(r){var a=this;this.waitForLoaded(r,function(){var t={legend:"none",colorAxis:{colors:r.options.colors||["#f6c7b6","#ce502d"]}},e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn("string",""),n.addColumn("number",r.options.label||"Value"),n.addRows(r.data),a.drawChart(r,"GeoChart",n,e)})},K.prototype.renderScatterChart=function(l){var c=this;this.waitForLoaded(l,function(){var t,e,n,r,a=G(l,l.options,{}),o=l.data,i=[];for(t=0;t<o.length;t++)for(o[t].name=o[t].name||"Value",r=o[t].data,e=0;e<r.length;e++){var s=new Array(o.length+1);s[0]=r[e][0],s[t+1]=r[e][1],i.push(s)}for((n=new c.library.visualization.DataTable).addColumn("number",""),t=0;t<o.length;t++)n.addColumn("number",o[t].name);n.addRows(i),c.drawChart(l,"ScatterChart",n,a)})},K.prototype.renderTimeline=function(r){var a=this;this.waitForLoaded(r,"timeline",function(){var t={legend:"none"};r.options.colors&&(t.colors=r.options.colors);var e=$($(F,t),r.options.library||{}),n=new a.library.visualization.DataTable;n.addColumn({type:"string",id:"Name"}),n.addColumn({type:"date",id:"Start"}),n.addColumn({type:"date",id:"End"}),n.addRows(r.data),r.element.style.lineHeight="normal",a.drawChart(r,"Timeline",n,e)})},K.prototype.destroy=function(t){t.chart&&t.chart.clearChart()},K.prototype.drawChart=function(t,e,n,r){this.destroy(t),t.options.code&&window.console.log("var data = new google.visualization.DataTable("+n.toJSON()+");\nvar chart = new google.visualization."+e+"(element);\nchart.draw(data, "+JSON.stringify(r)+");"),t.chart=new this.library.visualization[e](t.element),function(t){if(window.attachEvent){window.attachEvent("onresize",t)}else if(window.addEventListener){window.addEventListener("resize",t,true)}t()}(function(){t.chart.draw(n,r)})},K.prototype.waitForLoaded=function(t,e,n){var r=this;if(n||(n=e,e="corechart"),R.push({pack:e,callback:n}),N[e])this.runCallbacks();else{N[e]=!0;var a={packages:[e],callback:function(){r.runCallbacks()}},o=t.__config();o.language&&(a.language=o.language),"corechart"===e&&o.mapsApiKey&&(a.mapsApiKey=o.mapsApiKey),this.library.charts.load("current",a)}},K.prototype.runCallbacks=function(){for(var t,e=0;e<R.length;e++)t=R[e],this.library.visualization&&("corechart"===t.pack&&this.library.visualization.LineChart||"timeline"===t.pack&&this.library.visualization.Timeline)&&(t.callback(),R.splice(e,1),e--)},K.prototype.createDataTable=function(t,e){var n,r,a,o,i,s=[],l=[];for(n=0;n<t.length;n++)for(a=t[n],t[n].name=t[n].name||"Value",r=0;r<a.data.length;r++)o=a.data[r],i="datetime"===e?o[0].getTime():o[0],s[i]||(s[i]=new Array(t.length),l.push(i)),s[i][n]=tt(o[1]);var c,p=[],u=!0;for(r=0;r<l.length;r++)n=l[r],"datetime"===e?(c=new Date(tt(n)),u=u&&ot(c)):c="number"===e?tt(n):n,p.push([c].concat(s[n]));if("datetime"===e)p.sort(y);else if("number"===e){for(p.sort(m),n=0;n<p.length;n++)p[n][0]=f(p[n][0]);e="string"}var d=new this.library.visualization.DataTable;for(e="datetime"===e&&u?"date":e,d.addColumn(e,""),n=0;n<t.length;n++)d.addColumn("number",t[n].name);return d.addRows(p),d};var X=[],e=0,n=4;function Y(){if(e<n){var t=X.shift();t&&(e++,function(t,e,a){!function(t,e,n){var r=window.jQuery||window.Zepto||window.$;if(r)r.ajax({dataType:"json",url:t,success:e,error:n,complete:Z});else{var a=new XMLHttpRequest;a.open("GET",t,!0),a.setRequestHeader("Content-Type","application/json"),a.onload=function(){Z(),200===a.status?e(JSON.parse(a.responseText),a.statusText,a):n(a,"error",a.statusText)},a.send()}}(t,e,function(t,e,n){var r="string"==typeof n?n:n.message;a(r)})}(t[0],t[1],t[2]),Y())}}function Z(){e--,Y()}var q={},pt=[];function ut(t,e){document.body.innerText?t.innerText=e:t.textContent=e}function dt(t,e){ut(t,"Error Loading Chart: "+e),t.style.color="#ff0000"}function ht(e){try{e.__render()}catch(t){throw dt(e.element,t.message),t}}function ft(e,t){"string"==typeof t?function(t,e,n){X.push([t,e,n]),Y()}(t,function(t){e.rawData=t,ht(e)},function(t){dt(e.element,t)}):(e.rawData=t,ht(e))}function yt(t,e,n){if(t.addEventListener)return t.addEventListener(e,n,!1),n;var r=function(){return n.call(t,window.event)};return t.attachEvent("on"+e,r),r}function t(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)}function mt(t,e){if(t===e)return!1;for(;e&&e!==t;)e=e.parentNode;return e===t}function gt(t){var e=function(t){if(t){if("Highcharts"===t.product)return B;if(t.charts)return K;if(s(t))return D}throw new Error("Unknown adapter")}(t),n=new e(t);-1===pt.indexOf(n)&&pt.push(n)}function vt(t,e){e.options.messages&&e.options.messages.empty&&function(t,e){{if("PieChart"===e||"GeoChart"===e||"Timeline"===e)return 0===t.length;for(var n=0;n<t.length;n++)if(0<t[n].data.length)return!1;return!0}}(e.data,t)?ut(e.element,e.options.messages.empty):(function(t,e){var n,r,a,o;for(a="render"+t,o=e.options.adapter,function(){"Chart"in window&&gt(window.Chart);"Highcharts"in window&&gt(window.Highcharts);window.google&&window.google.charts&&gt(window.google)}(),n=0;n<pt.length;n++)if(r=pt[n],(!o||o===r.name)&&s(r[a]))return e.adapter=r.name,(e.__adapterObject=r)[a](e);throw 0<pt.length?new Error("No charting library found for "+t):new Error("No charting libraries found - be sure to include one before your charts")}(t,e),e.options.download&&!e.__downloadAttached&&"chartjs"===e.adapter&&function(n){var r=n.element,a=document.createElement("a"),o=n.options.download;!0===o?o={}:"string"==typeof o&&(o={filename:o});a.download=o.filename||"chart.png",a.style.position="absolute",a.style.top="20px",a.style.right="20px",a.style.zIndex=1e3,a.style.lineHeight="20px",a.target="_blank";var t=document.createElement("img");t.alt="Download",t.style.border="none",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABCFBMVEUAAADMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMywEsqxAAAAV3RSTlMAAQIDBggJCgsMDQ4PERQaHB0eISIjJCouLzE0OTo/QUJHSUpLTU5PUllhYmltcHh5foWLjI+SlaCio6atr7S1t7m6vsHHyM7R2tze5Obo7fHz9ff5+/1hlxK2AAAA30lEQVQYGUXBhVYCQQBA0TdYWAt2d3d3YWAHyur7/z9xgD16Lw0DW+XKx+1GgX+FRzM3HWQWrHl5N/oapW5RPe0PkBu+UYeICvozTWZVK23Ao04B79oJrOsJDOoxkZoQPWgX29pHpCZEk7rEvQYiNSFq1UMqvlCjJkRBS1R8hb00Vb/TajtBL7nTHE1X1vyMQF732dQhyF2o6SAwrzP06iUQzvwsArlnzcOdrgBhJyHa1QOgO9U1GsKuvjUTjavliZYQ8nNPapG6sap/3nrIdJ6bOWzmX/fy0XVpfzZP3S8OJT3g9EEiJwAAAABJRU5ErkJggg==",a.appendChild(t),r.style.position="relative",n.__downloadAttached=!0,n.__enterEvent=yt(r,"mouseover",function(t){var e=t.relatedTarget;e&&(e===this||mt(this,e))||!n.options.download||(a.href=n.toImage(o),r.appendChild(a))}),n.__leaveEvent=yt(r,"mouseout",function(t){var e=t.relatedTarget;e&&(e===this||mt(this,e))||a.parentNode&&a.parentNode.removeChild(a)})}(e))}var zt=function(t,e){return t="number"===e?tt(t):"datetime"===e?et(t):f(t)},xt=function(t,e){var n,r,a=[];for(r=0;r<t.length;r++)"bubble"===e?a.push([tt(t[r][0]),tt(t[r][1]),tt(t[r][2])]):(n=zt(t[r][0],e),a.push([n,tt(t[r][1])]));return"datetime"===e?a.sort(y):"number"===e&&a.sort(m),a};function bt(t,e){var n,r,a;for(n=0;n<t.length;n++)for(a=c(t[n].data),r=0;r<a.length;r++)if(!e(a[r][0]))return!1;return!0}function Mt(t,e,n){var r,a=t.options,o=t.rawData;for(!i(o)||"object"!=typeof o[0]||i(o[0])?(o=[{name:a.label,data:o}],t.hideLegend=!0):t.hideLegend=!1,t.xtype=e||(a.discrete?"string":function(t,e){return bt(t,u)?"number":!e&&bt(t,p)?"datetime":"string"}(o,n)),o=function(t){var e,n,r=[];for(e=0;e<t.length;e++){var a={};for(n in t[e])t[e].hasOwnProperty(n)&&(a[n]=t[e][n]);r.push(a)}return r}(o),r=0;r<o.length;r++)o[r].data=xt(c(o[r].data),t.xtype);return o}function wt(t){var e,n=c(t.rawData);for(e=0;e<n.length;e++)n[e]=[f(n[e][0]),tt(n[e][1])];return n}var Ct=function(t,e,n){var r;if("string"==typeof t&&(r=t,!(t=document.getElementById(t))))throw new Error("No element with id "+r);this.element=t,this.options=$(At.options,n||{}),this.dataSource=e,ft(At.charts[t.id]=this,e),this.options.refresh&&this.startRefresh()};Ct.prototype.getElement=function(){return this.element},Ct.prototype.getDataSource=function(){return this.dataSource},Ct.prototype.getData=function(){return this.data},Ct.prototype.getOptions=function(){return this.options},Ct.prototype.getChartObject=function(){return this.chart},Ct.prototype.getAdapter=function(){return this.adapter},Ct.prototype.updateData=function(t,e){this.dataSource=t,e&&this.__updateOptions(e),ft(this,t)},Ct.prototype.setOptions=function(t){this.__updateOptions(t),this.redraw()},Ct.prototype.redraw=function(){ft(this,this.rawData)},Ct.prototype.refreshData=function(){if("string"==typeof this.dataSource){var t=-1===this.dataSource.indexOf("?")?"?":"&",e=this.dataSource+t+"_="+(new Date).getTime();ft(this,e)}},Ct.prototype.startRefresh=function(){var t=this,e=this.options.refresh;if(e&&"string"!=typeof this.dataSource)throw new Error("Data source must be a URL for refresh");if(!this.intervalId){if(!e)throw new Error("No refresh interval");this.intervalId=setInterval(function(){t.refreshData()},1e3*e)}},Ct.prototype.stopRefresh=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)},Ct.prototype.toImage=function(t){if("chartjs"!==this.adapter)return null;if(t&&t.background&&"transparent"!==t.background){var e=this.chart.chart.canvas,n=this.chart.chart.ctx,r=document.createElement("canvas"),a=r.getContext("2d");return r.width=n.canvas.width,r.height=n.canvas.height,a.fillStyle=t.background,a.fillRect(0,0,r.width,r.height),a.drawImage(e,0,0),r.toDataURL("image/png")}return this.chart.toBase64Image()},Ct.prototype.destroy=function(){this.__adapterObject&&this.__adapterObject.destroy(this),this.__enterEvent&&t(this.element,"mouseover",this.__enterEvent),this.__leaveEvent&&t(this.element,"mouseout",this.__leaveEvent)},Ct.prototype.__updateOptions=function(t){var e=t.refresh&&t.refresh!==this.options.refresh;this.options=$(At.options,t),e&&(this.stopRefresh(),this.startRefresh())},Ct.prototype.__render=function(){this.data=this.__processData(),vt(this.__chartName(),this)},Ct.prototype.__config=function(){return q};var At={LineChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this)},e.prototype.__chartName=function(){return"LineChart"},e}(Ct),PieChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return wt(this)},e.prototype.__chartName=function(){return"PieChart"},e}(Ct),ColumnChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,null,!0)},e.prototype.__chartName=function(){return"ColumnChart"},e}(Ct),BarChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,null,!0)},e.prototype.__chartName=function(){return"BarChart"},e}(Ct),AreaChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this)},e.prototype.__chartName=function(){return"AreaChart"},e}(Ct),GeoChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return wt(this)},e.prototype.__chartName=function(){return"GeoChart"},e}(Ct),ScatterChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,"number")},e.prototype.__chartName=function(){return"ScatterChart"},e}(Ct),BubbleChart:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){return Mt(this,"bubble")},e.prototype.__chartName=function(){return"BubbleChart"},e}(Ct),Timeline:function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.__processData=function(){var t,e=this.rawData;for(t=0;t<e.length;t++)e[t][1]=et(e[t][1]),e[t][2]=et(e[t][2]);return e},e.prototype.__chartName=function(){return"Timeline"},e}(Ct),charts:{},configure:function(t){for(var e in t)t.hasOwnProperty(e)&&(q[e]=t[e])},setDefaultOptions:function(t){At.options=t},eachChart:function(t){for(var e in At.charts)At.charts.hasOwnProperty(e)&&t(At.charts[e])},config:q,options:{},adapters:pt,addAdapter:gt,use:function(t){return gt(t),At}};return"undefined"==typeof window||window.Chartkick||(window.Chartkick=At),At.default=At}()}(e={exports:{}},e.exports),e.exports);function r(r){function t(t){var e=t.innerRef,n=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&-1===e.indexOf(r)&&(n[r]=t[r]);return n}(t,["innerRef"]);return n.chartType=r,n.ref=e,a.createElement(i,n)}return t.displayName=r.name,t}var o=1,i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.newChartType=function(t){var e=t.data,n={};for(var r in t)t.hasOwnProperty(r)&&"data"!==r&&"id"!==r&&"height"!==r&&"width"!==r&&(n[r]=t[r]);this.element&&(this.chart?this.chart.updateData(e,n):this.chart=new t.chartType(this.element,e,n))},e.prototype.componentDidMount=function(){this.newChartType(this.props)},e.prototype.componentDidUpdate=function(){this.newChartType(this.props)},e.prototype.render=function(){var e=this,t=this.props,n={height:t.height||"300px",lineHeight:t.height||"300px",width:t.width||"100%",textAlign:"center",color:"#999",fontSize:"14px",fontFamily:"'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif"};return this.chartId=t.id||this.chartId||"chart-"+o++,a.createElement("div",{id:this.chartId,style:n,ref:function(t){return e.element=t}},"Loading...")},e}(a.Component),s=r(n.LineChart),l=r(n.PieChart),c=r(n.ColumnChart),p=r(n.BarChart),u=r(n.AreaChart),d=r(n.ScatterChart),h=r(n.GeoChart),f=r(n.Timeline);t.AreaChart=u,t.BarChart=p,t.ColumnChart=c,t.GeoChart=h,t.LineChart=s,t.PieChart=l,t.ScatterChart=d,t.Timeline=f,t.default=n,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "react-chartkick",
"version": "0.3.1",
"version": "0.3.2",
"description": "Create beautiful JavaScript charts with one line of React",

@@ -35,4 +35,4 @@ "main": "dist/react-chartkick.js",

"dependencies": {
"chartkick": "^3.1.0"
"chartkick": "^3.1.1"
}
}

@@ -350,3 +350,3 @@ # React Chartkick

<script src="https://unpkg.com/chart.js@2.8.0/dist/Chart.bundle.js"></script>
<script src="https://unpkg.com/react-chartkick@0.3.1"></script>
<script src="https://unpkg.com/react-chartkick@0.3.2"></script>
```

@@ -360,3 +360,3 @@

```javascript
```jsx
<LineChart adapter="google" />

@@ -363,0 +363,0 @@ ```

Sorry, the diff of this file is too big to display