react-chartkick
Advanced tools
+6
-0
@@ -0,1 +1,7 @@ | ||
| ## 0.5.0 (2021-04-05) | ||
| - Added `loading` option | ||
| - Prefer `empty` over `messages: {empty: ...}` | ||
| - Removed Chartkick.js from the no packager manager install | ||
| ## 0.4.1 (2020-07-23) | ||
@@ -2,0 +8,0 @@ |
@@ -1,6 +0,6 @@ | ||
| /* | ||
| /*! | ||
| * React Chartkick | ||
| * Create beautiful JavaScript charts with one line of React | ||
| * https://github.com/ankane/react-chartkick | ||
| * v0.4.1 | ||
| * v0.5.0 | ||
| * MIT License | ||
@@ -66,3 +66,3 @@ */ | ||
| React.createElement("div", {id: this.chartId, style: style, ref: function (element) { return this$1.element = element; }}, | ||
| "Loading..." | ||
| props.loading || "Loading..." | ||
| ) | ||
@@ -69,0 +69,0 @@ ) |
@@ -1,1 +0,2 @@ | ||
| !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,n){"use strict";n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var e,r=(function(t){t.exports=function(){function u(t){return Object.prototype.toString.call(t)==="[object Array]"}function o(t){return t instanceof Function}function a(t){return Object.prototype.toString.call(t)==="[object Object]"&&!o(t)&&t instanceof Object}function n(t,e){var r;for(r in e){if(r==="__proto__"){continue}if(a(e[r])||u(e[r])){if(a(e[r])&&!a(t[r])){t[r]={}}if(u(e[r])&&!u(t[r])){t[r]=[]}n(t[r],e[r])}else if(e[r]!==undefined){t[r]=e[r]}}}function Y(t,e){var r={};n(r,t);n(r,e);return r}var s=/^(\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 l(t){var e,r,a,n,i,o,s,l,c,f,p;f=Object.prototype.toString.call(t);if(f==="[object Date]"){return t}if(f!=="[object String]"){return}a=t.match(d);if(a){p=parseInt(a[1],10);o=parseInt(a[3],10)-1;e=parseInt(a[5],10);r=parseInt(a[7],10);i=a[9]?parseInt(a[9],10):0;c=a[11]?parseInt(a[11],10):0;n=a[12]?parseFloat(h+a[12].slice(1))*1e3:0;l=Date.UTC(p,o,e,r,i,c,n);if(a[13]&&a[14]){s=a[15]*60;if(a[17]){s+=parseInt(a[17],10)}s*=a[14]==="-"?-1:1;l-=s*60*1e3}return new Date(l)}}function y(t){var e,r,a;for(e=0;e<t.length;e++){a=t[e].data;for(r=0;r<a.length;r++){if(a[r][1]<0){return true}}}return false}function v(t){return""+t}function Z(t){return parseFloat(t)}function q(t){var e,r,a,n;if(typeof t!=="object"){if(typeof t==="number"){t=new Date(t*1e3)}else{t=v(t);if(e=t.match(s)){r=parseInt(e[1],10);a=parseInt(e[3],10)-1;n=parseInt(e[5],10);return new Date(r,a,n)}else{var i=t.replace(/ /,"T").replace(" ","").replace("UTC","Z");t=l(i)||new Date(t)}}}return t}function c(t){if(!u(t)){var e=[],r;for(r in t){if(t.hasOwnProperty(r)){e.push([r,t[r]])}}t=e}return t}function f(i,o,s,l,c,f,p,u){return function(t,e,r){var a=t.data;var n=Y({},i);n=Y(n,r||{});if(t.hideLegend||"legend"in e){o(n,e.legend,t.hideLegend)}if(e.title){s(n,e.title)}if("min"in e){l(n,e.min)}else if(!y(a)){l(n,0)}if(e.max){c(n,e.max)}if("stacked"in e){f(n,e.stacked)}if(e.colors){n.colors=e.colors}if(e.xtitle){p(n,e.xtitle)}if(e.ytitle){u(n,e.ytitle)}n=Y(n,e.library||{});return n}}function m(t,e){return t[0].getTime()-e[0].getTime()}function g(t,e){return t[0]-e[0]}function $(t,e){return t-e}function tt(t){return t.getMilliseconds()===0&&t.getSeconds()===0}function et(t){return tt(t)&&t.getMinutes()===0}function rt(t){return et(t)&&t.getHours()===0}function at(t,e){return rt(t)&&t.getDay()===e}function nt(t){return rt(t)&&t.getDate()===1}function it(t){return nt(t)&&t.getMonth()===0}function i(t){return!isNaN(q(t))&&v(t).length>=6}function p(t){return typeof t==="number"}var x=["bytes","KB","MB","GB","TB","PB","EB"];function z(t,e,r,a){t=t||"";if(r.prefix){if(e<0){e=e*-1;t+="-"}t+=r.prefix}var n=r.suffix||"";var i=r.precision;var o=r.round;if(r.byteScale){var s;var l=a?r.byteScale:e;if(l>=0x1000000000000000){e/=0x1000000000000000;s=6}else if(l>=0x4000000000000){e/=0x4000000000000;s=5}else if(l>=1099511627776){e/=1099511627776;s=4}else if(l>=1073741824){e/=1073741824;s=3}else if(l>=1048576){e/=1048576;s=2}else if(l>=1024){e/=1024;s=1}else{s=0}if(i===undefined&&o===undefined){if(e>=1023.5){if(s<x.length-1){e=1;s+=1}}i=e>=1e3?4:3}n=" "+x[s]}if(i!==undefined&&o!==undefined){throw Error("Use either round or precision, not both")}if(!a){if(i!==undefined){e=e.toPrecision(i);if(!r.zeros){e=parseFloat(e)}}if(o!==undefined){if(o<0){var c=Math.pow(10,-1*o);e=parseInt((1*e/c).toFixed(0))*c}else{e=e.toFixed(o);if(!r.zeros){e=parseFloat(e)}}}}if(r.thousands||r.decimal){e=v(e);var f=e.split(".");e=f[0];if(r.thousands){e=e.replace(/\B(?=(\d{3})+(?!\d))/g,r.thousands)}if(f.length>1){e+=(r.decimal||".")+f[1]}}return t+e+n}function ot(t,e,r){if(r in e){return e[r]}else if(r in t.options){return t.options[r]}return null}function b(t){var e,r,a;for(e=0;e<t.length;e++){a=t[e].data;for(r=0;r<a.length;r++){if(a[r][1]!=0){return false}}}return true}var M={maintainAspectRatio:false,animation:false,tooltips:{displayColors:false,callbacks:{}},legend:{},title:{fontSize:20,fontColor:"#333"}},w={scales:{yAxes:[{ticks:{maxTicksLimit:4},scaleLabel:{fontSize:16,fontColor:"#333"}}],xAxes:[{gridLines:{drawOnChartArea:false},scaleLabel:{fontSize:16,fontColor:"#333"},time:{},ticks:{}}]}},st=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#651067"],C=function(t,e,r){if(e!==undefined){t.legend.display=!!e;if(e&&e!==true){t.legend.position=e}}else if(r){t.legend.display=false}},A=function(t,e){t.title.display=true;t.title.text=e},t=function(t,e){if(e!==null){t.scales.yAxes[0].ticks.min=Z(e)}},e=function(t,e){t.scales.yAxes[0].ticks.max=Z(e)},_=function(t,e){if(e!==null){t.scales.xAxes[0].ticks.min=Z(e)}},k=function(t,e){t.scales.xAxes[0].ticks.max=Z(e)},S=function(t,e){t.scales.xAxes[0].stacked=!!e;t.scales.yAxes[0].stacked=!!e},T=function(t,e){t.scales.xAxes[0].scaleLabel.display=true;t.scales.xAxes[0].scaleLabel.labelString=e},L=function(t,e){t.scales.yAxes[0].scaleLabel.display=true;t.scales.yAxes[0].scaleLabel.labelString=e},lt=function(t,e){var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r?"rgba("+parseInt(r[1],16)+", "+parseInt(r[2],16)+", "+parseInt(r[3],16)+", "+e+")":t},ct=function(t){return t!=null},D=function(t,e,r){var a=Math.ceil(t.element.offsetWidth/4/e.labels.length);if(a>25){a=25}else if(a<10){a=10}if(!r.scales.xAxes[0].ticks.callback){r.scales.xAxes[0].ticks.callback=function(t){t=v(t);if(t.length>a){return t.substring(0,a-2)+"..."}else{return t}}}},O=function(t,e,r){var n={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal,precision:t.options.precision,round:t.options.round,zeros:t.options.zeros};if(t.options.bytes){var a=t.data;if(r==="pie"){a=[{data:a}]}var i=0;for(var o=0;o<a.length;o++){var s=a[o];for(var l=0;l<s.data.length;l++){if(s.data[l][1]>i){i=s.data[l][1]}}}var c=1;while(i>=1024){c*=1024;i/=1024}n.byteScale=c}if(r!=="pie"){var f=e.scales.yAxes;if(r==="bar"){f=e.scales.xAxes}if(n.byteScale){if(!f[0].ticks.stepSize){f[0].ticks.stepSize=n.byteScale/2}if(!f[0].ticks.maxTicksLimit){f[0].ticks.maxTicksLimit=4}}if(!f[0].ticks.callback){f[0].ticks.callback=function(t){return z("",t,n,true)}}}if(!e.tooltips.callbacks.label){if(r==="scatter"){e.tooltips.callbacks.label=function(t,e){var r=e.datasets[t.datasetIndex].label||"";if(r){r+=": "}return r+"("+t.xLabel+", "+t.yLabel+")"}}else if(r==="bubble"){e.tooltips.callbacks.label=function(t,e){var r=e.datasets[t.datasetIndex].label||"";if(r){r+=": "}var a=e.datasets[t.datasetIndex].data[t.index];return r+"("+t.xLabel+", "+t.yLabel+", "+a.v+")"}}else if(r==="pie"){e.tooltips.callbacks.label=function(t,e){var r=e.labels[t.index];var a=": ";if(u(r)){r=r.slice();r[0]+=a}else{r+=a}return z(r,e.datasets[t.datasetIndex].data[t.index],n)}}else{var p=r==="bar"?"xLabel":"yLabel";e.tooltips.callbacks.label=function(t,e){var r=e.datasets[t.datasetIndex].label||"";if(r){r+=": "}return z(r,t[p],n)}}}},E=f(Y(M,w),C,A,t,e,S,T,L),j=function(t,e,r,a){var n=[];var i=[];var o=t.options.colors||st;var s=true;var l=true;var c;var f=true;var p=true;var u=true;var d=true;var h=t.data;var y=0;if(r==="bubble"){for(var v=0;v<h.length;v++){var m=h[v];for(var g=0;g<m.data.length;g++){if(m.data[g][2]>y){y=m.data[g][2]}}}}var x,z,b,M,w,C=[],A=[];if(r==="bar"||r==="column"||t.xtype!=="number"&&t.xtype!=="bubble"){var _=[];for(x=0;x<h.length;x++){b=h[x];for(z=0;z<b.data.length;z++){M=b.data[z];w=t.xtype=="datetime"?M[0].getTime():M[0];if(!C[w]){C[w]=new Array(h.length)}C[w][x]=Z(M[1]);if(_.indexOf(w)===-1){_.push(w)}}}if(t.xtype==="datetime"||t.xtype==="number"){_.sort($)}for(z=0;z<h.length;z++){A.push([])}var k;var S;for(S=0;S<_.length;S++){x=_[S];if(t.xtype==="datetime"){k=new Date(Z(x));s=s&&rt(k);if(!c){c=k.getDay()}l=l&&at(k,c);f=f&&nt(k);p=p&&it(k);u=u&&et(k);d=d&&tt(k)}else{k=x}i.push(k);for(z=0;z<h.length;z++){A[z].push(C[x][z]===undefined?null:C[x][z])}}}else{for(var T=0;T<h.length;T++){var L=h[T];var D=[];for(var O=0;O<L.data.length;O++){var E={x:Z(L.data[O][0]),y:Z(L.data[O][1])};if(r==="bubble"){E.r=Z(L.data[O][2])*20/y;E.v=L.data[O][2]}D.push(E)}A.push(D)}}for(x=0;x<h.length;x++){b=h[x];var j=b.color||o[x];var B=r!=="line"?lt(j,.5):j;var I={label:b.name||"",data:A[x],fill:r==="area",borderColor:j,backgroundColor:B,pointBackgroundColor:j,borderWidth:2,pointHoverBackgroundColor:j};if(b.stack){I.stack=b.stack}var N=ot(t,b,"curve");if(N===false){I.lineTension=0}var F=ot(t,b,"points");if(F===false){I.pointRadius=0;I.pointHitRadius=5}I=Y(I,t.options.dataset||{});I=Y(I,b.library||{});I=Y(I,b.dataset||{});n.push(I)}var R=t.options.xmin;var H=t.options.xmax;if(t.xtype==="datetime"){var P="math"in a.helpers;var U=P?"ticks":"time";if(ct(R)){e.scales.xAxes[0][U].min=q(R).getTime()}if(ct(H)){e.scales.xAxes[0][U].max=q(H).getTime()}}else if(t.xtype==="number"){if(ct(R)){e.scales.xAxes[0].ticks.min=R}if(ct(H)){e.scales.xAxes[0].ticks.max=H}}if(t.xtype==="datetime"&&i.length===0){if(ct(R)){i.push(q(R))}if(ct(H)){i.push(q(H))}s=false;l=false;f=false;p=false;u=false;d=false}if(t.xtype==="datetime"&&i.length>0){var W=(ct(R)?q(R):i[0]).getTime();var V=(ct(H)?q(H):i[0]).getTime();for(x=1;x<i.length;x++){var Q=i[x].getTime();if(Q<W){W=Q}if(Q>V){V=Q}}var G=(V-W)/(86400*1e3);if(!e.scales.xAxes[0].time.unit){var J;if(p||G>365*10){e.scales.xAxes[0].time.unit="year";J=365}else if(f||G>30*10){e.scales.xAxes[0].time.unit="month";J=30}else if(s||G>10){e.scales.xAxes[0].time.unit="day";J=1}else if(u||G>.5){e.scales.xAxes[0].time.displayFormats={hour:"MMM D, h a"};e.scales.xAxes[0].time.unit="hour";J=1/24}else if(d){e.scales.xAxes[0].time.displayFormats={minute:"h:mm a"};e.scales.xAxes[0].time.unit="minute";J=1/24/60}if(J&&G>0){var K=Math.ceil(G/J/(t.element.offsetWidth/100));if(l&&J===1){K=Math.ceil(K/7)*7}e.scales.xAxes[0].time.unitStepSize=K}}if(!e.scales.xAxes[0].time.tooltipFormat){if(s){e.scales.xAxes[0].time.tooltipFormat="ll"}else if(u){e.scales.xAxes[0].time.tooltipFormat="MMM D, h a"}else if(d){e.scales.xAxes[0].time.tooltipFormat="h:mm a"}}}var X={labels:i,datasets:n};return X},r=function t(e){this.name="chartjs";this.library=e};r.prototype.renderLineChart=function t(e,r){var a={};if(!e.options.max&&b(e.data)){a.max=1}var n=E(e,Y(a,e.options));O(e,n,r);var i=j(e,n,r||"line",this.library);if(e.xtype==="number"){n.scales.xAxes[0].type="linear";n.scales.xAxes[0].position="bottom"}else{n.scales.xAxes[0].type=e.xtype==="string"?"category":"time"}this.drawChart(e,"line",i,n)},r.prototype.renderPieChart=function t(e){var r=Y({},M);if(e.options.donut){r.cutoutPercentage=50}if("legend"in e.options){C(r,e.options.legend)}if(e.options.title){A(r,e.options.title)}r=Y(r,e.options.library||{});O(e,r,"pie");var a=[];var n=[];for(var i=0;i<e.data.length;i++){var o=e.data[i];a.push(o[0]);n.push(o[1])}var s={data:n,backgroundColor:e.options.colors||st};s=Y(s,e.options.dataset||{});var l={labels:a,datasets:[s]};this.drawChart(e,"pie",l,r)},r.prototype.renderColumnChart=function t(e,r){var a;if(r==="bar"){var n=Y(M,w);delete n.scales.yAxes[0].ticks.maxTicksLimit;a=f(n,C,A,_,k,S,T,L)(e,e.options)}else{a=E(e,e.options)}O(e,a,r);var i=j(e,a,"column",this.library);if(r!=="bar"){D(e,i,a)}this.drawChart(e,r==="bar"?"horizontalBar":"bar",i,a)},r.prototype.renderAreaChart=function t(e){this.renderLineChart(e,"area")},r.prototype.renderBarChart=function t(e){this.renderColumnChart(e,"bar")},r.prototype.renderScatterChart=function t(e,r){r=r||"scatter";var a=E(e,e.options);O(e,a,r);if(!("showLines"in a)){a.showLines=false}var n=j(e,a,r,this.library);a.scales.xAxes[0].type="linear";a.scales.xAxes[0].position="bottom";this.drawChart(e,r,n,a)},r.prototype.renderBubbleChart=function t(e){this.renderScatterChart(e,"bubble")},r.prototype.destroy=function t(e){if(e.chart){e.chart.destroy()}},r.prototype.drawChart=function t(e,r,a,n){this.destroy(e);var i={type:r,data:a,options:n};if(e.options.code){window.console.log("new Chart(ctx, "+JSON.stringify(i)+");")}e.element.innerHTML="<canvas></canvas>";var o=e.element.getElementsByTagName("CANVAS")[0];e.chart=new this.library(o,i)};var B={chart:{},xAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},yAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},title:{text:null},credits:{enabled:false},legend:{borderWidth:0},tooltip:{style:{fontSize:"12px"}},plotOptions:{areaspline:{},area:{},series:{marker:{}}}},I=function(t,e,r){if(e!==undefined){t.legend.enabled=!!e;if(e&&e!==true){if(e==="top"||e==="bottom"){t.legend.verticalAlign=e}else{t.legend.layout="vertical";t.legend.verticalAlign="middle";t.legend.align=e}}}else if(r){t.legend.enabled=false}},N=function(t,e){t.title.text=e},F,R,H,P,U,W=f(B,I,N,function(t,e){t.yAxis.min=e},function(t,e){t.yAxis.max=e},function(t,e){var r=e?e===true?"normal":e:null;t.plotOptions.series.stacking=r;t.plotOptions.area.stacking=r;t.plotOptions.areaspline.stacking=r},function(t,e){t.xAxis.title.text=e},function(t,e){t.yAxis.title.text=e}),V=function(t,e,r){var a={prefix:t.options.prefix,suffix:t.options.suffix,thousands:t.options.thousands,decimal:t.options.decimal,precision:t.options.precision,round:t.options.round,zeros:t.options.zeros};if(r!=="pie"&&!e.yAxis.labels.formatter){e.yAxis.labels.formatter=function(){return z("",this.value,a)}}if(!e.tooltip.pointFormatter){e.tooltip.pointFormatter=function(){return'<span style="color:'+this.color+'">ā</span> '+z(this.series.name+": <b>",this.y,a)+"</b><br/>"}}},Q=function t(e){this.name="highcharts";this.library=e};Q.prototype.renderLineChart=function t(e,r){r=r||"spline";var a={};if(r==="areaspline"){a={plotOptions:{areaspline:{stacking:"normal"},area:{stacking:"normal"},series:{marker:{enabled:false}}}}}if(e.options.curve===false){if(r==="areaspline"){r="area"}else if(r==="spline"){r="line"}}var n=W(e,e.options,a),i,o,s;n.xAxis.type=e.xtype==="string"?"category":e.xtype==="number"?"linear":"datetime";if(!n.chart.type){n.chart.type=r}V(e,n,r);var l=e.data;for(o=0;o<l.length;o++){l[o].name=l[o].name||"Value";i=l[o].data;if(e.xtype==="datetime"){for(s=0;s<i.length;s++){i[s][0]=i[s][0].getTime()}}l[o].marker={symbol:"circle"};if(e.options.points===false){l[o].marker.enabled=false}}this.drawChart(e,l,n)},Q.prototype.renderScatterChart=function t(e){var r=W(e,e.options,{});r.chart.type="scatter";this.drawChart(e,e.data,r)},Q.prototype.renderPieChart=function t(e){var r=Y(B,{});if(e.options.colors){r.colors=e.options.colors}if(e.options.donut){r.plotOptions={pie:{innerSize:"50%"}}}if("legend"in e.options){I(r,e.options.legend)}if(e.options.title){N(r,e.options.title)}var a=Y(r,e.options.library||{});V(e,a,"pie");var n=[{type:"pie",name:e.options.label||"Value",data:e.data}];this.drawChart(e,n,a)},Q.prototype.renderColumnChart=function t(e,r){r=r||"column";var a=e.data;var n=W(e,e.options),i,o,s,l,c=[],f=[];n.chart.type=r;V(e,n,r);for(i=0;i<a.length;i++){s=a[i];for(o=0;o<s.data.length;o++){l=s.data[o];if(!c[l[0]]){c[l[0]]=new Array(a.length);f.push(l[0])}c[l[0]][i]=l[1]}}if(e.xtype==="number"){f.sort($)}n.xAxis.categories=f;var p=[],u;for(i=0;i<a.length;i++){l=[];for(o=0;o<f.length;o++){l.push(c[f[o]][i]||0)}u={name:a[i].name||"Value",data:l};if(a[i].stack){u.stack=a[i].stack}p.push(u)}this.drawChart(e,p,n)},Q.prototype.renderBarChart=function t(e){this.renderColumnChart(e,"bar")},Q.prototype.renderAreaChart=function t(e){this.renderLineChart(e,"areaspline")},Q.prototype.destroy=function t(e){if(e.chart){e.chart.destroy()}},Q.prototype.drawChart=function t(e,r,a){this.destroy(e);a.chart.renderTo=e.element.id;a.series=r;if(e.options.code){window.console.log("new Highcharts.Chart("+JSON.stringify(a)+");")}e.chart=new this.library.Chart(a)};var G={},J=[],K={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}}},X=function(t,e,r){if(e!==undefined){var a;if(!e){a="none"}else if(e===true){a="right"}else{a=e}t.legend.position=a}else if(r){t.legend.position="none"}},ft=function(t,e){t.title=e;t.titleTextStyle={color:"#333",fontSize:"20px"}},pt,ut,dt=function(t,e){t.hAxis.viewWindow.min=e},ht=function(t,e){t.hAxis.viewWindow.max=e},yt=function(t,e){t.isStacked=e?e:false},vt=function(t,e){t.hAxis.title=e;t.hAxis.titleTextStyle.italic=false},mt=function(t,e){t.vAxis.title=e;t.vAxis.titleTextStyle.italic=false},gt=f(K,X,ft,function(t,e){t.vAxis.viewWindow.min=e},function(t,e){t.vAxis.viewWindow.max=e},yt,vt,mt),xt=function(t){if(window.attachEvent){window.attachEvent("onresize",t)}else if(window.addEventListener){window.addEventListener("resize",t,true)}t()},zt=function t(e){this.name="google";this.library=e};zt.prototype.renderLineChart=function t(a){var n=this;this.waitForLoaded(a,function(){var t={};if(a.options.curve===false){t.curveType="none"}if(a.options.points===false){t.pointSize=0}var e=gt(a,a.options,t);var r=n.createDataTable(a.data,a.xtype);n.drawChart(a,"LineChart",r,e)})},zt.prototype.renderPieChart=function t(a){var n=this;this.waitForLoaded(a,function(){var t={chartArea:{top:"10%",height:"80%"},legend:{}};if(a.options.colors){t.colors=a.options.colors}if(a.options.donut){t.pieHole=.5}if("legend"in a.options){X(t,a.options.legend)}if(a.options.title){ft(t,a.options.title)}var e=Y(Y(K,t),a.options.library||{});var r=new n.library.visualization.DataTable;r.addColumn("string","");r.addColumn("number","Value");r.addRows(a.data);n.drawChart(a,"PieChart",r,e)})},zt.prototype.renderColumnChart=function t(r){var a=this;this.waitForLoaded(r,function(){var t=gt(r,r.options);var e=a.createDataTable(r.data,r.xtype);a.drawChart(r,"ColumnChart",e,t)})},zt.prototype.renderBarChart=function t(a){var n=this;this.waitForLoaded(a,function(){var t={hAxis:{gridlines:{color:"#ccc"}}};var e=f(K,X,ft,dt,ht,yt,vt,mt)(a,a.options,t);var r=n.createDataTable(a.data,a.xtype);n.drawChart(a,"BarChart",r,e)})},zt.prototype.renderAreaChart=function t(a){var n=this;this.waitForLoaded(a,function(){var t={isStacked:true,pointSize:0,areaOpacity:.5};var e=gt(a,a.options,t);var r=n.createDataTable(a.data,a.xtype);n.drawChart(a,"AreaChart",r,e)})},zt.prototype.renderGeoChart=function t(a){var n=this;this.waitForLoaded(a,"geochart",function(){var t={legend:"none",colorAxis:{colors:a.options.colors||["#f6c7b6","#ce502d"]}};var e=Y(Y(K,t),a.options.library||{});var r=new n.library.visualization.DataTable;r.addColumn("string","");r.addColumn("number",a.options.label||"Value");r.addRows(a.data);n.drawChart(a,"GeoChart",r,e)})},zt.prototype.renderScatterChart=function t(c){var f=this;this.waitForLoaded(c,function(){var t={};var e=gt(c,c.options,t);var r=c.data,a=[],n,i,o,s;for(n=0;n<r.length;n++){r[n].name=r[n].name||"Value";s=r[n].data;for(i=0;i<s.length;i++){var l=new Array(r.length+1);l[0]=s[i][0];l[n+1]=s[i][1];a.push(l)}}o=new f.library.visualization.DataTable;o.addColumn("number","");for(n=0;n<r.length;n++){o.addColumn("number",r[n].name)}o.addRows(a);f.drawChart(c,"ScatterChart",o,e)})},zt.prototype.renderTimeline=function t(a){var n=this;this.waitForLoaded(a,"timeline",function(){var t={legend:"none"};if(a.options.colors){t.colors=a.options.colors}var e=Y(Y(K,t),a.options.library||{});var r=new n.library.visualization.DataTable;r.addColumn({type:"string",id:"Name"});r.addColumn({type:"date",id:"Start"});r.addColumn({type:"date",id:"End"});r.addRows(a.data);a.element.style.lineHeight="normal";n.drawChart(a,"Timeline",r,e)})},zt.prototype.destroy=function t(e){if(e.chart){e.chart.clearChart()}},zt.prototype.drawChart=function t(e,r,a,n){this.destroy(e);if(e.options.code){window.console.log("var data = new google.visualization.DataTable("+a.toJSON()+");\nvar chart = new google.visualization."+r+"(element);\nchart.draw(data, "+JSON.stringify(n)+");")}e.chart=new this.library.visualization[r](e.element);xt(function(){e.chart.draw(a,n)})},zt.prototype.waitForLoaded=function t(e,r,a){var n=this;if(!a){a=r;r="corechart"}J.push({pack:r,callback:a});if(G[r]){this.runCallbacks()}else{G[r]=true;var i={packages:[r],callback:function(){n.runCallbacks()}};var o=e.__config();if(o.language){i.language=o.language}if(r==="geochart"&&o.mapsApiKey){i.mapsApiKey=o.mapsApiKey}this.library.charts.load("current",i)}},zt.prototype.runCallbacks=function t(){var e,r;for(var a=0;a<J.length;a++){e=J[a];r=this.library.visualization&&(e.pack==="corechart"&&this.library.visualization.LineChart||e.pack==="timeline"&&this.library.visualization.Timeline||e.pack==="geochart"&&this.library.visualization.GeoChart);if(r){e.callback();J.splice(a,1);a--}}},zt.prototype.createDataTable=function t(e,r){var a,n,i,o,s,l=[],c=[];for(a=0;a<e.length;a++){i=e[a];e[a].name=e[a].name||"Value";for(n=0;n<i.data.length;n++){o=i.data[n];s=r==="datetime"?o[0].getTime():o[0];if(!l[s]){l[s]=new Array(e.length);c.push(s)}l[s][a]=Z(o[1])}}var f=[];var p=true;var u;for(n=0;n<c.length;n++){a=c[n];if(r==="datetime"){u=new Date(Z(a));p=p&&rt(u)}else if(r==="number"){u=Z(a)}else{u=a}f.push([u].concat(l[a]))}if(r==="datetime"){f.sort(m)}else if(r==="number"){f.sort(g);for(a=0;a<f.length;a++){f[a][0]=v(f[a][0])}r="string"}var d=new this.library.visualization.DataTable;r=r==="datetime"&&p?"date":r;d.addColumn(r,"");for(a=0;a<e.length;a++){d.addColumn("number",e[a].name)}d.addRows(f);return d};var bt=[],Mt=0,wt=4;function Ct(t,e,r){bt.push([t,e,r]);At()}function At(){if(Mt<wt){var t=bt.shift();if(t){Mt++;kt(t[0],t[1],t[2]);At()}}}function _t(){Mt--;At()}function kt(t,e,n){St(t,e,function(t,e,r){var a=typeof r==="string"?r:r.message;n(a)})}function St(t,e,r){var a=window.jQuery||window.Zepto||window.$;if(a&&a.ajax){a.ajax({dataType:"json",url:t,success:e,error:r,complete:_t})}else{var n=new XMLHttpRequest;n.open("GET",t,true);n.setRequestHeader("Content-Type","application/json");n.onload=function(){_t();if(n.status===200){e(JSON.parse(n.responseText),n.statusText,n)}else{r(n,"error",n.statusText)}};n.send()}}var Tt={},Lt=[];function Dt(t,e){if(document.body.innerText){t.innerText=e}else{t.textContent=e}}function Ot(t,e,r){if(!r){e="Error Loading Chart: "+e}Dt(t,e);t.style.color="#ff0000"}function Et(e){try{e.__render()}catch(t){Ot(e.element,t.message);throw t}}function jt(e,t){if(typeof t==="string"){Ct(t,function(t){e.rawData=t;Et(e)},function(t){Ot(e.element,t)})}else if(typeof t==="function"){try{t(function(t){e.rawData=t;Et(e)},function(t){Ot(e.element,t,true)})}catch(t){Ot(e.element,t,true)}}else{e.rawData=t;Et(e)}}function Bt(r){var a=r.element;var n=document.createElement("a");var i=r.options.download;if(i===true){i={}}else if(typeof i==="string"){i={filename:i}}n.download=i.filename||"chart.png";n.style.position="absolute";n.style.top="20px";n.style.right="20px";n.style.zIndex=1e3;n.style.lineHeight="20px";n.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==";n.appendChild(t);a.style.position="relative";r.__downloadAttached=true;r.__enterEvent=It(a,"mouseover",function(t){var e=t.relatedTarget;if((!e||e!==this&&!Ft(this,e))&&r.options.download){n.href=r.toImage(i);a.appendChild(n)}});r.__leaveEvent=It(a,"mouseout",function(t){var e=t.relatedTarget;if(!e||e!==this&&!Ft(this,e)){if(n.parentNode){n.parentNode.removeChild(n)}}})}function It(t,e,r){if(t.addEventListener){t.addEventListener(e,r,false);return r}else{var a=function(){return r.call(t,window.event)};t.attachEvent("on"+e,a);return a}}function Nt(t,e,r){if(t.removeEventListener){t.removeEventListener(e,r,false)}else{t.detachEvent("on"+e,r)}}function Ft(t,e){if(t===e){return false}while(e&&e!==t){e=e.parentNode}return e===t}function Rt(t){if(t){if(t.product==="Highcharts"){return Q}else if(t.charts){return zt}else if(o(t)){return r}}throw new Error("Unknown adapter")}function Ht(t){var e=Rt(t);var r=new e(t);if(Lt.indexOf(r)===-1){Lt.push(r)}}function Pt(){if("Chart"in window){Ht(window.Chart)}if("Highcharts"in window){Ht(window.Highcharts)}if(window.google&&window.google.charts){Ht(window.google)}}function Ut(t,e){if(e==="PieChart"||e==="GeoChart"||e==="Timeline"){return t.length===0}else{for(var r=0;r<t.length;r++){if(t[r].data.length>0){return false}}return true}}function Wt(t,e){if(e.options.messages&&e.options.messages.empty&&Ut(e.data,t)){Dt(e.element,e.options.messages.empty)}else{Vt(t,e);if(e.options.download&&!e.__downloadAttached&&e.adapter==="chartjs"){Bt(e)}}}function Vt(t,e){var r,a,n,i;n="render"+t;i=e.options.adapter;Pt();for(r=0;r<Lt.length;r++){a=Lt[r];if((!i||i===a.name)&&o(a[n])){e.adapter=a.name;e.__adapterObject=a;return a[n](e)}}if(Lt.length>0){throw new Error("No charting library found for "+t)}else{throw new Error("No charting libraries found - be sure to include one before your charts")}}var Qt=function(t,e){if(e==="number"){t=Z(t)}else if(e==="datetime"){t=q(t)}else{t=v(t)}return t},Gt=function(t,e){var r=[],a,n;for(n=0;n<t.length;n++){if(e==="bubble"){r.push([Z(t[n][0]),Z(t[n][1]),Z(t[n][2])])}else{a=Qt(t[n][0],e);r.push([a,Z(t[n][1])])}}if(e==="datetime"){r.sort(m)}else if(e==="number"){r.sort(g)}return r};function Jt(t,e,r){if(Ut(t)){if((r.xmin||r.xmax)&&(!r.xmin||i(r.xmin))&&(!r.xmax||i(r.xmax))){return"datetime"}else{return"number"}}else if(Kt(t,p)){return"number"}else if(!e&&Kt(t,i)){return"datetime"}else{return"string"}}function Kt(t,e){var r,a,n;for(r=0;r<t.length;r++){n=c(t[r].data);for(a=0;a<n.length;a++){if(!e(n[a][0])){return false}}}return true}function Xt(t){var e=[],r,a;for(r=0;r<t.length;r++){var n={};for(a in t[r]){if(t[r].hasOwnProperty(a)){n[a]=t[r][a]}}e.push(n)}return e}function Yt(t,e,r){var a;var n=t.options;var i=t.rawData;if(!u(i)||typeof i[0]!=="object"||u(i[0])){i=[{name:n.label,data:i}];t.hideLegend=true}else{t.hideLegend=false}i=Xt(i);for(a=0;a<i.length;a++){i[a].data=c(i[a].data)}t.xtype=e?e:n.discrete?"string":Jt(i,r,n);for(a=0;a<i.length;a++){i[a].data=Gt(i[a].data,t.xtype)}return i}function Zt(t){var e=c(t.rawData),r;for(r=0;r<e.length;r++){e[r]=[v(e[r][0]),Z(e[r][1])]}return e}var qt=function t(e,r,a){var n;if(typeof e==="string"){n=e;e=document.getElementById(e);if(!e){throw new Error("No element with id "+n)}}this.element=e;this.options=Y(le.options,a||{});this.dataSource=r;le.charts[e.id]=this;jt(this,r);if(this.options.refresh){this.startRefresh()}};qt.prototype.getElement=function t(){return this.element},qt.prototype.getDataSource=function t(){return this.dataSource},qt.prototype.getData=function t(){return this.data},qt.prototype.getOptions=function t(){return this.options},qt.prototype.getChartObject=function t(){return this.chart},qt.prototype.getAdapter=function t(){return this.adapter},qt.prototype.updateData=function t(e,r){this.dataSource=e;if(r){this.__updateOptions(r)}jt(this,e)},qt.prototype.setOptions=function t(e){this.__updateOptions(e);this.redraw()},qt.prototype.redraw=function t(){jt(this,this.rawData)},qt.prototype.refreshData=function t(){if(typeof this.dataSource==="string"){var e=this.dataSource.indexOf("?")===-1?"?":"&";var r=this.dataSource+e+"_="+(new Date).getTime();jt(this,r)}else if(typeof this.dataSource==="function"){jt(this,this.dataSource)}},qt.prototype.startRefresh=function t(){var e=this;var r=this.options.refresh;if(r&&typeof this.dataSource!=="string"&&typeof this.dataSource!=="function"){throw new Error("Data source must be a URL or callback for refresh")}if(!this.intervalId){if(r){this.intervalId=setInterval(function(){e.refreshData()},r*1e3)}else{throw new Error("No refresh interval")}}},qt.prototype.stopRefresh=function t(){if(this.intervalId){clearInterval(this.intervalId);this.intervalId=null}},qt.prototype.toImage=function t(e){if(this.adapter==="chartjs"){if(e&&e.background&&e.background!=="transparent"){var r=this.chart.chart.canvas;var a=this.chart.chart.ctx;var n=document.createElement("canvas");var i=n.getContext("2d");n.width=a.canvas.width;n.height=a.canvas.height;i.fillStyle=e.background;i.fillRect(0,0,n.width,n.height);i.drawImage(r,0,0);return n.toDataURL("image/png")}else{return this.chart.toBase64Image()}}else{return null}},qt.prototype.destroy=function t(){if(this.__adapterObject){this.__adapterObject.destroy(this)}if(this.__enterEvent){Nt(this.element,"mouseover",this.__enterEvent)}if(this.__leaveEvent){Nt(this.element,"mouseout",this.__leaveEvent)}},qt.prototype.__updateOptions=function t(e){var r=e.refresh&&e.refresh!==this.options.refresh;this.options=Y(le.options,e);if(r){this.stopRefresh();this.startRefresh()}},qt.prototype.__render=function t(){this.data=this.__processData();Wt(this.__chartName(),this)},qt.prototype.__config=function t(){return Tt};var $t,te,ee,re,ae,ne,ie,oe,se,le={LineChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this)};e.prototype.__chartName=function t(){return"LineChart"};return e}(qt),PieChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Zt(this)};e.prototype.__chartName=function t(){return"PieChart"};return e}(qt),ColumnChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this,null,true)};e.prototype.__chartName=function t(){return"ColumnChart"};return e}(qt),BarChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this,null,true)};e.prototype.__chartName=function t(){return"BarChart"};return e}(qt),AreaChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this)};e.prototype.__chartName=function t(){return"AreaChart"};return e}(qt),GeoChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Zt(this)};e.prototype.__chartName=function t(){return"GeoChart"};return e}(qt),ScatterChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this,"number")};e.prototype.__chartName=function t(){return"ScatterChart"};return e}(qt),BubbleChart:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){return Yt(this,"bubble")};e.prototype.__chartName=function t(){return"BubbleChart"};return e}(qt),Timeline:function(t){function e(){t.apply(this,arguments)}if(t){e.__proto__=t}e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.__processData=function t(){var e,r=this.rawData;for(e=0;e<r.length;e++){r[e][1]=q(r[e][1]);r[e][2]=q(r[e][2])}return r};e.prototype.__chartName=function t(){return"Timeline"};return e}(qt),charts:{},configure:function(t){for(var e in t){if(t.hasOwnProperty(e)){Tt[e]=t[e]}}},setDefaultOptions:function(t){le.options=t},eachChart:function(t){for(var e in le.charts){if(le.charts.hasOwnProperty(e)){t(le.charts[e])}}},config:Tt,options:{},adapters:Lt,addAdapter:Ht,use:function(t){Ht(t);return le}};if(typeof window!=="undefined"&&!window.Chartkick){window.Chartkick=le}return le.default=le}()}(e={exports:{}}),e.exports);function a(a){function t(t){var e=t.innerRef,r=function(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&-1===e.indexOf(a)&&(r[a]=t[a]);return r}(t,["innerRef"]);return r.chartType=a,r.ref=e,n.createElement(o,r)}return t.displayName=a.name,t}var i=1,o=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,r={};for(var a in t)t.hasOwnProperty(a)&&"data"!==a&&"id"!==a&&"height"!==a&&"width"!==a&&(r[a]=t[a]);this.element&&(this.chart?this.chart.updateData(e,r):this.chart=new t.chartType(this.element,e,r))},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,r={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-"+i++,n.createElement("div",{id:this.chartId,style:r,ref:function(t){return e.element=t}},"Loading...")},e}(n.Component),s=a(r.LineChart),l=a(r.PieChart),c=a(r.ColumnChart),f=a(r.BarChart),p=a(r.AreaChart),u=a(r.ScatterChart),d=a(r.GeoChart),h=a(r.Timeline);t.AreaChart=p,t.BarChart=f,t.ColumnChart=c,t.GeoChart=d,t.LineChart=s,t.PieChart=l,t.ScatterChart=u,t.Timeline=h,t.default=r,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
| /*! React Chartkick v0.5.0 | MIT License */ | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("chartkick")):"function"==typeof define&&define.amd?define(["exports","react","chartkick"],e):e((t=t||self).ReactChartkick={},t.React,t.Chartkick)}(this,function(t,a,e){"use strict";a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var n=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,r=t.data,a={};for(e in t)t.hasOwnProperty(e)&&"data"!==e&&"id"!==e&&"height"!==e&&"width"!==e&&(a[e]=t[e]);this.element&&(this.chart?this.chart.updateData(r,a):this.chart=new t.chartType(this.element,r,a))},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,r={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-"+n++,a.createElement("div",{id:this.chartId,style:r,ref:function(t){return e.element=t}},t.loading||"Loading...")},e}(a.Component),r=function(r){function t(t){var e=t.innerRef;return(t=function(t,e){var r,a={};for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&-1===e.indexOf(r)&&(a[r]=t[r]);return a}(t,["innerRef"])).chartType=r,t.ref=e,a.createElement(i,t)}return t.displayName=r.name,t},o=r(e.LineChart),h=r(e.PieChart),c=r(e.ColumnChart),p=r(e.BarChart),d=r(e.AreaChart),u=r(e.ScatterChart),f=r(e.GeoChart),r=r(e.Timeline);t.AreaChart=d,t.BarChart=p,t.ColumnChart=c,t.GeoChart=f,t.LineChart=o,t.PieChart=h,t.ScatterChart=u,t.Timeline=r,t.default=e,Object.defineProperty(t,"__esModule",{value:!0})}); |
+2
-2
| { | ||
| "name": "react-chartkick", | ||
| "version": "0.4.1", | ||
| "version": "0.5.0", | ||
| "description": "Create beautiful JavaScript charts with one line of React", | ||
@@ -36,4 +36,4 @@ "main": "dist/react-chartkick.js", | ||
| "dependencies": { | ||
| "chartkick": "^3.2.0" | ||
| "chartkick": "^4.0.0" | ||
| } | ||
| } |
+17
-11
@@ -21,3 +21,3 @@ # React Chartkick | ||
| import { LineChart, PieChart } from 'react-chartkick' | ||
| import 'chart.js' | ||
| import 'chartkick/chart.js' | ||
| ``` | ||
@@ -221,8 +221,14 @@ | ||
| Show a message when data is empty | ||
| Specify the message when the chart is loading | ||
| ```jsx | ||
| <LineChart messages={{empty: "No data"}} /> | ||
| ```vue | ||
| <LineChart loading="Loading..." /> | ||
| ``` | ||
| Specify the message when data is empty | ||
| ```vue | ||
| <LineChart empty="No data" /> | ||
| ``` | ||
| Refresh data from a remote source every `n` seconds | ||
@@ -335,3 +341,3 @@ | ||
| import { LineChart, PieChart } from 'react-chartkick' | ||
| import 'chart.js' | ||
| import 'chartkick/chart.js' | ||
| ``` | ||
@@ -376,6 +382,4 @@ | ||
| ```javascript | ||
| import Chartkick, { LineChart, PieChart } from 'react-chartkick' | ||
| import Highcharts from 'highcharts' | ||
| Chartkick.use(Highcharts) | ||
| import { LineChart, PieChart } from 'react-chartkick' | ||
| import 'chartkick/highcharts' | ||
| ``` | ||
@@ -388,4 +392,6 @@ | ||
| ```html | ||
| <script src="https://unpkg.com/chart.js@2.8.0/dist/Chart.bundle.js"></script> | ||
| <script src="https://unpkg.com/react-chartkick@0.4.1"></script> | ||
| <script src="https://unpkg.com/chart.js@3.0.2/dist/chart.js"></script> | ||
| <script src="https://unpkg.com/chartjs-adapter-date-fns@2.0.0/dist/chartjs-adapter-date-fns.bundle.js"></script> | ||
| <script src="https://unpkg.com/chartkick@4.0.0/dist/chartkick.js"></script> | ||
| <script src="https://unpkg.com/react-chartkick@0.5.0"></script> | ||
| ``` | ||
@@ -392,0 +398,0 @@ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
423
1.44%0
-100%20084
-83.73%191
-92.09%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated