govuk_publishing_components 44.4.0 → 44.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +1 -1
- data/app/views/govuk_publishing_components/components/_chart.html.erb +2 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/README.md +3 -3
- data/node_modules/axe-core/axe.d.ts +5 -1
- data/node_modules/axe-core/axe.js +317 -299
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/README.md +3 -3
- data/node_modules/axe-core/locales/_template.json +14 -14
- data/node_modules/axe-core/package.json +2 -1
- data/node_modules/axe-core/sri-history.json +4 -0
- data/node_modules/chartkick/LICENSE.txt +22 -0
- data/node_modules/chartkick/README.md +593 -0
- data/node_modules/chartkick/chart.js/chart.esm.js +5 -0
- data/node_modules/chartkick/chart.js/package.json +6 -0
- data/node_modules/chartkick/dist/chartkick.esm.js +2562 -0
- data/node_modules/chartkick/dist/chartkick.js +2570 -0
- data/node_modules/chartkick/dist/chartkick.min.js +2 -0
- data/node_modules/chartkick/highcharts/highcharts.esm.js +4 -0
- data/node_modules/chartkick/highcharts/package.json +6 -0
- data/node_modules/chartkick/package.json +50 -0
- metadata +12 -2
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! Chartkick.js v5.0.1 | MIT License */
|
2
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chartkick=e()}(this,(function(){"use strict";function t(t){return"[object Array]"===Object.prototype.toString.call(t)}function e(t){return t instanceof Function}function r(t){return"[object Object]"===Object.prototype.toString.call(t)&&!e(t)&&t instanceof Object}function n(e,o){for(var a in o)"__proto__"!==a&&(r(o[a])||t(o[a])?(r(o[a])&&!r(e[a])&&(e[a]={}),t(o[a])&&!t(e[a])&&(e[a]=[]),n(e[a],o[a])):void 0!==o[a]&&(e[a]=o[a]))}function o(t,e){var r={};return n(r,t),n(r,e),r}var a=/^(\d\d\d\d)(?:-)?(\d\d)(?:-)?(\d\d)$/i;function i(t){return""+t}function s(t){return parseFloat(t)}function l(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);var e=i(t),r=e.match(a);if(r){var n=parseInt(r[1],10),o=parseInt(r[2],10)-1,s=parseInt(r[3],10);return new Date(n,o,s)}var l=e.replace(/ /,"T").replace(" ","").replace("UTC","Z");return new Date(Date.parse(l)||e)}function c(e){if(t(e))return e;var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.push([n,e[n]]);return r}function p(t,e,r,n,a,i,s,l){return function(c,p,u){var d=c.data,h=o({},t);return h=o(h,u||{}),(c.singleSeriesFormat||"legend"in p)&&e(h,p.legend,c.singleSeriesFormat),p.title&&r(h,p.title),"min"in p?n(h,p.min):function(t){for(var e=0;e<t.length;e++)for(var r=t[e].data,n=0;n<r.length;n++)if(r[n][1]<0)return!0;return!1}(d)||n(h,0),p.max&&a(h,p.max),"stacked"in p&&i(h,p.stacked),p.colors&&(h.colors=p.colors),p.xtitle&&s(h,p.xtitle),p.ytitle&&l(h,p.ytitle),h=o(h,p.library||{})}}function u(t,e){return t[0].getTime()-e[0].getTime()}function d(t,e){return t[0]-e[0]}function h(t,e){return t-e}function f(t,e){for(var r=0;r<t.length;r++)if(!e(t[r]))return!1;return!0}function y(t,e){if(void 0===e&&(e=!1),0===t.length)return null;if(!f(t,(function(t){return 0===t.getMilliseconds()&&0===t.getSeconds()})))return null;if(!f(t,(function(t){return 0===t.getMinutes()})))return"minute";if(!f(t,(function(t){return 0===t.getHours()})))return"hour";if(e)return"day";if(!f(t,(function(t){return 1===t.getDate()}))){var r=t[0].getDay();return f(t,(function(t){return t.getDay()===r}))?"week":"day"}return f(t,(function(t){return 0===t.getMonth()}))?"year":"month"}function m(t){return!isNaN(l(t))&&i(t).length>=6}function v(t){return"number"==typeof t}var g=["bytes","KB","MB","GB","TB","PB","EB"];function b(t,e,r,n){t=t||"",r.prefix&&(e<0&&(e*=-1,t+="-"),t+=r.prefix);var o=r.suffix||"",a=r.precision,s=r.round;if(r.byteScale){var l=e>=0;l||(e*=-1);var c,p=n?r.byteScale:e;p>=0x1000000000000000?(e/=0x1000000000000000,c=6):p>=0x4000000000000?(e/=0x4000000000000,c=5):p>=1099511627776?(e/=1099511627776,c=4):p>=1073741824?(e/=1073741824,c=3):p>=1048576?(e/=1048576,c=2):p>=1024?(e/=1024,c=1):c=0,void 0===a&&void 0===s&&(e>=1023.5&&c<g.length-1&&(e=1,c+=1),a=e>=1e3?4:3),o=" "+g[c],l||(e*=-1)}if(void 0!==a&&void 0!==s)throw Error("Use either round or precision, not both");if(!n&&(void 0!==a&&(e=e.toPrecision(a),r.zeros||(e=parseFloat(e))),void 0!==s))if(s<0){var u=Math.pow(10,-1*s);e=parseInt((1*e/u).toFixed(0))*u}else e=e.toFixed(s),r.zeros||(e=parseFloat(e));if(r.thousands||r.decimal){var d=(e=i(e)).split(".");e=d[0],r.thousands&&(e=e.replace(/\B(?=(\d{3})+(?!\d))/g,r.thousands)),d.length>1&&(e+=(r.decimal||".")+d[1])}return t+e+o}function x(t,e,r){return r in e?e[r]:r in t.options?t.options[r]:null}var w={maintainAspectRatio:!1,animation:!1,plugins:{legend:{},tooltip:{displayColors:!1,callbacks:{}},title:{font:{size:20},color:"#333"}},interaction:{}},C={scales:{y:{ticks:{maxTicksLimit:4},title:{font:{size:16},color:"#333"},grid:{}},x:{grid:{drawOnChartArea:!1},title:{font:{size:16},color:"#333"},time:{},ticks:{}}}},_=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#651067"];function k(t,e,r){void 0!==e?(t.plugins.legend.display=!!e,e&&!0!==e&&(t.plugins.legend.position=e)):r&&(t.plugins.legend.display=!1)}function S(t,e){t.plugins.title.display=!0,t.plugins.title.text=e}function A(t,e){null!==e&&(t.scales.x.min=s(e))}function T(t,e){t.scales.x.max=s(e)}function D(t,e){t.scales.x.stacked=!!e,t.scales.y.stacked=!!e}function O(t,e){t.scales.x.title.display=!0,t.scales.x.title.text=e}function L(t,e){t.scales.y.title.display=!0,t.scales.y.title.text=e}function z(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}function E(t){return null!=t}function F(t){for(var e=1,r=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=t[r].data,o=0;o<n.length;o++){var a=Math.abs(n[o][1]);a>e&&(e=a)}return e}(t);r>=1024;)e*=1024,r/=1024;return e}function j(t,e,r){var n={thousands:t.options.thousands,decimal:t.options.decimal},a=o({prefix:t.options.prefix,suffix:t.options.suffix,precision:t.options.precision,round:t.options.round,zeros:t.options.zeros},n);if(t.options.bytes){var s=t.data;"pie"===r&&(s=[{data:s}]),a.byteScale=F(s)}if("pie"!==r){var l=e.scales.y;"bar"===r&&(l=e.scales.x),a.byteScale&&(l.ticks.stepSize||(l.ticks.stepSize=a.byteScale/2),l.ticks.maxTicksLimit||(l.ticks.maxTicksLimit=4)),l.ticks.callback||(l.ticks.callback=function(t){return b("",t,a,!0)}),"scatter"!==r&&"bubble"!==r||e.scales.x.ticks.callback||(e.scales.x.ticks.callback=function(t){return b("",t,n,!0)})}if(!e.plugins.tooltip.callbacks.label)if("scatter"===r)e.plugins.tooltip.callbacks.label=function(t){var e=t.dataset.label||"";e&&(e+=": ");var r=t.parsed;return e+"("+b("",r.x,n)+", "+b("",r.y,a)+")"};else if("bubble"===r)e.plugins.tooltip.callbacks.label=function(t){var e=t.dataset.label||"";e&&(e+=": ");var r=t.raw;return e+"("+b("",r.x,n)+", "+b("",r.y,a)+", "+b("",r.v,n)+")"};else if("pie"===r)e.plugins.tooltip.callbacks.label=function(t){return b("",t.parsed,a)};else{var c="bar"===r?"x":"y";e.plugins.tooltip.callbacks.label=function(t){if(null!==t.parsed[c]){var e=t.dataset.label||"";return e&&(e+=": "),b(e,t.parsed[c],a)}}}"line"!==r&&"area"!==r||"number"!==t.xtype||(e.scales.x.ticks.callback||(e.scales.x.ticks.callback=function(t){return i(t)}),e.plugins.tooltip.callbacks.title||(e.plugins.tooltip.callbacks.title=function(t){return i(t[0].parsed.x)}))}var B=p(o(w,C),k,S,(function(t,e){null!==e&&(t.scales.y.min=s(e))}),(function(t,e){t.scales.y.max=s(e)}),D,O,L);function N(t,e){return"bubble"===e?function(t){for(var e=t.data,r=[],n=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=t[r].data,o=0;o<n.length;o++){var a=n[o][2];a>e&&(e=a)}return e}(e),o=0;o<e.length;o++){for(var a=e[o].data,i=[],s=0;s<a.length;s++){var l=a[s];i.push({x:l[0],y:l[1],r:20*l[2]/n,v:l[2]})}r.push(i)}return{labels:[],values:r}}(t):"number"===t.xtype&&"bar"!==e&&"column"!==e?function(t){for(var e=t.data,r=[],n=0;n<e.length;n++){var o=e[n].data;o.sort(d);for(var a=[],i=0;i<o.length;i++){var s=o[i];a.push({x:s[0],y:s[1]})}r.push(a)}return{labels:[],values:r}}(t):function(t){for(var e=t.data,r={},n=[],o=[],a=[],i=0;i<e.length;i++)for(var s=e[i].data,l=0;l<s.length;l++){var c=s[l],p="datetime"===t.xtype?c[0].getTime():c[0];r[p]||(r[p]=new Array(e.length),n.push(p)),r[p][i]=c[1]}"datetime"!==t.xtype&&"number"!==t.xtype||n.sort(h);for(var u=0;u<e.length;u++)a.push([]);for(var d=0;d<n.length;d++){var f=n[d],y="datetime"===t.xtype?new Date(f):f;o.push(y);for(var m=r[f],v=0;v<e.length;v++){var g=m[v];a[v].push(void 0===g?null:g)}}return{labels:o,values:a}}(t)}function I(e,r,n){for(var a=N(e,n),i=a.labels,s=a.values,c=e.data,p=[],u=e.options.colors||_,d=0;d<c.length;d++){var h=c[d],f=void 0,m=void 0;if(!e.options.colors||!e.singleSeriesFormat||"bar"!==n&&"column"!==n||h.color||!t(e.options.colors)||t(e.options.colors[0]))f=h.color||u[d],m="line"!==n?z(f,.5):f;else{f=u,m=[];for(var v=0;v<u.length;v++)m[v]=z(f[v],.5)}var g={label:h.name||"",data:s[d],fill:"area"===n,borderColor:f,backgroundColor:m,borderWidth:2},b="line"===n||"area"===n||"scatter"===n||"bubble"===n;b&&(g.pointBackgroundColor=f,g.pointHoverBackgroundColor=f,g.pointHitRadius=50),"bubble"===n&&(g.pointBackgroundColor=m,g.pointHoverBackgroundColor=m,g.pointHoverBorderWidth=2),h.stack&&(g.stack=h.stack),!1===x(e,h,"curve")?g.tension=0:b&&(g.tension=.4),!1===x(e,h,"points")&&(g.pointRadius=0,g.pointHoverRadius=0),g=o(g,e.options.dataset||{}),g=o(g,h.library||{}),g=o(g,h.dataset||{}),p.push(g)}var w=e.options.xmin,C=e.options.xmax;if("datetime"===e.xtype?(E(w)&&(r.scales.x.min=l(w).getTime()),E(C)&&(r.scales.x.max=l(C).getTime())):"number"===e.xtype&&(E(w)&&(r.scales.x.min=w),E(C)&&(r.scales.x.max=C)),"datetime"===e.xtype){var k=y(i);if(0===i.length&&(E(w)&&i.push(l(w)),E(C)&&i.push(l(C))),i.length>0){for(var S=(E(w)?l(w):i[0]).getTime(),A=(E(C)?l(C):i[0]).getTime(),T=1;T<i.length;T++){var D=i[T].getTime();D<S&&(S=D),D>A&&(A=D)}var O,L=(A-S)/864e5;if(!r.scales.x.time.unit)if("year"===k||L>3650?(r.scales.x.time.unit="year",O=365):"month"===k||L>300?(r.scales.x.time.unit="month",O=30):"week"===k||"day"===k||L>10?(r.scales.x.time.unit="day",O=1):"hour"===k||L>.5?(r.scales.x.time.displayFormats={hour:"MMM d, h a"},r.scales.x.time.unit="hour",O=1/24):"minute"===k&&(r.scales.x.time.displayFormats={minute:"h:mm a"},r.scales.x.time.unit="minute",O=1/24/60),O&&L>0){var F=e.element.offsetWidth;if(F>0){var j=Math.ceil(L/O/(F/100));"week"===k&&1===O&&(j=7*Math.ceil(j/7)),r.scales.x.ticks.stepSize=j}}r.scales.x.time.tooltipFormat||("year"===k?r.scales.x.time.tooltipFormat="yyyy":"month"===k?r.scales.x.time.tooltipFormat="MMM yyyy":"week"===k||"day"===k?r.scales.x.time.tooltipFormat="PP":"hour"===k?r.scales.x.time.tooltipFormat="MMM d, h a":"minute"===k&&(r.scales.x.time.tooltipFormat="h:mm a"))}}return{labels:i,datasets:p}}var M=function(t){this.name="chartjs",this.library=t};M.prototype.renderLineChart=function(t,e){e||(e="line");var r=B(t,o({},t.options));j(t,r,e);var n=I(t,r,e);"number"===t.xtype?(r.scales.x.type=r.scales.x.type||"linear",r.scales.x.position=r.scales.x.position||"bottom"):r.scales.x.type="string"===t.xtype?"category":"time",this.drawChart(t,"line",n,r)},M.prototype.renderPieChart=function(t){var e=o({},w);t.options.donut&&(e.cutout="50%"),"legend"in t.options&&k(e,t.options.legend),t.options.title&&S(e,t.options.title),j(t,e=o(e,t.options.library||{}),"pie");for(var r=[],n=[],a=0;a<t.data.length;a++){var i=t.data[a];r.push(i[0]),n.push(i[1])}var s={data:n,backgroundColor:t.options.colors||_},l={labels:r,datasets:[s=o(s,t.options.dataset||{})]};this.drawChart(t,"pie",l,e)},M.prototype.renderColumnChart=function(t,e){var r;if("bar"===e){var n=o(w,C);n.indexAxis="y",n.scales.x.grid.drawOnChartArea=!0,n.scales.y.grid.drawOnChartArea=!1,delete n.scales.y.ticks.maxTicksLimit,r=p(n,k,S,A,T,D,O,L)(t,t.options)}else r=B(t,t.options);j(t,r,e);var a=I(t,r,"column");"bar"!==e&&function(t,e,r){var n=Math.ceil(t.element.offsetWidth/4/e.labels.length);n>25?n=25:n<10&&(n=10),r.scales.x.ticks.callback||(r.scales.x.ticks.callback=function(t){return(t=i(this.getLabelForValue(t))).length>n?t.substring(0,n-2)+"...":t})}(t,a,r),"mode"in r.interaction||(r.interaction.mode="index"),this.drawChart(t,"bar",a,r)},M.prototype.renderAreaChart=function(t){this.renderLineChart(t,"area")},M.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},M.prototype.renderScatterChart=function(t,e){e=e||"scatter";var r=B(t,t.options);j(t,r,e),"showLine"in r||(r.showLine=!1);var n=I(t,r,e);r.scales.x.type=r.scales.x.type||"linear",r.scales.x.position=r.scales.x.position||"bottom","mode"in r.interaction||(r.interaction.mode="nearest"),this.drawChart(t,e,n,r)},M.prototype.renderBubbleChart=function(t){this.renderScatterChart(t,"bubble")},M.prototype.destroy=function(t){t.chart&&t.chart.destroy()},M.prototype.drawChart=function(t,e,r,n){if(this.destroy(t),!t.destroyed){var o={type:e,data:r,options:n};t.options.code&&window.console.log("new Chart(ctx, "+JSON.stringify(o)+");"),t.element.innerHTML="<canvas></canvas>";var a=t.element.getElementsByTagName("CANVAS")[0];t.chart=new this.library(a,o)}};var R={chart:{},xAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},yAxis:{title:{text:null},labels:{style:{fontSize:"12px"}}},title:{text:null},credits:{enabled:!1},legend:{borderWidth:0},tooltip:{style:{fontSize:"12px"}},plotOptions:{areaspline:{},area:{},series:{marker:{}}},time:{useUTC:!1}};function H(t,e,r){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))):r&&(t.legend.enabled=!1)}function P(t,e){t.title.text=e}var W=p(R,H,P,(function(t,e){t.yAxis.min=e}),(function(t,e){t.yAxis.max=e}),(function(t,e){var r=e?!0===e?"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}));function V(e,r,n){var o={prefix:e.options.prefix,suffix:e.options.suffix,thousands:e.options.thousands,decimal:e.options.decimal,precision:e.options.precision,round:e.options.round,zeros:e.options.zeros};"pie"===n||t(r.yAxis)||r.yAxis.labels.formatter||(r.yAxis.labels.formatter=function(){return b("",this.value,o)}),r.tooltip.pointFormatter||r.tooltip.pointFormat||(r.tooltip.pointFormatter=function(){return'<span style="color:'+this.color+'">●</span> '+b(this.series.name+": <b>",this.y,o)+"</b><br/>"})}var G=function(t){this.name="highcharts",this.library=t};G.prototype.renderLineChart=function(t,e){var r={};"areaspline"===(e=e||"spline")&&(r={plotOptions:{areaspline:{stacking:"normal"},area:{stacking:"normal"},series:{marker:{enabled:!1}}}}),!1===t.options.curve&&("areaspline"===e?e="area":"spline"===e&&(e="line"));var n=W(t,t.options,r);"number"===t.xtype?n.xAxis.type=n.xAxis.type||"linear":n.xAxis.type="string"===t.xtype?"category":"datetime",n.chart.type||(n.chart.type=e),V(t,n,e);for(var o=t.data,a=0;a<o.length;a++){o[a].name=o[a].name||"Value";var i=o[a].data;if("datetime"===t.xtype)for(var s=0;s<i.length;s++)i[s][0]=i[s][0].getTime();else"number"===t.xtype&&i.sort(d);o[a].marker={symbol:"circle"},!1===t.options.points&&(o[a].marker.enabled=!1)}this.drawChart(t,o,n)},G.prototype.renderScatterChart=function(t){var e=W(t,t.options,{});e.chart.type="scatter",this.drawChart(t,t.data,e)},G.prototype.renderPieChart=function(t){var e=o(R,{});t.options.colors&&(e.colors=t.options.colors),t.options.donut&&(e.plotOptions={pie:{innerSize:"50%"}}),"legend"in t.options&&H(e,t.options.legend),t.options.title&&P(e,t.options.title);var r=o(e,t.options.library||{});V(t,r,"pie");var n=[{type:"pie",name:t.options.label||"Value",data:t.data}];this.drawChart(t,n,r)},G.prototype.renderColumnChart=function(t,e){e=e||"column";var r=t.data,n=W(t,t.options),o=[],a=[];n.chart.type=e,V(t,n,e);for(var i=0;i<r.length;i++)for(var s=r[i],l=0;l<s.data.length;l++){var c=s.data[l];o[c[0]]||(o[c[0]]=new Array(r.length),a.push(c[0])),o[c[0]][i]=c[1]}"number"===t.xtype&&a.sort(h),n.xAxis.categories=a;for(var p=[],u=0;u<r.length;u++){for(var d=[],f=0;f<a.length;f++)d.push(o[a[f]][u]||0);var y={name:r[u].name||"Value",data:d};r[u].stack&&(y.stack=r[u].stack),p.push(y)}this.drawChart(t,p,n)},G.prototype.renderBarChart=function(t){this.renderColumnChart(t,"bar")},G.prototype.renderAreaChart=function(t){this.renderLineChart(t,"areaspline")},G.prototype.destroy=function(t){t.chart&&t.chart.destroy()},G.prototype.drawChart=function(t,e,r){this.destroy(t),t.destroyed||(r.chart.renderTo=t.element.id,r.series=e,t.options.code&&window.console.log("new Highcharts.Chart("+JSON.stringify(r)+");"),t.chart=new this.library.Chart(r))};var U={},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}}};function q(t,e,r){var n;void 0!==e?(n=e?!0===e?"right":e:"none",t.legend.position=n):r&&(t.legend.position="none")}function $(t,e){t.title=e,t.titleTextStyle={color:"#333",fontSize:"20px"}}function X(t,e){t.hAxis.viewWindow.min=e}function Y(t,e){t.hAxis.viewWindow.max=e}function Z(t,e){t.isStacked=e||!1}function Q(t,e){t.hAxis.title=e,t.hAxis.titleTextStyle.italic=!1}function tt(t,e){t.vAxis.title=e,t.vAxis.titleTextStyle.italic=!1}var et=p(K,q,$,(function(t,e){t.vAxis.viewWindow.min=e}),(function(t,e){t.vAxis.viewWindow.max=e}),Z,Q,tt);var rt=function(t){this.name="google",this.library=t};rt.prototype.renderLineChart=function(t){var e=this;this.waitForLoaded(t,(function(){var r={};!1===t.options.curve&&(r.curveType="none"),!1===t.options.points&&(r.pointSize=0);var n=et(t,t.options,r),o=e.createDataTable(t.data,t.xtype);e.drawChart(t,"LineChart",o,n)}))},rt.prototype.renderPieChart=function(t){var e=this;this.waitForLoaded(t,(function(){var r={chartArea:{top:"10%",height:"80%"},legend:{}};t.options.colors&&(r.colors=t.options.colors),t.options.donut&&(r.pieHole=.5),"legend"in t.options&&q(r,t.options.legend),t.options.title&&$(r,t.options.title);var n=o(o(K,r),t.options.library||{}),a=new e.library.visualization.DataTable;a.addColumn("string",""),a.addColumn("number","Value"),a.addRows(t.data),e.drawChart(t,"PieChart",a,n)}))},rt.prototype.renderColumnChart=function(t){var e=this;this.waitForLoaded(t,(function(){var r=et(t,t.options),n=e.createDataTable(t.data,t.xtype);e.drawChart(t,"ColumnChart",n,r)}))},rt.prototype.renderBarChart=function(t){var e=this;this.waitForLoaded(t,(function(){var r=p(K,q,$,X,Y,Z,Q,tt)(t,t.options,{hAxis:{gridlines:{color:"#ccc"}}}),n=e.createDataTable(t.data,t.xtype);e.drawChart(t,"BarChart",n,r)}))},rt.prototype.renderAreaChart=function(t){var e=this;this.waitForLoaded(t,(function(){var r=et(t,t.options,{isStacked:!0,pointSize:0,areaOpacity:.5}),n=e.createDataTable(t.data,t.xtype);e.drawChart(t,"AreaChart",n,r)}))},rt.prototype.renderGeoChart=function(t){var e=this;this.waitForLoaded(t,"geochart",(function(){var r={legend:"none",colorAxis:{colors:t.options.colors||["#f6c7b6","#ce502d"]}},n=o(o(K,r),t.options.library||{}),a=new e.library.visualization.DataTable;a.addColumn("string",""),a.addColumn("number",t.options.label||"Value"),a.addRows(t.data),e.drawChart(t,"GeoChart",a,n)}))},rt.prototype.renderScatterChart=function(t){var e=this;this.waitForLoaded(t,(function(){for(var r=et(t,t.options,{}),n=t.data,o=[],a=0;a<n.length;a++){n[a].name=n[a].name||"Value";for(var i=n[a].data,s=0;s<i.length;s++){var l=new Array(n.length+1);l[0]=i[s][0],l[a+1]=i[s][1],o.push(l)}}var c=new e.library.visualization.DataTable;c.addColumn("number","");for(var p=0;p<n.length;p++)c.addColumn("number",n[p].name);c.addRows(o),e.drawChart(t,"ScatterChart",c,r)}))},rt.prototype.renderTimeline=function(t){var e=this;this.waitForLoaded(t,"timeline",(function(){var r={legend:"none"};t.options.colors&&(r.colors=t.options.colors);var n=o(o(K,r),t.options.library||{}),a=new e.library.visualization.DataTable;a.addColumn({type:"string",id:"Name"}),a.addColumn({type:"date",id:"Start"}),a.addColumn({type:"date",id:"End"}),a.addRows(t.data),t.element.style.lineHeight="normal",e.drawChart(t,"Timeline",a,n)}))},rt.prototype.destroy=function(t){t.chart&&t.chart.clearChart()},rt.prototype.drawChart=function(t,e,r,n){var o;(this.destroy(t),t.destroyed)||(t.options.code&&window.console.log("var data = new google.visualization.DataTable("+r.toJSON()+");\nvar chart = new google.visualization."+e+"(element);\nchart.draw(data, "+JSON.stringify(n)+");"),t.chart=new this.library.visualization[e](t.element),o=function(){t.chart.draw(r,n)},window.attachEvent?window.attachEvent("onresize",o):window.addEventListener&&window.addEventListener("resize",o,!0),o())},rt.prototype.waitForLoaded=function(t,e,r){var n=this;if(r||(r=e,e="corechart"),J.push({pack:e,callback:r}),U[e])this.runCallbacks();else{U[e]=!0;var o={packages:[e],callback:function(){n.runCallbacks()}},a=t.__config();a.language&&(o.language=a.language),"geochart"===e&&a.mapsApiKey&&(o.mapsApiKey=a.mapsApiKey),this.library.charts.load("current",o)}},rt.prototype.runCallbacks=function(){for(var t=0;t<J.length;t++){var e=J[t];this.library.visualization&&("corechart"===e.pack&&this.library.visualization.LineChart||"timeline"===e.pack&&this.library.visualization.Timeline||"geochart"===e.pack&&this.library.visualization.GeoChart)&&(e.callback(),J.splice(t,1),t--)}},rt.prototype.createDataTable=function(t,e){for(var r=[],n=[],o=0;o<t.length;o++){var a=t[o];t[o].name=t[o].name||"Value";for(var s=0;s<a.data.length;s++){var l=a.data[s],c="datetime"===e?l[0].getTime():l[0];r[c]||(r[c]=new Array(t.length),n.push(c)),r[c][o]=l[1]}}for(var p=[],h=[],f=0;f<n.length;f++){var m=n[f],v=void 0;"datetime"===e?(v=new Date(m),h.push(v)):v=m,p.push([v].concat(r[m]))}var g=!0;if("datetime"===e)p.sort(u),g=function(t){return"day"===t||"week"===t||"month"===t||"year"===t}(y(h,!0));else if("number"===e){p.sort(d);for(var b=0;b<p.length;b++)p[b][0]=i(p[b][0]);e="string"}var x=new this.library.visualization.DataTable;e="datetime"===e&&g?"date":e,x.addColumn(e,"");for(var w=0;w<t.length;w++)x.addColumn("number",t[w].name);return x.addRows(p),x};var nt=[];function ot(t){for(var r=function(t){if(t){if("Highcharts"===t.product)return G;if(t.charts)return rt;if(e(t))return M}throw new Error("Unknown adapter")}(t),n=0;n<nt.length;n++)if(nt[n].library===t)return;nt.push(new r(t))}function at(t,r){var n="render"+t,o=r.options.adapter;"Chart"in window&&ot(window.Chart),"Highcharts"in window&&ot(window.Highcharts),window.google&&window.google.charts&&ot(window.google);for(var a=0;a<nt.length;a++){var i=nt[a];if((!o||o===i.name)&&e(i[n]))return r.adapter=i.name,r.__adapterObject=i,i[n](r)}throw nt.length>0?new Error("No charting library found for "+t):new Error("No charting libraries found - be sure to include one before your charts")}var it={charts:{},configure:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(it.config[e]=t[e])},setDefaultOptions:function(t){it.options=t},eachChart:function(t){for(var e in it.charts)Object.prototype.hasOwnProperty.call(it.charts,e)&&t(it.charts[e])},destroyAll:function(){for(var t in it.charts)Object.prototype.hasOwnProperty.call(it.charts,t)&&(it.charts[t].destroy(),delete it.charts[t])},config:{},options:{},adapters:nt,addAdapter:ot,use:function(t){return ot(t),it}};function st(t,e){if("bubble"===e)return function(t){for(var e=[],r=0;r<t.length;r++)e.push([s(t[r][0]),s(t[r][1]),s(t[r][2])]);return e}(t);var r;r="number"===e?s:"datetime"===e?l:i;for(var n=[],o=0;o<t.length;o++)n.push([r(t[o][0]),s(t[o][1])]);return n}function lt(t,e){for(var r=0;r<t.length;r++)for(var n=c(t[r].data),o=0;o<n.length;o++)if(!e(n[o][0]))return!1;return!0}function ct(e,n,o){var a=e.options,i=e.rawData;e.singleSeriesFormat=!t(i)||!r(i[0]),e.singleSeriesFormat&&(i=[{name:a.label,data:i}]),i=function(t){for(var e=[],r=0;r<t.length;r++){var n={};for(var o in t[r])Object.prototype.hasOwnProperty.call(t[r],o)&&(n[o]=t[r][o]);e.push(n)}return e}(i);for(var s=0;s<i.length;s++)i[s].data=c(i[s].data);e.xtype=n||(a.discrete?"string":function(t,e,r){return ut(t)?!r.xmin&&!r.xmax||r.xmin&&!m(r.xmin)||r.xmax&&!m(r.xmax)?"number":"datetime":lt(t,v)?"number":!e&<(t,m)?"datetime":"string"}(i,o,a));for(var l=0;l<i.length;l++)i[l].data=st(i[l].data,e.xtype);return i}function pt(t){for(var e=c(t.rawData),r=0;r<e.length;r++)e[r]=[i(e[r][0]),s(e[r][1])];return e}function ut(t,e){if("PieChart"===e||"GeoChart"===e||"Timeline"===e)return 0===t.length;for(var r=0;r<t.length;r++)if(t[r].data.length>0)return!1;return!0}var dt=[],ht=0;function ft(){if(ht<4){var t=dt.shift();t&&(ht++,e=t[0],r=t[1],n=t[2],(o=new XMLHttpRequest).open("GET",e,!0),o.setRequestHeader("Content-Type","application/json"),o.onload=function(){ht--,ft(),200===o.status?r(JSON.parse(o.responseText)):n(o.statusText)},o.send(),ft())}var e,r,n,o}function yt(t,e){t.textContent=e}function mt(t,e,r){r||(e="Error Loading Chart: "+e),yt(t,e),t.style.color="#ff0000"}function vt(t){try{t.__render()}catch(e){throw mt(t.element,e.message),e}}function gt(t,e,r){if(r&&t.options.loading&&("string"==typeof e||"function"==typeof e)&&yt(t.element,t.options.loading),"string"==typeof e)n=e,o=function(e){t.rawData=e,vt(t)},a=function(e){mt(t.element,e)},dt.push([n,o,a]),ft();else if("function"==typeof e)try{e((function(e){t.rawData=e,vt(t)}),(function(e){mt(t.element,e,!0)}))}catch(e){mt(t.element,e,!0)}else t.rawData=e,vt(t);var n,o,a}function bt(t,e){if(ut(e.data,t)){var r=e.options.empty||e.options.messages&&e.options.messages.empty||"No data";yt(e.element,r)}else at(t,e),e.options.download&&!e.__downloadAttached&&"chartjs"===e.adapter&&function(t){var e=t.options.download;!0===e?e={}:"string"==typeof e&&(e={filename:e});var r=document.createElement("a");r.download=e.filename||"chart.png",r.style.position="absolute",r.style.top="20px",r.style.right="20px",r.style.zIndex=1e3,r.style.lineHeight="20px",r.target="_blank";var n=document.createElement("img");n.src="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path fill="#CCCCCC" d="M344 240h-56L287.1 152c0-13.25-10.75-24-24-24h-16C234.7 128 223.1 138.8 223.1 152L224 240h-56c-9.531 0-18.16 5.656-22 14.38C142.2 263.1 143.9 273.3 150.4 280.3l88.75 96C243.7 381.2 250.1 384 256.8 384c7.781-.3125 13.25-2.875 17.75-7.844l87.25-96c6.406-7.031 8.031-17.19 4.188-25.88S353.5 240 344 240zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z"/></svg>'),n.alt="Download",n.style.width="20px",n.style.height="20px",n.style.border="none",r.appendChild(n);var o=t.element;o.style.position="relative",t.__downloadAttached=!0,t.__enterEvent=o.addEventListener("mouseover",(function(n){var a=n.relatedTarget;a&&(a===this||this.contains(a))||!t.options.download||(r.href=t.toImage(e),o.appendChild(r))})),t.__leaveEvent=o.addEventListener("mouseout",(function(t){var e=t.relatedTarget;e&&(e===this||this.contains(e))||r.parentNode&&r.parentNode.removeChild(r)}))}(e)}var xt=function(t,e,r){this.element=function(t){if("string"==typeof t){var e=t;if(!(t=document.getElementById(t)))throw new Error("No element with id "+e)}return t}(t),this.options=o(it.options,r||{}),this.dataSource=e,this.element.id&&(it.charts[this.element.id]=this),gt(this,e,!0),this.options.refresh&&this.startRefresh()};xt.prototype.getElement=function(){return this.element},xt.prototype.getDataSource=function(){return this.dataSource},xt.prototype.getData=function(){return this.data},xt.prototype.getOptions=function(){return this.options},xt.prototype.getChartObject=function(){return this.chart},xt.prototype.getAdapter=function(){return this.adapter},xt.prototype.updateData=function(t,e){this.dataSource=t,e&&this.__updateOptions(e),gt(this,t,!0)},xt.prototype.setOptions=function(t){this.__updateOptions(t),this.redraw()},xt.prototype.redraw=function(){gt(this,this.rawData)},xt.prototype.refreshData=function(){if("string"==typeof this.dataSource){var t=-1===this.dataSource.indexOf("?")?"?":"&";gt(this,this.dataSource+t+"_="+(new Date).getTime())}else"function"==typeof this.dataSource&>(this,this.dataSource)},xt.prototype.startRefresh=function(){var t=this,e=this.options.refresh;if(e&&"string"!=typeof this.dataSource&&"function"!=typeof this.dataSource)throw new Error("Data source must be a URL or callback for refresh");if(!this.intervalId){if(!e)throw new Error("No refresh interval");this.intervalId=setInterval((function(){t.refreshData()}),1e3*e)}},xt.prototype.stopRefresh=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)},xt.prototype.toImage=function(t){if("chartjs"===this.adapter){if(t&&t.background&&"transparent"!==t.background){var e=this.chart.canvas,r=this.chart.ctx,n=document.createElement("canvas"),o=n.getContext("2d");return n.width=r.canvas.width,n.height=r.canvas.height,o.fillStyle=t.background,o.fillRect(0,0,n.width,n.height),o.drawImage(e,0,0),n.toDataURL("image/png")}return this.chart.toBase64Image()}throw new Error("Feature only available for Chart.js")},xt.prototype.destroy=function(){this.destroyed=!0,this.stopRefresh(),this.__adapterObject&&this.__adapterObject.destroy(this),this.__enterEvent&&this.element.removeEventListener("mouseover",this.__enterEvent),this.__leaveEvent&&this.element.removeEventListener("mouseout",this.__leaveEvent)},xt.prototype.__updateOptions=function(t){var e=t.refresh&&t.refresh!==this.options.refresh;this.options=o(it.options,t),e&&(this.stopRefresh(),this.startRefresh())},xt.prototype.__render=function(){this.data=this.__processData(),bt(this.__chartName(),this)},xt.prototype.__config=function(){return it.config};var wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this)},e.prototype.__chartName=function(){return"LineChart"},e}(xt),Ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return pt(this)},e.prototype.__chartName=function(){return"PieChart"},e}(xt),_t=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this,null,!0)},e.prototype.__chartName=function(){return"ColumnChart"},e}(xt),kt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this,null,!0)},e.prototype.__chartName=function(){return"BarChart"},e}(xt),St=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this)},e.prototype.__chartName=function(){return"AreaChart"},e}(xt),At=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return pt(this)},e.prototype.__chartName=function(){return"GeoChart"},e}(xt),Tt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this,"number")},e.prototype.__chartName=function(){return"ScatterChart"},e}(xt),Dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){return ct(this,"bubble")},e.prototype.__chartName=function(){return"BubbleChart"},e}(xt),Ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__processData=function(){for(var t=this.rawData,e=0;e<t.length;e++)t[e][1]=l(t[e][1]),t[e][2]=l(t[e][2]);return t},e.prototype.__chartName=function(){return"Timeline"},e}(xt);return it.LineChart=wt,it.PieChart=Ct,it.ColumnChart=_t,it.BarChart=kt,it.AreaChart=St,it.GeoChart=At,it.ScatterChart=Tt,it.BubbleChart=Dt,it.Timeline=Ot,"undefined"==typeof window||window.Chartkick||(window.Chartkick=it,document.addEventListener("turbolinks:before-render",(function(){!1!==it.config.autoDestroy&&it.destroyAll()})),document.addEventListener("turbo:before-render",(function(){!1!==it.config.autoDestroy&&it.destroyAll()})),setTimeout((function(){window.dispatchEvent(new Event("chartkick:load"))}),0)),it.default=it,it}));
|
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"name": "chartkick",
|
3
|
+
"version": "5.0.1",
|
4
|
+
"homepage": "https://github.com/ankane/chartkick.js",
|
5
|
+
"description": "Create beautiful charts with one line of JavaScript",
|
6
|
+
"type": "module",
|
7
|
+
"main": "./dist/chartkick.js",
|
8
|
+
"module": "./dist/chartkick.esm.js",
|
9
|
+
"exports": {
|
10
|
+
".": {
|
11
|
+
"require": "./dist/chartkick.js",
|
12
|
+
"import": "./dist/chartkick.esm.js"
|
13
|
+
},
|
14
|
+
"./chart.js": "./chart.js/chart.esm.js",
|
15
|
+
"./highcharts": "./highcharts/highcharts.esm.js"
|
16
|
+
},
|
17
|
+
"scripts": {
|
18
|
+
"build": "rollup -c",
|
19
|
+
"lint": "eslint src"
|
20
|
+
},
|
21
|
+
"keywords": [
|
22
|
+
"charts"
|
23
|
+
],
|
24
|
+
"authors": [
|
25
|
+
"ankane"
|
26
|
+
],
|
27
|
+
"license": "MIT",
|
28
|
+
"repository": {
|
29
|
+
"type": "git",
|
30
|
+
"url": "https://github.com/ankane/chartkick.js"
|
31
|
+
},
|
32
|
+
"files": [
|
33
|
+
"dist",
|
34
|
+
"chart.js",
|
35
|
+
"highcharts"
|
36
|
+
],
|
37
|
+
"devDependencies": {
|
38
|
+
"@rollup/plugin-buble": "^1.0.1",
|
39
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
40
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
41
|
+
"@rollup/plugin-terser": "^0.3.0",
|
42
|
+
"eslint": "^8.8.0",
|
43
|
+
"rollup": "^3.9.1"
|
44
|
+
},
|
45
|
+
"optionalDependencies": {
|
46
|
+
"chart.js": "4",
|
47
|
+
"chartjs-adapter-date-fns": ">=3",
|
48
|
+
"date-fns": ">=2"
|
49
|
+
}
|
50
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 44.4.
|
4
|
+
version: 44.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -1046,6 +1046,16 @@ files:
|
|
1046
1046
|
- node_modules/axe-core/locales/zh_TW.json
|
1047
1047
|
- node_modules/axe-core/package.json
|
1048
1048
|
- node_modules/axe-core/sri-history.json
|
1049
|
+
- node_modules/chartkick/LICENSE.txt
|
1050
|
+
- node_modules/chartkick/README.md
|
1051
|
+
- node_modules/chartkick/chart.js/chart.esm.js
|
1052
|
+
- node_modules/chartkick/chart.js/package.json
|
1053
|
+
- node_modules/chartkick/dist/chartkick.esm.js
|
1054
|
+
- node_modules/chartkick/dist/chartkick.js
|
1055
|
+
- node_modules/chartkick/dist/chartkick.min.js
|
1056
|
+
- node_modules/chartkick/highcharts/highcharts.esm.js
|
1057
|
+
- node_modules/chartkick/highcharts/package.json
|
1058
|
+
- node_modules/chartkick/package.json
|
1049
1059
|
- node_modules/govuk-frontend/README.md
|
1050
1060
|
- node_modules/govuk-frontend/dist/govuk-prototype-kit/init.js
|
1051
1061
|
- node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss
|